Esempio n. 1
0
$_SGLOBAL['tpl_blockvalue'] = array();
$_SGLOBAL['debug_query'] = array();
define('A_DIR', $_SCONFIG['attachmentdir']);
if (substr($_SCONFIG['attachmentdir'], 0, 2) == './' && empty($_SCONFIG['attachmenturl'])) {
    $_SCONFIG['attachmenturl'] = S_URL . substr($_SCONFIG['attachmentdir'], 1);
}
define('A_URL', $_SCONFIG['attachmenturl']);
$newsiteurl = S_URL;
if (strpos($newsiteurl, '://') === false) {
    $newsiteurl = 'http://' . (empty($_SERVER['HTTP_HOST']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST']) . $newsiteurl;
}
define('S_URL_ALL', $newsiteurl);
if (empty($nolanguage)) {
    include_once S_ROOT . './language/main.lang.php';
}
if (file_exists(S_ROOT . './index.html')) {
    define('S_ISPHP', '1');
}
//链接数据库
dbconnect();
if (!defined('IN_SUPESITE_UPDATE')) {
    getcookie();
}
//获取频道信息
$channels = getchannels();
//计划任务
@(include_once S_ROOT . './data/system/cron.cache.php');
if (empty($_SGLOBAL['cronnextrun']) || $_SGLOBAL['cronnextrun'] <= $_SGLOBAL['timestamp']) {
    include_once S_ROOT . './function/cron.func.php';
    runcron();
}
if (!defined('IN_BRAND')) {
    exit('Access Denied');
}
$groupbuycronfile = B_ROOT . './data/system/updategroupbuygrade.cache.php';
if (!file_exists($groupbuycronfile)) {
    $groupbuycrontext = '$crongroupbuyid=0';
    writefile($groupbuycronfile, $groupbuycrontext, 'php');
}
@(include $groupbuycronfile);
$pernum = 1000;
$resultarr = array();
$wheresql = 'itemid>' . $crongroupbuyid . ' AND';
$groupbuynum = DB::result_first('SELECT COUNT(itemid) FROM ' . tname('groupbuyitems') . ' WHERE ' . $wheresql . ' grade>2 ORDER BY itemid ASC');
$query = DB::query('SELECT itemid, validity_end FROM ' . tname('groupbuyitems') . ' WHERE ' . $wheresql . ' grade>2 ORDER BY itemid ASC LIMIT ' . $pernum);
while ($value = DB::fetch($query)) {
    if (!empty($value['validity_end']) && $value['validity_end'] < $_G['timestamp']) {
        DB::query('UPDATE ' . tname('groupbuyitems') . ' SET grade=2 WHERE itemid=' . $value['itemid'], 'UNBUFFERED');
    }
    $resultarr[] = $value;
}
if ($groupbuynum > $pernum) {
    $cronlastgroupbuy = array_pop($resultarr);
    $crongroupbuyid = $cronlastgroupbuy['itemid'];
    $groupbuycrontext = '$crongroupbuyid=' . $crongroupbuyid;
    writefile($groupbuycronfile, $groupbuycrontext, 'php');
    runcron($cron['cronid']);
} else {
    $groupbuycrontext = '$crongroupbuyid=0';
    writefile($groupbuycronfile, $groupbuycrontext, 'php');
    cronnextrun(array($cron['cronid']));
}
Esempio n. 3
0
    $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('crons') . ' WHERE cronid=\'' . $_GET['cronid'] . '\'');
    if ($thevalue = $_SGLOBAL['db']->fetch_array($query)) {
    }
} elseif ($_GET['op'] == 'add') {
    //ONE ADD
    $thevalue = array('cronid' => 0, 'name' => '', 'available' => 1, 'filename' => '', 'weekday' => '-1', 'day' => '-1', 'hour' => '-1', 'minute' => '');
    $addclass = ' class="active"';
} elseif ($_GET['op'] == 'delete') {
    //ONE DELETE
    $_GET['cronid'] = intval($_GET['cronid']);
    $_SGLOBAL['db']->query('DELETE FROM ' . tname('crons') . ' WHERE cronid=\'' . $_GET['cronid'] . '\'');
    updatecronscache();
    showmessage('cron_delete_success', $newurl);
} elseif ($_GET['op'] == 'run') {
    $_GET['cronid'] = intval($_GET['cronid']);
    runcron($_GET['cronid'], 1);
    showmessage('cron_run_success', $newurl);
}
//SHOW HTML
//MENU
echo '
<table summary="" id="pagehead" cellpadding="0" cellspacing="0" border="0" width="100%">
	<tr>
		<td><h1>' . $alang['cron_title'] . '</h1></td>
		<td class="actions">
			<table summary="" cellpadding="0" cellspacing="0" border="0" align="right">
				<tr>
					<td' . $viewclass . '><a href="' . $newurl . '" class="view">' . $alang['cron_view_list'] . '</a></td>
					<td' . $addclass . '><a href="' . $newurl . '&op=add" class="add">' . $alang['cron_add'] . '</a></td>
				</tr>
			</table>
