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


PHP WebUtils::checkError方法代码示例

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


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

示例1: _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

示例2: run

 public function run($json)
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     // $json = "{'id': 1, 'idType': 'aid', 'page': 1, 'pageSize': 10, }";
     $json = rawurldecode($json);
     $json = WebUtils::jsonDecode($json);
     $res = $this->_checkComment($res, $json);
     if (!WebUtils::checkError($res)) {
         $comments = $this->getCommentList($json);
         $res['body']['list'] = $comments['list'];
         $res = array_merge($res, WebUtils::getWebApiArrayWithPage($res, $json['page'], $json['pageSize'], $comments['count']));
     }
     echo WebUtils::outputWebApi($res, '', false);
 }
开发者ID:caidongyun,项目名称:CS,代码行数:14,代码来源:CommentListAction.php

示例3: _viewRate

    private function _viewRate($res, $tid, $pid)
    {
        $res = $this->_checkRate($res, $tid, $pid);
        $status = WebUtils::checkError($res);
        $location = WebUtils::createUrl_oldVersion('index/returnmobileview');
        if ($status) {
            $str = <<<HTML
            <script>
                alert("{$res['head']['errInfo']}");
                location.href = "{$location}";
            </script>
HTML;
            echo $str;
            exit;
        }
        // [add]修复gbk编码导致的评分理由不显示。Author:HanPengyu Data:04.09.27
        if (!empty($_POST)) {
            // 把$_POST转成utf-8, 这是由于discuz源码会在mobile情况下把$_POST预先转码成对应的charset,
            $_POST = array_intersect_key($_REQUEST, $_POST);
            // 手动把转成utf-8的$_POST数据再次转成对应的charset
            foreach ($_POST as $key => $value) {
                if (is_string($value)) {
                    $_POST[$key] = WebUtils::t($value);
                }
            }
            $_GET = array_merge($_GET, $_POST);
        }
        global $_G;
        require_once libfile('function/misc');
        require_once libfile('function/forum');
        //今日剩余积分
        $maxratetoday = $this->_getratingleft($_G['group']['raterange']);
        $post = C::t('forum_post')->fetch('tid:' . $tid, $pid);
        $thread = C::t('forum_thread')->fetch($tid);
        if (!empty($_POST)) {
            $reason = checkreasonpm();
            $rate = $ratetimes = 0;
            $creditsarray = $sub_self_credit = array();
            getuserprofile('extcredits1');
            foreach ($_G['group']['raterange'] as $id => $rating) {
                $score = intval($_GET['score' . $id]);
                if (isset($_G['setting']['extcredits'][$id]) && !empty($score)) {
                    if ($rating['isself'] && intval($_G['member']['extcredits' . $id]) - $score < 0) {
                        //抱歉,您的{extcreditstitle}(评分栏目)不足,无法评分
                        $errorMsg = lang('message', 'thread_rate_range_self_invalid', array('extcreditstitle' => $_G['setting']['extcredits'][$id]['title']));
                        $this->_renderTemplates($tid, $pid, $errorMsg);
                        exit;
                    }
                    if (abs($score) <= $maxratetoday[$id]) {
                        if ($score > $rating['max'] || $score < $rating['min']) {
                            //请输入正确的分值
                            $errorMsg = lang('message', 'thread_rate_range_invalid');
                            $this->_renderTemplates($tid, $pid, $errorMsg);
                            exit;
                        } else {
                            $creditsarray[$id] = $score;
                            if ($rating['isself']) {
                                $sub_self_credit[$id] = -abs($score);
                            }
                            $rate += $score;
                            $ratetimes += ceil(max(abs($rating['min']), abs($rating['max'])) / 5);
                        }
                    } else {
                        //抱歉,24 小时评分数超过限制
                        $errorMsg = lang('message', 'thread_rate_ctrl');
                        $this->_renderTemplates($tid, $pid, $errorMsg);
                        exit;
                    }
                }
            }
            if (!$creditsarray) {
                //请输入正确的分值
                $errorMsg = lang('message', 'thread_rate_range_invalid');
                $this->_renderTemplates($tid, $pid, $errorMsg);
                exit;
            }
            updatemembercount($post['authorid'], $creditsarray, 1, 'PRC', $_GET['pid']);
            if (!empty($sub_self_credit)) {
                updatemembercount($_G['uid'], $sub_self_credit, 1, 'RSC', $_GET['pid']);
            }
            C::t('forum_post')->increase_rate_by_pid('tid:' . $_G['tid'], $_GET['pid'], $rate, $ratetimes);
            if ($post['first']) {
                $threadrate = intval(@($post['rate'] + $rate) / abs($post['rate'] + $rate));
                C::t('forum_thread')->update($_G['tid'], array('rate' => $threadrate));
            }
            require_once libfile('function/discuzcode');
            $sqlvalues = $comma = '';
            $sqlreason = censor(trim($_GET['reason']));
            $sqlreason = cutstr(dhtmlspecialchars($sqlreason), 40, '.');
            foreach ($creditsarray as $id => $addcredits) {
                $insertarr = array('pid' => $_GET['pid'], 'uid' => $_G['uid'], 'username' => $_G['username'], 'extcredits' => $id, 'dateline' => $_G['timestamp'], 'score' => $addcredits, 'reason' => $sqlreason);
                C::t('forum_ratelog')->insert($insertarr);
            }
            include_once libfile('function/post');
            $_G['forum']['threadcaches'] && @deletethreadcaches($_G['tid']);
            $reason = dhtmlspecialchars(censor(trim($reason)));
            //对是否通知作者做的一些初始工作
            if ($_G['group']['resasonpm'] == 2 || $_G['group']['reasonpm'] == 3 || !empty($_GET['sendreasonpm'])) {
                $forumname = strip_tags($_G['forum']['name']);
                $sendreasonpm = 1;
//.........这里部分代码省略.........
开发者ID:frogoscar,项目名称:mobcent-discuz,代码行数:101,代码来源:TopicRateAction.php


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