cron.php
上传用户:gzy2002
上传日期:2010-02-11
资源大小:1785k
文件大小:3k
- <?php
- // +-------------------------------------------------------------+
- // | DeskPRO v [2.0.1 Production]
- // | Copyright (C) 2001 - 2004 Headstart Solutions Limited
- // | Supplied by WTN-WDYL
- // | Nullified by WTN-WDYL
- // | Distribution via WebForum, ForumRU and associated file dumps
- // +-------------------------------------------------------------+
- // | DESKPRO IS NOT FREE SOFTWARE
- // +-------------------------------------------------------------+
- // | License ID : Full Enterprise License =) ...
- // | License Owner : WTN-WDYL Team
- // +-------------------------------------------------------------+
- // | $RCSfile: cron.php,v $
- // | $Date: 2004/02/10 01:34:25 $
- // | $Revision: 1.14 $
- // +-------------------------------------------------------------+
- // | File Details:
- // | - Automatic tasks runner.
- // +-------------------------------------------------------------+
- error_reporting(E_ALL & ~E_NOTICE);
- $cron_folder = "includes/cron/"; // include trailing slash
- define('INCLUDE_PATH', realpath(dirname(__FILE__).'/includes/'));
- ignore_user_abort(1);
- @set_time_limit(0);
- define('CRONZONE', 1); // we are in the cron zone
- require_once('includes/config.php');
- require_once('includes/functions/admin-tech_functions.php');
- require_once('includes/functions/general_functions.php');
- require_once('includes/functions/session_functions.php');
- require_once('includes/functions/fields_functions.php');
- require_once('includes/functions/form_functions.php');
- require_once('includes/functions/database/mysql.php');
- $db = new DB_Sql;
- $db->User=constant('DATABASE_USER');
- $db->Password=constant('DATABASE_PASSWORD');
- $db->Host=constant('DATABASE_HOST');
- $db->Database=constant('DATABASE_NAME');
- get_settings();
- ############################### RUN RELEVANT SCRIPTS ###############################
- $crons = $db->query_return_array("SELECT * FROM cron_options");
- if ($db->num_rows()) {
- foreach ($crons AS $cron) {
- $tmp = unserialize($cron[options]);
- unset($options);
- if (is_array($tmp)) {
- foreach ($tmp AS $key => $var) {
- $options[$key] = $var['value'];
- }
- }
- // are we running this script, options are to run every hour or once per day on certain hour
- if (($cron[day]) OR ($cron[hour] == $settings[cron_hour])) {
- // empty variables to run next cron script
- unset($parsevars);
- $parsevars = array(
- 'GLOBALS' => 1,
- '_GET' => 1,
- '_POST' => 1,
- '_COOKIE' => 1,
- 'options' => 1,
- 'cron_folder' => 1,
- 'cron' => 1,
- 'db' => 1,
- '_REQUEST' => 1,
- '_SERVER' => 1,
- '_FILES' => 1,
- 'bench' => 1,
- 'showqueries' => 1,
- 'parsevars' => 1
- );
- if (is_array($GLOBALS)) {
- foreach ($GLOBALS as $var => $key) {
- if ((!isset($parsevars[$var])) AND ($var != 'var') AND ($var != 'key')) {
- unset($GLOBALS[$var]);
- }
- }
- }
- // run the script
- include($cron_folder . $cron[scriptname]);
- }
- }
- }
- ############################### FINISH UP ###############################
- // sort out hour
- if ($settings[cron_hour] == "23") {
- $db->query("UPDATE settings SET value = 0 WHERE settings = 'cron_hour'");
- } else {
- $db->query("UPDATE settings SET value = value + 1 WHERE settings = 'cron_hour'");
- }