function cleandata() { global $CURRENTPATH, $TABLE_PREFIX, $btit_settings; global $clean_interval; if ($clean_interval == 0) { return; } $now = time(); $res = get_result("SELECT last_time as lt FROM {$TABLE_PREFIX}tasks WHERE task='sanity'", true, $btit_settings['cache_duration']); $row = $res[0]; if (!$row) { do_sqlquery("INSERT INTO {$TABLE_PREFIX}tasks (task, last_time) VALUES ('sanity',{$now})"); return; } $ts = $row['lt']; if ($ts + $clean_interval > $now) { return; } do_sqlquery("UPDATE {$TABLE_PREFIX}tasks SET last_time={$now} WHERE task='sanity' AND last_time = {$ts}"); if (!mysqli_affected_rows($GLOBALS["___mysqli_ston"])) { return; } require_once $CURRENTPATH . '/sanity.php'; do_sanity($ts); }
$tpl->set("main_content", set_block($language["LOGS_PHP"], "center", $admintpl->fetch(load_template("admin.php_errors_log.tpl")))); break; case 'seedbonus': include "{$ADMIN_PATH}/admin.bonus.php"; $tpl->set("main_content", set_block($language["ACP_SEEDBONUS"], "center", $admintpl->fetch(load_template("admin.bonus.tpl")))); break; case 'warn': include "{$ADMIN_PATH}/admin.warn.php"; $tpl->set("main_content", set_block($block_title, "center", $admintpl->fetch(load_template("admin.warn.tpl")))); break; case 'smf_select': include "{$ADMIN_PATH}/admin.cats.forum.php"; $tpl->set("main_content", set_block($language["ACP_CATFORUM_CONFIG"], "center", $admintpl->fetch(load_template("admin.cats.forum.tpl")))); break; case 'sanity': require_once "{$THIS_BASEPATH}/include/sanity.php"; $now = time(); $res = do_sqlquery("SELECT last_time FROM {$TABLE_PREFIX}tasks WHERE task='sanity'"); $row = mysqli_fetch_row($res); if (!$row) { do_sqlquery("INSERT INTO {$TABLE_PREFIX}tasks (task, last_time) VALUES ('sanity',{$now})"); } else { $ts = $row[0]; do_sqlquery("UPDATE {$TABLE_PREFIX}tasks SET last_time={$now} WHERE task='sanity' AND last_time = {$ts}"); } do_sanity($ts); default: include "{$ADMIN_PATH}/admin.main.php"; $tpl->set("main_content", set_block($language["WELCOME_ADMINCP"], "center", $admintpl->fetch(load_template("admin.main.tpl")))); break; }
$tpl->set("main_content", set_block($language["ACP_BAN_IP"], "center", $admintpl->fetch(load_template("admin.banip.tpl")))); break; case 'module_config': include "{$ADMIN_PATH}/admin.module_config.php"; $tpl->set("main_content", set_block($language["ACP_MODULES_CONFIG"], "center", $admintpl->fetch(load_template("admin.module_config.tpl")))); break; case 'hacks': include "{$ADMIN_PATH}/admin.hacks.php"; $tpl->set("main_content", set_block($language["ACP_HACKS_CONFIG"], "center", $admintpl->fetch(load_template("admin.hacks.tpl")))); break; case 'users': include "{$ADMIN_PATH}/admin.users.tools.php"; $tpl->set("main_content", set_block($block_title, "center", $admintpl->fetch(load_template("admin.users.tools.tpl")))); break; case 'sanity': require_once "{$THIS_BASEPATH}/include/sanity.php"; $now = time(); $res = do_sqlquery("SELECT last_time FROM {$TABLE_PREFIX}tasks WHERE task='sanity'"); $row = mysql_fetch_row($res); if (!$row) { do_sqlquery("INSERT INTO {$TABLE_PREFIX}tasks (task, last_time) VALUES ('sanity',{$now})"); } else { $ts = $row[0]; do_sqlquery("UPDATE {$TABLE_PREFIX}tasks SET last_time={$now} WHERE task='sanity' AND last_time = {$ts}"); } do_sanity(); default: include "{$ADMIN_PATH}/admin.main.php"; $tpl->set("main_content", set_block($language["WELCOME_ADMINCP"], "center", $admintpl->fetch(load_template("admin.main.tpl")))); break; }
function cleandata() { global $db; require_once INCL_PATH . 'sanity.php'; global $clean_interval; if (0 + $clean_interval == 0) { return; } $now = vars::$timestamp; $res = $db->query("SELECT last_time FROM tasks WHERE task = 'sanity'"); $row = $res->fetch_array(MYSQLI_BOTH); if (!$row) { $db->query("INSERT INTO tasks (task, last_time) VALUES ('sanity', " . $now . ")"); return; } $ts = $row[0]; if ($ts + $clean_interval > $now) { return; } $db->query("UPDATE tasks SET last_time = " . $now . " WHERE task = 'sanity' AND last_time = " . $ts); if (!$db->affected_rows) { return; } do_sanity(); }