예제 #1
0
파일: Permission.php 프로젝트: pancke/yyaf
 /**
  * 编辑权限点
  * 
  * @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());
     }
 }
예제 #2
0
파일: City.php 프로젝트: 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);
         }
     }
 }
예제 #3
0
파일: Crawlproxy.php 프로젝트: 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);
         }
         $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);
     }
 }
예제 #4
0
파일: Role.php 프로젝트: 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());
     }
 }
예제 #5
0
파일: Ueditor.php 프로젝트: pancke/yyaf
 /**
  * 上传视频
  *
  * @param
  *            $aConfig
  * @return array
  */
 public function uploadimg($aConfig)
 {
     $aReturn = array('state' => 'SUCCESS', 'url' => '', 'title' => '', 'original' => '', 'type' => '', 'size' => '');
     do {
         $sFileField = $aConfig['imageFieldName'];
         if (!isset($_FILES[$sFileField])) {
             $aReturn['state'] = '上传文件为空';
             break;
         }
         $sFromURL = $this->getRequest()->getHttpReferer();
         $oStorage = new File_Storage();
         $mResult = $oStorage->isAllowedDomain($sFromURL);
         if (!$mResult) {
             // 当前站点不允许上传到图片服务器
             $aReturn['state'] = '当前站点不允许上传到服务器';
             break;
         }
         $sIP = $this->getRequest()->getClientIP();
         $sDomain = Util_Uri::getDomain($sFromURL);
         $aFile = $_FILES[$sFileField];
         list($iError, $mResult) = $oStorage->saveFile($aFile['name'], $aFile['tmp_name'], $aFile['error'], $aFile['size'], $sIP, $sDomain);
         if ($iError !== 0) {
             $aReturn['state'] = $mResult;
             break;
         }
         $sCDNDomain = Yaf_G::getConf('file', 'domain');
         $aReturn['url'] = 'http://' . $sCDNDomain . '/view/' . $mResult['sKey'] . '.' . $mResult['sExt'];
         $aReturn['title'] = basename($aFile['name']);
         $aReturn['original'] = basename($aFile['name']);
         $aReturn['type'] = $mResult['sExt'];
         $aReturn['size'] = $mResult['iSize'];
     } while (false);
     return $aReturn;
 }
예제 #6
0
파일: Router.php 프로젝트: pancke/yyaf
 /**
  * Find a matching route to the current Request and inject
  * returning values to the Request object.
  *
  * @return bool if there is a valid route
  */
 public function route(Yaf_Request_Abstract $request)
 {
     $requestUri = $request->getRequestUri();
     //去掉根目录
     $baseuri = $request->getBaseUri();
     if ($requestUri != '' && $baseuri != '' && stripos($requestUri, $baseuri) === 0) {
         $path = substr($requestUri, strlen($baseuri));
     } else {
         $path = $requestUri;
     }
     //支持rewrite路由
     $matches = null;
     $rewrites = Yaf_G::getConf('rewrite', 'route');
     $rest = explode('?', $path, 2);
     $path = $rest[0];
     if (!empty($rewrites)) {
         foreach ($rewrites as $k => $v) {
             $matches = null;
             if (preg_match($k, $path, $matches)) {
                 $path = preg_replace($k, $v, $path);
                 break;
             }
         }
     }
     if (!empty($rest[1])) {
         $path .= '?' . $rest[1];
     }
     //取得Route
     $aRoute = Yaf_G::getRoute($path);
     $request->setModuleName($aRoute['module']);
     $request->setControllerName($aRoute['controller']);
     $request->setActionName($aRoute['action']);
     //解析参数
     parse_str($aRoute['query'], $params);
     /*
     $params = array();
     $rest = $aRoute['query'];
     $numSegs = count($rest);
     if ($numSegs > 0) {
         for ($i = 0; $i < $numSegs; $i = $i + 2) {
             $key = $rest[$i];
             $val = isset($rest[$i + 1]) ? $rest[$i + 1]: null;
             $params[$key] = (isset($params[$key]) ? (array_merge((array) $params[$key], array(
                 $val
             ))) : $val);
         }
     }
     */
     //rewrite参数解析
     if (!empty($matches)) {
         foreach ($matches as $k => $v) {
             if (!is_numeric($k)) {
                 $params[$k] = $v;
             }
         }
     }
     $request->setParam($params);
     return true;
 }
