Esempio n. 1
0
function include_setting($file)
{
    sfs_errorsonoff();
    $ppath = plugin_dir_path(__FILE__);
    if (file_exists($ppath . $file)) {
        require_once $ppath . $file;
    } else {
        echo "<br>Missing file:{$ppath} {$file} <br>";
    }
    sfs_errorsonoff('off');
}
Esempio n. 2
0
function sfs_handle_ajax_sfs_process($data)
{
    sfs_errorsonoff();
    sfs_handle_ajax_sfs_process_watch($data);
    sfs_errorsonoff('off');
}
Esempio n. 3
0
function kpg_ss_scan_for_eval_recurse($dir, $phparray)
{
    if (!@is_dir($dir)) {
        return $phparray;
    }
    //if (substr($dir,0,1)='.') return $phparray;
    $dh = null;
    // can't protect this - turn off the error capture for a moment.
    sfs_errorsonoff('off');
    try {
        $dh = @opendir($dir);
    } catch (Exception $e) {
        sfs_errorsonoff();
        return $phparray;
    }
    sfs_errorsonoff();
    if ($dh !== null && $dh !== false) {
        while (($file = readdir($dh)) !== false) {
            if (@is_dir($dir . '/' . $file)) {
                if ($file != '.' && $file != '..') {
                    $phparray = kpg_ss_scan_for_eval_recurse($dir . '/' . $file, $phparray);
                }
            } else {
                if (strpos($file, '.php') > 0) {
                    $phparray[count($phparray)] = $dir . '/' . $file;
                } else {
                    //echo "can't find .php in $file <br/>";
                }
            }
        }
        closedir($dh);
    }
    return $phparray;
}
Esempio n. 4
0
function sfs_handle_ajax_sfs_process($data)
{
    if (!is_user_logged_in()) {
        return;
    }
    if (!current_user_can('manage_options')) {
        return;
    }
    sfs_errorsonoff();
    sfs_handle_ajax_sfs_process_watch($data);
    sfs_errorsonoff('off');
}
function kpg_ss_check_white_block()
{
    sfs_errorsonoff();
    $options = kpg_ss_get_options();
    $stats = kpg_ss_get_stats();
    $post = get_post_variables();
    $post['block'] = true;
    $ansa = be_load('kpg_ss_check_white', kpg_get_ip(), $stats, $options, $post);
    sfs_errorsonoff('off');
    return $ansa;
}
function kpg_ss_user_reg_filter($user_login)
{
    // the plugin should be all initialized
    // check the ip, etc.
    sfs_errorsonoff();
    $options = kpg_ss_get_options();
    $stats = kpg_ss_get_stats();
    // fake out the post variables
    $post = get_post_variables();
    $post['author'] = $user_login;
    $post['addon'] = 'chkRegister';
    // no really an addon - but may be moved out when working.
    if ($options['filterregistrations'] != 'Y') {
        remove_filter('pre_user_login', kpg_ss_user_reg_filter, 1);
        sfs_errorsonoff('off');
        return $user_login;
    }
    // if the suspect is already in the bad cache he does not get a second chance?
    // prevents looping
    $reason = be_load('chkbcache', kpg_get_ip(), $stats, $options, $post);
    sfs_errorsonoff();
    if ($reason !== false) {
        $rejectmessage = $options['rejectmessage'];
        $post['reason'] = 'Failed Registration: bad cache';
        $host['chk'] = 'chkbcache';
        $ansa = be_load('kpg_ss_log_bad', kpg_get_ip(), $stats, $options, $post);
        wp_die("{$rejectmessage}", "Login Access Denied", array('response' => 403));
        exit;
    }
    // check the white list
    $reason = kpg_ss_check_white();
    sfs_errorsonoff();
    if ($reason !== false) {
        $post['reason'] = 'passed registration:' . $reason;
        $ansa = be_load('kpg_ss_log_good', kpg_get_ip(), $stats, $options, $post);
        sfs_errorsonoff('off');
        return $user_login;
    }
    // check the black list
    //sfs_debug_msg("Checking black list on registration: /r/n".print_r($post,true));
    $ret = be_load('kpg_ss_check_post', kpg_get_ip(), $stats, $options, $post);
    $post['reason'] = 'Passed Registration ' . $ret;
    $ansa = be_load('kpg_ss_log_good', kpg_get_ip(), $stats, $options, $post);
    return $user_login;
}