<?php !function_exists('readover') && exit('Forbidden'); @set_time_limit(600); @ignore_user_abort(TRUE); $query = $db->query("SELECT * FROM pw_plan WHERE ifopen='1' AND nexttime<" . S::sqlEscape($timestamp)); while ($plan = $db->fetch_array($query)) { if (file_exists(R_P . 'require/plan/' . $plan['filename'] . '.php')) { $nexttime = nexttime($plan); require_once S::escapePath(R_P . 'require/plan/' . $plan['filename'] . '.php'); $db->update("UPDATE pw_plan SET" . S::sqlSingle(array('usetime' => $timestamp, 'nexttime' => $nexttime), false) . "WHERE id=" . S::sqlEscape($plan['id'], false)); } } $db->free_result($query); unset($plan); require_once R_P . 'admin/cache.php'; updatecache_plan(); function nexttime($plan) { global $timestamp, $db_timedf; $t = gmdate('G', $timestamp + $db_timedf * 3600); $timenow = (int) (floor($timestamp / 3600) - $t) * 3600; $minute = (int) get_date($timestamp, 'i'); $hour = get_date($timestamp, 'G'); $day = get_date($timestamp, 'j'); $month = get_date($timestamp, 'n'); $year = get_date($timestamp, 'Y'); $week = get_date($timestamp, 'w'); $week == 0 && ($week = 7); if (is_numeric($plan['month'])) { $timenow += (min($plan['month'], DaysInMouth($month)) - $day) * 86400;
<?php defined('IN_DESTOON') or exit('Access Denied'); function nexttime($schedule, $time) { if (strpos($schedule, ',') !== false) { list($h, $m) = explode(',', $schedule); $t = strtotime(timetodate($time, 3) . ' ' . ($h < 10 ? '0' . $h : $h) . ':' . ($m < 10 ? '0' . $m : $m) . ':00'); return $t > $time ? $t : $t + 86400; } else { $m = intval($schedule); return $time + ($m ? $m : 1800) * 60; } } $result = $db->query("SELECT * FROM {$DT_PRE}cron WHERE nexttime<{$DT_TIME} ORDER BY itemid"); while ($r = $db->fetch_array($result)) { if ($r['status']) { continue; } include DT_ROOT . '/api/cron/' . $r['name'] . '.inc.php'; $nexttime = nexttime($r['schedule'], $DT_TIME); $db->query("UPDATE {$DT_PRE}cron SET lasttime={$DT_TIME},nexttime={$nexttime} WHERE itemid={$r['itemid']}"); } if ($DT['message_email'] && $DT['mail_type'] != 'close' && !$_userid) { include DT_ROOT . '/api/cron/message.php'; }