Example #1
0
 private function __run($shopItemData, $shopId, $itemId)
 {
     pamAccount::setAuthType('sysshop');
     pamAccount::setSession($shopId, 'test');
     $objMdlItemDesc = app::get('sysitem')->model('item_desc');
     $itemInfoDesc = $objMdlItemDesc->getRow("*", array('item_id' => $itemId));
     $update = [];
     if ($itemInfoDesc['pc_desc']) {
         $pcDesc = $this->__replaceHost($itemInfoDesc['pc_desc']);
         //$pcDesc = $this->__replaceHref($this->__replaceImage($itemInfoDesc['pc_desc']));
         if ($pcDesc != stripslashes($itemInfoDesc['pc_desc'])) {
             $update['pc_desc'] = $pcDesc;
         }
     }
     if ($itemInfoDesc['wap_desc']) {
         $wapDesc = $this->__replaceHost($itemInfoDesc['wap_desc']);
         //$wapDesc = $this->__replaceHref($this->__replaceImage($itemInfoDesc['wap_desc']));
         if ($wapDesc != stripslashes($itemInfoDesc['wap_desc'])) {
             $update['wap_desc'] = $wapDesc;
         }
     }
     if ($update) {
         $objMdlItemDesc->update($update, array('item_id' => $itemId));
     }
     return true;
 }
Example #2
0
 public function __construct()
 {
     $this->app = app::get('sysshop');
     kernel::single('base_session')->start();
     pamAccount::setAuthType('sysshop');
     $this->sellerId = pamAccount::getAccountId();
 }
Example #3
0
 public function call($method, $parameters = array(), $appId = 'default', $identity = "")
 {
     if ($identity) {
         switch ($identity) {
             case "buyer":
                 pamAccount::setAuthType('sysuser');
                 $oauth['auth_type'] = pamAccount::getAuthType('sysuser');
                 break;
             case "seller":
                 pamAccount::setAuthType('sysshop');
                 $oauth['auth_type'] = pamAccount::getAuthType('sysshop');
                 break;
             case "shopadmin":
                 pamAccount::setAuthType('desktop');
                 $oauth['auth_type'] = pamAccount::getAuthType('desktop');
                 break;
         }
         $oauth['account_id'] = pamAccount::getAccountId();
         $oauth['account_name'] = pamAccount::getLoginName();
     }
     $parameters['oauth'] = $oauth;
     if ($this->distribute()) {
         if ($appId != 'default') {
             $appId = $appId;
         }
         return $this->callOutside($method, $parameters, $appId);
     } else {
         return $this->callInternal($method, $parameters);
     }
 }
Example #4
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();
     }
 }
Example #5
0
 protected static function getFacadeAccessor()
 {
     pamAccount::setAuthType('sysuser');
     if (!static::$__userAuth) {
         static::$__userAuth = new pam_auth_user();
     }
     return static::$__userAuth;
 }
Example #6
0
 /**
  * @brief 生成唯一的用户标识
  *
  * @return 返回md5的值
  */
 public function getUserIdentMd5($userId = null)
 {
     pamAccount::setAuthType('sysuser');
     $userId = pamAccount::getAccountId();
     if ($userId) {
         return md5($userId);
     } else {
         return $this->getSessionUserIdent();
     }
 }
Example #7
0
 public function status()
 {
     pamAccount::setAuthType('desktop');
     $errorCount = pamAccount::getLoginErrorCount();
     //验证码必填是否开启
     $mustVcode = app::get('desktop')->getConf('shopadminVcode');
     if ($mustVcode != 'true') {
         //没开启验证码必填的情况下,错误三次及其以上则需要验证码
         return $errorCount >= 3 ? true : false;
     }
     return true;
 }
Example #8
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 #9
0
 public function __construct($app)
 {
     pamAccount::setAuthType('sysshop');
     $this->app = $app;
     $this->sellerId = pamAccount::getAccountId();
     $this->sellerName = pamAccount::getLoginName();
     $this->shopId = app::get('topshop')->rpcCall('shop.get.loginId', array('seller_id' => $this->sellerId), 'seller');
     $action = route::current()->getActionName();
     $actionArr = explode('@', $action);
     if ($actionArr['0'] != 'topshop_ctl_passport') {
         if (!$this->sellerId) {
             redirect::action('topshop_ctl_passport@signin')->send();
             exit;
         }
         if (!$this->shopId && $actionArr[0] != 'topshop_ctl_enterapply') {
             redirect::action('topshop_ctl_enterapply@apply')->send();
             exit;
         }
     }
 }
Example #10
0
 /**
  * 图片ID,关联上用户类型ID
  *
  * @param string $from 上传图片用户类型
  */
 private function __imageAttach($from = false, $test = false)
 {
     if ($from == 'shop') {
         pamAccount::setAuthType('sysshop');
         $data['target_id'] = pamAccount::getAccountId();
         $shopId = app::get('image')->rpcCall('shop.get.loginId', array('seller_id' => $data['target_id']), 'seller');
         if ($shopId) {
             $data['target_id'] = $shopId;
             $data['target_type'] = 'shop';
         } else {
             $data['target_type'] = 'seller';
         }
     } elseif ($from == 'user') {
         pamAccount::setAuthType('sysuser');
         $data['target_id'] = pamAccount::getAccountId();
         $data['target_type'] = 'user';
     } else {
         pamAccount::setAuthType('desktop');
         $data['target_id'] = pamAccount::getAccountId();
         $data['target_type'] = 'admin';
     }
     if (!$data['target_id'] && !$test) {
         throw new \LogicException(app::get('image')->_('无上传图片权限'));
     }
     return $data;
 }