/Admin/Lib/Action/BaseAction.class.php
http://nblog-thinkphp.googlecode.com/ · PHP · 99 lines · 52 code · 19 blank · 28 comment · 8 complexity · dd4130612d78b02f9cdf72c6006792c3 MD5 · raw file
- <?php
- // +----------------------------------------------------------------------
- // | ??Action?????
- // +----------------------------------------------------------------------
- // | @link ( http://www.yurnero.net )
- // +----------------------------------------------------------------------
- // | @copyright
- // +----------------------------------------------------------------------
- // | @licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
- // +----------------------------------------------------------------------
- // | @author Haijun Wu <nicholasinlove@126.com>
- // +----------------------------------------------------------------------
- // | $Id: BaseAction.class.php 115 2011-05-11 09:06:41Z nicholasinlove1986@gmail.com $
- // +----------------------------------------------------------------------
-
-
- class BaseAction extends Action {
-
- //?????
- public function _initialize() {
-
- if (!$_SESSION[C('USER_AUTH_KEY')]) {
- //???????
- redirect(PHP_FILE.C('USER_AUTH_GATEWAY'));
- }
-
- /* ???????? */
- $this->checkOnline();
-
- /* ?????????????????*/
- all_stripslashes();
-
- /* ?????? */
- global $_CFG;
- $_CFG = get_config();
-
- /* ???? */
- smilies_init();
-
- /* ???????? */
- import("@.ORG.StaticCaches");
- $cache = new StaticCaches();
- $cache->cacheInit();
- //create_static_caches();
-
- header('Expires: Fri, 14 Mar 1980 20:53:00 GMT');
- header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
- header('Cache-Control: no-cache, must-revalidate');
- header('Pragma: no-cache');
-
- /* ??????gzip?? */
- if (gzip_enabled()) {
- ob_start('ob_gzhandler');
- } else {
- ob_start();
- }
-
- /* ???????? */
- clearstatcache();
-
- /* ???? */
- require_cache (ROOT_PATH.'Public/Plugins/fml/fml.php');
- }
-
- //????????,??1800s
- protected function checkOnline($online='1800') {
- $nowtime = gmtime();
- if ($nowtime - $_SESSION['user_logintime'] > $online) {
- $this->assign('jumpUrl',__APP__.'/Admin/login/');
- $this->success(L('login_online'));
- } else {
- $_SESSION['user_logintime'] = gmtime();
- }
- }
-
- //????????
- protected function checkUser() {
- if (!isset($_SESSION[C('USER_AUTH_KEY')])) {
- $this->assign('jumpUrl',__APP__.'/Admin/login/');
- $this->error(L('login_first'));
- }
- }
-
- //????
- protected function checkLimits() {
- if ($_SESSION['user_level'] != 0) {
- $this->error(L('no_limits'));
- }
- }
-
- //???
- public function _empty() {
- $this->assign('jumpUrl',__APP__);
- $this->error(L('illegal'));
- }
-
- }
-
- ?>