public function run($tid, $act = 'apply')
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     $uid = $this->getController()->uid;
     // $_REQUEST['json'] = "{'payment':1,'payvalue':100, 'realname': '请求参数11', 'qq': '8', 'message': '请求参数'}";
     $json = isset($_REQUEST['json']) ? $_REQUEST['json'] : '';
     $json = rawurldecode($json);
     $data = WebUtils::jsonDecode($json);
     if (!empty($data)) {
         foreach ($data as $key => $value) {
             if (is_string($value)) {
                 $data[$key] = WebUtils::t($value);
             }
         }
         switch ($act) {
             case 'apply':
                 $res = $this->_applyActivityTopic($res, $tid, $uid, $data);
                 break;
             case 'cancel':
                 $res = $this->_cancelActivityTopic($res, $tid, $uid, $data);
                 break;
             default:
                 $res = $this->_makeErrorInfo($res, 'activity_apply_params_error');
                 break;
         }
     } else {
         $res = $this->_makeErrorInfo($res, 'activity_apply_params_error');
     }
     echo WebUtils::outputWebApi($res, '', false);
 }
 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));
 }
 public function run($attachment)
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     $uid = $this->getController()->uid;
     // $attachment ="{'head': {'errCode': 0, 'errInfo': ''}, 'body': {'attachment': {'name': 'test', 'isPost': 1, 'data': 'ss', 'type': 'image', 'module':'forum'}, 'externInfo': {}}}";
     $attachment = rawurldecode($attachment);
     $attachment = WebUtils::jsonDecode($attachment);
     $attachment = isset($attachment['body']['attachment']) ? $attachment['body']['attachment'] : array();
     !isset($attachment['module']) && ($attachment['module'] = 'forum');
     $resAttachment = false;
     if (!empty($attachment)) {
         if ($attachment['isPost'] == 1) {
             if (($data = file_get_contents('php://input')) === false) {
                 $attachment['data'] = $GLOBALS['HTTP_RAW_POST_DATA'];
             } else {
                 $attachment['data'] = $data;
             }
         }
         // $attachment['data'] = WebUtils::httpRequest('http://bbs.appbyme.com/static/image/common/logo.png');// test
         $resAttachment = $this->_saveAttachment($uid, $attachment);
     }
     if ($resAttachment === false) {
         $attachmentTypes = array('audio' => WebUtils::t('语音'), 'image' => WebUtils::t('图片'));
         $res = WebUtils::makeErrorInfo_oldVersion($res, 'UPLOAD_ATTACHMENT_ERROR', array('{attachment}' => $attachmentTypes[$attachment['type']]));
     } else {
         $res['body']['attachment'] = $resAttachment;
     }
     echo WebUtils::outputWebApi($res, '', false);
 }
Example #4
0
 public function run($share)
 {
     $res = $this->initWebApiArray();
     // $share = "{'body': {'shareInfo': {'shareId':8,'shareType': 'news'}}}";
     $share = rawurldecode($share);
     $shareInfo = WebUtils::jsonDecode($share);
     $res['body']['shareData'] = $this->_getShareData($shareInfo);
     echo WebUtils::outputWebApi($res, '', false);
 }
Example #5
0
 private function _getForWardInfo($params)
 {
     $_GET = array_merge($_GET, $params);
     ob_start();
     $this->getController()->forward('user/userlist', false);
     $res = ob_get_clean();
     $list = WebUtils::jsonDecode($res);
     return $list['list'];
 }
Example #6
0
 public function run($json)
 {
     $res = $this->initWebApiArray();
     $json = rawurldecode($json);
     $json = WebUtils::jsonDecode($json);
     !isset($json['page']) && ($json['page'] = 1);
     !isset($json['pageSize']) && ($json['pageSize'] = 10);
     $res = $this->_getResult($res, $json);
     echo WebUtils::outputWebApi($res, '', false);
 }
Example #7
0
 public function run($pmlist)
 {
     $res = $this->initWebApiArray();
     $uid = $this->getController()->uid;
     // $pmlist ='{"body": {"pmInfos": [{"fromUid": 4, "startTime": "0", "stopTime": "0", "cacheCount": 0, "pmLimit": 10, }], "externInfo": {"onlyFromUid":0} } }';
     $pmlist = rawurldecode($pmlist);
     $pmInfos = WebUtils::jsonDecode($pmlist);
     $res['body']['userInfo'] = $this->_getUserInfo($uid);
     $res['body']['pmList'] = $this->_getPMList($uid, $pmInfos);
     echo WebUtils::outputWebApi($res, '', false);
 }