예제 #7
0
파일: Alipay.php 프로젝트: pancke/yyaf
 /**
  * 支付宝回调
  * @param unknown $aParams
  * @return Ambigous <验证结果, boolean>
  */
 public static function callback($aParams)
 {
     require_once LIB_PATH . '/Payment/Alipay/alipay_service.class.php';
     require_once LIB_PATH . '/Payment/Alipay/alipay_notify.class.php';
     $alipay_config = Yaf_G::getConf('aliapy_config', null, 'alipay');
     $alipayNotify = new AlipayNotify($alipay_config);
     return $alipayNotify->verifyNotify($aParams);
 }
예제 #8
0
파일: User.php 프로젝트: 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;
 }
예제 #9
0
파일: Base.php 프로젝트: nicevoice/yhtx
 /**
  * 执行Action前执行
  * @see Yaf_Controller::actionBefore()
  */
 public function actionBefore()
 {
     $this->aCurrProject = Yaf_G::getConf('project');
     if ($this->bCheckLogin) {
     }
     $this->assign('sStaticRoot', 'http://' . Yaf_G::getConf('static', 'domain'));
     $this->assign('sRoot', 'http://' . Yaf_G::getConf('static', 'domain'));
     $this->assign('aMeta', array('title' => $this->aCurrProject['name']));
     //做个零时的
     $this->aCurrUser = ['iUsername' => 'admin', 'iUserID' => 1];
 }
예제 #10
0
파일: Base.php 프로젝트: 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'));
 }
예제 #11
0
파일: Logger.php 프로젝트: pancke/yyaf
 /**
  * 构造函数
  */
 private static function init()
 {
     self::$_bInit = true;
     self::$_aConfig = Yaf_G::getConf(null, 'logger');
     $sBaseDir = self::$_aConfig['sBaseDir'];
     unset(self::$_aConfig['sBaseDir']);
     foreach (self::$_aConfig as $sKey => $mConfig) {
         $sDir = isset(self::$_aConfig[$sKey]['sDir']) ? self::$_aConfig[$sKey]['sDir'] : $sKey;
         self::$_aConfig[$sKey]['sPath'] = $sBaseDir . DIRECTORY_SEPARATOR . $sDir . DIRECTORY_SEPARATOR;
         if (!is_dir(self::$_aConfig[$sKey]['sPath'])) {
             umask(00);
             if (false === mkdir(self::$_aConfig[$sKey]['sPath'], 0755, true)) {
                 throw new Exception(__CLASS__ . ': can not create path(' . self::$_aConfig[$sKey]['sPath'] . ').');
                 return false;
             }
         }
     }
 }
예제 #12
0
파일: Base.php 프로젝트: 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';
예제 #13
0
파일: Index.php 프로젝트: pancke/yyaf
 /**
  * 更换城市
  */
 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);
 }
예제 #14
0
파일: Domain.php 프로젝트: 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);
         }
         $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);
 }
예제 #15
0
파일: Menu.php 프로젝트: 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);
     }
 }
예제 #16
0
파일: Badword.php 프로젝트: 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);
         }
         $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);
     }
 }
예제 #17
0
파일: Logger.php 프로젝트: nicevoice/yhtx
 /**
  * 构造函数
  */
 private function __construct()
 {
     $this->_aConfig = Yaf_G::getConf(null, 'logger');
     $sBaseDir = $this->_aConfig['sBaseDir'];
     unset($this->_aConfig['sBaseDir']);
     $iTime = time();
     foreach ($this->_aConfig as $sKey => $mConfig) {
         //  设置日志级别
         if (isset($this->_aConfig[$sKey]['sLevelName'])) {
             $this->_aConfig[$sKey]['iLevel'] = $this->getLogLevelByName($this->_aConfig[$sKey]['sLevelName']);
         }
         $sDir = isset($this->_aConfig[$sKey]['sDir']) ? $this->_aConfig[$sKey]['sDir'] : $sKey;
         switch ($mConfig['sSplitType']) {
             case 'day':
                 $this->_aConfig[$sKey]['sFilename'] = $sBaseDir . DIRECTORY_SEPARATOR . $sDir . DIRECTORY_SEPARATOR . date('Ymd', $iTime) . '.log';
                 break;
             case 'week':
                 $this->_aConfig[$sKey]['sFilename'] = $sBaseDir . DIRECTORY_SEPARATOR . $sDir . DIRECTORY_SEPARATOR . date('YW', $iTime) . '.log';
                 break;
             case 'month':
                 $this->_aConfig[$sKey]['sFilename'] = $sBaseDir . DIRECTORY_SEPARATOR . $sDir . DIRECTORY_SEPARATOR . date('Ym', $iTime) . '.log';
                 break;
             case 'persistent':
                 $this->_aConfig[$sKey]['sFilename'] = $sBaseDir . DIRECTORY_SEPARATOR . $sDir . DIRECTORY_SEPARATOR . $this->_aConfig[$sKey]['sFile'];
                 break;
         }
         $sPath = dirname($this->_aConfig[$sKey]['sFilename']);
         if (!is_dir($sPath)) {
             umask(00);
             if (false === mkdir($sPath, 0755, true)) {
                 throw new Exception(__CLASS__ . ': can not create path(' . $sPath . ').');
                 return false;
             }
         }
     }
 }
