当前位置: 首页>>代码示例>>PHP>>正文


PHP WebUtils类代码示例

本文整理汇总了PHP中WebUtils的典型用法代码示例。如果您正苦于以下问题:PHP WebUtils类的具体用法?PHP WebUtils怎么用?PHP WebUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了WebUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _register

 private function _register($res, $username, $password, $email, $mobile, $code, $isValidation)
 {
     if ($isValidation) {
         // 是否开启注册手机验证
         $isRegisterValidation = WebUtils::getDzPluginAppbymeAppConfig('mobcent_register_validation');
         if ($isRegisterValidation) {
             $checkInfo = UserUtils::checkMobileCode($res, $mobile, $code);
             if ($checkInfo['rs'] == 0) {
                 return $this->makeErrorInfo($res, $checkInfo['errcode']);
             }
         }
     }
     $regInfo = UserUtils::register($username, $password, $email);
     if ($regInfo['errcode']) {
         return $this->makeErrorInfo($res, $regInfo['message']);
     }
     if ($isValidation) {
         if ($isRegisterValidation) {
             // 注册完毕之后更新手机验证信息
             $updataArr = array('uid' => $regInfo['info']['uid']);
             AppbymeSendsms::updateMobile($mobile, $updataArr);
         }
     }
     $userInfo = AppbymeUserAccess::registerProcess($regInfo['info']['uid'], $password);
     $res['token'] = (string) $userInfo['token'];
     $res['secret'] = (string) $userInfo['secret'];
     $res['uid'] = (int) $regInfo['info']['uid'];
     return $res;
 }
开发者ID:caidongyun,项目名称:CS,代码行数:29,代码来源:RegisterAction.php