Example #8
0
 public function run($json)
 {
     $res = $this->initWebApiArray();
     // $json = '{"aid": 10, "page": 1}';
     $json = rawurldecode($json);
     $json = WebUtils::jsonDecode($json);
     !isset($json['aid']) && ($json['aid'] = 0);
     !isset($json['page']) && ($json['page'] = 1);
     $res = $this->_getResult($res, (int) $json['aid'], (int) $json['page']);
     echo WebUtils::outputWebApi($res, '', false);
 }
Example #9
0
 public function run($json)
 {
     $res = $this->initWebApiArray();
     $json = rawurldecode($json);
     $json = WebUtils::jsonDecode($json);
     !isset($json['action']) && ($json['action'] = 'send');
     !isset($json['toUid']) && ($json['toUid'] = 0);
     !isset($json['plid']) && ($json['plid'] = 0);
     !isset($json['pmid']) && ($json['pmid'] = 0);
     $res = $this->_pmAdmin($res, $json);
     echo WebUtils::outputWebApi($res, '', false);
 }
 public function run($setting)
 {
     $res = $this->initWebApiArray();
     $uid = $this->getController()->uid;
     // test
     // $setting ='{"head": {"errCode": 0, "errInfo": ""}, "body": {"settingInfo": {"hidden": 0}, "externInfo": {}}}';
     $settings = rawurldecode($setting);
     $settings = WebUtils::jsonDecode($settings);
     $settings = !empty($settings) ? $settings['body']['settingInfo'] : array();
     // insert or update new settings
     AppbymeUserSetting::saveNewSettings($uid, $settings);
     echo WebUtils::outputWebApi($res, '', false);
 }
 private function _doNewApp($res, $appKey, $test)
 {
     // $url = 'http://192.168.1.211:9797/mobcentACA/app/wAMkQjefj3HPHsrfCk/profile';
     $url = 'http://www.appbyme.com/mobcentACA/app/' . $appKey . '/profile';
     $temRes = WebUtils::httpRequest($url, 30);
     $temRes = WebUtils::jsonDecode($temRes);
     $appInfo = array('appName' => WebUtils::t($temRes['appName']), 'appAuthor' => WebUtils::t($temRes['appAuthor']), 'appDescribe' => WebUtils::t($temRes['appDescribtion']), 'appVersion' => WebUtils::t($temRes['appVersion']), 'appIcon' => $temRes['appIcon'], 'appImage' => $temRes['appCover'], 'appContentId' => $temRes['contentId'], 'appDownloadUrl' => array('android' => $temRes['apkUrl'], 'apple' => $temRes['ipaUrl'], 'appleMobile' => $temRes['plistUrl']), 'appQRCode' => array('android' => $temRes['qrcode'], 'apple' => $temRes['qrcode']));
     if ($test == 0) {
         AppbymeConfig::saveDownloadOptions($appInfo);
         AppbymeConfig::saveForumkey($temRes['forumKey']);
     }
     return $res;
 }
Example #12
0
 private function _getWeatherConfig()
 {
     $weather = array('allowUsage' => 1, 'allowCityQuery' => 1);
     $forumKey = isset($_GET['forumKey']) ? $_GET['forumKey'] : '';
     $platType = isset($_GET['platType']) ? $_GET['platType'] : APP_TYPE_ANDROID;
     $url = 'http://sdk.mobcent.com/baikesdk/phpapi/settings';
     // $url = 'http://192.168.1.213/forum/phpapi/settings';
     $url .= sprintf('?forumKey=%s&platType=%s&gzip=false', $forumKey, $platType);
     $res = WebUtils::httpRequest($url, 10);
     $res = WebUtils::jsonDecode($res);
     isset($res['data']['weather']['show_weather']) && ($weather['allowUsage'] = (int) $res['data']['weather']['show_weather']);
     isset($res['data']['weather']['city_query_setting']) && ($weather['allowCityQuery'] = (int) $res['data']['weather']['city_query_setting']);
     return $weather;
 }