예제 #18
0
파일: Index.php 프로젝트: pancke/yyaf
 /**
  * @param $p_Content
  * @param $p_eTag
  * @param string $p_sMime
  * @return bool
  * 浏览器输出文件
  */
 protected function sendFile($p_Content, $p_eTag, $p_sMime = 'image/jpg')
 {
     $oResponse = $this->getResponse();
     $oResponse->setHeader('Cache-Control', 'max-age:' . Yaf_G::getConf('browseCache', 'file'));
     $oResponse->setHeader('Content-Type', $p_sMime);
     $oResponse->setHeader('ETag', $p_eTag);
     $oResponse->setHeader('Last-Modified', gmdate("D, d M Y H:i:s", time()) . " GMT");
     $oResponse->setBody($p_Content);
     return false;
 }
예제 #19
0
파일: Storage.php 프로젝트: pancke/yyaf
 /**
  * 检查是否为图片
  *
  * @param
  *            $p_sExtension
  */
 protected function isImage($p_sExtension)
 {
     $aImageType = Yaf_G::getConf('aImageType', 'file', 'file');
     $bImage = in_array($p_sExtension, $aImageType) ? true : false;
     return $bImage;
 }
예제 #20
0
파일: Uri.php 프로젝트: nicevoice/yhtx
 public static function getDefaultImg($type = 1)
 {
     $staticUrl = Yaf_G::getConf('static', 'domain');
     $imgUrl = null;
     switch ($type) {
         case 1:
             $imgUrl = 'http://' . $staticUrl . '/img/blistd.png';
             break;
         case 2:
             $imgUrl = 'http://' . $staticUrl . '/touchweb/Evaluation/image/nopic.png';
             break;
         case 3:
             $imgUrl = 'http://' . $staticUrl . '/img/bd.png';
             break;
         case 4:
             $imgUrl = 'http://' . $staticUrl . '/img/default.png';
             break;
         default:
             break;
     }
     return $imgUrl;
 }
예제 #21
0
파일: Index.php 프로젝트: nicevoice/yhtx
 public function logoutAction()
 {
     Util_Cookie::delete(Yaf_G::getConf('authkey', 'cookie'));
     $this->redirect('/login');
 }