Esempio n. 4
0
    $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('crons') . ' WHERE cronid=\'' . $_GET['cronid'] . '\'');
    if ($thevalue = $_SGLOBAL['db']->fetch_array($query)) {
    }
} elseif ($_GET['op'] == 'add') {
    //ONE ADD
    $thevalue = array('cronid' => 0, 'name' => '', 'available' => 1, 'filename' => '', 'weekday' => '-1', 'day' => '-1', 'hour' => '-1', 'minute' => '');
    $addclass = ' class="active"';
} elseif ($_GET['op'] == 'delete') {
    //ONE DELETE
    $_GET['cronid'] = intval($_GET['cronid']);
    $_SGLOBAL['db']->query('DELETE FROM ' . tname('crons') . ' WHERE cronid=\'' . $_GET['cronid'] . '\'');
    updatecronscache();
    showmessage('cron_delete_success', $newurl);
} elseif ($_GET['op'] == 'run') {
    $_GET['cronid'] = intval($_GET['cronid']);
    runcron($_GET['cronid']);
    showmessage('cron_run_success', $newurl);
}
//SHOW HTML
//MENU
echo '
<table summary="" id="pagehead" cellpadding="0" cellspacing="0" border="0" width="100%">
	<tr>
		<td><h1>' . $alang['cron_title'] . '</h1></td>
		<td class="actions">
			<table summary="" cellpadding="0" cellspacing="0" border="0" align="right">
				<tr>
					<td' . $viewclass . '><a href="' . $newurl . '" class="view">' . $alang['cron_view_list'] . '</a></td>
					<td' . $addclass . '><a href="' . $newurl . '&op=add" class="add">' . $alang['cron_add'] . '</a></td>
				</tr>
			</table>
Esempio n. 5
0
    //更新config
    cron_config();
    cpmessage('do_success', 'admincp.php?ac=cron');
}
if ($_GET['op'] == 'edit') {
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('cron') . " WHERE cronid='{$cronid}'");
    $thevalue = $_SGLOBAL['db']->fetch_array($query);
} elseif ($_GET['op'] == 'add') {
    $thevalue = array('week' => '-1', 'hour' => '-1', 'day' => '-1', 'minute' => '0', 'available' => 1);
} elseif ($_GET['op'] == 'delete') {
    $_SGLOBAL['db']->query("DELETE FROM " . tname('cron') . " WHERE cronid='{$cronid}' AND type='user'");
    //更新缓存
    cron_config();
    cpmessage('do_success', 'admincp.php?ac=cron');
} elseif ($_GET['op'] == 'run') {
    runcron($cronid);
    cpmessage('do_success', 'admincp.php?ac=cron');
} else {
    //列表
    $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('cron') . " ORDER BY type DESC");
    while ($cron = $_SGLOBAL['db']->fetch_array($query)) {
        foreach (array('weekday', 'day', 'hour', 'minute') as $key) {
            if (in_array($cron[$key], array(-1, ''))) {
                $cron[$key] = '*';
            } elseif ($key == 'weekday') {
                $cron[$key] = 1 + $cron[$key];
            } elseif ($key == 'minute') {
                foreach ($cron[$key] = explode("\t", $cron[$key]) as $k => $v) {
                    $cron[$key][$k] = sprintf('%02d', $v);
                }
                $cron[$key] = implode(',', $cron[$key]);
Esempio n. 6
0
 function _run_cron()
 {
     global $_G, $_SGLOBAL;
     // 計劃任務
     @(include_once B_ROOT . './data/system/cron.cache.php');
     if (empty($_SGLOBAL['cronnextrun']) || $_SGLOBAL['cronnextrun'] <= $_G['timestamp']) {
         include_once B_ROOT . './source/function/cron.func.php';
         runcron();
     }
 }