Example #1
0
function JB_do_cron_job()
{
    if (is_numeric(JB_CRON_LIMIT)) {
        // check load averge. Do not do cron if load avg is larger than the limit
        JB_exec("w", $out);
        preg_match('#load average: (\\d+\\.\\d+)#', $out[0], $m);
        $load_av = $m[1];
        if ($load_av > JB_CRON_LIMIT) {
            return false;
        }
    }
    $unix_time = time();
    $dir = JB_basedirpath();
    // process the email queue
    JB_process_mail_queue(JB_EMAILS_PER_BATCH);
    // scan inbox
    if (!function_exists('JB_monitor_mail_box')) {
        require_once $dir . "include/mail_monitor_functions.php";
    }
    JB_load_monitor_constants();
    if (MON_ENABLED == 'YES') {
        JB_monitor_mail_box();
    }
    // get the time of last HOURLY run
    $sql = "SELECT * FROM `jb_variables` where `key` = 'LAST_HOURLY_RUN' ";
    $result = @JB_mysql_query($sql) or $DB_ERROR = mysql_error();
    $t_row = @mysql_fetch_array($result, MYSQL_ASSOC);
    JBPLUG_do_callback('do_cron_job', $A = false);
    // queue email alerts
    if ($unix_time > $t_row['val'] + 3600) {
        // did 1 hour elapse since last run? 3600
        if (JB_JOB_ALERTS_ENABLED == 'YES') {
            // need to init jobs tag_to_field
            define('JB_JOB_ALERTS_DO_SEND', true);
            require $dir . 'admin/jobalerts.php';
        }
        if (JB_RESUME_ALERTS_ENABLED == 'YES') {
            // need to init resume tag_to_field
            define('JB_RESUME_ALERTS_DO_SEND', true);
            require $dir . 'admin/resumealerts.php';
        }
        JB_update_employer_subscriptions();
        JB_update_memberships();
        // update timestamp
        $sql = "REPLACE INTO jb_variables (`key`, `val`) VALUES ('LAST_HOURLY_RUN', '{$unix_time}')  ";
        $result = @JB_mysql_query($sql) or $DB_ERROR = mysql_error();
        if (!function_exists('JB_search_category_tree_for_posts')) {
            require_once $dir . "include/posts.inc.php";
        }
        JB_expire_posts('PREMIUM');
        JB_expire_posts('STANDARD');
        JB_cache_del_keys_for_all_cats(1);
        JB_cache_del_keys_for_all_cats(2);
        JB_cache_del_keys_for_all_cats(3);
        JB_cache_del_keys_for_all_cats(4);
        JB_cache_del_keys_for_all_cats(5);
        //
        JB_update_post_count();
        JB_update_resume_count();
        JB_update_profile_count();
        JB_update_employer_count();
        JB_update_user_count();
        if (EMAIL_URL_SHORTEN == 'YES') {
            JB_expire_short_URLs();
        }
        // run the import tool
        JB_process_xml_import();
        JBPLUG_do_callback('do_cron_hourly', $A = false);
    }
}
Example #2
0
    $sql = "REPLACE INTO jb_config (`key`, `val`) VALUES('" . MON_EMAIL_POP_SERVER . "', '" . jb_escape_sql($_REQUEST['mon_email_pop_server']) . "')  ";
    $result = JB_mysql_query($sql) or die(mysql_error($result));
    $sql = "REPLACE INTO jb_config (`key`, `val`) VALUES('" . MON_EMAIL_POP_PASS . "', '" . jb_escape_sql($_REQUEST['mon_email_pop_pass']) . "')  ";
    $result = JB_mysql_query($sql) or die(mysql_error($result));
    $sql = "REPLACE INTO jb_config (`key`, `val`) VALUES('" . MON_POP3_PORT . "', '" . jb_escape_sql($_REQUEST['mon_pop3_port']) . "')  ";
    $result = JB_mysql_query($sql) or die(mysql_error($result));
    $sql = "REPLACE INTO jb_config (`key`, `val`) VALUES('" . MON_LOG_DAYS . "', '" . jb_escape_sql($_REQUEST['mon_log_days']) . "')  ";
    $result = JB_mysql_query($sql) or die(mysql_error($result));
    $sql = "REPLACE INTO jb_config (`key`, `val`) VALUES('" . MON_DEL_DAYS . "', '" . jb_escape_sql($_REQUEST['mon_del_days']) . "')  ";
    $result = JB_mysql_query($sql) or die(mysql_error($result));
    $JBMarkup->ok_msg('Changes Saved.');
}
JB_load_monitor_constants();
if ($_REQUEST['scan'] != '') {
    if (MON_ENABLED == 'YES' && JB_DEMO_MODE != 'YES') {
        JB_monitor_mail_box();
    }
}
if (!defined('MON_POP3_PORT')) {
    define('MON_POP3_PORT', 110);
}
if (!defined('MON_EMAIL_POP_USER')) {
    define('MON_EMAIL_POP_USER', JB_EMAIL_SMTP_USER);
}
if (!defined('MON_EMAIL_POP_SERVER')) {
    define('MON_EMAIL_POP_SERVER', JB_EMAIL_POP_SERVER);
}
if (!defined('MON_EMAIL_POP_PASS')) {
    define('MON_EMAIL_POP_PASS', JB_EMAIL_SMTP_PASS);
}
if (!defined('MON_LOG_DAYS')) {