Example #1
0
 /**
  * 检验验证码
  * @param unknown $sMobile
  * @param unknown $iType
  * @param unknown $sCode
  */
 public static function checkSMSCode($sMobile, $iType, $sCode)
 {
     $sKey = self::getSmsKey($iType);
     $sSaveCode = Util_Cookie::get($sKey);
     Util_Cookie::delete($sKey);
     return strtoupper($sCode) == strtoupper($sSaveCode);
 }
Example #2
0
 /**
  * 代理修改
  */
 public function editAction()
 {
     if ($this->_request->isPost()) {
         //修改密码验证
         $aCookie = Util_Cookie::get(Yaf_G::getConf('authkey', 'cookie'));
         $iAdminID = $aCookie['iAdminID'];
         $aUser = Model_Admin::getDetail($iAdminID);
         $pwd = $this->getParam('pwd');
         if (!isset($pwd) || $pwd == '') {
             return $this->showMsg('修改密码不可以为空', false);
         }
         if ($aUser['sEditPassword'] != md5($pwd)) {
             return $this->showMsg('修改密码不正确', false);
         }
         $aProxy = $this->_checkData('update');
         if (empty($aProxy)) {
             return null;
         }
         $aProxy['iProxyID'] = intval($this->getParam('iProxyID'));
         $aOldProxy = Model_CrawlProxy::getDetail($aProxy['iProxyID']);
         if (!$aOldProxy) {
             return $this->showMsg('代理信息更新失败!', false);
         }
         if (1 == Model_CrawlProxy::updData($aProxy)) {
             return $this->showMsg('代理信息更新成功!', true);
         } else {
             return $this->showMsg('代理信息更新失败!', false);
         }
     } else {
         $iProxyID = intval($this->getParam('id'));
         $aProxy = Model_CrawlProxy::getDetail($iProxyID);
         $this->assign('aProxy', $aProxy);
     }
 }
Example #3
0
File: Role.php Project: pancke/yyaf
 /**
  * 编辑角色
  * @return NULL|boolean
  */
 public function editAction()
 {
     if ($this->isPost()) {
         //修改密码验证
         $aCookie = Util_Cookie::get(Yaf_G::getConf('authkey', 'cookie'));
         $iAdminID = $aCookie['iAdminID'];
         $aUser = Model_Admin::getDetail($iAdminID);
         $pwd = $this->getParam('pwd');
         if (!isset($pwd) || $pwd == '') {
             return $this->showMsg('修改密码不可以为空', false);
         }
         if ($aUser['sEditPassword'] != md5($pwd)) {
             return $this->showMsg('修改密码不正确', false);
         }
         $aRole = $this->_checkData('update');
         if (empty($aRole)) {
             return null;
         }
         $aRole['iRoleID'] = intval($this->getParam('iRoleID'));
         if (1 == Model_Role::updData($aRole)) {
             return $this->showMsg('角色信息更新成功!', true);
         } else {
             return $this->showMsg('角色信息更新失败!', false);
         }
     } else {
         $iRoleID = intval($this->getParam('id'));
         $aRole = Model_Role::getDetail($iRoleID);
         $aRole['aPermission'] = explode(',', $aRole['sPermission']);
         $aRole['aModule'] = explode(',', $aRole['sModule']);
         $this->assign('aRole', $aRole);
         $this->assign('aPermissionList', Model_Permission::getAllPermissions());
         $this->assign('aMenuList', Model_Menu::getMenus());
     }
 }
