private function _commentReply($res, $data)
 {
     global $_G;
     require DISCUZ_ROOT . './source/function/function_home.php';
     require_once libfile('function/portalcp');
     // 在DISCUZ_ROOT/source/include/portalcp/portalcp_comment.php基础上二次开发
     if (!checkperm('allowcommentarticle')) {
         return $this->makeErrorInfo($res, 'group_nopermission', array('{grouptitle}' => $_G['group']['grouptitle']), array('login' => 1));
     }
     switch ($data['idType']) {
         case 'aid':
             $_POST['aid'] = $data['id'];
             break;
         case 'tid':
             $_POST['topicid'] = $data['id'];
             break;
         default:
             return $this->makeErrorInfo($res, 'mobcent_error_params');
     }
     $id = 0;
     $idtype = '';
     if (!empty($_POST['aid'])) {
         $id = intval($_POST['aid']);
         $idtype = 'aid';
     } elseif (!empty($_POST['topicid'])) {
         $id = intval($_POST['topicid']);
         $idtype = 'topicid';
     }
     // 获取评论内容
     $_POST['message'] = $commentText = '';
     foreach ($data['content'] as $line) {
         $line['type'] = $this->_transCommentType($line['type']);
         // 引用评论
         if (isset($data['quoteCommentId']) && $data['quoteCommentId'] > 0) {
             $quoteComment = DzPortalComment::getCommentById($data['quoteCommentId']);
             if (!empty($quoteComment)) {
                 $commentText .= $this->_getCommentMessage($quoteComment);
             }
         }
         if ($line['type'] == 'text') {
             $line['infor'] = rawurldecode($line['infor']);
             $commentText .= WebUtils::t($line['infor']);
         }
     }
     $_POST['message'] = $commentText;
     $message = $_POST['message'];
     require_once libfile('function/spacecp');
     if (($checkMessage = mobcent_cknewuser()) != '') {
         return $this->makeErrorInfo($res, WebUtils::emptyHtml($checkMessage));
     }
     $waittime = interval_check('post');
     if ($waittime > 0) {
         return $this->makeErrorInfo($res, 'operating_too_fast', array('{waittime}' => $waittime), array('return' => true));
     }
     $retmessage = addportalarticlecomment($id, $message, $idtype);
     return $this->makeErrorInfo($res, $retmessage, array('noError' => $retmessage == 'do_success' ? 1 : 0));
 }