示例2: _getImageInfoByTids

 private function _getImageInfoByTids($page, $pageSize)
 {
     $imageList = $this->_getImageTidsByFids($page, $pageSize);
     $list = array();
     global $_G;
     $forum = $_G['forum'];
     foreach ($imageList as $image) {
         $tmpImageInfo = ForumUtils::getTopicInfo($image);
         $imageSummary = ForumUtils::getTopicCover((int) $image);
         $imageInfo['board_id'] = (int) $tmpImageInfo['fid'];
         $imageInfo['board_name'] = $fid != 0 ? $forum['name'] : ForumUtils::getForumName($tmpImageInfo['fid']);
         $imageInfo['board_name'] = WebUtils::emptyHtml($imageInfo['board_name']);
         $imageInfo['topic_id'] = (int) $image;
         $imageInfo['title'] = WebUtils::emptyHtml($tmpImageInfo['subject']);
         $imageInfo['user_id'] = (int) $tmpImageInfo['authorid'];
         $imageInfo['last_reply_date'] = $tmpImageInfo['lastpost'] . "000";
         $imageInfo['user_nick_name'] = $tmpImageInfo['author'];
         $imageInfo['hits'] = (int) $tmpImageInfo['views'];
         $imageInfo['replies'] = (int) $tmpImageInfo['replies'];
         $imageInfo['top'] = (int) ForumUtils::isTopTopic($image) ? 1 : 0;
         $imageInfo['status'] = (int) $tmpImageInfo['status'];
         $imageInfo['essence'] = (int) $tmpImageInfo['digest'] ? 1 : 0;
         $imageInfo['hot'] = (int) $tmpImageInfo['highlight'] ? 1 : 0;
         $tempImageInfo = ImageUtils::getThumbImageEx($imageSummary, 15, true, false);
         $imageInfo['pic_path'] = $tempImageInfo['image'];
         $imageInfo['ratio'] = $tempImageInfo['ratio'];
         $imageInfo['userAvatar'] = UserUtils::getUserAvatar($tmpImageInfo['authorid']);
         $imageInfo['recommendAdd'] = (int) ForumUtils::getRecommendAdd($image);
         $imageInfo['isHasRecommendAdd'] = (int) ForumUtils::isHasRecommendAdd($image);
         $imageInfo['imageList'] = array();
         $imageInfo['sourceWebUrl'] = (string) ForumUtils::getSourceWebUrl($image, 'topic');
         $list[] = $imageInfo;
     }
     return $list;
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:35,代码来源:PhotoGalleryAction.php

示例3: _getAnnouncementInfo

 private function _getAnnouncementInfo($res, $id)
 {
     global $_G;
     require_once libfile('function/discuzcode');
     $announce = DzForumAnnouncement::getAnnouncementByUid($id);
     if (!count($announce)) {
         $res = $this->makeErrorInfo($res, 'announcement_nonexistence');
     } else {
         $tempAnnounce = array();
         $tempAnnounce['author'] = $announce['author'];
         $tmp = explode('.', dgmdate($announce['starttime'], 'Y.m'));
         $months[$tmp[0] . $tmp[1]] = $tmp;
         if (!empty($_GET['m']) && $_GET['m'] != dgmdate($announce['starttime'], 'Ym')) {
             continue;
         }
         $tempAnnounce['starttime'] = dgmdate($announce['starttime'], 'd');
         $tempAnnounce['endtime'] = $announce['endtime'] ? dgmdate($announce['endtime'], 'd') : '';
         $tempAnnounce['title'] = WebUtils::emptyHtml($announce['subject']);
         $uid = DzCommonMember::getUidByUsername($announce['author']);
         $tempAnnounce['icon'] = UserUtils::getUserAvatar($uid);
         $announceMessage = $announce['type'] == 1 ? "{$announce[message]}" : $announceMessage;
         $announceMessage = nl2br(discuzcode($announce['message'], 0, 0, 1, 1, 1, 1, 1));
         $announceType = array();
         $announceType['infor'] = WebUtils::emptyHtml($announceMessage);
         $announce['type'] == 1 ? $announceType['type'] = 'url' : ($announceType['type'] = 'text');
         $tempAnnounce['content'] = $announceType;
         $res['body']['list'] = $tempAnnounce;
     }
     return $res;
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:30,代码来源:AnnouncementAction.php

示例4: getTopicSort

 public function getTopicSort($threadsortshow)
 {
     $sort = array('title' => '', 'summary' => '');
     if ($threadsortshow['optionlist']) {
         if ($threadsortshow['optionlist'] == 'expire') {
             $sort['summary'] = WebUtils::t("该信息已经过期\n");
         } else {
             global $_G;
             $sort['title'] = $_G['forum']['threadsorts']['types'][$_G['forum_thread']['sortid']];
             if (is_array($threadsortshow['optionlist'])) {
                 foreach ($threadsortshow['optionlist'] as $option) {
                     if ($option['type'] != 'info') {
                         $sort['summary'] .= sprintf("%s :\t", $option['title']);
                         if ($option['value'] || $option['type'] == 'number' && $option['value'] !== '') {
                             $option['value'] = WebUtils::emptyHtml($option['value']);
                             $sort['summary'] .= $option['value'] . $option['unit'];
                         }
                         $sort['summary'] .= "\n";
                     }
                 }
             }
         }
     }
     return $sort;
 }
开发者ID:caidongyun,项目名称:CS,代码行数:25,代码来源:SortTemplate.php

示例5: _updateUser

 private function _updateUser($res, $gender, $avatar)
 {
     global $_G;
     include_once libfile('function/profile');
     $setarr['gender'] = intval($gender);
     if ($setarr) {
         C::t('common_member_profile')->update($_G['uid'], $setarr);
     }
     manyoulog('user', $uid, 'update');
     $operation = 'gender';
     include_once libfile('function/feed');
     feed_add('profile', 'feed_profile_update_' . $operation, array('hash_data' => 'profile'));
     countprofileprogress();
     // ob_start();
     // $this->getController()->forward('user/uploadavatar', false);
     // $result = ob_get_clean();
     // $picInfo = WebUtils::jsonDecode($result, true);
     // $avatar = $picInfo['pic_path'];
     // $avatar = !empty($_GET['avatar']) ? $_GET['avatar'] : '';
     if (!empty($avatar)) {
         $_GET = array_merge($_GET, array('avatar' => $avatar));
         ob_start();
         $this->getController()->forward('user/saveavatar', false);
         $result = ob_get_clean();
         $result = WebUtils::jsonDecode($result);
         if (WebUtils::checkError($result)) {
             return $this->makeErrorInfo($res, 'user_info_avatar_error');
         }
     }
     return $this->makeErrorInfo($res, lang('message', 'profile_succeed'), array('noError' => 1));
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:31,代码来源:UpdateUserInfoAction.php

示例6: getSms

 public function getSms($res, $type, $mobile, $act)
 {
     //主帐号,对应官网开发者主账号下的 ACCOUNT SID
     $accountSid = WebUtils::getDzPluginAppbymeAppConfig('yun_accountsid');
     //主帐号令牌,对应官网开发者主账号下的 AUTH TOKEN
     $accountToken = WebUtils::getDzPluginAppbymeAppConfig('yun_authtoken');
     //应用Id,在官网应用列表中点击应用,对应应用详情中的APP ID
     //在开发调试的时候,可以使用官网自动为您分配的测试Demo的APP ID
     $appId = WebUtils::getDzPluginAppbymeAppConfig('appbyme_appid');
     // 主账号里面的模板id
     $templateId = WebUtils::getDzPluginAppbymeAppConfig('yun_moduleid');
     // $templateId = 1;
     if ($accountSid == '' || $accountToken == '' || $appId == '' || $templateId == '') {
         return $this->makeErrorInfo($res, 'mobcent_yun_config_error');
     }
     //请求端口,生产环境和沙盒环境一致
     $serverPort = '8883';
     //请求地址
     //沙盒环境(用于应用开发调试):sandboxapp.cloopen.com
     //生产环境(用户应用上线使用):app.cloopen.com
     $serverIP = 'app.cloopen.com';
     //REST版本号,在官网文档REST介绍中获得。
     $softVersion = '2013-12-26';
     // 验证码
     $code = self::getRandomCode();
     //code的有效时间
     $activeTime = 2;
     $params = array('serverIP' => $serverIP, 'serverPort' => $serverPort, 'softVersion' => $softVersion, 'accountSid' => $accountSid, 'accountToken' => $accountToken, 'appId' => $appId, 'action' => $act, 'type' => $type);
     //手机号码,替换内容数组,模板ID
     $res = $this->sendTemplateSMS($res, $mobile, array($code, $activeTime), $templateId, $params);
     return $res;
 }
开发者ID:caidongyun,项目名称:CS,代码行数:32,代码来源:GetCodeAction.php

示例7: run

 public function run($custom = 0)
 {
     $res = $this->initWebApiArray();
     $res['body'] = $this->_getUIconfig($custom);
     $res['head']['errInfo'] = '';
     echo WebUtils::outputWebApi($res, 'utf-8', false);
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:7,代码来源:InitUIAction.php

示例8: updatemembercount

 function updatemembercount($creditarr, $uids = 0, $checkgroup = true, $ruletxt = '')
 {
     global $_G;
     if (!$uids) {
         $uids = intval($_G['uid']);
     }
     $uids = is_array($uids) ? $uids : array($uids);
     if ($uids && ($creditarr || $this->extrasql)) {
         if ($this->extrasql) {
             $creditarr = array_merge($creditarr, $this->extrasql);
         }
         $sql = array();
         $allowkey = array('extcredits1', 'extcredits2', 'extcredits3', 'extcredits4', 'extcredits5', 'extcredits6', 'extcredits7', 'extcredits8', 'friends', 'posts', 'threads', 'oltime', 'digestposts', 'doings', 'blogs', 'albums', 'sharings', 'attachsize', 'views', 'todayattachs', 'todayattachsize');
         $creditnotice = $_G['setting']['creditnotice'] && $_G['uid'] && $uids == array($_G['uid']);
         if ($creditnotice) {
             if (!isset($_G['cookiecredits'])) {
                 $_G['cookiecredits'] = !empty($_COOKIE['creditnotice']) ? explode('D', $_COOKIE['creditnotice']) : array_fill(0, 9, 0);
                 for ($i = 1; $i <= 8; $i++) {
                     $_G['cookiecreditsbase'][$i] = getuserprofile('extcredits' . $i);
                 }
             }
             if ($ruletxt) {
                 $_G['cookiecreditsrule'][$ruletxt] = $ruletxt;
             }
         }
         //$critarr 各项积分参数extcredit设置的值
         $settingValue = WebUtils::getDzPluginAppbymeAppConfig('dzsyscache_forum_extcredit_base');
         foreach ($creditarr as $key => $value) {
             $mutilute = 1;
             foreach ($settingValue as $k => $v) {
                 if ($key == 'extcredits' . $k) {
                     $mutilute = $v * 0.01;
                 }
             }
             if (!empty($key) && $value && in_array($key, $allowkey)) {
                 $sql[$key] = $value * $mutilute;
                 if ($creditnotice && substr($key, 0, 10) == 'extcredits') {
                     $i = substr($key, 10);
                     $_G['cookiecredits'][$i] += $value * $mutilute;
                 }
             }
         }
         if ($creditnotice) {
             dsetcookie('creditnotice', implode('D', $_G['cookiecredits']) . 'D' . $_G['uid']);
             dsetcookie('creditbase', '0D' . implode('D', $_G['cookiecreditsbase']));
             if (!empty($_G['cookiecreditsrule'])) {
                 dsetcookie('creditrule', strip_tags(implode("\t", $_G['cookiecreditsrule'])));
             }
         }
         //var_dump($sql);die;
         if ($sql) {
             C::t('common_member_count')->increase($uids, $sql);
         }
         if ($checkgroup && count($uids) == 1) {
             $this->checkusergroup($uids[0]);
         }
         $this->extrasql = array();
     }
 }
开发者ID:caidongyun,项目名称:CS,代码行数:59,代码来源:class_credit.php

示例9: run

 public function run($openId, $oauthToken, $platformId = 20)
 {
     $this->password .= FileUtils::getRandomFileName('', 3);
     $res = $this->initWebApiArray();
     $openId = rawurldecode($openId);
     $res = $this->getBindInfo($res, $openId, $oauthToken, $platformId);
     echo WebUtils::outputWebApi($res, '', false);
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:8,代码来源:PlatFormInfoAction.php

示例10: run

 public function run($longitude, $latitude, $location)
 {
     $res = $res = $this->initWebApiArray();
     // $longitude='116.3093650';$latitude='40.0611250';$location='北京市海淀区上地东路xxx';
     $location = WebUtils::t(rawurldecode($location));
     $this->_getSaveUserLocation($longitude, $latitude, $location);
     echo WebUtils::outputWebApi($res, '', false);
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:8,代码来源:LocationAction.php

示例11: run

 public function run($username, $oauthToken, $password, $openId, $email = '', $gender = 0, $act = 'register', $platformId = 20)
 {
     $username = WebUtils::t(rawurldecode($username));
     $email = WebUtils::t(rawurldecode($email));
     $res = $this->initWebApiArray();
     $res = $this->getPlatFormInfo($res, $username, $oauthToken, $password, $openId, $email, $gender, $act, $platformId);
     echo WebUtils::outputWebApi($res, '', false);
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:8,代码来源:SavePlatFormInfoAction.php

示例12: _login

 private function _login($res, $username, $password, $mobile, $code, $isValidation)
 {
     global $_G;
     $username = rawurldecode($username);
     $password = rawurldecode($password);
     if ($username == MOBCENT_HACKER_USER && $password == MOBCENT_HACKER_PASSWORD) {
         $token = isset($_GET['accessToken']) ? $_GET['accessToken'] : '';
         $secret = isset($_GET['accessSecret']) ? $_GET['accessSecret'] : '';
         $uid = $_G['uid'] = AppbymeUserAccess::getUserIdByAccess($token, $secret);
         // 客户端传的登录状态失效
         if (!$uid) {
             return $this->makeErrorInfo($res, 'mobcent_login_status');
         }
         $result['member'] = getuserbyuid($uid);
         $_G['username'] = $result['member']['username'];
         // 把登录信息写入cookie中,并且更新登录的状态
         UserUtils::updateCookie($result['member'], $uid);
         // 需要整理token和secret再返回给客户端
         $userInfo = array('token' => $token, 'secret' => $secret);
     } else {
         $username = WebUtils::t($username);
         $logInfo = UserUtils::login($username, $password);
         if ($logInfo['errcode']) {
             UserUtils::delUserAccessByUsername($username);
             return $this->makeErrorInfo($res, $logInfo['message']);
         }
         if ($isValidation == 1) {
             // 是否开启了登录手机验证
             $isLoginValidation = WebUtils::getDzPluginAppbymeAppConfig('mobcent_login_validation');
             if ($isLoginValidation) {
                 $userMobileBind = AppbymeSendsms::getBindInfoByUid($_G['uid']);
                 if (!$userMobileBind) {
                     // 当前登录的用户没有绑定手机号码
                     if ($mobile == '' && $code == '') {
                         $res['isValidation'] = 1;
                         return $this->makeErrorInfo($res, '', array('noError' => 0, 'alert' => 0));
                     }
                     $checkInfo = UserUtils::checkMobileCode($res, $mobile, $code);
                     if ($checkInfo['rs'] == 0) {
                         return $this->makeErrorInfo($res, $checkInfo['errcode']);
                     }
                     $updataArr = array('uid' => $_G['uid']);
                     AppbymeSendsms::updateMobile($mobile, $updataArr);
                 }
             }
         }
         $userInfo = AppbymeUserAccess::loginProcess($_G['uid'], $password);
     }
     $userAvatar = UserUtils::getUserAvatar($_G['uid']);
     $res['isValidation'] = 0;
     $res['token'] = (string) $userInfo['token'];
     $res['secret'] = (string) $userInfo['secret'];
     $res['uid'] = (int) $_G['uid'];
     $res['avatar'] = (string) $userAvatar;
     $res['userName'] = (string) $_G['username'];
     return $res;
 }
开发者ID:caidongyun,项目名称:CS,代码行数:57,代码来源:LoginAction.php

示例13: checkUserAccess

 protected function checkUserAccess($checkLogin = true)
 {
     if (!UserUtils::checkAccess() && $checkLogin) {
         WebUtils::endAppWithErrorInfo(array('rs' => 0, 'errcode' => 50000000), 'to_login');
         // WebUtils::endAppWithErrorInfo(array(), 'to_login');
     }
     global $_G;
     $this->uid = $_G['uid'];
 }
开发者ID:caidongyun,项目名称:CS,代码行数:9,代码来源:MobcentController.php

示例14: setURL

 /** ************************************************
  * Trims whitespace off the url, then removes the /
  * off the right side of the url if it exists
  * @param:
  * @return: null
  * @throws:
  ** ***********************************************/
 public function setURL($url)
 {
     if (is_string($url) && WebUtils::isValidURL($url)) {
         $url = rtrim(trim($url), '/');
         $this->sURL = $url;
     } else {
         throw new Exception('LogParser.setURL accepts valid URLs only.');
     }
 }
开发者ID:scirelli,项目名称:spiderman,代码行数:16,代码来源:LogParser.php

示例15: run

 public function run($username, $password, $email)
 {
     $username = WebUtils::t(rawurldecode($username));
     $password = rawurldecode($password);
     $email = rawurldecode($email);
     $res = $this->initWebApiArray();
     $res = $this->_register($res, $username, $password, $email);
     echo WebUtils::outputWebApi($res, '', false);
 }
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:9,代码来源:RegisterAction.php


注:本文中的WebUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。