Example #4
0
 /**
  * 编辑权限点
  * 
  * @return boolean
  */
 public function editAction()
 {
     if ($this->isPost()) {
         //修改密码验证
         $aCookie = Util_Cookie::get(Yaf_G::getConf('authkey', 'cookie'));
         $iAdminID = $aCookie['iAdminID'];
         $aUser = Model_Admin::getDetail($iAdminID);
         $pwd = $this->getParam('pwd');
         if (!isset($pwd) || $pwd == '') {
             return $this->showMsg('修改密码不可以为空', false);
         }
         if ($aUser['sEditPassword'] != md5($pwd)) {
             return $this->showMsg('修改密码不正确', false);
         }
         $aPermission = $this->_checkData();
         if (empty($aPermission)) {
             return null;
         }
         $aPermission['iPermissionID'] = intval($this->getParam('iPermissionID'));
         if (1 == Model_Permission::updData($aPermission)) {
             return $this->showMsg('权限点信息更新成功!', true);
         } else {
             return $this->showMsg('权限点信息更新失败!', false);
         }
     } else {
         $iPermissionID = intval($this->getParam('id'));
         $aPermission = Model_Permission::getDetail($iPermissionID);
         $this->assign('aPermission', $aPermission);
         $this->assign('aMenuTree', Model_Menu::getMenus());
     }
 }
Example #5
0
File: City.php Project: pancke/yyaf
 /**
  * 增加城市
  */
 public function addAction()
 {
     if ($this->_request->isPost()) {
         //修改密码验证
         $aCookie = Util_Cookie::get(Yaf_G::getConf('authkey', 'cookie'));
         $iAdminID = $aCookie['iAdminID'];
         $aUser = Model_Admin::getDetail($iAdminID);
         $pwd = $this->getParam('pwd');
         if (!isset($pwd) || $pwd == '') {
             return $this->showMsg('修改密码不可以为空', false);
         }
         if ($aUser['sEditPassword'] != md5($pwd)) {
             return $this->showMsg('修改密码不正确', false);
         }
         $aCity = $this->_checkData('add');
         if (empty($aCity)) {
             return null;
         }
         if (Model_City::getCityByName($aCity['sCityName'])) {
             return $this->showMsg('城市已经存在!', false);
         }
         if (Model_City::addData($aCity) > 0) {
             return $this->showMsg('城市增加成功!', true);
         } else {
             return $this->showMsg('城市增加失败!', false);
         }
     }
 }
Example #6
0
File: User.php Project: pancke/yyaf
 /**
  * 登录
  * @param unknown $aUser
  */
 public static function login($aUser)
 {
     $aCookie = array('iUserID' => $aUser['iUserID'], 'sEmail' => $aUser['sEmail'], 'sMobile' => $aUser['sMobile'], 'iType' => $aUser['iType'], 'sRealName' => $aUser['sRealName']);
     $sKey = Model_User::getUserType($aUser['iType']);
     $expire = Yaf_G::getConf('frontexpire', 'cookie');
     Util_Cookie::set(Yaf_G::getConf($sKey, 'cookie'), $aCookie, $expire);
     $sKey = Model_User::getUserType($aUser['iType'] == Model_User::TYPE_AD ? Model_User::TYPE_MEDIA : Model_User::TYPE_AD);
     Util_Cookie::delete(Yaf_G::getConf($sKey, 'cookie'));
     return $aCookie;
 }