예제 #22
0
파일: Member.php 프로젝트: pancke/yyaf
 /**
  * 请求数据检测
  *
  * @return mixed
  */
 public function _checkData($sType = 'add')
 {
     $iType = $this->getParam('iType');
     $sEmail = $this->getParam('sEmail');
     $sMobile = $this->getParam('sMobile');
     $sRealName = $this->getParam('sRealName');
     $sPassword = $this->getParam('sPassword');
     $sCoName = $this->getParam('sCoName');
     $iCoIndustry = $this->getParam('iCoIndustry');
     $sCoAddress = $this->getParam('sCoAddress');
     $sCoWebSite = $this->getParam('sCoWebSite');
     $sCoDesc = $this->getParam('sCoDesc');
     $sWeixin = $this->getParam('sWeixin');
     $sQQ = $this->getParam('sQQ');
     $iIncome = $this->getParam('iIncome');
     $iMoney = $this->getParam('iMoney');
     $iStatus = $this->getParam('iStatus');
     $iRate = $this->getParam('iRate');
     $iUpdateTime = time();
     if (!Util_Validate::isEmail($sEmail)) {
         return $this->showMsg('输入的邮箱地址不合法!', false);
     }
     if (($sType == 'add' || !empty($sPassword)) && !Util_Validate::isLength($sPassword, 6, 20)) {
         return $this->showMsg('登录密码长度范围为6到20字符!', false);
     }
     if (!Util_Validate::isMobile($sMobile)) {
         return $this->showMsg('输入的手机号码不合法!', false);
     }
     if (!Util_Validate::isLength($sRealName, 2, 20)) {
         return $this->showMsg('真实姓名长度范围为2到20字符!', false);
     }
     $aDomain = Model_Domain::getPairDomain(Model_Domain::TYPE_CO_INDUSTRY);
     if (!isset($aDomain[$iCoIndustry])) {
         return $this->showMsg('选择的行业不存在!', false);
     }
     $aRow = array('iType' => $iType, 'sEmail' => $sEmail, 'sMobile' => $sMobile, 'sRealName' => $sRealName, 'sCoName' => $sCoName, 'iCoIndustry' => $iCoIndustry, 'sCoAddress' => $sCoAddress, 'sCoWebSite' => $sCoWebSite, 'sCoDesc' => $sCoDesc, 'sWeixin' => $sWeixin, 'sQQ' => $sQQ, 'iIncome' => $iIncome, 'iMoney' => $iMoney, 'iStatus' => $iStatus, 'iUpdateTime' => $iUpdateTime, 'iRate' => $iRate);
     if (!empty($sPassword)) {
         $aRow['sPassword'] = md5(Yaf_G::getConf('cryptkey', 'cookie') . $sPassword);
     }
     return $aRow;
 }
예제 #23
0
파일: Uri.php 프로젝트: pancke/yyaf
 /**
  * 获取文件服务路径
  *
  * @param string $p_sFileKey            
  * @param string $p_sExtension            
  * @param int $p_iWidth            
  * @param int $p_iHeight            
  * @param string $p_sOption            
  * @return string
  */
 public static function getDFSViewURL($p_sFileKey, $p_iWidth = 0, $p_iHeight = 0, $p_sOption = '', $sBiz = '')
 {
     $sViewUrl = Yaf_G::getConf('dfsview', 'url');
     if (!$p_sFileKey) {
         return '';
     }
     if ('banner' == $sBiz) {
         $sViewUrl .= '/fjbanner';
     }
     list($p_sKey, $p_sExt) = explode('.', $p_sFileKey);
     if (0 == $p_iWidth && 0 == $p_iHeight) {
         return $sViewUrl . '/' . $p_sKey . '.' . $p_sExt;
     } else {
         if ('' == $p_sOption) {
             return $sViewUrl . '/' . $p_sKey . '/' . $p_iWidth . 'x' . $p_iHeight . '.' . $p_sExt;
         } else {
             return $sViewUrl . '/' . $p_sKey . '/' . $p_iWidth . 'x' . $p_iHeight . '_' . $p_sOption . '.' . $p_sExt;
         }
     }
 }