Example #13
0
 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);
 }
 public function run($json)
 {
     $res = WebUtils::initWebApiArray_oldVersion();
     // $json = "{'action': 'reply', 'idType': 'aid', 'id': 1, 'content': [{'type': 0, 'infor': '呵呵\r\nhaha%25E5%2591%25B5%25E5%2591%25B5%25E2%2580%259C%25E2%2580%259D%2522%2522',}], 'quoteCommentId': 12, }";
     $json = rawurldecode($json);
     $json = WebUtils::jsonDecode($json);
     !isset($json['action']) && ($json['action'] = 'reply');
     !isset($json['idType']) && ($json['idType'] = 'aid');
     switch ($json['action']) {
         case 'reply':
             $res = $this->_commentReply($res, $json);
             break;
         default:
             $res = WebUtils::makeErrorInfo_oldVersion($res, 'mobcent_error_params');
             break;
     }
     echo WebUtils::outputWebApi($res, '', false);
 }
 protected function runWithCache($key, $params = array())
 {
     $page = $params['page'];
     $fid = $params['fid'];
     $res = array();
     $cache = $this->getCacheInfo();
     if (!$cache['enable'] || ($res = Yii::app()->cache->get($key)) === false) {
         // var_dump('no cache');
         if ($params['sort'] == 'photo') {
             $_GET = array_merge($_GET, $params);
             ob_start();
             $this->getController()->forward('forum/photogallery', false);
             $res = WebUtils::jsonDecode(ob_get_clean());
             $res = WebUtils::outputWebApi($res, 'utf-8', false);
         } else {
             $res = WebUtils::outputWebApi($this->getResult($params), '', false);
         }
         if ($page == 1) {
             if ($fid > 0 && $sort != 'top') {
                 $sql = '
                     SELECT lastpost
                     FROM %t
                     WHERE fid=%d
                     ';
                 $params = array('forum_forum', $fid);
             } else {
                 $sql = '
                     SELECT MAX(dateline)
                     FROM %t
                     ';
                 $params = array('forum_post');
             }
             $dep = new DiscuzDbCacheDependency($sql, $params);
             if ($cache['enable']) {
                 Yii::app()->cache->set($key, $res, $cache['expire'], $dep);
             }
         }
     }
     echo $res;
 }
 public function run($tid, $act = 'apply')
 {
     $data = TopicUtils::getActivityInfo($tid);
     $data = $data['action']['info'];
     $errorMsg = '';
     if (!empty($_POST)) {
         // discuz 源码会在mobile情况下把POST的数据转码成对应的charset,
         // 由于这里需要强制使用utf-8,且dz本身并没有修改$_REQUEST变量
         $_POST = array_intersect_key($_REQUEST, $_POST);
         $requestData = WebUtils::jsonEncode($_POST, 'utf-8');
         $res = WebUtils::httpRequestAppAPI('forum/topicactivity', array('tid' => $tid, 'act' => $act, 'json' => rawurlencode($requestData)));
         if (($res = WebUtils::jsonDecode($res)) != false && $res['head']['errCode'] == MOBCENT_ERROR_NONE) {
             $this->getController()->redirect(WebUtils::createUrl_oldVersion('index/returnmobileview'));
         }
         if ($res != false) {
             $errorMsg = $res['head']['errInfo'];
         }
     }
     // render
     $viewFile = 'topicActivity';
     $this->getController()->renderPartial($viewFile, array('data' => $data, 'errorMsg' => $errorMsg, 'formUrl' => WebUtils::createUrl_oldVersion('forum/topicactivityview', array('tid' => $tid, 'act' => $act))));
 }