Example #2
0
 private function _pmSend($res, $data)
 {
     global $_G;
     $touid = (int) $data['toUid'];
     $pmid = (int) $data['pmid'];
     $_GET['topmuid'] = $touid;
     $_POST['message'] = $this->_transMessage($data['msg']);
     $_POST['subject'] = '';
     $users = array();
     $type = 0;
     $waittime = interval_check('post');
     if ($waittime > 0) {
         // showmessage('message_can_not_send_2', '', array(), array('return' => true));
         return $this->makeErrorInfo($res, lang('message', 'message_can_not_send_2'));
     }
     if (($checkMessage = mobcent_cknewuser()) != '') {
         return $this->makeErrorInfo($res, WebUtils::emptyHtml($checkMessage));
     }
     if (!checkperm('allowsendpm')) {
         // showmessage('no_privilege_sendpm', '', array(), array('return' => true));
         return $this->makeErrorInfo($res, 'no_privilege_sendpm');
     }
     if ($touid) {
         if (isblacklist($touid)) {
             // showmessage('is_blacklist', '', array(), array('return' => true));
             return $this->makeErrorInfo($res, lang('message', 'is_blacklist'));
         }
     }
     // !($_G['group']['exempt'] & 1) && checklowerlimit('sendpm', 0, $coef);
     $message = (!empty($_POST['messageappend']) ? $_POST['messageappend'] . "\n" : '') . trim($_POST['message']);
     if (empty($message)) {
         // showmessage('unable_to_send_air_news', '', array(), array('return' => true));
         return $this->makeErrorInfo($res, lang('message', 'unable_to_send_air_news'));
     }
     // $message = censor($message);
     loadcache(array('smilies', 'smileytypes'));
     foreach ($_G['cache']['smilies']['replacearray'] as $key => $smiley) {
         $_G['cache']['smilies']['replacearray'][$key] = '[img]' . $_G['siteurl'] . 'static/image/smiley/' . $_G['cache']['smileytypes'][$_G['cache']['smilies']['typearray'][$key]]['directory'] . '/' . $smiley . '[/img]';
     }
     $message = preg_replace($_G['cache']['smilies']['searcharray'], $_G['cache']['smilies']['replacearray'], $message);
     $subject = '';
     if ($type == 1) {
         $subject = dhtmlspecialchars(trim($_POST['subject']));
     }
     include_once libfile('function/friend');
     $return = 0;
     if ($touid || $pmid) {
         if ($touid) {
             if ($value = getuserbyuid($touid)) {
                 $value['onlyacceptfriendpm'] = $value['onlyacceptfriendpm'] ? $value['onlyacceptfriendpm'] : ($_G['setting']['onlyacceptfriendpm'] ? 1 : 2);
                 if ($_G['group']['allowsendallpm'] || $value['onlyacceptfriendpm'] == 2 || $value['onlyacceptfriendpm'] == 1 && friend_check($touid)) {
                     $return = sendpm($touid, $subject, $message, '', 0, 0, $type);
                 } else {
                     // showmessage('message_can_not_send_onlyfriend', '', array(), array('return' => true));
                     return $this->makeErrorInfo($res, lang('message', 'message_can_not_send_onlyfriend'));
                 }
             } else {
                 // showmessage('message_bad_touid', '', array(), array('return' => true));
                 return $this->makeErrorInfo($res, lang('message', 'message_bad_touid'));
             }
         } else {
             $topmuid = intval($_GET['topmuid']);
             $return = sendpm($topmuid, $subject, $message, '', $pmid, 0);
         }
     } elseif ($users) {
         $newusers = $uidsarr = $membersarr = array();
         if ($users) {
             $membersarr = C::t('common_member')->fetch_all_by_username($users);
             foreach ($membersarr as $aUsername => $aUser) {
                 $uidsarr[] = $aUser['uid'];
             }
         }
         if (empty($membersarr)) {
             showmessage('message_bad_touser', '', array(), array('return' => true));
         }
         if (isset($membersarr[$_G['uid']])) {
             showmessage('message_can_not_send_to_self', '', array(), array('return' => true));
         }
         friend_check($uidsarr);
         foreach ($membersarr as $key => $value) {
             $value['onlyacceptfriendpm'] = $value['onlyacceptfriendpm'] ? $value['onlyacceptfriendpm'] : ($_G['setting']['onlyacceptfriendpm'] ? 1 : 2);
             if ($_G['group']['allowsendallpm'] || $value['onlyacceptfriendpm'] == 2 || $value['onlyacceptfriendpm'] == 1 && $_G['home_friend_' . $value['uid'] . '_' . $_G['uid']]) {
                 $newusers[$value['uid']] = $value['username'];
                 unset($users[array_search($value['username'], $users)]);
             }
         }
         if (empty($newusers)) {
             showmessage('message_can_not_send_onlyfriend', '', array(), array('return' => true));
         }
         foreach ($newusers as $key => $value) {
             if (isblacklist($key)) {
                 showmessage('is_blacklist', '', array(), array('return' => true));
             }
         }
         $coef = count($newusers);
         $return = sendpm(implode(',', $newusers), $subject, $message, '', 0, 1, $type);
     } else {
         // showmessage('message_can_not_send_9', '', array(), array('return' => true));
         return $this->makeErrorInfo($res, lang('message', 'message_can_not_send_9'));
     }
     if ($return > 0) {
         include_once libfile('function/stat');
         updatestat('sendpm', 0, $coef);
         C::t('common_member_status')->update($_G['uid'], array('lastpost' => TIMESTAMP));
         !($_G['group']['exempt'] & 1) && updatecreditbyaction('sendpm', 0, array(), '', $coef);
         if (!empty($newusers)) {
             if ($type == 1) {
                 $returnurl = 'home.php?mod=space&do=pm&filter=privatepm';
             } else {
                 $returnurl = 'home.php?mod=space&do=pm';
             }
             showmessage(count($users) ? 'message_send_result' : 'do_success', $returnurl, array('users' => implode(',', $users), 'succeed' => count($newusers)));
         } else {
             if (!defined('IN_MOBILE')) {
                 // showmessage('do_success', 'home.php?mod=space&do=pm&subop=view&touid='.$touid, array('pmid' => $return), $_G['inajax'] ? array('msgtype' => 3, 'showmsg' => false) : array());
             } else {
                 // showmessage('do_success', 'home.php?mod=space&do=pm&subop=view'.(intval($_POST['touid']) ? '&touid='.intval($_POST['touid']) : ( intval($_POST['plid']) ? '&plid='.intval($_POST['plid']).'&daterange=1&type=1' : '' )));
             }
             $res = $this->makeErrorInfo($res, 'do_success', array('noError' => 1, 'alert' => 0));
             $msgInfo = uc_pm_viewnode($_G['uid'], $type, $return);
             $res['body']['plid'] = (int) $msgInfo['plid'];
             $res['body']['pmid'] = (int) $msgInfo['pmid'];
             $res['body']['sendTime'] = $msgInfo['dateline'] . '000';
             // ios push
             UserUtils::pushIOSMessage($touid, 'pm', $_G['username'] . WebUtils::t(' 对 您 说: ') . $message);
         }
     } else {
         if (in_array($return, range(-16, -1))) {
             // showmessage('message_can_not_send_'.abs($return));
             return $this->makeErrorInfo($res, lang('message', 'message_can_not_send_' . abs($return)));
         } else {
             // showmessage('message_can_not_send', '', array(), array('return' => true));
             return $this->makeErrorInfo($res, lang('message', 'message_can_not_send'));
         }
     }
     return $res;
 }
