function gettask() { global $space, $_SGLOBAL; $task = array(); if (!@(include_once S_ROOT . './data/data_task.php')) { include_once S_ROOT . './source/function_cache.php'; task_cache(); } if ($_SGLOBAL['task']) { $usertasks = array(); $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('usertask') . " WHERE uid='{$_SGLOBAL['supe_uid']}'"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $usertasks[$value['taskid']] = $value; } //需要执行的任务 foreach ($_SGLOBAL['task'] as $value) { if ($value['starttime'] <= $_SGLOBAL['timestamp'] && (empty($usertasks[$value['taskid']]) || $value['nexttime'] && $_SGLOBAL['timestamp'] - $usertasks[$value['taskid']]['dateline'] >= $value['nexttime'])) { $value['image'] = empty($value['image']) ? 'image/task.gif' : $value['image']; $task = $value; break; } } } return $task; }
//���»��� if (submitcheck('cachesubmit')) { include_once S_ROOT . './source/function_cp.php'; include_once S_ROOT . './source/function_cache.php'; //ϵͳ���� if (empty($_POST['cachetype']) || in_array('database', $_POST['cachetype'])) { config_cache(); usergroup_cache(); profilefield_cache(); profield_cache(); censor_cache(); block_cache(); eventclass_cache(); magic_cache(); click_cache(); task_cache(); ad_cache(); creditrule_cache(); userapp_cache(); app_cache(); network_cache(); } //ģ����뻺�� if (empty($_POST['cachetype']) || in_array('tpl', $_POST['cachetype'])) { tpl_cache(); } //ģ�黺�� if (empty($_POST['cachetype']) || in_array('block', $_POST['cachetype'])) { block_data_cache(); } //��㿴������
function gettask() { global $space, $_SGLOBAL; $tasks = array(); if (!(include_once S_ROOT . './data/data_task.php')) { include_once S_ROOT . './source/function_cache.php'; task_cache(); } if ($_SGLOBAL['task']) { // user allready 经执行的任务 $usertasks = array(); $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('usertask') . " WHERE uid='{$_SGLOBAL['supe_uid']}'"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $usertasks[$value['taskid']] = $value; } //需要执行的任务 foreach ($_SGLOBAL['task'] as $value) { $allownext = 0; $lasttime = $usertasks[$value['taskid']]['dateline']; if (empty($lasttime)) { $allownext = 1; //从未执行过 } elseif ($value['nexttype'] == 'day') { if (sgmdate('Ymd', $_SGLOBAL['timestamp']) != sgmdate('Ymd', $lasttime)) { $allownext = 1; } } elseif ($value['nexttype'] == 'hour') { if (sgmdate('YmdH', $_SGLOBAL['timestamp']) != sgmdate('YmdH', $lasttime)) { $allownext = 1; } } elseif ($value['nexttime']) { if ($_SGLOBAL['timestamp'] - $lasttime >= $value['nexttime']) { $allownext = 1; } } if ($value['starttime'] <= $_SGLOBAL['timestamp'] && $allownext) { $value['image'] = empty($value['image']) ? 'image/task.gif' : $value['image']; $tasks[] = $value; } } } if ($tasks) { $r_key = array_rand($tasks, 1); return $tasks[$r_key]; } else { return array(); } }