예제 #1
0
 function _run_action()
 {
     /* 只有登录的用户才可访问 */
     if (!$this->visitor->has_login && !in_array(ACT, array('login', 'register', 'check_user'))) {
         if (!IS_AJAX) {
             header('Location:index.php?app=member&act=login&ret_url=' . rawurlencode($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']));
             return;
         } else {
             $this->json_error('login_please');
             return;
         }
     }
     /* 检查是否是店铺管理员 */
     if (!$this->visitor->get('manage_store')) {
         /* 您不是店铺管理员 */
         $this->show_warning('not_storeadmin', 'apply_now', 'index.php?app=apply', 'go_back');
         return;
     }
     /* 检查是否被授权 */
     $privileges = $this->_get_privileges();
     if (!$this->visitor->i_can('do_action', $privileges)) {
         $this->show_warning('no_permission');
         return;
     }
     /* 检查店铺开启状态 */
     $state = $this->visitor->get('state');
     if ($state == 0) {
         $this->show_warning('apply_not_agree');
         return;
     } elseif ($state == 2) {
         $this->show_warning('store_is_closed');
         return;
     }
     parent::_run_action();
 }
예제 #2
0
 function _run_action()
 {
     /* 只有登录的用户才可访问 */
     if (!$this->visitor->has_login && !in_array(ACT, array('login', 'register', 'check_user'))) {
         if (!IS_AJAX) {
             header('Location:index.php?app=member&act=login&ret_url=' . rawurlencode($_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING']));
             return;
         } else {
             $this->json_error('login_please');
             return;
         }
     }
     $referer = $_SERVER['HTTP_REFERER'];
     if (strpos($referer, 'act=login') === false) {
         $ret_url = $_SERVER['HTTP_REFERER'];
         $ret_text = 'go_back';
     } else {
         $ret_url = SITE_URL . '/index.php';
         $ret_text = 'back_index';
     }
     /* 检查是否是店铺管理员 */
     if (!$this->visitor->get('manage_store')) {
         /* 您不是店铺管理员 */
         $this->show_warning('not_storeadmin', 'apply_now', 'index.php?app=apply', $ret_text, $ret_url);
         return;
     }
     /* 检查是否被授权 */
     $privileges = $this->_get_privileges();
     if (!$this->visitor->i_can('do_action', $privileges)) {
         $this->show_warning('no_permission', $ret_text, $ret_url);
         return;
     }
     /* 检查店铺开启状态 */
     $state = $this->visitor->get('state');
     if ($state == 0) {
         $this->show_warning('apply_not_agree', $ret_text, $ret_url);
         return;
     } elseif ($state == 2) {
         $this->show_warning('store_is_closed', $ret_text, $ret_url);
         return;
     }
     /* 检查附加功能 */
     if (!$this->_check_add_functions()) {
         $this->show_warning('not_support_function', $ret_text, $ret_url);
         return;
     }
     parent::_run_action();
 }