public function execute($request)
 {
     if ($request->format == 'json') {
         $user = Sp_Account_User::current();
         $userid = $user->id;
         $row = Sp_Account_User::getUser($userid);
         $old = $request->old;
         $password = $request->password;
         $confirming = $request->confirming;
         $patternPasswd = Sp_Dictionary::getOtherOption('patternPasswd');
         if (false == preg_match($patternPasswd, $old)) {
             return array('status' => '-122', 'msg' => '密码格式不正确');
         }
         if (false == preg_match($patternPasswd, $confirming)) {
             return array('status' => '-122', 'msg' => '密码格式不正确');
         }
         if (false == preg_match($patternPasswd, $password)) {
             return array('status' => '-122', 'msg' => '密码格式不正确');
         }
         // 旧密码
         if (!$this->checkOldPassword($old, $row)) {
             return array('status' => '-1', 'msg' => '旧密码不正确');
         }
         if ($password != $confirming) {
             return array('status' => '-2', 'msg' => '两次密码不一致');
         }
         $newpwd = Sp_Account_User::encrypt($password, $row['kid']);
         Sp_Account_Info::updatePassword($userid, $newpwd);
         return array('status' => '0', 'msg' => '密码修改成功');
     }
 }
 public function execute($request)
 {
     global $priv;
     $user = Sp_Account_User::current();
     $user = Sp_Account_User::getUser($user->id, array('name', 'face', 'gender', 'province', 'city', 'area'));
     $uploadInfo = Util_FileUpload::getUpfileKey('huitong');
     $view = new Sp_View();
     $view->assign('user', $user);
     $view->assign('action', $priv);
     $view->assign('uploadInfo', $uploadInfo);
     $view->display("account/password.html");
 }
 public function execute($request)
 {
     $user = Sp_Account_User::current();
     if ($user->isLogin() === FALSE) {
         //未登录跳转
         echo 'document.write(\'<div class="menu"><a href="javascript:void(0);"  ms-click="showlogin" class="ht-btn-blue">登录</a><a href="javascript:void(0);"  ms-click="showreg" class="ht-btn-gray">注册</a></div>\')';
     } else {
         $userInfo = Sp_Account_User::getUser($user->id, array('face'));
         $pic = empty($userInfo['face']) ? SP_URL_IMG . 'dzx.jpg' : SP_URL_UPLOAD . $userInfo['face'];
         $html = '<div class="ht-user">' . '<a href="javascript:void(0);" class="ht-user-navlink show">' . '<img src="' . $pic . '" /></a>' . '<div class="ht-user-dropdown">' . '<a href="/active/index.html" class="line">' . '<i class="ht-topNav-icon01"></i>' . '<span>我的活动</span></a>' . '<a href="/account/index.html" >' . '<i class="ht-topNav-icon02"></i><span>我的信息</span></a>' . '<a href="/account/password.html" class="line">' . '<i class="ht-topNav-icon03"></i>' . '<span>修改密码</span></a>' . '<a href="/user/signout.html" >' . '<i class="ht-topNav-icon05"></i>' . '<span>退出</span></a></div></div>';
         echo 'document.write(\'' . $html . '\')';
     }
 }
 public function execute($request)
 {
     global $priv;
     $user = Sp_Account_User::current();
     $uploadInfo = Util_FileUpload::getUpfileKey('huitong');
     $province = Sp_City_City::getProvince();
     $view = new Sp_View();
     $userInfo = Sp_Account_User::getUser($user->id, array('name', 'face', 'gender', 'province', 'city', 'area', 'mobile_status', 'email_status'));
     $auth = array('mobile_status' => $userInfo['mobile_status'], 'email_status' => $userInfo['email_status']);
     $view->assign('province', $province);
     $view->assign('action', $priv);
     $view->assign('auth', $auth);
     if (!empty($userInfo['province'])) {
         $city = Sp_City_City::getChlidById($userInfo['province']);
         $view->assign('city', $city);
     }
     if (!empty($userInfo['city'])) {
         $arrea = Sp_City_City::getChlidById($userInfo['city']);
         $view->assign('arrea', $arrea);
     }
     $view->assign('uploadInfo', $uploadInfo);
     $view->display("account/index.html");
 }
 /**
  * 继承Smarty并设置项目的属性
  */
 function __construct($charset = 'UTF-8', $cur_skin = 'default')
 {
     //Class Constructor. These automatically get set with each new instance.
     method_exists('Smarty', 'Smarty') && $this->Smarty() || parent::__construct();
     if (isset($cur_skin) && !empty($cur_skin)) {
         $this->_cur_skin = $cur_skin;
     } else {
         if (defined('VIEW_SKIN_CURRENT')) {
             $this->_cur_skin = VIEW_SKIN_CURRENT;
         } else {
             $this->_cur_skin = $this->_dft_skin;
         }
     }
     if (defined('VIEW_SKINS_ROOT')) {
         $this->_parent_dir = VIEW_SKINS_ROOT;
     } else {
         die("please set template skin dir first! ");
     }
     $this->template_dir = VIEW_SKINS_ROOT . $this->_cur_skin . '/';
     //echo $this->template_dir;
     //$this->use_sub_dirs = true;
     $this->compile_id = (isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : 'local') . '_' . $this->_cur_skin;
     $this->compile_dir = VIEW_COMPILE_DIR;
     $this->config_dir = VIEW_CONFIG_DIR;
     $this->plugins_dir = array(LIB_ROOT . 'function/smarty/plugins', SMARTY_DIR . '/plugins');
     // Smarty 的模板缓存,奇怪的设计,慎用
     //$this->cache_dir = VIEW_CACHE_DIR;
     //$this->cache_lifetime = defined('VIEW_CACHE_LIFETIME') ? VIEW_CACHE_LIFETIME : 1440;
     //$this->clear_all_cache();
     //$this->caching = defined('VIEW_CACHE_ENABLE') ? VIEW_CACHE_ENABLE : true;
     //$this->security = true;
     $this->use_sub_dirs = TRUE;
     //开启缓存目录分级
     $this->left_delimiter = '{%';
     $this->right_delimiter = '%}';
     $this->_charset = $charset;
     new Sp_View_Helper($this);
     $this->assign_by_ref('head_title', $this->_head_title);
     $this->assign_by_ref('head_keywords', $this->_head_keywords);
     $this->assign_by_ref('head_description', $this->_head_description);
     $this->assign_by_ref('head_links', $this->_head_links);
     $this->assign_by_ref('head_styles', $this->_head_styles);
     $this->assign_by_ref('head_scripts', $this->_head_scripts);
     $this->assign_by_ref('foot_scripts', $this->_foot_scripts);
     $this->assign_by_ref('charset', $this->_charset);
     defined('SP_URL_API') && $this->assign('SP_URL_API', SP_URL_API);
     //API  kong 增加
     defined('SP_URL_HOME') && $this->assign('SP_URL_HOME', SP_URL_HOME);
     defined('SP_URL_CSS') && $this->assign('SP_URL_CSS', SP_URL_CSS);
     defined('SP_URL_IMG') && $this->assign('SP_URL_IMG', SP_URL_IMG);
     defined('SP_URL_JS') && $this->assign('SP_URL_JS', SP_URL_JS);
     defined('SP_URL_STO') && $this->assign('SP_URL_STO', SP_URL_STO);
     defined('SP_URL_CS') && $this->assign('SP_URL_CS', SP_URL_CS);
     defined('SP_URL_UPLOAD') && $this->assign('SP_URL_UPLOAD', SP_URL_UPLOAD);
     defined('SP_URL_FILE') && $this->assign('SP_URL_FILE', SP_URL_FILE);
     defined('SP_DOMAIN_SUFFIX') && $this->assign('SP_DOMAIN_SUFFIX', SP_DOMAIN_SUFFIX);
     defined('DATA_TYPE') && $this->assign('DATA_TYPE', DATA_TYPE);
     $this->assign('COOKIE_DOMAIN', Request::genCookieDomain());
     // current request
     $this->_request = Request::current();
     $this->assign_by_ref('_request', $this->_request);
     is_null($this->_parent_dir) && ($this->_parent_dir = CONF_ROOT . 'templates/');
     if (is_dir($this->_parent_dir)) {
         $this->assign('parent_dir', $this->_parent_dir);
     } else {
         $this->assign('parent_dir', '');
     }
     $user = Sp_Account_User::current();
     if ($user->isLogin()) {
         $user = Sp_Account_User::getUser($user->id, array('name', 'face', 'gender', 'province', 'city', 'area', 'mobile_status', 'email_status'));
         $this->assign('user', $user);
     }
     $this->assign('SP_COMPANY', SP_COMPANY);
     //公司名称
     $this->assign('SP_INVEST_COMPANY', SP_INVEST_COMPANY);
     //网站名称
     $this->default_template_handler_func = array($this, 'make_template');
 }