Example #1
0
 function __construct()
 {
     pamAccount::setAuthType('desktop');
     if (pamAccount::check()) {
         $this->user_id = pamAccount::getAccountId();
         if (empty($_SESSION['account']['user_data'])) {
             $_SESSION['account']['user_data'] = array();
             $account = app::get('desktop')->model('account');
             if ($row = $account->getList('account_id', array('account_id' => $this->user_id))) {
                 $model = app::get('desktop')->model('users');
                 $data = $model->getList('user_id', array('user_id' => $this->user_id));
                 if (!$data) {
                     unset($_SESSION['account'][$this->account_type]);
                 } else {
                     $_SESSION['account']['user_data'] = app::get('desktop')->model('users')->dump($this->user_id, '*', array(':account@desktop' => array('*')));
                 }
             } else {
                 unset($_SESSION['account'][$this->account_type]);
             }
         }
         $this->user_data = $_SESSION['account']['user_data'];
     } else {
         $this->user_data = array();
     }
 }
/**
 * ShopEx licence
 *
 * @copyright  Copyright (c) 2005-2010 ShopEx Technologies Inc. (http://www.shopex.cn)
 * @license  http://ecos.shopex.cn/ ShopEx License
 */
function theme_widget_wap_ad_items(&$setting)
{
    $rows = 'item_id,title,price,image_default_id';
    $objItem = kernel::single('sysitem_item_info');
    $setting['item'] = $objItem->getItemList($setting['item_select'], $rows);
    $setting['defaultImg'] = app::get('image')->getConf('image.set');
    if (pamAccount::check()) {
        $setting['nologin'] = 1;
    }
    return $setting;
}
Example #3
0
 public function __construct($app)
 {
     $this->app = $app;
     $this->defaultwg = $this->defaultWorkground;
     kernel::single('base_session')->start();
     pamAccount::setAuthType('desktop');
     if ($_COOKIE['autologin'] > 0) {
         kernel::single('base_session')->set_sess_expires($_COOKIE['autologin']);
     }
     //如果有自动登录,设置session过期时间,单位:分
     if (get_class($this) != 'desktop_ctl_passport' && !pamAccount::check()) {
         if (get_class($this) != 'desktop_ctl_default') {
             $url = url::route('shopadmin', $_GET);
         } else {
             $url = url::route('shopadmin');
         }
         $url = base64_encode($url);
         $arr_get = $_GET;
         foreach ($arr_get as &$str_get) {
             $str_get = urldecode($str_get);
         }
         $params = urlencode(json_encode($arr_get));
         // 直接跳转, 所以直接send
         $goto = url::route('shopadmin', array('ctl' => 'passport', 'url' => $url, 'params' => $params));
         echo "<script>location ='{$goto}'</script>";
         exit;
     }
     $this->user = kernel::single('desktop_user');
     if ($_GET['ctl'] != "passport" && $_GET['ctl'] != "") {
         $this->status = $this->user->get_status();
         if (!$this->status && $this->status == 0) {
             unset($_SESSION['account']);
             //如果验证错误,则把此次的session值清掉
             $url = url::route('shopadmin');
             $url = base64_encode($url);
             $pagedata['link_url'] = '?ctl=passport&url=' . $url;
             view::make('desktop/auth_error.html', $pagedata)->send();
         }
     }
     ###如果不是超级管理员就查询操作权限
     if (!$this->user->is_super()) {
         if (!$this->user->chkground($this->workground)) {
             header('Content-Type:text/html; charset=utf-8');
             return app::get('desktop')->_("您无权操作");
         }
     }
     $obj_model = app::get('desktop')->model('menus');
     //检查链接是否可用
     $obj_model->permissionId($_GET);
     //end
     $this->url = url::route('shopadmin', array('app' => $this->app->app_id, 'ctl' => request::get('ctl')));
 }
Example #4
0
 /**
  * @brief 创建商家会员
  *
  * @return json
  */
 public function create()
 {
     if (input::get('license') != 'on') {
         $msg = $this->app->_('同意注册条款后才能注册');
         throw new \LogicException($msg);
     }
     try {
         shopAuth::signupSeller(input::get());
     } catch (Exception $e) {
         $msg = $e->getMessage();
     }
     if (pamAccount::check()) {
         $url = url::action('topshop_ctl_index@index');
         $msg = app::get('topshop')->_('注册成功');
         return $this->splash('success', $url, $msg, true);
     } else {
         return $this->splash('error', null, $msg, true);
     }
 }