예제 #24
0
파일: Base.php 프로젝트: nicevoice/yhtx
 private static function curl($sDomain, $sRoute, $aParam, $method, $iCacheTime)
 {
     if ($iCacheTime > 0) {
         $sCacheKey = md5($sDomain . $sRoute . serialize($aParam) . $method);
         $aRet = Util_Common::getCache()->get($sCacheKey);
         if (!empty($aRet)) {
             return $aRet;
         }
     }
     $time1 = microtime(true);
     $aParam['_time'] = time();
     $aParam['_sign'] = md5($aParam['_time'] . Yaf_G::getConf('signkey', 'sdk'));
     $sHost = Yaf_G::getConf($sDomain, 'sdkdomain');
     if (!$sHost) {
         throw new Exception('配置[sdkdomain][' . $sDomain . ']未找到!');
         return false;
     }
     $sRoute = trim($sRoute, '/?& ');
     $sUrl = 'http://' . $sHost . '/' . $sRoute;
     if (!self::$_hCurl) {
         self::$_hCurl = curl_init();
     }
     curl_setopt(self::$_hCurl, CURLOPT_DNS_USE_GLOBAL_CACHE, true);
     curl_setopt(self::$_hCurl, CURLOPT_HEADER, false);
     curl_setopt(self::$_hCurl, CURLOPT_RETURNTRANSFER, true);
     curl_setopt(self::$_hCurl, CURLOPT_FOLLOWLOCATION, true);
     curl_setopt(self::$_hCurl, CURLOPT_CONNECTTIMEOUT, 30);
     curl_setopt(self::$_hCurl, CURLOPT_TIMEOUT, 30);
     if ($method == 'post') {
         curl_setopt(self::$_hCurl, CURLOPT_POST, 1);
         curl_setopt(self::$_hCurl, CURLOPT_POSTFIELDS, http_build_query($aParam));
     } else {
         $sUrl .= strpos($sUrl, '?') === false ? '?' : '&';
         $sUrl .= http_build_query($aParam);
         $aParam = null;
     }
     $aCookie = array();
     if (Yaf_G::getEnv() == 'beta') {
         $aCookie[] = 'fjdp_version=beta';
     }
     if (Yaf_G::isDebug()) {
         $aCookie[] = 'debug=2k9j38h#4';
     }
     if (!empty($aCookie)) {
         curl_setopt(self::$_hCurl, CURLOPT_COOKIE, join('; ', $aCookie));
     }
     curl_setopt(self::$_hCurl, CURLOPT_URL, $sUrl);
     $sData = curl_exec(self::$_hCurl);
     $aRet = array('status' => false, 'data' => '数据请求失败,返回为空!');
     if (!empty($sData)) {
         $aData = json_decode($sData, true);
         if (isset($aData['code'])) {
             //兼容mapi没有status
             if ($aData['code'] === 0) {
                 $aData['status'] = true;
             } else {
                 $aData['status'] = false;
                 //unset($aData['msg']);
             }
             if (isset($aData['data'])) {
                 $aData['data']['msg'] = $aData['msg'];
             } else {
                 $aData['data'] = array('msg' => $aData['msg']);
             }
             unset($aData['msg']);
             unset($aData['code']);
         }
         if (isset($aData['status']) && isset($aData['data'])) {
             $aRet = $aData;
         } else {
             $aRet = array('status' => false, 'data' => '数据请求错误:' . $sData);
         }
     }
     $oDebug = Util_Common::getDebug();
     if ($oDebug) {
         $time2 = microtime(true);
         $use_time = round(($time2 - $time1) * 1000, 2);
         self::$_iOptCnt++;
         self::$_iUseTime += $use_time;
         $oDebug->groupCollapsed('Api: ' . $sUrl . ' ' . $use_time . '毫秒');
         if (!empty($aParam)) {
             $oDebug->debug($aParam);
         }
         $oDebug->debug($aRet['data']);
         if (isset($aRet['debug'])) {
             foreach ($aRet['debug'] as $v) {
                 if (is_array($v)) {
                     $oDebug->add($v[0], $v[1]);
                 } else {
                     $oDebug->groupCollapsed($v);
                 }
             }
             $oDebug->groupEnd();
             unset($aRet['debug']);
         }
         $oDebug->groupEnd();
     }
     if ($iCacheTime > 0 && $aRet['status']) {
         Util_Common::getCache()->set($sCacheKey, $aRet, $iCacheTime);
     }
     return $aRet;
 }
예제 #25
0
파일: Dispatcher.php 프로젝트: pancke/yyaf
 /**
  * Dispatch an HTTP request to a controller/action.
  *
  * @param Yaf_Request_Abstract|null $request
  *
  * @return void Yaf_Response_Abstract
  */
 public function dispatch()
 {
     $request = $this->getRequest();
     if (!$request instanceof Yaf_Request_Abstract) {
         throw new Yaf_Exception('Expect a Yaf_Request_Abstract instance');
     }
     if ($request instanceof Yaf_Request_Http) {
         $response = new Yaf_Response_Http();
     } elseif ($request instanceof Yaf_Request_Cli) {
         $response = new Yaf_Response_Cli();
     }
     // 选择路由
     $router = $this->getRouter();
     foreach ($this->_plugins as $plugin) {
         $plugin->routerStartup($request, $response);
     }
     $router->route($request);
     $this->_fixDefault($request);
     foreach ($this->_plugins as $plugin) {
         $plugin->routerShutdown($request, $response);
     }
     // 执行Action
     try {
         $view = $this->initView();
         foreach ($this->_plugins as $plugin) {
             $plugin->dispatchLoopStartup($request, $response);
         }
         $nested = Yaf_G::getConf('forward_limit');
         $nested = empty($nested) ? 5 : $nested;
         do {
             foreach ($this->_plugins as $plugin) {
                 $plugin->preDispatch($request, $response, $view);
             }
             $this->handle($request, $response, $view);
             $this->_fixDefault($request);
             foreach ($this->_plugins as $plugin) {
                 $plugin->postDispatch($request, $response);
             }
             $nested--;
         } while (!$request->isDispatched() && $nested > 0);
         foreach ($this->_plugins as $plugin) {
             $plugin->dispatchLoopShutdown($request, $response);
         }
     } catch (Exception $oExp) {
         if (Yaf_G::isDebug() || $request->getMethod() == 'CLI') {
             if ($request->getMethod() == 'CLI') {
                 Yaf_Logger::error(Yaf_G::parseException($oExp));
                 echo Yaf_G::parseException($oExp);
             } else {
                 echo "<pre>";
                 echo Yaf_G::parseException($oExp);
                 echo "</pre>";
             }
         } else {
             $response->setResponseCode(404);
             $view->display('404.phtml');
         }
     }
     if ($nested == 0 && !$request->isDispatched()) {
         throw new Yaf_Exception('The max dispatch nesting ' . Yaf_G::getConf('forward_limit') . ' was reached');
     }
     if ($this->returnResponse() == false) {
         $response->response();
     }
     return $response;
 }
