Esempio n. 1
0
 public function setup()
 {
     HTTP::no_cache_header();
     TPL::import_clean();
     TPL::import_css(array('mobile/css/icon.css', 'mobile/css/mobile.css'));
     TPL::import_js(array('js/jquery.2.js', 'js/jquery.form.js', 'mobile/js/framework.js', 'mobile/js/aws-mobile.js', 'mobile/js/app.js', 'mobile/js/aw-mobile-template.js'));
 }
 public function __construct()
 {
     parent::__construct(false);
     if ($_GET['app'] != 'admin') {
         return false;
     }
     TPL::import_clean();
     if (defined('SYSTEM_LANG')) {
         TPL::import_js(base_url() . '/language/' . SYSTEM_LANG . '.js');
     }
     if (HTTP::is_browser('ie', 8)) {
         TPL::import_js('js/jquery.js');
     } else {
         TPL::import_js('js/jquery.2.js');
     }
     TPL::import_js(array('admin/js/aws_admin.js', 'admin/js/aws_admin_template.js', 'js/jquery.form.js', 'admin/js/framework.js', 'admin/js/global.js'));
     TPL::import_css(array('admin/css/common.css'));
     if (in_array($_GET['act'], array('login', 'login_process'))) {
         return true;
     }
     if ($admin_info = H::decode_hash(AWS_APP::session()->admin_login)) {
         if ($admin_info['uid'] != $this->user_id or $admin_info['UA'] != $_SERVER['HTTP_USER_AGENT'] or !AWS_APP::session()->permission['is_administortar'] and !AWS_APP::session()->permission['is_moderator']) {
             unset(AWS_APP::session()->admin_login);
             if ($_POST['_post_type'] == 'ajax') {
                 H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('会话超时, 请重新登录')));
             } else {
                 H::redirect_msg(AWS_APP::lang()->_t('会话超时, 请重新登录'), '/admin/login/url-' . base64_encode($_SERVER['REQUEST_URI']));
             }
         }
     } else {
         if ($_POST['_post_type'] == 'ajax') {
             H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('会话超时, 请重新登录')));
         } else {
             HTTP::redirect('/admin/login/url-' . base64_encode($_SERVER['REQUEST_URI']));
         }
     }
     $this->setup();
 }
Esempio n. 3
0
 public function setup()
 {
     if ($_GET['ignore_ua_check'] == 'FALSE') {
         HTTP::set_cookie('_ignore_ua_check', 'FALSE');
     }
     if (!is_mobile()) {
         switch ($_GET['act']) {
             default:
                 HTTP::redirect('/');
                 break;
             case 'home':
                 HTTP::redirect('/home/');
                 break;
             case 'login':
                 HTTP::redirect('/account/login/');
                 break;
             case 'question':
                 HTTP::redirect('/question/' . $_GET['id']);
                 break;
             case 'register':
                 HTTP::redirect('/account/register/');
                 break;
             case 'topic':
                 HTTP::redirect('/topic/' . $_GET['id']);
                 break;
             case 'people':
                 HTTP::redirect('/people/' . $_GET['id']);
                 break;
             case 'article':
                 HTTP::redirect('/article/' . $_GET['id']);
                 break;
         }
     }
     if (!$this->user_id and !$this->user_info['permission']['visit_site'] and $_GET['act'] != 'login' and $_GET['act'] != 'register') {
         HTTP::redirect('/m/login/url-' . base64_encode($_SERVER['REQUEST_URI']));
     }
     switch ($_GET['act']) {
         default:
             if (!$this->user_id) {
                 HTTP::redirect('/m/login/url-' . base64_encode($_SERVER['REQUEST_URI']));
             }
             break;
         case 'index':
         case 'explore':
         case 'login':
         case 'question':
         case 'register':
         case 'topic':
         case 'search':
         case 'people':
         case 'article':
         case 'find_password':
         case 'find_password_success':
         case 'find_password_modify':
             // Public page..
             break;
     }
     TPL::import_clean();
     TPL::import_css(array('mobile/css/mobile.css'));
     TPL::import_js(array('js/jquery.2.js', 'js/jquery.form.js', 'mobile/js/framework.js', 'mobile/js/aws-mobile.js', 'mobile/js/app.js', 'mobile/js/aw-mobile-template.js'));
 }
Esempio n. 4
0
 public function setup()
 {
     if ($_GET['ignore_ua_check'] == 'FALSE') {
         HTTP::set_cookie('_ignore_ua_check', 'FALSE');
     }
     if (!is_mobile()) {
         switch ($_GET['act']) {
             default:
                 HTTP::redirect('/');
                 break;
             case 'home':
                 HTTP::redirect('/home/');
                 break;
             case 'login':
                 HTTP::redirect('/account/login/');
                 break;
             case 'question':
                 HTTP::redirect('/question/' . $_GET['id']);
                 break;
             case 'register':
                 HTTP::redirect('/account/register/');
                 break;
             case 'topic':
                 HTTP::redirect('/topic/' . $_GET['id']);
                 break;
             case 'people':
                 HTTP::redirect('/people/' . $_GET['id']);
                 break;
             case 'article':
                 HTTP::redirect('/article/' . $_GET['id']);
                 break;
         }
     }
     if (!$this->user_id and !$this->user_info['permission']['visit_site'] and $_GET['act'] != 'login' and $_GET['act'] != 'register') {
         HTTP::redirect('/m/login/url-' . base64_encode($_SERVER['REQUEST_URI']));
     }
     switch ($_GET['act']) {
         default:
             if (!$this->user_id) {
                 HTTP::redirect('/m/login/url-' . base64_encode($_SERVER['REQUEST_URI']));
             }
             break;
         case 'index':
         case 'explore':
         case 'login':
         case 'question':
         case 'register':
         case 'topic':
         case 'search':
         case 'people':
         case 'article':
         case 'find_password':
         case 'find_password_success':
         case 'find_password_modify':
             // Public page..
             break;
     }
     TPL::import_clean();
     TPL::import_css(array('mobile/css/mobile.css'));
     TPL::import_js(array('js/jquery.2.js', 'js/jquery.form.js', 'mobile/js/framework.js', 'mobile/js/aws-mobile.js', 'mobile/js/app.js', 'mobile/js/aw-mobile-template.js'));
     if (in_weixin()) {
         $noncestr = mt_rand(1000000000, 9999999999.0);
         TPL::assign('weixin_noncestr', $noncestr);
         $jsapi_ticket = $this->model('openid_weixin_weixin')->get_jsapi_ticket($this->model('openid_weixin_weixin')->get_access_token(get_setting('weixin_app_id'), get_setting('weixin_app_secret')));
         $url = ($_SERVER['HTTPS'] and !in_array(strtolower($_SERVER['HTTPS']), array('off', 'no'))) ? 'https' : 'http';
         $url .= '://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
         TPL::assign('weixin_signature', $this->model('openid_weixin_weixin')->generate_jsapi_ticket_signature($jsapi_ticket, $noncestr, TIMESTAMP, $url));
     }
 }