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
50 lines
| 1 | <?php |
| 2 | |
| 3 | class SiteGuard_Base { |
| 4 | function __construct() { |
| 5 | } |
| 6 | function error_log( $message ) { |
| 7 | $logfile = SITEGUARD_PATH . 'error.log'; |
| 8 | $f = @fopen( $logfile, 'a+' ); |
| 9 | if ( false != $f ) { |
| 10 | fwrite( $f, date_i18n( 'Y/m/d H:i:s:' ) . $message . "\n" ); |
| 11 | fclose( $f ); |
| 12 | } |
| 13 | } |
| 14 | function error_dump( $title, $obj ) { |
| 15 | ob_start(); |
| 16 | var_dump( $obj ); |
| 17 | $msg = ob_get_contents( ); |
| 18 | ob_end_clean( ); |
| 19 | $this->error_log( "$title: $msg" ); |
| 20 | } |
| 21 | function is_switch_value( $value ) { |
| 22 | if ( '0' == $value || '1' == $value ) { |
| 23 | return true; |
| 24 | } |
| 25 | return false; |
| 26 | } |
| 27 | function check_module( $name, $default = false ) { |
| 28 | if ( isset( $_SERVER['SERVER_SOFTWARE'] ) ) { |
| 29 | return ( strpos( $_SERVER['SERVER_SOFTWARE'], 'Apache' ) !== false || strpos( $_SERVER['SERVER_SOFTWARE'], 'LiteSpeed' ) !== false); |
| 30 | } else { |
| 31 | return $default; |
| 32 | } |
| 33 | |
| 34 | # It does not work in FastCGI well. |
| 35 | #$module = 'mod_' . $name; |
| 36 | #return apache_mod_loaded( $module, $default ); |
| 37 | #if ( function_exists('phpinfo') ) { |
| 38 | # ob_start( ); |
| 39 | # phpinfo(8); |
| 40 | # $phpinfo = ob_get_clean( ); |
| 41 | # if ( false !== strpos( $phpinfo, $module ) ) { |
| 42 | # return true; |
| 43 | # } |
| 44 | #} |
| 45 | #return $default; |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | ?> |
| 50 |