Example #17
0
 public static function filterComponent($component)
 {
     $tempComponent = $component;
     // 临时处理
     if ($component['type'] == AppbymeUIDiyModel::COMPONENT_TYPE_FORUMLIST) {
         $tempComponent['extParams']['forumId'] = 0;
     }
     $tempComponent['style'] = self::_filterStyle($component['style']);
     $tempComponent['extParams']['subListStyle'] = self::_filterStyle($component['extParams']['subListStyle']);
     $tempComponent['extParams']['subDetailViewStyle'] = self::_filterStyle($component['extParams']['subDetailViewStyle']);
     // 转换componentList结构
     $tempComponentList = array();
     if ($tempComponent['style'] == AppbymeUIDiyModel::COMPONENT_STYLE_LAYOUT_NEWS_AUTO && count($tempComponent['componentList']) > 0 && $tempComponent['componentList'][0]['type'] == AppbymeUIDiyModel::COMPONENT_TYPE_NEWSLIST) {
         $newslist = WebUtils::httpRequestAppAPI('portal/newslist', array('moduleId' => $tempComponent['componentList'][0]['extParams']['newsModuleId']));
         if ($newslist = WebUtils::jsonDecode($newslist)) {
             foreach ($newslist['list'] as $key => $value) {
                 $tempParam = array('title' => $value['title'], 'desc' => $value['summary'], 'icon' => $value['pic_path']);
                 if ($value['source_type'] == 'topic') {
                     $tempParam = array_merge($tempParam, array('type' => AppbymeUIDiyModel::COMPONENT_TYPE_POSTLIST, 'extParams' => array('topicId' => $value['source_id'])));
                 } else {
                     if ($value['source_type'] == 'weblink') {
                         $tempParam = array_merge($tempParam, array('type' => AppbymeUIDiyModel::COMPONENT_TYPE_WEBAPP, 'extParams' => array('redirect' => $value['redirectUrl'])));
                     } else {
                         if ($value['source_type'] == 'news') {
                             $tempParam = array_merge($tempParam, array('type' => AppbymeUIDiyModel::COMPONENT_TYPE_NEWSVIEW, 'extParams' => array('articleId' => $value['source_id'])));
                         }
                     }
                 }
                 $tempComponentList[] = array_merge(AppbymeUIDiyModel::initComponent(), $tempParam);
             }
         }
     } else {
         foreach ($tempComponent['componentList'] as $subComponent) {
             $tempComponentList[] = self::filterComponent($subComponent);
         }
     }
     $tempComponent['componentList'] = $tempComponentList;
     return $tempComponent;
 }