예제 #26
0
파일: Common.php 프로젝트: nicevoice/yhtx
 public static function getConf($sKey, $sType = null, $sFile = null)
 {
     return Yaf_G::getConf($sKey, $sType, $sFile);
 }
예제 #27
0
파일: Index.php 프로젝트: nicevoice/yhtx
 /**
  * 增加资讯
  *
  * @return boolean
  */
 public function addAction()
 {
     if ($this->isPost()) {
         $aNews = $this->_checkData();
         if (empty($aNews)) {
             return null;
         }
         $sAction = '保存';
         if ($this->getParam('iOptype') > 0) {
             $aNews['iPublishStatus'] = 1;
             //发布需要将该字段改为1
             $sAction = '发布';
         }
         //增加需要加上当前添加人ID
         $aCurrUserInfo = $this->aCurrUser;
         $aNews['iUpdateUserID'] = $aCurrUserInfo['iUserID'];
         $aNews['iCreateUserID'] = $aCurrUserInfo['iUserID'];
         $iNewsID = Model_News::addData($aNews);
         if ($iNewsID > 0) {
             return $this->showMsg(['sMsg' => '资讯信息' . $sAction . '成功!', 'iNewsID' => $iNewsID], true);
         } else {
             return $this->showMsg('资讯信息' . $sAction . '失败!', false);
         }
     } else {
         $this->_response->setHeader('Access-Control-Allow-Origin', '*.*');
         $aCategory = Model_Category::getPairCategorys($this->_getTypeCategory());
         $aTag = $this->_getTagList();
         //Model_Tag::getPairTags($this->_getTypeTag());
         $this->assign('iTypeID', $this->_getTypeID());
         $this->assign('iCityID', $this->_getCityID());
         $this->assign('aCategory', $aCategory);
         $this->assign('aTag', $aTag);
         $this->assign('sUploadUrl', Yaf_G::getConf('upload', 'url'));
         $this->assign('sFileBaseUrl', 'http://' . Yaf_G::getConf('file', 'domain'));
     }
 }
