/** * 设置缓存,按需重载 * @param string $cachename * @param mixed $value * @param int $expired * @return boolean */ protected function setCache($cachename, $value, $expired) { $db = new DB(); $db->connect(); $this->log($cachename); if ($db->setCache($cachename, $value, $expired)) { $db->disconnect(); return true; } $db->disconnect(); return false; }
break; } $smarty->assign("longtime", $db->getCache("LongTimeEnabled")['value']); $smarty->assign("notice", $db->getCache("notice")['value']); $smarty->display("systemMgr.html"); break; case 'setLong': if (!($admin['limit'] & 64)) { echo "Permission denied!"; break; } if (!isset($_GET['o'])) { echo "Please set properly!"; break; } $db->setCache("LongTimeEnabled", $_GET['o'], -1); if ($_GET['o']) { $db->adminLog($admin['name'], "开启长时"); } else { $db->adminLog($admin['name'], "关闭长时"); } header("location: index.php?a=systemMgr"); break; case 'newTerm': if (!($admin['limit'] & 64)) { echo "Permission denied!"; break; } $db->update("UPDATE tuser SET score = 40 WHERE score <= 0 AND state != 0"); $db->adminLog($admin['name'], "开启新学期"); header("location: index.php?a=systemMgr");