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
        }
        ?>
		</p>
		<?php 
    }
}
if ($success) {
    $_SESSION['JB_THEME'] = $_REQUEST['jb_theme'];
    JB_init_category_tables(0);
    JB_cache_flush();
    JBPLUG_clear_cache();
    JB_compute_cat_has_child();
    // update counters
    JB_update_post_count();
    JB_update_resume_count();
    JB_update_profile_count();
    JB_update_employer_count();
    JB_update_user_count();
    JB_merge_language_files(true);
}
if (!$success) {
    jb_main_config_form();
}
function jb_main_config_form()
{
    global $JBMarkup;
    ?>

	Options on this page affect the running of the entire website, including the paths, database setting, look-and-feel, business logic, and more.<p>
	Note: <i>Please make sure that config.php has permissions for writing when editing this form.</i><br>
	<?php