예제 #28
0
파일: User.php 프로젝트: pancke/yyaf
 /**
  * 请求数据检测
  *
  * @return mixed
  */
 public function _checkData($sType = 'add')
 {
     $sAdminName = $this->getParam('sAdminName');
     $sPassword = $this->getParam('sPassword');
     $sMobile = $this->getParam('sMobile');
     $sEmail = $this->getParam('sEmail');
     $sRealName = $this->getParam('sRealName');
     $iCityID = $this->getParam('iCityID');
     $aCityID = $this->getParam('aCityID');
     $sAllCityID = $this->getParam('sAllCityID');
     $aRoleID = $this->getParam('aRoleID');
     $sAdminID = $this->getParam('sAdminID');
     if (!Util_Validate::isLength($sAdminName, 3, 50)) {
         return $this->showMsg('用户名长度范围为3到30个字!', false);
     }
     if (($sType == 'add' || !empty($sPassword)) && !Util_Validate::isLength($sPassword, 6, 20)) {
         return $this->showMsg('登录密码长度范围为6到20字符!', false);
     }
     if (!Util_Validate::isMobile($sMobile)) {
         return $this->showMsg('输入的手机号码不合法!', false);
     }
     if (!Util_Validate::isEmail($sEmail)) {
         return $this->showMsg('输入的邮箱地址不合法!', false);
     }
     if (!Util_Validate::isLength($sRealName, 2, 20)) {
         return $this->showMsg('真实姓名长度范围为2到20字符!', false);
     }
     $aCity = Model_City::getPairCitys();
     if (!isset($aCity[$iCityID])) {
         return $this->showMsg('选择的城市不存在!', false);
     }
     // 将默认城市加入到城市权限中
     if ($sAllCityID == '1') {
         $aCityID = array(-1);
     } elseif (empty($aCityID) || !in_array($iCityID, $aCityID)) {
         $aCityID[] = $iCityID;
     }
     // 将默认城市加入到城市权限中
     if ($sAdminID == '1') {
         $aRoleID = array(-1);
     } elseif (empty($aRoleID)) {
         return $this->showMsg('请至少选择一个角色!', false);
     }
     $aRow = array('sAdminName' => $sAdminName, 'sMobile' => $sMobile, 'sEmail' => $sEmail, 'sRealName' => $sRealName, 'iCityID' => $iCityID, 'sCityID' => join(',', $aCityID), 'sRoleID' => join(',', $aRoleID));
     if (!empty($sPassword)) {
         $aRow['sPassword'] = md5(Yaf_G::getConf('cryptkey', 'cookie') . $sPassword);
     }
     return $aRow;
 }
예제 #29
0
파일: Finances.php 프로젝트: 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);
         }
         $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);
     }
 }
예제 #30
0
파일: Index.php 프로젝트: nicevoice/yhtx
 /**
  * 编辑资讯
  *
  * @return boolean
  */
 public function editAction()
 {
     if ($this->isPost()) {
         $aNews = $this->_checkData('edit');
         if (empty($aNews)) {
             return null;
         }
         $sAction = '保存';
         if ($this->getParam('iOptype') > 0) {
             $aNews['iPublishStatus'] = 1;
             //发布需要将该字段改为1
             $sAction = '发布';
         }
         $aNews['iNewsID'] = intval($this->getParam('iNewsID'));
         //修改需要加上当前修改人ID
         $aCurrUserInfo = $this->aCurrUser;
         $aNews['iUpdateUserID'] = $aCurrUserInfo['iUserID'];
         if (1 == Model_News::updData($aNews)) {
             return $this->showMsg(['sMsg' => '资讯信息' . $sAction . '成功!', 'iNewsID' => $aNews['iNewsID']], true);
         } else {
             return $this->showMsg('资讯信息' . $sAction . '失败!', false);
         }
     } else {
         $this->_response->setHeader('Access-Control-Allow-Origin', '*');
         $iNewsID = intval($this->getParam('id'));
         $aNews = Model_News::getDetail($iNewsID);
         /**
                     Model_News::changeNewsLouName($aNews);
                     print_r($aNews);
                     die
         */
         if ($aNews['sTag']) {
             $aNews['aTag'] = explode(',', $aNews['sTag']);
         }
         if ($aNews['iAuthorID'] == 0) {
             //处理老数据的作者问题
             $aAuthor = Model_Author::getAll(['where' => ['sAuthorName' => $aNews['sAuthor']]]);
             if ($aAuthor) {
                 foreach ($aAuthor as $author) {
                     $aNews['iAuthorID'] = $author['iAuthorID'];
                     if ($author['iCityID'] == $aNews['iCityID']) {
                         break;
                     }
                 }
             }
         }
         $this->assign('aNews', $aNews);
         $aCategory = Model_Category::getPairCategorys($this->_getTypeCategory());
         $aTag = $this->_getTagList();
         //Model_Tag::getPairTags($this->_getTypeTag());
         $aLoupan = Model_CricUnit::getLoupanNames($aNews['sLoupanID']);
         $this->assign('iTypeID', $this->_getTypeID());
         $this->assign('iCityID', $this->_getCityID());
         $this->assign('aCategory', $aCategory);
         $this->assign('aTag', $aTag);
         $this->assign('aLoupan', $aLoupan);
         $this->assign('sUploadUrl', Yaf_G::getConf('upload', 'url'));
         $this->assign('sFileBaseUrl', 'http://' . Yaf_G::getConf('file', 'domain'));
     }
 }