Example #3
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;
 }
 private function _userFavoriteSetting($res, $id, $idType)
 {
     global $_G;
     $uid = $_G['uid'];
     if (($checkMessage = mobcent_cknewuser()) != '') {
         return $this->makeErrorInfo($res, WebUtils::emptyHtml($checkMessage));
     }
     $spaceuid = empty($_GET['spaceuid']) ? 0 : intval($_GET['spaceuid']);
     $title = '';
     switch ($idType) {
         case 'tid':
             $idType = 'tid';
             $thread = C::t('forum_thread')->fetch($id);
             $title = $thread['subject'];
             break;
         case 'fid':
             $idType = 'fid';
             $foruminfo = C::t('forum_forum')->fetch($id);
             loadcache('forums');
             $forum = $_G['cache']['forums'][$id];
             if (!$forum['viewperm'] || $forum['viewperm'] && forumperm($forum['viewperm']) || strstr($forum['users'], "\t{$_G['uid']}\t")) {
                 $title = $foruminfo['status'] != 3 ? $foruminfo['name'] : '';
                 // $icon = '<img src="static/image/feed/discuz.gif" alt="forum" class="vm" /> ';
             }
             break;
         case 'blog':
             $idType = 'blogid';
             $bloginfo = C::t('home_blog')->fetch($id);
             $title = $bloginfo['uid'] == $spaceuid ? $bloginfo['subject'] : '';
             break;
         case 'group':
             $idType = 'gid';
             $foruminfo = C::t('forum_forum')->fetch($id);
             $title = $foruminfo['status'] == 3 ? $foruminfo['name'] : '';
             break;
         case 'album':
             $idType = 'albumid';
             $result = C::t('home_album')->fetch($id, $spaceuid);
             $title = $result['albumname'];
             break;
         case 'space':
             $idType = 'uid';
             $_member = getuserbyuid($id);
             $title = $_member['username'];
             $unset($_member);
             break;
         case 'article':
             $idType = 'aid';
             $article = C::t('portal_article_title')->fetch($id);
             $title = $article['title'];
             break;
         default:
             break;
     }
     if (empty($title)) {
         return $this->makeErrorInfo($res, 'favorite_cannot_favorite');
     } else {
         $fav = C::t('home_favorite')->fetch_by_id_idtype($id, $idType, $uid);
         if ($fav) {
             $res = $this->makeErrorInfo($res, 'favorite_repeat');
         } else {
             $description = '';
             $description_show = nl2br($description);
             $fav_count = C::t('home_favorite')->count_by_id_idtype($id, $idType);
             require_once libfile('function/home');
             $description = WebUtils::t('用手机客户端收藏');
             $arr = array('uid' => intval($uid), 'idtype' => $idType, 'id' => $id, 'spaceuid' => $thread['authorid'], 'title' => getstr($title, 255), 'description' => getstr($description, '', 0, 0, 1), 'dateline' => TIMESTAMP);
             $favid = C::t('home_favorite')->insert($arr, true);
             if ($_G['setting']['cloud_status']) {
                 $favoriteService = Cloud::loadClass('Service_Client_Favorite');
                 $favoriteService->add($arr['uid'], $favid, $arr['id'], $arr['idtype'], $arr['title'], $arr['description'], TIMESTAMP);
             }
             switch ($idType) {
                 case 'tid':
                     C::t('forum_thread')->increase($id, array('favtimes' => 1));
                     require_once libfile('function/forum');
                     update_threadpartake($id);
                     break;
                 case 'fid':
                     C::t('forum_forum')->update_forum_counter($id, 0, 0, 0, 0, 1);
                     // $extrajs = '<script type="text/javascript">$("number_favorite_num").innerHTML = parseInt($("number_favorite_num").innerHTML)+1;$("number_favorite").style.display="";</script>';
                     dsetcookie('nofavfid', '', -1);
                     break;
                 case 'blog':
                     C::t('home_blog')->increase($id, $spaceuid, array('favtimes' => 1));
                     break;
                 case 'group':
                     C::t('forum_forum')->update_forum_counter($id, 0, 0, 0, 0, 1);
                     break;
                 case 'album':
                     C::t('home_album')->update_num_by_albumid($id, 1, 'favtimes', $spaceuid);
                     break;
                 case 'space':
                     C::t('common_member_status')->increase($id, array('favtimes' => 1));
                     break;
                 case 'article':
                     C::t('portal_article_count')->increase($id, array('favtimes' => 1));
                     break;
                 default:
                     break;
             }
             $params['noError'] = 1;
             $res = $this->makeErrorInfo($res, 'favorite_do_success', $params);
         }
     }
     return $res;
 }