Example #18
0
                        <span class="glyphicon glyphicon-chevron-left"></span>
                    </a>
                    <a class="right carousel-control" href=".carousel-example-generic_one" data-slide="next">
                        <span class="glyphicon glyphicon-chevron-right"></span>
                    </a>
            </div>
            <?php 
        } elseif ($component['style'] == AppbymeUIDiyModel::COMPONENT_STYLE_LAYOUT_NEWS_AUTO) {
            ?>
                <?php 
            foreach ($component['componentList'] as $key => $comp) {
                ?>
                
                <?php 
                $newslist = WebUtils::httpRequestAppAPI('portal/newslist', array('moduleId' => $component['componentList'][0]['extParams']['newsModuleId'], 'hacker_uid' => 1));
                $newslist = WebUtils::jsonDecode($newslist);
                ?>
                    <?php 
                foreach ($newslist['list'] as $list) {
                    ?>
                    <div class="newsauto-component-item">
                        <div class="pull-left">
                            <img src="<?php 
                    echo str_replace('xgsize', 'mobcentSmallPreview', $list['pic_path']);
                    ?>
" style="width:50px;height:50px" class="img-rounded">
                        </div>
                        <div class="pull-left text-left page-main">
                            <div class="page-title"><strong><?php 
                    echo $list['title'];
                    ?>
Example #19
0
 private function _sendPostResult($jsonInfo, $act)
 {
     $res = $this->initWebApiArray();
     switch ($act) {
         case 'new':
             $res['head']['errInfo'] = WebUtils::t('发贴成功');
             break;
         case 'reply':
             $res['head']['errInfo'] = WebUtils::t('回贴成功');
             break;
         default:
             $res['head']['errInfo'] = WebUtils::t('编辑成功');
             break;
     }
     $app = Yii::app()->getController()->mobcentDiscuzApp;
     $app->loadForum($jsonInfo['fid'], $jsonInfo['tid']);
     if (($checkMessage = mobcent_cknewuser()) != '') {
         return $this->makeErrorInfo($res, WebUtils::emptyHtml($checkMessage));
     }
     require_once libfile('class/credit');
     require_once libfile('function/post');
     global $_G;
     if ($_G['forum']['simple'] & 1 || $_G['forum']['redirect']) {
         return $this->makeErrorInfo($res, lang('message', 'forum_disablepost'));
     }
     /*初始化变量*/
     $pid = 0;
     $sortid = 0;
     $typeid = 0;
     $special = 0;
     $readperm = 0;
     $_GET['tid'] = $jsonInfo['tid'];
     $_GET['fid'] = $jsonInfo['fid'];
     $_G['tid'] = $jsonInfo['tid'];
     $_GET['typeoption'] = WebUtils::jsonDecode(rawurldecode($jsonInfo['typeOption']));
     $typeInfo = array();
     foreach ($_GET['typeoption'] as $k => $v) {
         $typeInfo[$k] = WebUtils::t($v);
     }
     $_GET['typeoption'] = $typeInfo;
     $_GET['isanonymous'] = $jsonInfo['isAnonymous'];
     $_GET['hiddenreplies'] = $jsonInfo['isOnlyAuthor'];
     $_GET['usesig'] = 1;
     $_GET['allownoticeauthor'] = 1;
     if ($jsonInfo['typeId']) {
         $typeid = $jsonInfo['typeId'];
     }
     //copy dz from source/module/forum/forum_post.php
     $postinfo = array('subject' => '');
     $thread = array('readperm' => '', 'pricedisplay' => '', 'hiddenreplies' => '');
     $_G['forum_dtype'] = $_G['forum_checkoption'] = $_G['forum_optionlist'] = $tagarray = $_G['forum_typetemplate'] = array();
     if ($jsonInfo['sortId'] && $jsonInfo['sortId'] > 0) {
         $sortid = $jsonInfo['sortId'];
         require_once libfile('post/threadsorts', 'include');
     }
     /*找出哪项是图片上传项和多项选择项,拼接成所想要的数组类型*/
     $optionId = DB::fetch_all("SELECT optionid FROM " . DB::table('forum_typevar') . " WHERE sortid=%d", array($sortid));
     foreach ($optionId as $key => $value) {
         $type = DB::fetch_first("SELECT identifier,type FROM " . DB::table('forum_typeoption') . " WHERE optionid=%d", array($value['optionid']));
         if ($type['type'] == 'image') {
             $attachImg = DB::fetch_first("SELECT attachment FROM " . DB::table('forum_attachment_unused') . " WHERE aid = %d ", array($_GET['typeoption'][$type['identifier']]));
             $attachImg = $_G['setting']['attachurl'] . 'forum/' . $attachImg['attachment'];
             $_GET['typeoption'][$type['identifier']] = array('aid' => $_GET['typeoption'][$type['identifier']], 'url' => $attachImg);
         }
         if ($type['type'] == 'checkbox') {
             $_GET['typeoption'][$type['identifier']] = explode(',', $_GET['typeoption'][$type['identifier']]);
         }
     }
     require_once libfile('function/discuzcode');
     if ($act == 'edit' || $act == 'reply') {
         $thread = C::t('forum_thread')->fetch($_G['tid']);
         if (!$_G['forum_auditstatuson'] && !($thread['displayorder'] >= 0 || in_array($thread['displayorder'], array(-4, -2)) && $thread['authorid'] == $_G['uid'])) {
             $thread = array();
         }
         if (!empty($thread)) {
             if ($thread['readperm'] && $thread['readperm'] > $_G['group']['readaccess'] && !$_G['forum']['ismoderator'] && $thread['authorid'] != $_G['uid']) {
                 return WebUtils::makeErrorInfo_oldVersion($res, 'thread_nopermission', array('{readperm}' => $thread['readperm']));
             }
             $_G['fid'] = $thread['fid'];
             $special = $thread['special'];
         } else {
             return WebUtils::makeErrorInfo_oldVersion($res, 'thread_nonexistence');
         }
         if ($thread['closed'] == 1 && !$_G['forum']['ismoderator']) {
             return WebUtils::makeErrorInfo_oldVersion($res, 'post_thread_closed');
         }
     }
     if ($jsonInfo['isQuote'] && $jsonInfo['replyId'] > 0) {
         $_GET['repquote'] = $jsonInfo['replyId'];
         $language = lang('forum/misc');
         $noticeauthor = $noticetrimstr = '';
         $thaquote = C::t('forum_post')->fetch('tid:' . $_G['tid'], $_GET['repquote']);
         if (!($thaquote && ($thaquote['invisible'] == 0 || $thaquote['authorid'] == $_G['uid'] && $thaquote['invisible'] == -2))) {
             $thaquote = array();
         }
         if ($thaquote['tid'] != $_G['tid']) {
             return WebUtils::makeErrorInfo_oldVersion($res, 'reply_quotepost_error');
         }
         if (getstatus($thread['status'], 2) && $thaquote['authorid'] != $_G['uid'] && $_G['uid'] != $thread['authorid'] && $thaquote['first'] != 1 && !$_G['forum']['ismoderator']) {
             return WebUtils::makeErrorInfo_oldVersion($res, 'reply_quotepost_error');
         }
         if (!($thread['price'] && !$thread['special'] && $thaquote['first'])) {
             $quotefid = $thaquote['fid'];
             $message = $thaquote['message'];
             if ($_G['setting']['bannedmessages'] && $thaquote['authorid']) {
                 $author = getuserbyuid($thaquote['authorid']);
                 if (!$author['groupid'] || $author['groupid'] == 4 || $author['groupid'] == 5) {
                     $message = $language['post_banned'];
                 } elseif ($thaquote['status'] & 1) {
                     $message = $language['post_single_banned'];
                 }
             }
             $time = dgmdate($thaquote['dateline']);
             $message = messagecutstr($message, 100);
             $message = implode("\n", array_slice(explode("\n", $message), 0, 3));
             $thaquote['useip'] = substr($thaquote['useip'], 0, strrpos($thaquote['useip'], '.')) . '.x';
             if ($thaquote['author'] && $thaquote['anonymous']) {
                 $thaquote['author'] = lang('forum/misc', 'anonymoususer');
             } elseif (!$thaquote['author']) {
                 $thaquote['author'] = lang('forum/misc', 'guestuser') . ' ' . $thaquote['useip'];
             } else {
                 $thaquote['author'] = $thaquote['author'];
             }
             $post_reply_quote = lang('forum/misc', 'post_reply_quote', array('author' => $thaquote['author'], 'time' => $time));
             $noticeauthormsg = dhtmlspecialchars($message);
             if (!defined('IN_MOBILE')) {
                 $message = "[quote][size=2][color=#999999]{$post_reply_quote}[/color] [url=forum.php?mod=redirect&goto=findpost&pid={$_GET['repquote']}&ptid={$_G['tid']}][img]static/image/common/back.gif[/img][/url][/size]\n{$message}[/quote]";
             } else {
                 $message = "[quote][color=#999999]{$post_reply_quote}[/color]\n[color=#999999]{$message}[/color][/quote]";
             }
             $quotemessage = discuzcode($message, 0, 0);
             $noticeauthor = dhtmlspecialchars(authcode('q|' . $thaquote['authorid'], 'ENCODE'));
             $noticetrimstr = dhtmlspecialchars($message);
             $_GET['noticetrimstr'] = $noticetrimstr;
             $_GET['noticeauthor'] = $noticeauthor;
         }
     }
     //periodscheck('postbanperiods');
     if ($_G['forum']['password'] && $_G['forum']['password'] != $_G['cookie']['fidpw' . $_G['fid']]) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd');
     }
     if (empty($_G['forum']['allowview'])) {
         if (!$_G['forum']['viewperm'] && !$_G['group']['readaccess']) {
             return WebUtils::makeErrorInfo_oldVersion($res, 'group_nopermission', array('{grouptitle}' => $_G['group']['grouptitle']));
         } elseif ($_G['forum']['viewperm'] && !forumperm($_G['forum']['viewperm'])) {
             $msg = mobcent_showmessagenoperm('viewperm', $_G['fid']);
             return WebUtils::makeErrorInfo_oldVersion($res, $msg['message'], $msg['params']);
         }
     } elseif ($_G['forum']['allowview'] == -1) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'forum_access_view_disallow');
     }
     $msg = mobcent_formulaperm($_G['forum']['formulaperm']);
     if ($msg['message'] != '') {
         return WebUtils::makeErrorInfo_oldVersion($res, $msg['message'], $msg['params']);
     }
     //formulaperm($_G['forum']['formulaperm']);
     if (!$_G['adminid'] && $_G['setting']['newbiespan'] && (!getuserprofile('lastpost') || TIMESTAMP - getuserprofile('lastpost') < $_G['setting']['newbiespan'] * 60) && TIMESTAMP - $_G['member']['regdate'] < $_G['setting']['newbiespan'] * 60) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'post_newbie_span', array('{newbiespan}' => $_G['setting']['newbiespan']));
     }
     $special = $special > 0 && $special < 7 || $special == 127 ? intval($special) : 0;
     $jsonInfo['title'] = rawurldecode($jsonInfo['title']);
     $subject = isset($jsonInfo['title']) ? dhtmlspecialchars(censor(trim($jsonInfo['title']))) : '';
     $subject = !empty($subject) ? str_replace("\t", ' ', $subject) : $subject;
     $subject = WebUtils::t($subject);
     /*贴子内容处理*/
     $_GET['attachnew'] = array();
     $aid = $jsonInfo['aid'];
     if (isset($aid) && !empty($aid)) {
         $aid_Img = explode(',', $aid);
         foreach ($aid_Img as $key => $value) {
             $_GET['attachnew'][$value] = array('description' => '');
         }
     }
     $message = '';
     $i = 0;
     if ($act == 'new') {
         $act = 'newthread';
     }
     $jsonInfo['content'] = WebUtils::jsonDecode(rawurldecode($jsonInfo['content']));
     foreach ($jsonInfo['content'] as $k => $v) {
         switch ($v["type"]) {
             case 0:
                 // 解析文本的超链接
                 // @author: xjp
                 $v['infor'] = preg_replace('/(https?:\\/\\/\\S+)/i', '[url=$1]$1[/url]', $v['infor']);
                 $message .= $v["infor"] . "\r\n";
                 break;
             case 1:
                 if (empty($aid_Img)) {
                     if ($aid != 0) {
                         $message .= '[attachimg]' . $aid . '[/attachimg]';
                     } else {
                         $message .= '[img]' . $v['infor'] . '[/img]';
                     }
                 } else {
                     if ($aid_Img[$i] != 0) {
                         $message .= '[attachimg]' . $aid_Img[$i] . '[/attachimg]';
                     } else {
                         $message .= '[img]' . $v['infor'] . '[/img]';
                     }
                     $i = $i + 1;
                 }
                 $attachment = 2;
                 $message .= "\r\n";
                 break;
             case 3:
                 $message .= "[audio]" . $v["infor"] . "[/audio]";
                 break;
         }
     }
     //表情处理
     $message = $this->smilesReplace($message);
     WebUtils::getDzPluginAppbymeAppConfig('forum_allow_gbk_special') && ($message = mb_convert_encoding($message, 'HTML-ENTITIES', 'UTF-8'));
     $message = WebUtils::t($message);
     $readperm = isset($_GET['readperm']) ? intval($_GET['readperm']) : 0;
     $price = isset($_GET['price']) ? intval($_GET['price']) : 0;
     if (empty($bbcodeoff) && !$_G['group']['allowhidecode'] && !empty($message) && preg_match("/\\[hide=?\\d*\\].*?\\[\\/hide\\]/is", preg_replace("/(\\[code\\](.+?)\\[\\/code\\])/is", ' ', $message))) {
         return WebUtils::makeErrorInfo_oldVersion($res, 'post_hide_nopermission');
     }
     $modnewthreads = $modnewreplies = 0;
     if (($subject || $message) && empty($_GET['save'])) {
         $extramessage = ($special == 5 ? "\t" . $_GET['affirmpoint'] . "\t" . $_GET['negapoint'] : '') . ($special == 4 ? "\t" . $_GET['activityplace'] . "\t" . $_GET['activitycity'] . "\t" . $_GET['activityclass'] : '') . ($special == 2 ? "\t" . $_GET['item_name'] . "\t" . $_GET['item_locus'] : '') . ($_GET['typeoption'] ? "\t" . implode("\t", $_GET['typeoption']) : '') . ($_GET['polloptions'] || $_GET['polloption'] ? "\t" . implode("\t", $_GET['tpolloption'] == 2 ? explode("\n", $_GET['polloptions']) : $_GET['polloption']) : '');
         list($modnewthreads, $modnewreplies) = threadmodstatus($subject . "\t" . $message . $extramessage);
         unset($extramessage);
     }
     $urloffcheck = $usesigcheck = $smileyoffcheck = $codeoffcheck = $htmloncheck = $emailcheck = '';
     $seccodecheck = $_G['setting']['seccodestatus'] & 4 && (!$_G['setting']['seccodedata']['minposts'] || getuserprofile('posts') < $_G['setting']['seccodedata']['minposts']);
     $secqaacheck = $_G['setting']['secqaa']['status'] & 2 && (!$_G['setting']['secqaa']['minposts'] || getuserprofile('posts') < $_G['setting']['secqaa']['minposts']);
     $_G['group']['allowpostpoll'] = $_G['group']['allowpost'] && $_G['group']['allowpostpoll'] && $_G['forum']['allowpostspecial'] & 1;
     $_G['group']['allowposttrade'] = $_G['group']['allowpost'] && $_G['group']['allowposttrade'] && $_G['forum']['allowpostspecial'] & 2;
     $_G['group']['allowpostreward'] = $_G['group']['allowpost'] && $_G['group']['allowpostreward'] && $_G['forum']['allowpostspecial'] & 4;
     $_G['group']['allowpostactivity'] = $_G['group']['allowpost'] && $_G['group']['allowpostactivity'] && $_G['forum']['allowpostspecial'] & 8;
     $_G['group']['allowpostdebate'] = $_G['group']['allowpost'] && $_G['group']['allowpostdebate'] && $_G['forum']['allowpostspecial'] & 16;
     $usesigcheck = $_G['uid'] && $_G['group']['maxsigsize'] ? 'checked="checked"' : '';
     $ordertypecheck = !empty($thread['tid']) && getstatus($thread['status'], 4) ? 'checked="checked"' : '';
     $specialextra = !empty($_GET['specialextra']) ? $_GET['specialextra'] : '';
     $_G['forum']['threadplugin'] = dunserialize($_G['forum']['threadplugin']);
     $_G['group']['allowanonymous'] = $_G['forum']['allowanonymous'] || $_G['group']['allowanonymous'] ? 1 : 0;
     if ($specialextra) {
         $special = 127;
     }
     if ($act == 'newthread') {
         $policykey = 'post';
     } elseif ($act == 'reply') {
         $policykey = 'reply';
     } else {
         $policykey = '';
     }
     if ($policykey) {
         $postcredits = $_G['forum'][$policykey . 'credits'] ? $_G['forum'][$policykey . 'credits'] : $_G['setting']['creditspolicy'][$policykey];
     }
     if ($act == 'reply') {
         $allow = $this->check_allow_action($res, 'allowreply');
     } else {
         $allow = $this->check_allow_action($res, 'allowpost');
     }
     if ($allow) {
         return $allow;
     }
     if (!empty($jsonInfo['location'])) {
         $jsonInfo['location'] = WebUtils::t(rawurldecode($jsonInfo['location']));
     }
     $extract = array('modnewthreads' => $modnewthreads, 'modnewreplies' => $modnewreplies, 'thread' => $thread, 'res' => $res, 'special' => $special, 'subject' => $subject, 'message' => $message, 'jsonInfo' => $jsonInfo, 'sortid' => $sortid, 'typeid' => $typeid);
     switch ($act) {
         case 'newthread':
             $result = $this->sendPost($extract);
             break;
         case 'reply':
             $result = $this->replyPost($extract);
             break;
         case 'edit':
             $result = $this->editPost($extract);
             break;
     }
     if ($result['errcode'] != WebUtils::t('发贴成功')) {
         return $result;
     }
     $res = array_merge($result, $res);
     return $res;
 }
Example #20
0
 private function _decodeConfig($config)
 {
     $res = array();
     $tmpConfig = base64_decode($config);
     $tmpConfig = WebUtils::jsonDecode($tmpConfig);
     if (isset($tmpConfig['data']) && isset($tmpConfig['dataChecksum']) && $tmpConfig['dataChecksum'] == md5(WebUtils::jsonEncode($tmpConfig['data'], 'utf-8'))) {
         $res = $tmpConfig['data'];
     }
     return $res;
 }