/** * @brief 根据用户的权限过滤菜单 * @return array */ private function filterMenu() { $rights = ISession::get('admin_right'); //如果不是超级管理员则要过滤菜单 if ($rights != 'administrator') { foreach (self::$menu as $firstKey => $firstVal) { if (is_array($firstVal)) { foreach ($firstVal as $secondKey => $secondVal) { if (is_array($secondVal)) { foreach ($secondVal as $thirdKey => $thirdVal) { if (!in_array($thirdKey, self::$commonMenu) && stripos(str_replace('@', '/', $rights), ',' . substr($thirdKey, 1) . ',') === false) { unset(self::$menu[$firstKey][$secondKey][$thirdKey]); } } if (empty(self::$menu[$firstKey][$secondKey])) { unset(self::$menu[$firstKey][$secondKey]); } } } if (empty(self::$menu[$firstKey])) { unset(self::$menu[$firstKey]); } } } } }
/** * @brief 发送短信 * @param string $mobile 手机号 * @param string $content 短信内容 * @param int $delay 延迟设置 * @return success or fail */ public static function send($mobile, $content, $delay = 1) { if (self::$smsInstance == null) { $platform = self::getPlatForm(); switch ($platform) { case "zhutong": $classFile = IWeb::$app->getBasePath() . 'plugins/hsms/zhutong.php'; require $classFile; self::$smsInstance = new zhutong(); break; default: $classFile = IWeb::$app->getBasePath() . 'plugins/hsms/haiyan.php'; require $classFile; self::$smsInstance = new haiyan(); } } if (IValidate::mobi($mobile) && $content) { $ip = IClient::getIp(); if ($ip) { if ($delay == 1) { $mobileKey = md5($ip); $sendTime = ISession::get($mobileKey); if ($sendTime && time() - $sendTime < 60) { return false; } ISession::set($mobileKey, time()); } return self::$smsInstance->send($mobile, $content); } } return false; }
public function getUserInfo() { require_once dirname(__FILE__) . "/API/qqConnectAPI.php"; $qc = new QC(ISession::get('access_token'), ISession::get('openid'), $this->apiId); $arr = $qc->get_user_info(); $userInfo['id'] = ISession::get('openid'); $userInfo['name'] = isset($arr['nickname']) ? $arr['nickname'] : ''; return $userInfo; }
function getUserInfo() { $c = new WeiboClient(ISession::get('apiKey'), ISession::get('apiSecret'), $_SESSION['last_key']['oauth_token'], $_SESSION['last_key']['oauth_token_secret']); $ms = $c->home_timeline(); $me = $c->verify_credentials(); $userInfo = array(); $userInfo['id'] = isset($me['id']) ? $me['id'] : ''; $userInfo['name'] = isset($me['name']) ? $me['name'] : ''; return $userInfo; }
public function getUserInfo() { //获取用户信息的接口地址, 不要更改!! $url = "http://openapi.qzone.qq.com/user/get_user_info"; $info = $this->do_get($url, $this->apiId, $this->apiKey, ISession::get('token'), ISession::get('secret'), ISession::get('openid')); $arr = JSON::decode($info); $userInfo = array(); $userInfo['id'] = ISession::get('openid'); $userInfo['name'] = isset($arr['nickname']) ? $arr['nickname'] : ''; return $userInfo; }
function getUserInfo() { require_once dirname(__FILE__) . "/API/saetv2.ex.class.php"; $token = ISession::get('token'); $c = new SaeTClientV2(ISession::get('apiKey'), ISession::get('apiSecret'), $token['access_token']); $ms = $c->home_timeline(); $uid_get = $c->get_uid(); $uid = $uid_get['uid']; $user_message = $c->show_user_by_id($uid); $userInfo = array(); $userInfo['id'] = $uid; $userInfo['name'] = isset($user_message['screen_name']) ? $user_message['screen_name'] : ''; return $userInfo; }
public function getMyCart() { $cartName = $this->getCartName(); if ($this->saveType == 'session') { $cartValue = ISession::get($cartName); } else { $cartValue = ICookie::get($cartName); } if ($cartValue == null) { return $this->cartExeStruct; } else { $cartValue = JSON::decode(str_replace(array('&', '$'), array('"', ','), $cartValue)); if (is_array($cartValue)) { return $this->cartFormat($cartValue); } else { return $this->cartExeStruct; } } }
public function getUserInfo() { $url = 'http://gw.api.taobao.com/router/rest?'; $paramArr = array('method' => 'taobao.user.get', 'session' => ISession::get('access_token'), 'timestamp' => date('Y-m-d H:i:s'), 'format' => 'json', 'app_key' => $this->apiKey, 'v' => '2.0', 'sign_method' => 'md5', 'fields' => 'user_id,nick,sex,email'); $sign = $this->createSign($paramArr, $this->apiSecret); //组织参数 $strParam = $this->createStrParam($paramArr); $strParam .= 'sign=' . $sign; //构造Url $urls = $url . $strParam; $userInfo = array(); $results = file_get_contents($urls); $resultsArray = JSON::decode($results); if (isset($resultsArray['user_get_response']['user'])) { $userArray = $resultsArray['user_get_response']['user']; $userInfo['id'] = isset($userArray['user_id']) ? $userArray['user_id'] : ''; $userInfo['name'] = isset($userArray['nick']) ? $userArray['nick'] : ''; $userInfo['sex'] = isset($userArray['sex']) ? $userArray['sex'] == 'm' ? 1 : 2 : ''; } return $userInfo; }
public function getUserInfo() { $apiUrl = 'http://api.renren.com/restserver.do'; $parms = array('access_token' => ISession::get('access_token'), 'call_id' => time(), 'method' => 'users.getInfo', 'v' => '1.0', 'format' => 'json'); $sign = $this->createSign($parms); $parms['sig'] = $sign; $userInfo = array(); //模拟post提交 $ch = curl_init(); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_URL, $apiUrl); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($parms)); $renrenUser = JSON::decode(curl_exec($ch)); $userInfo['id'] = isset($renrenUser[0]['uid']) ? $renrenUser[0]['uid'] : ''; $userInfo['name'] = isset($renrenUser[0]['name']) ? $renrenUser[0]['name'] : ''; $userInfo['sex'] = isset($renrenUser[0]['sex']) ? $renrenUser[0]['sex'] == 1 ? 1 : 2 : ''; return $userInfo; }
/** * Runtime initializations based on the application specification. * Derived classes can override this method to provide additional initializations. */ protected function init() { foreach ($this->preload as $namespace) { using($namespace); } $locatorClass = $this->handlers['locator']; $parserClass = $this->handlers['parser']; $cacheClass = $this->handlers['cache']; $errorClass = $this->handlers['error']; $requestClass = $this->handlers['request']; $sessionClass = $this->handlers['session']; $vsmClass = $this->handlers['vsmanager']; $globalizationClass = $this->handlers['globalization']; $serviceManagerClass = $this->handlers['services']; $this->resourceLocator = new $locatorClass($this->specification->locator); $this->resourceParser = new $parserClass($this->specification->parser); $this->cacheManager = new $cacheClass($this->specification->cache); $this->errorHandler = new $errorClass($this->specification->error); $this->request = new $requestClass($this->specification->request); $this->session = new $sessionClass($this->specification->session); $this->vsm = new $vsmClass($this->specification->vsmanager); $this->services = new $serviceManagerClass($this->specification->services); $this->session->start(); $userClass = $this->handlers['user']; if (!empty($userClass)) { if ($this->session->has($this->id . ':' . self::SESSION_USER)) { $this->user = pradoUnserializeObject($this->session->get($this->id . ':' . self::SESSION_USER)); } if (!$this->user instanceof IUser) { $this->user = new $userClass($this->specification->user); } if (!$this->user instanceof IUser) { throw new Exception('User class must implement IUser interface.'); } } // load the theme if one was declared in the app.spec file if (is_file($this->getThemeFile())) { $this->theme = $this->getResourceParser()->parseTheme(file_get_contents($this->getThemeFile())); } //globalization should be last, it may require Request, Session, Resource and User if ($this->specification->globalization->length) { $this->globalization = new $globalizationClass($this->specification->globalization); } }
public function bind_nexists_user() { $username = IFilter::act(IReq::get('username')); $email = IFilter::act(IReq::get('email')); $oauth_id = IFilter::act(ISession::get('oauth_id')); $oauth_userInfo = IFilter::act(ISession::get('oauth_userInfo')); /*注册信息校验*/ if (IValidate::email($email) == false) { $message = '邮箱格式不正确'; } else { if (!Util::is_username($username)) { $message = '用户名必须是由2-20个字符,可以为字数,数字下划线和中文'; } else { $userObj = new IModel('user'); $where = 'email = "' . $email . '" or username = "******" or username = "******"'; $userRow = $userObj->getObj($where); if (!empty($userRow)) { if ($email == $userRow['email']) { $message = '此邮箱已经被注册过,请重新更换'; } else { $message = "此用户名已经被注册过,请重新更换"; } } else { $userData = array('email' => $email, 'username' => $username, 'password' => md5(ITime::getDateTime())); $userObj->setData($userData); $user_id = $userObj->add(); $memberObj = new IModel('member'); $memberData = array('user_id' => $user_id, 'true_name' => $oauth_userInfo['name'], 'last_login' => ITime::getDateTime(), 'sex' => isset($oauth_userInfo['sex']) ? $oauth_userInfo['sex'] : 1, 'time' => ITime::getDateTime()); $memberObj->setData($memberData); $memberObj->add(); $oauthUserObj = new IModel('oauth_user'); //插入关系表 $oauthUserData = array('oauth_user_id' => $oauth_userInfo['id'], 'oauth_id' => $oauth_id, 'user_id' => $user_id, 'datetime' => ITime::getDateTime()); $oauthUserObj->setData($oauthUserData); $oauthUserObj->add(); $userRow = CheckRights::isValidUser($userData['email'], $userData['password']); CheckRights::loginAfter($userRow); //自定义跳转页面 $callback = ISafe::get('callback'); $this->redirect('/site/success?message=' . urlencode("注册成功!") . '&callback=' . $callback); } } } if ($message != '') { $this->message = $message; $this->redirect('bind_user', false); } }