Example #7
0
File: Menu.php Project: pancke/yyaf
 public static function getTree($iAdminID = 0)
 {
     $aWhere = array('iStatus' => 1);
     $aList = self::getAll(array('where' => $aWhere, 'order' => 'iMenuID ASC'));
     // 权限判断
     if ($iAdminID > 0) {
         $aMenuPermission = Model_Permission::getMenuPermissions($iAdminID);
     }
     // 是否查找当前菜单
     $bFind = 0;
     if ($iAdminID > 0) {
         $sUri = Yaf_G::getUrl();
     } else {
         $sUri = null;
     }
     // 排序及整理
     $aParentID = array();
     $aOrder = array();
     $aData = array();
     foreach ($aList as $aMenu) {
         if ($iAdminID > 0) {
             if ($aMenuPermission != -1 && !isset($aMenuPermission[$aMenu['iMenuID']])) {
                 continue;
             }
             $aMenu['iCurr'] = Yaf_G::getUrl($aMenu['sUrl']) == $sUri ? 1 : 0;
             if (!$bFind && $aMenu['iCurr'] == 1) {
                 $bFind = 1;
             }
         }
         $aParentID[] = $aMenu['iParentID'];
         $aOrder[] = $aMenu['iOrder'];
         unset($aMenu['iOrder'], $aMenu['iStatus'], $aMenu['iCreateTime'], $aMenu['iUpdateTime']);
         $aData[] = $aMenu;
     }
     unset($aList);
     array_multisort($aParentID, SORT_NUMERIC, SORT_ASC, $aOrder, SORT_NUMERIC, SORT_ASC, $aData);
     // 如果没有匹配的菜单,则从Cookie中获取
     if ($iAdminID > 0) {
         if (!$bFind) {
             $sUri = Util_Cookie::get('menu');
         } else {
             Util_Cookie::set('menu', $sUri);
         }
     }
     // 整理父节点
     $aParent = [];
     foreach ($aData as $aMenu) {
         if (!$bFind) {
             $aMenu['iCurr'] = Yaf_G::getUrl($aMenu['sUrl']) == $sUri ? 1 : 0;
         }
         $aParent[$aMenu['iParentID']][] = $aMenu;
     }
     unset($aMenu);
     return self::_buildTree($aParent, 0, 0, '');
 }
Example #8
0
File: Base.php Project: pancke/yyaf
 /**
  * 执行Action前执行
  *
  * @see Yaf_Controller::actionBefore()
  */
 public function actionBefore()
 {
     Model_ActionLog::setType(Model_ActionLog::TYPE_FRONT);
     $this->_frame = 'frame.phtml';
     // 访问者的GUID
     $this->sVistorGuid = Util_Cookie::get('guid');
     if (empty($this->sVistorGuid)) {
         $this->sVistorGuid = Util_Guid::get('-');
         Util_Cookie::set('guid', $this->sVistorGuid, 86400 * 365);
     }
     $this->assign('sStaticRoot', 'http://' . Yaf_G::getConf('static', 'domain'));
 }
