siteguard-admin-filter.php
11 years ago
siteguard-base.php
11 years ago
siteguard-captcha.php
11 years ago
siteguard-config.php
11 years ago
siteguard-disable-pingback.php
11 years ago
siteguard-htaccess.php
11 years ago
siteguard-login-history.php
11 years ago
siteguard-login-lock.php
11 years ago
siteguard-rename-login.php
11 years ago
siteguard-waf-exclude-rule.php
11 years ago
siteguard-base.php
62 lines
| 1 | <?php |
| 2 | |
| 3 | function siteguard_error_log( $message ) { |
| 4 | $logfile = SITEGUARD_PATH . 'error.log'; |
| 5 | $f = @fopen( $logfile, 'a+' ); |
| 6 | if ( false != $f ) { |
| 7 | fwrite( $f, date_i18n( 'Y/m/d H:i:s:' ) . $message . "\n" ); |
| 8 | fclose( $f ); |
| 9 | } |
| 10 | } |
| 11 | |
| 12 | function siteguard_error_dump( $title, $obj ) { |
| 13 | ob_start(); |
| 14 | var_dump( $obj ); |
| 15 | $msg = ob_get_contents( ); |
| 16 | ob_end_clean( ); |
| 17 | siteguard_error_log( "$title: $msg" ); |
| 18 | } |
| 19 | |
| 20 | class SiteGuard_Base { |
| 21 | function __construct() { |
| 22 | } |
| 23 | function is_switch_value( $value ) { |
| 24 | if ( '0' == $value || '1' == $value ) { |
| 25 | return true; |
| 26 | } |
| 27 | return false; |
| 28 | } |
| 29 | function check_module( $name, $default = false ) { |
| 30 | if ( isset( $_SERVER['SERVER_SOFTWARE'] ) ) { |
| 31 | return ( strpos( $_SERVER['SERVER_SOFTWARE'], 'Apache' ) !== false || strpos( $_SERVER['SERVER_SOFTWARE'], 'LiteSpeed' ) !== false); |
| 32 | } else { |
| 33 | return $default; |
| 34 | } |
| 35 | |
| 36 | # It does not work in FastCGI well. |
| 37 | #$module = 'mod_' . $name; |
| 38 | #return apache_mod_loaded( $module, $default ); |
| 39 | #if ( function_exists('phpinfo') ) { |
| 40 | # ob_start( ); |
| 41 | # phpinfo(8); |
| 42 | # $phpinfo = ob_get_clean( ); |
| 43 | # if ( false !== strpos( $phpinfo, $module ) ) { |
| 44 | # return true; |
| 45 | # } |
| 46 | #} |
| 47 | #return $default; |
| 48 | } |
| 49 | function is_active_plugin( $plugin ) { |
| 50 | if ( function_exists('is_plugin_active') ) { |
| 51 | return is_plugin_active( $plugin ); |
| 52 | } else { |
| 53 | return in_array( |
| 54 | $plugin, |
| 55 | get_option('active_plugins') |
| 56 | ); |
| 57 | } |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | ?> |
| 62 |