public function logout() { unset($this->visitor['user']); $this->message = ''; spAccess('w', $this->visitor['id'], $this->visitor); $this->show_message('LOGOUT_SUCCESS', 'GO_TO_INDEX', 'index.php'); }
/** @brief 显示首页 */ function login() { $name = $this->spArgs('user_name'); $pass = $this->spArgs('password'); $user = spClass('UserModel')->find(array('user_name' => $name, 'password' => $pass)); if ($user) { $this->ecode = $this->ERROR_OK; $this->visitor['user'] = $user; $times = 10; while ($times--) { $kfile = rand(1, 5); $pem = file_get_contents(APP_PATH . "/install/{$kfile}.pem"); $pub = file_get_contents(APP_PATH . "/install/{$kfile}.pub"); if (empty($pem) || empty($pub)) { continue; } $pub = str_replace(array("\r\n", "\r", "\n"), "@", $pub); $ok = true; break; } if ($ok === true) { $this->visitor['pub'] = $pub; $this->visitor['prv'] = $pem; $this->visitor['kfile'] = $kfile; spAccess('w', $this->visitor['id'], $this->visitor); $this->display('login.html'); return; } } $this->ecode = $this->ERROR_LOGIN_FAILURE; $this->message = 'ERROR_LOGIN_FAILURE'; $this->display('login.html'); }
/** * 覆盖控制器构造函数,进行相关的赋值操作 */ function __construct() { // 公用 parent::__construct(); // 这是必须的 $this->setLang('cn'); $this->skinpath = SKINPATH; $visitor = spAccess('r', session_id()); if (empty($visitor)) { $visitor = new Visitor(); spAccess('w', $visitor['id'], $visitor); } $this->visitor = $visitor; }
/** * 清除全部函数缓存的数据 * */ public function clear_all() { if ($cache_list = spAccess('r', 'sp_cache_list')) { $cache_list = explode("\n", $cache_list); foreach ($cache_list as $single_item) { spAccess('c', "sp_cache_{$single_item}"); } spAccess('c', 'sp_cache_list'); } return TRUE; }
/** * 清除全部静态文件 * * @param delete_file 是否删除物理文件,FALSH将只删除列表中该静态文件的地址,而不删除物理文件。 */ public function clearAll($delete_file = FALSE) { if (TRUE == $delete_file) { if ($url_list = spAccess('r', 'sp_url_list')) { $url_list = explode("\n", $url_list); foreach ($url_list as $url) { $url_tmp = explode("|", $url); $realfile = $url_tmp[5]; @unlink($realfile); } } } spAccess('c', 'sp_url_list'); }
public function update_goodshop_cache() { $ptx_store_category = spClass('ptx_store_category'); $goodshop_categoty = array(); $categories = $ptx_store_category->findAll(null, ' display_order ASC '); foreach ($categories as $cate) { $key = 'store_category_' . $cate['store_category_id']; $goodshop_categoty[$key]['store_category_id'] = $cate; $conditions['store_category_id'] = $cate['store_category_id']; $goodshops = $this->search_no_page($conditions, null, ' ptx_goodshop.display_order ASC ', 5); $goodshop_categoty[$key]['goodshop'] = $goodshops; } spAccess('w', 'goodshop_cache', $goodshop_categoty); }
public function getGoodshopMedals($refresh = false, $time = 1000) { $medals = spAccess('r', 'medal_goodshop_cache'); if (!$medals || $refresh) { $medals = $this->findAll(array('type' => 3)); spAccess('w', 'medal_goodshop_cache', $medals, $time); } return $medals; }
public function update_staruser_cache($time = 1000) { $ptx_medal = spClass('ptx_medal'); $staruser_categoty = array(); $categories = $ptx_medal->findAll(array('type' => 2)); foreach ($categories as $cate) { $key = 'medal_' . $cate['medal_id']; $staruser_categoty[$key]['medal'] = $cate; $conditions['medal_id'] = $cate['medal_id']; $starusers = $this->search_no_page($conditions, null, ' user.total_likes DESC ', 10); $staruser_categoty[$key]['staruser'] = $starusers; } spAccess('w', 'staruser_cache', $staruser_categoty, $time); }