Example #9
0
File: Base.php Project: pancke/yyaf
  * 当前用户
  * 
  * @var unknown
  */
 protected $aCurrUser = null;
 /**
  * 当前城市
  * 
  * @var unknown
  */
 protected $iCurrCityID = null;
 protected $aCurrCity = null;
 /**
  * 执行Action前执行
  * 
  * @see Yaf_Controller::actionBefore()
  */
 public function actionBefore()
 {
     $this->_frame = 'admin.phtml';
Example #10
0
 /**
  * 更换城市
  */
 public function changeAction()
 {
     // 当前用户
     $aCookie = Util_Cookie::get(Yaf_G::getConf('authkey', 'cookie'));
     if (empty($aCookie)) {
         return $this->redirect('/admin/login');
     }
     $this->aCurrUser = $aCookie;
     $iCityID = $this->getParam('id');
     $aCity = Model_City::getDetail($iCityID);
     if (empty($aCity) || $aCity['iBackendShow'] == 0 || $aCity['iStatus'] == 0) {
         return $this->showMsg('城市不存在或未开放!', false);
     }
     $aUser = Model_Admin::getDetail($this->aCurrUser['iAdminID']);
     $aCityID = explode(',', $aUser['sCityID']);
     if ($aUser['sCityID'] != '-1' && !in_array($iCityID, $aCityID)) {
         return $this->showMsg('您没有访问该城市的权限,请联系管理员!', false);
     }
     Util_Cookie::set('city', $iCityID);
     return $this->showMsg('城市切换成功!', true);
 }
Example #11
0
 /**
  * 基础配置修改
  */
 public function editAction()
 {
     if ($this->_request->isPost()) {
         //修改密码验证
         $aCookie = Util_Cookie::get(Yaf_G::getConf('authkey', 'cookie'));
         $iAdminID = $aCookie['iAdminID'];
         $aUser = Model_Admin::getDetail($iAdminID);
         $pwd = $this->getParam('pwd');
         if (!isset($pwd) || $pwd == '') {
             return $this->showMsg('修改密码不可以为空', false);
         }
         if ($aUser['sEditPassword'] != md5($pwd)) {
             return $this->showMsg('修改密码不正确', false);
         }
         $aDomain = $this->_checkData('update');
         if (empty($aDomain)) {
             return null;
         }
         $aDomain['iAutoID'] = intval($this->getParam('iAutoID'));
         $aOldDomain = Model_Domain::getDetail($aDomain['iAutoID']);
         if (empty($aOldDomain)) {
             return $this->showMsg('基础配置不存在!', false);
         }
         if ($aOldDomain['sName'] != $aDomain['sName']) {
             if (Model_Domain::getRow(array('where' => array('sName' => $aDomain['sName'], 'iType' => $aDomain['iType'], 'iStatus' => 1)))) {
                 return $this->showMsg('基础配置已经存在!', false);
             }
         }
         if (1 == Model_Domain::updData($aDomain)) {
             return $this->showMsg('基础配置信息更新成功!', true);
         } else {
             return $this->showMsg('基础配置信息更新失败!', false);
         }
     } else {
         $iAutoID = intval($this->getParam('id'));
         $aDomain = Model_Domain::getDetail($iAutoID);
         $this->assign('aDomain', $aDomain);
     }
     $this->assign('iType', Model_Domain::$iType);
 }
Example #12
0
File: Menu.php Project: pancke/yyaf
 /**
  * 编辑菜单
  */
 public function editAction()
 {
     if ($this->isPost()) {
         //修改密码验证
         $aCookie = Util_Cookie::get(Yaf_G::getConf('authkey', 'cookie'));
         $iAdminID = $aCookie['iAdminID'];
         $aUser = Model_Admin::getDetail($iAdminID);
         $pwd = $this->getParam('pwd');
         if (!isset($pwd) || $pwd == '') {
             return $this->showMsg('修改密码不可以为空', false);
         }
         if ($aUser['sEditPassword'] != md5($pwd)) {
             return $this->showMsg('修改密码不正确', false);
         }
         $aMenu = $this->_checkData('update');
         if (empty($aMenu)) {
             return null;
         }
         $aMenu['iMenuID'] = intval($this->getParam('iMenuID'));
         $aOldMenu = Model_Menu::getDetail($aMenu['iMenuID']);
         if (empty($aOldMenu)) {
             return $this->showMsg('菜单不存在!', false);
         }
         //更新排序,加在最后面
         if ($aOldMenu['iParentID'] != $aMenu['iParentID']) {
             $aMenu['iOrder'] = Model_Menu::getNextOrder($aMenu['iParentID']);
         }
         if (1 == Model_Menu::updData($aMenu)) {
             return $this->showMsg('菜单信息更新成功!', true);
         } else {
             return $this->showMsg('菜单信息更新失败!', false);
         }
     } else {
         $iMenuID = intval($this->getParam('id'));
         $aMenu = Model_Menu::getDetail($iMenuID);
         $aTree = Model_Menu::getMenus();
         $this->assign('aTree', $aTree);
         $this->assign('aMenu', $aMenu);
     }
 }
Example #13
0
 /**
  * 敏感词修改
  */
 public function editAction()
 {
     if ($this->_request->isPost()) {
         //修改密码验证
         $aCookie = Util_Cookie::get(Yaf_G::getConf('authkey', 'cookie'));
         $iAdminID = $aCookie['iAdminID'];
         $aUser = Model_Admin::getDetail($iAdminID);
         $pwd = $this->getParam('pwd');
         if (!isset($pwd) || $pwd == '') {
             return $this->showMsg('修改密码不可以为空', false);
         }
         if ($aUser['sEditPassword'] != md5($pwd)) {
             return $this->showMsg('修改密码不正确', false);
         }
         $aBadword = $this->_checkData('update');
         if (empty($aBadword)) {
             return null;
         }
         $aBadword['iAutoID'] = intval($this->getParam('iAutoID'));
         $aOldBadword = Model_Badword::getDetail($aBadword['iAutoID']);
         if (empty($aOldBadword)) {
             return $this->showMsg('敏感词不存在!', false);
         }
         if ($aOldBadword['sWord'] != $aBadword['sWord']) {
             if (Model_Badword::getBadwordByWord($aBadword['sWord'])) {
                 return $this->showMsg('敏感词已经存在!', false);
             }
         }
         if (1 == Model_Badword::updData($aBadword)) {
             return $this->showMsg('敏感词信息更新成功!', true);
         } else {
             return $this->showMsg('敏感词信息更新失败!', false);
         }
     } else {
         $iBadwordID = intval($this->getParam('id'));
         $aBadword = Model_Badword::getDetail($iBadwordID);
         $this->assign('aBadword', $aBadword);
     }
 }
Example #14
0
 /**
  * 添加自媒体
  */
 public function addAction()
 {
     if ($this->isPost()) {
         $aUser = $this->getCurrUser(Model_User::TYPE_MEDIA);
         if (empty($aUser)) {
             return $this->showMsg('请先登录!', false);
         }
         $iMediaID = (int) $this->getParam('iMediaID');
         $aMedia = null;
         if ($iMediaID > 0) {
             $aMedia = Model_Media::getDetail($iMediaID);
             if ($aMedia['iUserID'] != $aUser['iUserID']) {
                 return $this->showMsg('不要乱改别人的数据', false);
             }
         }
         $aData = array();
         $aData['iUserID'] = $aUser['iUserID'];
         $aData['iMediaType'] = (int) $this->getParam('iMediaType');
         $aData['sMediaName'] = $this->getParam('sMediaName');
         $aData['sOpenName'] = $this->getParam('sOpenName');
         $aData['iFollowerNum'] = (int) $this->getParam('iFollowerNum');
         $aData['sFollowerImg'] = $this->getParam('sFollowerImg');
         $aData['sAvatar'] = $this->getParam('sAvatar');
         $aData['sQRCode'] = $this->getParam('sQRCode');
         $aErr = array();
         switch ($aData['iMediaType']) {
             case Model_Media::TYPE_WEIXIN:
                 if ($aData['iFollowerNum'] == 0) {
                     $aErr['iFollowerNum'] = '请输入丝粉数量';
                 }
                 if (!Util_Validate::isLength($aData['sMediaName'], 2, 50)) {
                     $aErr['sMediaName'] = '请输入微信名称';
                 }
                 if (!preg_match('/[a-z][0-9a-z_\\-]{5,19}/i', $aData['sOpenName'])) {
                     $aErr['sOpenName'] = '请输入正确的微信帐号';
                 }
                 if (empty($aData['sFollowerImg'])) {
                     $aErr['sFollowerImg'] = '请上传粉丝数截图';
                 }
                 if (empty($aData['sAvatar'])) {
                     $aErr['sAvatar'] = '请上传微信头像';
                 }
                 if (empty($aData['sQRCode'])) {
                     $aErr['sQRCode'] = '请上传二维码';
                 }
                 $aOtherMedia = Model_Media::getMediaByOpenName($aData['iMediaType'], $aData['sOpenName'], $iMediaID);
                 if (!empty($aOtherMedia)) {
                     $aErr['sOpenName'] = '该自媒体已经存在!';
                 }
                 break;
             case Model_Media::TYPE_FRIEND:
                 if (empty($aData['sMediaName'])) {
                     $aErr['sMediaName'] = '请输入账号名称';
                 }
                 if ($aData['iFollowerNum'] == 0) {
                     $aErr['iFollowerNum'] = '请输入好友数量';
                 }
                 if (empty($aData['sFollowerImg'])) {
                     $aErr['sFollowerImg'] = '请上传好友数截图';
                 }
                 if (empty($aData['sAvatar'])) {
                     $aErr['sAvatar'] = '请上传你微信头像';
                 }
                 // 判断该自媒是否已经存在
                 $aOtherMedia = Model_Media::getMediaByName($aData['iMediaType'], $aData['sMediaName'], $iMediaID);
                 if (!empty($aOtherMedia)) {
                     $aErr['sMediaName'] = '该微信帐号已经存在!';
                 }
                 break;
             case Model_Media::TYPE_WEIBO:
                 if (empty($aData['sMediaName'])) {
                     $aErr['sMediaName'] = '请输入账号名称';
                 }
                 if ($aData['iFollowerNum'] == 0) {
                     $aErr['iFollowerNum'] = '请输入好友数量';
                 }
                 if (empty($aData['sFollowerImg'])) {
                     $aErr['sFollowerImg'] = '请上传好友数截图';
                 }
                 if (empty($aData['sAvatar'])) {
                     $aErr['sAvatar'] = '请上传你微博头像';
                 }
                 $aData['sUrl'] = $this->getParam('sUrl');
                 if (!Util_Validate::isAbsoluteUrl($aData['sUrl'])) {
                     $aErr['sUrl'] = '请输入正确的微博地址';
                 }
                 // 判断该自媒是否已经存在
                 $aOtherMedia = Model_Media::getMediaByName($aData['iMediaType'], $aData['sMediaName'], $iMediaID);
                 if (!empty($aOtherMedia)) {
                     $aErr['sMediaName'] = '该微博帐号已经存在!';
                 }
                 break;
         }
         $aCatID = $this->getParam('aCatID');
         $aCityID = $this->getParam('aCityID');
         $aTagID = $this->getParam('aTagID');
         //             if (empty($aCatID)) {
         //                 $aErr['aCatID'] = '请选择媒体类别';
         //             }
         //             if (! empty($aCatID) && count($aCatID) > 3) {
         //                 $aErr['aCatID'] = '最多选择3个媒体类别';
         //             }
         if (empty($aTagID)) {
             $aErr['aTagID'] = '请选择媒体标签';
         }
         if (!empty($aTagID) && count($aTagID) > 6) {
             $aErr['aTagID'] = '最多选择6个媒体标签';
         }
         if (empty($aCityID)) {
             $aErr['aCityID'] = '请选择城市/地区';
         }
         if (!empty($aCityID) && count($aCityID) > 3) {
             $aErr['aCityID'] = '最多选择3个城市/地区';
         }
         if (!empty($aErr)) {
             return $this->showMsg($aErr, false);
         }
         if (empty($aMedia)) {
             $aData['iStatus'] = 3;
             $aData['sVerifyCode'] = strtoupper(Util_Tools::passwdGen(32));
             $iMediaID = Model_Media::addData($aData);
         } else {
             $aData['iStatus'] = 2;
             $aData['iMediaID'] = $aMedia['iMediaID'];
             Model_Media::updData($aData);
         }
         Model_User::updData(array('iUserID' => $this->aCurrUser['iUserID'], 'iFirst' => 'iFirst + 1'));
         if ($iMediaID > 0) {
             //Model_Media::updCategory($iMediaID, $aCatID);
             Model_Media::updCity($iMediaID, $aCityID);
             Model_Media::updTag($iMediaID, $aTagID);
             return $this->showMsg($iMediaID, true);
         } else {
             $aErr['sMediaName'] = '添加失败,请稍后再试';
             return $this->showMsg($aErr, false);
         }
     } else {
         $aUser = $this->getCurrUser(Model_User::TYPE_MEDIA);
         if (empty($aUser)) {
             return $this->redirect('/user/login/type/' . Model_User::TYPE_MEDIA . '.html?ret=' . Util_Uri::getCurrUrl());
         }
         $iMediaID = intval($this->getParam('id'));
         $aMedia = null;
         if ($iMediaID > 0) {
             $aMedia = Model_Media::getFullDetail($iMediaID);
         }
         if (empty($aMedia)) {
             $iType = intval($this->getParam('type', Model_Media::TYPE_WEIXIN));
         } else {
             $iType = $aMedia['iMediaType'];
         }
         $aData = array();
         switch ($iType) {
             case Model_Media::TYPE_WEIXIN:
                 $aData['aCategory'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_WEIXIN_CATEGORY);
                 $aData['aTag'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_WEIXIN_TAG);
                 break;
             case Model_Media::TYPE_FRIEND:
                 $aData['aCategory'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_FRIEND_CATEGORY);
                 $aData['aTag'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_FRIEND_TAG);
                 break;
             case Model_Media::TYPE_WEIBO:
                 $aData['aCategory'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_WEIBO_CATEGORY);
                 $aData['aTag'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_WEIBO_TAG);
                 break;
             case Model_Media::TYPE_NEWS:
                 $aData['aCategory'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_NEWS_CATEGORY);
                 $aData['aTag'] = Model_Domain::getOption(Model_Domain::TYPE_MEDIA_NEWS_TAG);
                 break;
         }
         $aData['aCity'] = Model_City::getPairCitys(Model_City::TYPE_FRONT);
         // array_unshift($aData['aCategory'], '不限');
         // array_unshift($aData['aCity'], '不限');
         // array_unshift($aData['aTag'], '不限');
         $aType = Model_Media::$aType;
         unset($aType[Model_Media::TYPE_NEWS]);
         $this->assign('iType', $iType);
         $this->assign('aType', $aType);
         $this->assign('aData', $aData);
         $this->assign('aMedia', $aMedia);
         $this->assign('aUser', Model_User::getDetail($this->aCurrUser['iUserID']));
         $this->assign('sTopMenu', 'madd');
         $sRandCode = Util_Tools::passwdGen(8, Util_Tools::FLAG_ALPHANUMERIC);
         Util_Cookie::set('media_verify_code', $sRandCode);
         $this->assign('sRandCode', $sRandCode);
         $this->setMeta('media_add', array('sTitle' => '添加媒体'));
     }
 }
 public static function getID()
 {
     return Util_Cookie::get('changeDay', true);
 }
Example #16
0
 public function logoutAction()
 {
     Util_Cookie::delete(Yaf_G::getConf('authkey', 'cookie'));
     $this->redirect('/login');
 }
Example #17
0
 /**
  * 更换自媒体
  */
 public function changeAction()
 {
     $iCityID = $this->getParam('id');
     $aCity = Model_Media::getDetail($iCityID);
     if (empty($aCity) || $aCity['iBackendShow'] == 0 || $aCity['iStatus'] == 0) {
         return $this->showMsg('自媒体不存在或未开放!', false);
     }
     $aUser = Model_Admin::getDetail($this->aCurrUser['iAdminID']);
     $aCityID = explode(',', $aUser['sCityID']);
     if ($aUser['sCityID'] != '-1' && !in_array($iCityID, $aCityID)) {
         return $this->showMsg('您没有访问该自媒体的权限,请联系管理员!', false);
     }
     Util_Cookie::set('city', $iCityID);
     return $this->showMsg('自媒体切换成功!', true);
 }
Example #18
0
File: User.php Project: pancke/yyaf
 /**
  * 用户修改
  */
 public function editAction()
 {
     if ($this->_request->isPost()) {
         //修改密码验证
         $aCookie = Util_Cookie::get(Yaf_G::getConf('authkey', 'cookie'));
         $iAdminID = $aCookie['iAdminID'];
         $aUser = Model_Admin::getDetail($iAdminID);
         $pwd = $this->getParam('pwd');
         if (!isset($pwd) || $pwd == '') {
             return $this->showMsg('修改密码不可以为空', false);
         }
         if ($aUser['sEditPassword'] != md5($pwd)) {
             return $this->showMsg('修改密码不正确', false);
         }
         $aUser = $this->_checkData('update');
         if (empty($aUser)) {
             return null;
         }
         $aUser['iAdminID'] = intval($this->getParam('iAdminID'));
         $aOldUser = Model_Admin::getDetail($aUser['iAdminID']);
         if (empty($aOldUser)) {
             return $this->showMsg('用户不存在!', false);
         }
         if ($aOldUser['sAdminName'] != $aUser['sAdminName']) {
             if (Model_Admin::getAdminByName($aUser['sAdminName'])) {
                 return $this->showMsg('用户已经存在!', false);
             }
         }
         if (1 == Model_Admin::updData($aUser)) {
             return $this->showMsg('用户信息更新成功!', true);
         } else {
             return $this->showMsg('用户信息更新失败!', false);
         }
     } else {
         $iAdminID = intval($this->getParam('id'));
         $aUser = Model_Admin::getDetail($iAdminID);
         $aUser['aCityID'] = explode(',', $aUser['sCityID']);
         $aUser['aRoleID'] = explode(',', $aUser['sRoleID']);
         $this->assign('aUser', $aUser);
         $this->assign('aCity', Model_City::getPairCitys());
         $this->assign('aRole', Model_Role::getPairRoles());
     }
 }
Example #19
0
 /**
  * 财务修改
  */
 public function editAction()
 {
     if ($this->_request->isPost()) {
         //修改密码验证
         $aCookie = Util_Cookie::get(Yaf_G::getConf('authkey', 'cookie'));
         $iAdminID = $aCookie['iAdminID'];
         $aUser = Model_Admin::getDetail($iAdminID);
         $pwd = $this->getParam('pwd');
         if (!isset($pwd) || $pwd == '') {
             return $this->showMsg('修改密码不可以为空', false);
         }
         if ($aUser['sEditPassword'] != md5($pwd)) {
             return $this->showMsg('修改密码不正确', false);
         }
         $aFinance = $this->_checkData('update');
         if (empty($aFinance)) {
             return null;
         }
         $aFinance['iAutoID'] = intval($this->getParam('iAutoID'));
         $aOldFinance = Model_Finance::getDetail($aFinance['iAutoID']);
         if (empty($aOldFinance)) {
             return $this->showMsg('财务不存在!', false);
         }
         if (1 == Model_Finance::updData($aFinance)) {
             if ($aOldFinance['iPayStatus'] == 0 && $aFinance['iPayStatus'] == 1) {
                 // 邮件通知
                 $sTitle = Model_Kv::getValue('finance_forget_email_title');
                 $sContent = Model_Kv::getValue('finance_forget_email_content');
                 $aUser = Model_Finance::getDetail($aFinance['iAutoID']);
                 $time = date('Y-m-d H:i:s', $aUser['iUpdateTime']);
                 $email = Model_User::getDetail($aUser['iUserID']);
                 // 短信通知
                 //					$iTempID = Util_Common::getConf(1, 'aSmsTempID');
                 Util_Mail::send($email['sEmail'], $sTitle, $sContent, array($email['sEmail'], $time, $aUser['iPayMoney']));
                 //					Util_Sms::sendTemplateSms($email['sMobile'], array(
                 //						$aUser['sMediaName']
                 //					), $iTempID);
             }
             return $this->showMsg('财务更新成功!', true);
         } else {
             return $this->showMsg('财务更新失败!', false);
         }
     } else {
         $iFinanceID = intval($this->getParam('id'));
         $aFinance = Model_Finance::getDetail($iFinanceID);
         $aUser = Model_User::getDetail($aFinance['iUserID']);
         $this->assign('aUser', $aUser);
         $this->assign('aFinance', $aFinance);
     }
 }
Example #20
0
File: User.php Project: pancke/yyaf
 /**
  * 用户退出
  */
 public function logoutAction()
 {
     $iType = $this->getParam('type');
     $sKey = Model_User::getUserType($iType);
     Util_Cookie::delete(Yaf_G::getConf($sKey, 'cookie'));
     if ($this->isPost()) {
         return $this->showMsg('登出成功!', true);
     } else {
         return $this->redirect('/');
     }
 }