private function _getImageInfoCount() { loadcache('plugin', true); $fids = ForumUtils::getForumPhotoGalleryShowFids(); $count = DzPictureSet::getImageListCount($fids); return $count; }
private function _getShareData($shareInfo) { $data = array('title' => '', 'source' => '', 'content' => array()); $shareInfo = !empty($shareInfo['body']['shareInfo']) ? $shareInfo['body']['shareInfo'] : array(); if (!empty($shareInfo)) { $sid = $shareInfo['shareId']; $type = $shareInfo['shareType']; switch ($type) { case 'topic': $info = ForumUtils::getTopicInfo($sid); $content = ForumUtils::getTopicContent($sid); $data['title'] = !empty($info['subject']) ? $info['subject'] : ''; $data['source'] = !empty($info['dateline']) ? date('Y-m-d H:i:s', $info['dateline']) : ''; $data['content'] = $this->_getPostContent($content); break; case 'news': $info = PortalUtils::getNewsInfo($sid); $content = PortalUtils::getNewsContent($info); $data['title'] = !empty($info['title']) ? $info['title'] : ''; $data['source'] = !empty($info['dateline']) ? date('Y-m-d H:i:s', $info['dateline']) : ''; $data['content'] = $this->_filterContent($content); break; default: break; } } return $data; }
private function _getInfoList($uid, $puid) { $list = array(); $topicList = array(); if ($uid == $puid) { $topicList = DzUserInfo::getFavouriteTopics($uid); } else { $topicList = DzUserInfo::getTopicsByUid($puid); } foreach ($topicList as $topic) { $topicSummary = ForumUtils::getTopicSummary((int) $topic['tid']); $tmpTopic['board_id'] = (int) $topic['fid']; $tmpTopic['board_name'] = ForumUtils::getForumName((int) $topic['fid']); $tmpTopic['topic_id'] = (int) $topic['tid']; $tmpTopic['title'] = $topic['subject']; $tmpTopic['user_id'] = (int) $topic['authorid']; $tmpTopic['lastpost'] = $topic['lastpost'] . "000"; $tmpTopic['user_nick_name'] = $topic['author']; $tmpTopic['hits'] = (int) $topic['views']; $tmpTopic['content'] = WebUtils::emptyReturnLine($topicSummary['msg'], ' '); $tmpTopic['replies'] = (int) $topic['replies']; $tmpTopic['pic_path'] = ImageUtils::getThumbImage($topicSummary['image']); $list[] = $tmpTopic; } return $list; }
private function _checkRate($res, $tid, $pid) { global $_G; // [add]通过fid获取版主的相关信息 Author:HanPengyu Data:04.09.26 $topicInfo = ForumUtils::getTopicInfo($tid); ForumUtils::initForum($topicInfo['fid']); require_once libfile('function/misc'); $_GET['tid'] = $_G['tid'] = $tid; $_GET['pid'] = $pid; //基于DISCUZ_ROOT/source/module/forum/forum_misc.php修改 if (!$_G['group']['raterange']) { //抱歉,您所在的用户组({grouptitle})无法进行此操作 return $this->makeErrorInfo($res, lang('message', 'group_nopermission', array('grouptitle' => $_G['group']['grouptitle']))); } elseif ($_G['setting']['modratelimit'] && $_G['adminid'] == 3 && !$_G['forum']['ismoderator']) { //抱歉,作为版主您只能在自己的管辖范围内评分 return $this->makeErrorInfo($res, lang('message', 'thread_rate_moderator_invalid')); } if ($_G['group']['resasonpm'] == 2 || $_G['group']['reasonpm'] == 3 || !empty($_GET['sendreasonpm'])) { $forumname = strip_tags($_G['forum']['name']); $sendreasonpm = 1; } else { $sendreasonpm = 0; } $thread = C::t('forum_thread')->fetch($_G['tid']); $post = C::t('forum_post')->fetch('tid:' . $_G['tid'], $_GET['pid']); if ($post['invisible'] != 0 || $post['authorid'] == 0) { $post = array(); } if (!$post || $post['tid'] != $thread['tid'] || !$post['authorid']) { //帖子不存在或不能被推送 return $this->makeErrorInfo($res, lang('message', 'rate_post_error')); } elseif (!$_G['forum']['ismoderator'] && $_G['setting']['karmaratelimit'] && TIMESTAMP - $post['dateline'] > $_G['setting']['karmaratelimit'] * 3600) { //抱歉,您不能对发表于 {karmaratelimit} 小时前的帖子进行评分 return $this->makeErrorInfo($res, lang('message', 'thread_rate_timelimit', array('karmaratelimit' => $_G['setting']['karmaratelimit']))); } elseif ($post['authorid'] == $_G['uid'] || $post['tid'] != $_G['tid']) { //抱歉,您不能给自己发表的帖子评分 return $this->makeErrorInfo($res, lang('message', 'thread_rate_member_invalid')); //$errorMsg = lang('message', 'thread_rate_member_invalid'); } elseif ($post['anonymous']) { //抱歉,您不能对匿名帖评分 return $this->makeErrorInfo($res, lang('message', 'thread_rate_anonymous')); } elseif ($post['status'] & 1) { //抱歉,您不能对屏蔽帖评分 return $this->makeErrorInfo($res, lang('message', 'thread_rate_banned')); } $allowrate = TRUE; if (!$_G['setting']['dupkarmarate']) { if (C::t('forum_ratelog')->count_by_uid_pid($_G['uid'], $_GET['pid'])) { //抱歉,您不能对同一个帖子重复评分 return $this->makeErrorInfo($res, lang('message', 'thread_rate_duplicate')); } } return $res; }
public static function getActivityInfo($tid) { $activity = array('image' => '', 'summary' => '', 'content' => array(), 'action' => array(), 'applyList' => array()); $activityInfo = ForumUtils::getTopicActivityInfo($tid); if (!empty($activityInfo)) { $activity['image'] = WebUtils::getHttpFileName($activityInfo['thumb']); $activity['summary'] = self::_getActivitySummary($activityInfo); $activity['action'] = self::_getActivityAction($activityInfo); $activity['applyList'] = self::_getActivityApplyList($activityInfo); $activity['applyListVerified'] = self::_getActivityApplyListVerified($activityInfo); } return $activity; }
public function actionIndex() { $newsModules = AppbymePoralModule::getModuleList(); $forumList = ForumUtils::getForumListForHtml(); $navInfo = AppbymeUIDiyModel::getNavigationInfo(true); $tempModules = AppbymeUIDiyModel::getModules(true); // 初始化默认配置 if (empty($navInfo) || empty($navInfo['navItemList']) || empty($tempModules)) { $navInfo = AppbymeUIDiyModel::initNavigation(); $tempModules = AppbymeUIDiyModel::initModules(); } // 必须存在发现导航 $hasDiscoverNavItem = false; foreach ($navInfo['navItemList'] as $navItem) { if ($navItem['moduleId'] == AppbymeUIDiyModel::MODULE_ID_DISCOVER) { $hasDiscoverNavItem = true; break; } } !$hasDiscoverNavItem && array_unshift($navInfo['navItemList'], AppbymeUIDiyModel::initNavItemDiscover()); // 必须存在发现和快发模块 $isFindDiscover = $isFindFastpost = false; $discoverModule = AppbymeUIDiyModel::initDiscoverModule(); $fastpostModule = AppbymeUIDiyModel::initFastpostModule(); $modules = array(); foreach ($tempModules as $module) { switch ($module['id']) { case AppbymeUIDiyModel::MODULE_ID_DISCOVER: if (!$isFindDiscover) { $isFindDiscover = true; $discoverModule = $module; } break; case AppbymeUIDiyModel::MODULE_ID_FASTPOST: if (!$isFindFastpost) { $isFindFastpost = true; $fastpostModule = $module; } break; default: $modules[] = $module; break; } } array_unshift($modules, $discoverModule, $fastpostModule); // 检测浏览器信息 $mobileDetect = new Mobile_Detect(); $browserInfo = $mobileDetect->version('Chrome'); $this->renderPartial('index', array('navInfo' => $navInfo, 'modules' => $modules, 'newsModules' => $newsModules, 'forumList' => $forumList, 'browserInfo' => $browserInfo, 'appLevel' => AppUtils::getAppLevel(), 'topicTypeSortInfos' => $this->_getTopicTypeSortInfos())); }
private function _transTopicList($topicList, $type) { $list = array(); global $_G; $forum = $_G['forum']; foreach ($topicList as $topic) { $tmpTopicInfo = ForumUtils::getTopicInfo((int) $topic); $topicSummary = ForumUtils::getTopicSummary((int) $topic); $topicInfo['board_id'] = (int) $tmpTopicInfo['fid']; $topicInfo['board_name'] = $fid != 0 ? $forum['name'] : ForumUtils::getForumName($tmpTopicInfo['fid']); $topicInfo['board_name'] = WebUtils::emptyHtml($topicInfo['board_name']); $topicInfo['topic_id'] = (int) $topic; $topicInfo['type_id'] = (int) $tmpTopicInfo['typeid']; $topicInfo['sort_id'] = (int) $tmpTopicInfo['sortid']; $topicInfo['title'] = WebUtils::emptyHtml($tmpTopicInfo['subject']); $topicSummary['msg'] = WebUtils::emptyReturnLine($topicSummary['msg'], ' '); $topicInfo['subject'] = $topicSummary['msg']; $topicInfo['user_id'] = (int) $tmpTopicInfo['authorid']; if ($type = 'favorite' && empty($tmpTopicInfo['author'])) { $dateline = UserTopicInfo::getUserfavorite($_G['uid'], $topic); $topicInfo['last_reply_date'] = $dateline . '000'; $topicInfo['user_nick_name'] = UserUtils::getUserName($dateline['uid']); } else { $topicInfo['last_reply_date'] = $tmpTopicInfo['dateline'] . '000'; $topicInfo['user_nick_name'] = (string) $tmpTopicInfo['author']; } $topicInfo['hits'] = (int) $tmpTopicInfo['views']; $topicInfo['replies'] = (int) $tmpTopicInfo['replies']; $topicInfo['top'] = (int) ForumUtils::isTopTopic($topic) ? 1 : 0; $topicInfo['status'] = (int) $tmpTopicInfo['status']; $topicInfo['essence'] = (int) $tmpTopicInfo['digest'] ? 1 : 0; $topicInfo['hot'] = (int) $tmpTopicInfo['highlight'] ? 1 : 0; $topicInfo['pic_path'] = ImageUtils::getThumbImage($topicSummary['image']); $list[] = $topicInfo; } return $list; }
private function _getPicList($mid) { $portals = AppbymePortalModuleSource::getPortalByMid($mid, 2); $piclist = array(); foreach ($portals as $portal) { $pic_path = ImageUtils::getThumbImage(WebUtils::getHttpFileName($portal['imgurl'])); if ($portal['idtype'] == 'tid') { $topicinfo = ForumUtils::getTopicInfo($portal['id']); $piclist[] = $this->_fieldPicList($topicinfo['fid'], 'topic', $portal['id'], $portal['title'], $pic_path); } elseif ($portal['idtype'] == 'aid') { $piclist[] = $this->_fieldPicList(0, 'news', $portal['id'], $portal['title'], $pic_path); } elseif ($portal['idtype'] == 'url') { $piclist[] = $this->_fieldPicList(0, 'weblink', $portal['id'], $portal['title'], $pic_path, $portal['url']); } elseif ($portal['idtype'] == 'bid') { $piclist = array_merge($piclist, $this->_getPicByBid($portal['id'])); } } return $piclist; }
private function _filterContent($content) { $typeMaps = array('text' => 0, 'image' => 1, 'video' => 2, 'audio' => 3, 'url' => 4, 'attachment' => 5); $newContent = array(); foreach ($content as $value) { $tempContent['infor'] = $value['content']; $tempContent['type'] = $typeMaps[$value['type']]; switch ($value['type']) { case 'image': $tempContent['originalInfo'] = $value['content']; $tempContent['aid'] = isset($value['extraInfo']['aid']) ? $value['extraInfo']['aid'] : 0; $tempContent['infor'] = ImageUtils::getThumbImage($value['content']); break; case 'url': $tempContent['infor'] = $value['content']; $tempContent['url'] = $value['extraInfo']['url']; break; case 'attachment': $tempContent['infor'] = $value['content']; $tempContent['url'] = $value['extraInfo']['url']; $tempContent['desc'] = $value['extraInfo']['desc']; break; case 'video': $videoInfo = ForumUtils::parseVideoUrl($value['content']); $tempContent['extParams'] = array('videoType' => $videoInfo['type'], 'videoId' => $videoInfo['vid']); break; default: break; } // 判定是否开启附件下载 if (!WebUtils::getDzPluginAppbymeAppConfig('forum_allow_attachment') && $tempContent['type'] == 5) { $tempContent = array(); } !empty($tempContent) && ($newContent[] = $tempContent); } return $newContent; }
public function run($tid, $pid) { $res = ForumUtils::rateList($tid, $pid); $this->getController()->renderPartial('rateListView', array('loglist' => $res['loglist'], 'logcount' => $res['logcount'])); }
private function sendPost($extract) { global $_G; extract($extract); // 获取主题和帖子要插入的状态信息 $topicStatus = ForumUtils::getPostSendStatus('topic', $_GET['platType']); $postStatus = ForumUtils::getPostSendStatus('post', $_GET['platType']); //copy from dz source/include/post/post_newthread.php if (empty($_G['forum']['fid']) || $_G['forum']['type'] == 'group') { return WebUtils::makeErrorInfo_oldVersion($res, 'forum_nonexistence'); } if ($special == 1 && !$_G['group']['allowpostpoll'] || $special == 2 && !$_G['group']['allowposttrade'] || $special == 3 && !$_G['group']['allowpostreward'] || $special == 4 && !$_G['group']['allowpostactivity'] || $special == 5 && !$_G['group']['allowpostdebate']) { return WebUtils::makeErrorInfo_oldVersion($res, 'group_nopermission', array('{grouptitle}' => $_G['group']['grouptitle'])); } if (!$_G['uid'] && !(!$_G['forum']['postperm'] && $_G['group']['allowpost'] || $_G['forum']['postperm'] && forumperm($_G['forum']['postperm']))) { if (!defined('IN_MOBILE')) { return WebUtils::makeErrorInfo_oldVersion($res, 'postperm_login_nopermission', array('{login}' => 1)); } else { return WebUtils::makeErrorInfo_oldVersion($res, 'postperm_login_nopermission_mobile', array('{login}' => 1)); } } elseif (empty($_G['forum']['allowpost'])) { if (!$_G['forum']['postperm'] && !$_G['group']['allowpost']) { return WebUtils::makeErrorInfo_oldVersion($res, 'postperm_none_nopermission'); } elseif ($_G['forum']['postperm'] && !forumperm($_G['forum']['postperm'])) { $msg = mobcent_showmessagenoperm('postperm', $_G['fid'], $_G['forum']['formulaperm']); return WebUtils::makeErrorInfo_oldVersion($res, $msg['message'], $msg['params']); } } elseif ($_G['forum']['allowpost'] == -1) { return WebUtils::makeErrorInfo_oldVersion($res, 'post_forum_newthread_nopermission'); } if (!$_G['uid'] && ($_G['setting']['need_avatar'] || $_G['setting']['need_email'] || $_G['setting']['need_friendnum'])) { return WebUtils::makeErrorInfo_oldVersion($res, 'postperm_login_nopermission'); } if (trim($subject) == '') { return WebUtils::makeErrorInfo_oldVersion($res, 'post_sm_isnull'); } if (!$sortid && !$special && trim($message) == '') { return WebUtils::makeErrorInfo_oldVersion($res, 'post_sm_isnull'); } if ($post_invalid = checkpost($subject, $message, $special || $sortid)) { return WebUtils::makeErrorInfo_oldVersion($res, $post_invalid, array('{minpostsize}' => $_G['setting']['minpostsize'], '{maxpostsize}' => $_G['setting']['maxpostsize'])); //showmessage($post_invalid, '', array('minpostsize' => $_G['setting']['minpostsize'], 'maxpostsize' => $_G['setting']['maxpostsize'])); } if (checkflood()) { return WebUtils::makeErrorInfo_oldVersion($res, 'post_flood_ctrl', array('{floodctrl}' => $_G['setting']['floodctrl'])); } elseif (checkmaxperhour('tid')) { return WebUtils::makeErrorInfo_oldVersion($res, 'thread_flood_ctrl_threads_per_hour', array('{threads_per_hour}' => $_G['group']['maxthreadsperhour'])); } $_GET['save'] = $_G['uid'] ? $_GET['save'] : 0; if ($_G['group']['allowsetpublishdate'] && $_GET['cronpublish'] && $_GET['cronpublishdate']) { $publishdate = strtotime($_GET['cronpublishdate']); if ($publishdate > $_G['timestamp']) { $_GET['save'] = 1; } else { $publishdate = $_G['timestamp']; } } else { $publishdate = $_G['timestamp']; } $typeid = isset($typeid) && isset($_G['forum']['threadtypes']['types'][$typeid]) && (empty($_G['forum']['threadtypes']['moderators'][$typeid]) || $_G['forum']['ismoderator']) ? $typeid : 0; $displayorder = $modnewthreads ? -2 : ($_G['forum']['ismoderator'] && $_G['group']['allowstickthread'] && !empty($_GET['sticktopic']) ? 1 : (empty($_GET['save']) ? 0 : -4)); if ($displayorder == -2) { C::t('forum_forum')->update($_G['fid'], array('modworks' => '1')); } elseif ($displayorder == -4) { $_GET['addfeed'] = 0; } $digest = $_G['forum']['ismoderator'] && $_G['group']['allowdigestthread'] && !empty($_GET['addtodigest']) ? 1 : 0; $readperm = $_G['group']['allowsetreadperm'] ? $readperm : 0; $isanonymous = $_G['group']['allowanonymous'] && $_GET['isanonymous'] ? 1 : 0; $price = intval($price); $price = $_G['group']['maxprice'] && !$special ? $price <= $_G['group']['maxprice'] ? $price : $_G['group']['maxprice'] : 0; //强制主题类别判断 if (!$typeid && $_G['forum']['threadtypes']['required'] && !$special) { return WebUtils::makeErrorInfo_oldVersion($res, 'post_type_isnull'); } //强制主题分类判断 if (!$sortid && $_G['forum']['threadsorts']['required'] && !$special) { return WebUtils::makeErrorInfo_oldVersion($res, 'post_sort_isnull'); } //主题售价 客户端暂不支持 if ($price > 0 && floor($price * (1 - $_G['setting']['creditstax'])) == 0) { return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd'); showmessage('post_net_price_iszero'); } //投票贴相关 if ($special == 1) { $polloption = $_GET['tpolloption'] == 2 ? explode("\n", $_GET['polloptions']) : $_GET['polloption']; $pollarray = array(); foreach ($polloption as $key => $value) { $polloption[$key] = censor($polloption[$key]); if (trim($value) === '') { unset($polloption[$key]); } } if (count($polloption) > $_G['setting']['maxpolloptions']) { return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd'); showmessage('post_poll_option_toomany', '', array('maxpolloptions' => $_G['setting']['maxpolloptions'])); } elseif (count($polloption) < 2) { return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd'); showmessage('post_poll_inputmore'); } $curpolloption = count($polloption); $pollarray['maxchoices'] = empty($_GET['maxchoices']) ? 0 : ($_GET['maxchoices'] > $curpolloption ? $curpolloption : $_GET['maxchoices']); $pollarray['multiple'] = empty($_GET['maxchoices']) || $_GET['maxchoices'] == 1 ? 0 : 1; $pollarray['options'] = $polloption; $pollarray['visible'] = empty($_GET['visibilitypoll']); $pollarray['overt'] = !empty($_GET['overt']); if (preg_match("/^\\d*\$/", trim($_GET['expiration']))) { if (empty($_GET['expiration'])) { $pollarray['expiration'] = 0; } else { $pollarray['expiration'] = TIMESTAMP + 86400 * $_GET['expiration']; } } else { return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd'); showmessage('poll_maxchoices_expiration_invalid'); } } // 分类信息有效期 $_GET['typeexpiration'] = $_GET['typeoption']['typeexpiration']; $sortid = $special && $_G['forum']['threadsorts']['types'][$sortid] ? 0 : $sortid; $typeexpiration = intval($_GET['typeexpiration']); if ($_G['forum']['threadsorts']['expiration'][$typeid] && !$typeexpiration) { return WebUtils::makeErrorInfo_oldVersion($res, 'threadtype_expiration_invalid'); } $_G['forum_optiondata'] = array(); if ($_G['forum']['threadsorts']['types'][$sortid] && !$_G['forum']['allowspecialonly']) { Mobcent::import(MOBCENT_APP_ROOT . '/components/discuz/source/function/function_threadsort.php'); $_G['forum_optiondata'] = mobcent_threadsort_validator($_GET['typeoption'], $pid); if ($_G['forum_optiondata']['message'] != '') { return WebUtils::makeErrorInfo_oldVersion($res, $_G['forum_optiondata']['message'], $_G['forum_optiondata']['params']); } } $author = !$isanonymous ? $_G['username'] : ''; $moderated = $digest || $displayorder > 0 ? 1 : 0; $thread['status'] = 0; $_GET['ordertype'] && ($thread['status'] = setstatus(4, 1, $thread['status'])); $_GET['hiddenreplies'] && ($thread['status'] = setstatus(2, 1, $thread['status'])); /* if($_G['group']['allowpostrushreply'] && $_GET['rushreply']) { $_GET['rushreplyfrom'] = strtotime($_GET['rushreplyfrom']); $_GET['rushreplyto'] = strtotime($_GET['rushreplyto']); $_GET['rewardfloor'] = trim($_GET['rewardfloor']); $_GET['stopfloor'] = intval($_GET['stopfloor']); $_GET['creditlimit'] = $_GET['creditlimit'] == '' ? '-996' : intval($_GET['creditlimit']); if($_GET['rushreplyfrom'] > $_GET['rushreplyto'] && !empty($_GET['rushreplyto'])) { return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd'); showmessage('post_rushreply_timewrong'); } if(($_GET['rushreplyfrom'] > $_G['timestamp']) || (!empty($_GET['rushreplyto']) && $_GET['rushreplyto'] < $_G['timestamp']) || ($_GET['stopfloor'] == 1) ) { $closed = true; } if(!empty($_GET['rewardfloor']) && !empty($_GET['stopfloor'])) { $floors = explode(',', $_GET['rewardfloor']); if(!empty($floors) && is_array($floors)) { foreach($floors AS $key => $floor) { if(strpos($floor, '*') === false) { if(intval($floor) == 0) { unset($floors[$key]); } elseif($floor > $_GET['stopfloor']) { unset($floors[$key]); } } } $_GET['rewardfloor'] = implode(',', $floors); } } $thread['status'] = setstatus(3, 1, $thread['status']); $thread['status'] = setstatus(1, 1, $thread['status']); } */ $_GET['allownoticeauthor'] && ($thread['status'] = setstatus(6, 1, $thread['status'])); $isgroup = $_G['forum']['status'] == 3 ? 1 : 0; /* if($_G['group']['allowreplycredit']) { $_GET['replycredit_extcredits'] = intval($_GET['replycredit_extcredits']); $_GET['replycredit_times'] = intval($_GET['replycredit_times']); $_GET['replycredit_membertimes'] = intval($_GET['replycredit_membertimes']); $_GET['replycredit_random'] = intval($_GET['replycredit_random']); $_GET['replycredit_random'] = $_GET['replycredit_random'] < 0 || $_GET['replycredit_random'] > 99 ? 0 : $_GET['replycredit_random'] ; $replycredit = $replycredit_real = 0; if($_GET['replycredit_extcredits'] > 0 && $_GET['replycredit_times'] > 0) { $replycredit_real = ceil(($_GET['replycredit_extcredits'] * $_GET['replycredit_times']) + ($_GET['replycredit_extcredits'] * $_GET['replycredit_times'] * $_G['setting']['creditstax'])); if($replycredit_real > getuserprofile('extcredits'.$_G['setting']['creditstransextra'][10])) { return WebUtils::makeErrorInfo_oldVersion($res, 'forum_passwd'); showmessage('replycredit_morethan_self'); } else { $replycredit = ceil($_GET['replycredit_extcredits'] * $_GET['replycredit_times']); } } } */ $newthread = array('fid' => $_G['fid'], 'posttableid' => 0, 'readperm' => $readperm, 'price' => $price, 'typeid' => $typeid, 'sortid' => $sortid, 'author' => $author, 'authorid' => $_G['uid'], 'subject' => $subject, 'dateline' => $publishdate, 'lastpost' => $publishdate, 'lastposter' => $author, 'displayorder' => $displayorder, 'digest' => $digest, 'special' => $special, 'attachment' => 0, 'moderated' => $moderated, 'status' => $thread['status'] | $topicStatus, 'isgroup' => $isgroup, 'replycredit' => $replycredit, 'closed' => $closed ? 1 : 0); $tid = C::t('forum_thread')->insert($newthread, true); useractionlog($_G['uid'], 'tid'); if (!getuserprofile('threads') && $_G['setting']['newbie']) { C::t('forum_thread')->update($tid, array('icon' => $_G['setting']['newbie'])); } if ($publishdate != $_G['timestamp']) { loadcache('cronpublish'); $cron_publish_ids = dunserialize($_G['cache']['cronpublish']); $cron_publish_ids[$tid] = $tid; $cron_publish_ids = serialize($cron_publish_ids); savecache('cronpublish', $cron_publish_ids); } if (!$isanonymous) { C::t('common_member_field_home')->update($_G['uid'], array('recentnote' => $subject)); } if ($special == 3 && $_G['group']['allowpostreward']) { updatemembercount($_G['uid'], array($_G['setting']['creditstransextra'][2] => -$realprice), 1, 'RTC', $tid); } if ($moderated) { updatemodlog($tid, $displayorder > 0 ? 'STK' : 'DIG'); updatemodworks($displayorder > 0 ? 'STK' : 'DIG', 1); } /* if($special == 1) { foreach($pollarray['options'] as $polloptvalue) { $polloptvalue = dhtmlspecialchars(trim($polloptvalue)); C::t('forum_polloption')->insert(array('tid' => $tid, 'polloption' => $polloptvalue)); } $polloptionpreview = ''; $query = C::t('forum_polloption')->fetch_all_by_tid($tid, 1, 2); foreach($query as $option) { $polloptvalue = preg_replace("/\[url=(https?){1}:\/\/([^\[\"']+?)\](.+?)\[\/url\]/i", "<a href=\"\\1://\\2\" target=\"_blank\">\\3</a>", $option['polloption']); $polloptionpreview .= $polloptvalue."\t"; } $polloptionpreview = daddslashes($polloptionpreview); $data = array('tid' => $tid, 'multiple' => $pollarray['multiple'], 'visible' => $pollarray['visible'], 'maxchoices' => $pollarray['maxchoices'], 'expiration' => $pollarray['expiration'], 'overt' => $pollarray['overt'], 'pollpreview' => $polloptionpreview); C::t('forum_poll')->insert($data); } */ if ($_G['forum']['threadsorts']['types'][$sortid] && !empty($_G['forum_optiondata']) && is_array($_G['forum_optiondata'])) { $filedname = $valuelist = $separator = ''; foreach ($_G['forum_optiondata'] as $optionid => $value) { if ($value) { $filedname .= $separator . $_G['forum_optionlist'][$optionid]['identifier']; $valuelist .= $separator . "'" . daddslashes($value) . "'"; $separator = ' ,'; } if ($_G['forum_optionlist'][$optionid]['type'] == 'image') { $identifier = $_G['forum_optionlist'][$optionid]['identifier']; $sortaids[] = intval($_GET['typeoption'][$identifier]['aid']); } C::t('forum_typeoptionvar')->insert(array('sortid' => $sortid, 'tid' => $tid, 'fid' => $_G['fid'], 'optionid' => $optionid, 'value' => censor($value), 'expiration' => $typeexpiration ? $publishdate + $typeexpiration : 0)); } if ($filedname && $valuelist) { C::t('forum_optionvalue')->insert($sortid, "({$filedname}, tid, fid) VALUES ({$valuelist}, '{$tid}', '{$_G['fid']}')"); } } if ($_G['group']['allowat']) { $atlist = $atlist_tmp = array(); preg_match_all("/@([^\r\n]*?)\\s/i", $message . ' ', $atlist_tmp); $atlist_tmp = array_slice(array_unique($atlist_tmp[1]), 0, $_G['group']['allowat']); if (!empty($atlist_tmp)) { if (empty($_G['setting']['at_anyone'])) { foreach (C::t('home_follow')->fetch_all_by_uid_fusername($_G['uid'], $atlist_tmp) as $row) { $atlist[$row['followuid']] = $row['fusername']; } if (count($atlist) < $_G['group']['allowat']) { $query = C::t('home_friend')->fetch_all_by_uid_username($_G['uid'], $atlist_tmp); foreach ($query as $row) { $atlist[$row['fuid']] = $row['fusername']; } } } else { foreach (C::t('common_member')->fetch_all_by_username($atlist_tmp) as $row) { $atlist[$row['uid']] = $row['username']; } } } if ($atlist) { foreach ($atlist as $atuid => $atusername) { $atsearch[] = "/@" . str_replace('/', '\\/', preg_quote($atusername)) . " /i"; $atreplace[] = "[url=home.php?mod=space&uid={$atuid}]@{$atusername}[/url] "; } $message = preg_replace($atsearch, $atreplace, $message . ' ', 1); } } $bbcodeoff = checkbbcodes($message, !empty($_GET['bbcodeoff'])); $smileyoff = checksmilies($message, !empty($_GET['smileyoff'])); $parseurloff = !empty($_GET['parseurloff']); $htmlon = $_G['group']['allowhtml'] && !empty($_GET['htmlon']) ? 1 : 0; $usesig = !empty($_GET['usesig']) && $_G['group']['maxsigsize'] ? 1 : 0; $class_tag = new tag(); $tagstr = $class_tag->add_tag($_GET['tags'], $tid, 'tid'); /* if($_G['group']['allowreplycredit']) { if($replycredit > 0 && $replycredit_real > 0) { updatemembercount($_G['uid'], array('extcredits'.$_G['setting']['creditstransextra'][10] => -$replycredit_real), 1, 'RCT', $tid); $insertdata = array( 'tid' => $tid, 'extcredits' => $_GET['replycredit_extcredits'], 'extcreditstype' => $_G['setting']['creditstransextra'][10], 'times' => $_GET['replycredit_times'], 'membertimes' => $_GET['replycredit_membertimes'], 'random' => $_GET['replycredit_random'] ); C::t('forum_replycredit')->insert($insertdata); } } */ if ($_G['group']['allowpostrushreply'] && $_GET['rushreply']) { $rushdata = array('tid' => $tid, 'stopfloor' => $_GET['stopfloor'], 'starttimefrom' => $_GET['rushreplyfrom'], 'starttimeto' => $_GET['rushreplyto'], 'rewardfloor' => $_GET['rewardfloor'], 'creditlimit' => $_GET['creditlimit']); C::t('forum_threadrush')->insert($rushdata); } $pinvisible = $modnewthreads ? -2 : (empty($_GET['save']) ? 0 : -3); $message = preg_replace('/\\[attachimg\\](\\d+)\\[\\/attachimg\\]/is', '[attach]\\1[/attach]', $message); $pid = insertpost(array('fid' => $_G['fid'], 'tid' => $tid, 'first' => '1', 'author' => $_G['username'], 'authorid' => $_G['uid'], 'subject' => $subject, 'dateline' => $publishdate, 'message' => $message, 'useip' => $_G['clientip'], 'invisible' => $pinvisible, 'anonymous' => $isanonymous, 'usesig' => $usesig, 'htmlon' => $htmlon, 'bbcodeoff' => $bbcodeoff, 'smileyoff' => $smileyoff, 'parseurloff' => $parseurloff, 'attachment' => '0', 'tags' => $tagstr, 'replycredit' => 0, 'status' => (defined('IN_MOBILE') ? 8 : 0) | $postStatus)); if ($_G['group']['allowat'] && $atlist) { foreach ($atlist as $atuid => $atusername) { notification_add($atuid, 'at', 'at_message', array('from_id' => $tid, 'from_idtype' => 'at', 'buyerid' => $_G['uid'], 'buyer' => $_G['username'], 'tid' => $tid, 'subject' => $subject, 'pid' => $pid, 'message' => messagecutstr($message, 150))); } set_atlist_cookie(array_keys($atlist)); } $threadimageaid = 0; $threadimage = array(); if ($special == 4 && $_GET['activityaid']) { $threadimageaid = $_GET['activityaid']; convertunusedattach($_GET['activityaid'], $tid, $pid); } if ($_G['forum']['threadsorts']['types'][$sortid] && !empty($_G['forum_optiondata']) && is_array($_G['forum_optiondata']) && $sortaids) { foreach ($sortaids as $sortaid) { convertunusedattach($sortaid, $tid, $pid); } } if (($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) && ($_GET['attachnew'] || $sortid || !empty($_GET['activityaid']))) { updateattach($displayorder == -4 || $modnewthreads, $tid, $pid, $_GET['attachnew']); if (!$threadimageaid) { $threadimage = C::t('forum_attachment_n')->fetch_max_image('tid:' . $tid, 'tid', $tid); $threadimageaid = $threadimage['aid']; } } $values = array('fid' => $_G['fid'], 'tid' => $tid, 'pid' => $pid, 'coverimg' => '', 'sechash' => !empty($_GET['sechash']) ? $_GET['sechash'] : ''); $param = array(); Mobcent::import(MOBCENT_APP_ROOT . '/components/discuz/source/function/function_post.php'); if ($_G['forum']['picstyle']) { if (!mobcent_setthreadcover($pid, 0, $threadimageaid)) { preg_match_all("/(\\[img\\]|\\[img=\\d{1,4}[x|\\,]\\d{1,4}\\])\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/is", $message, $imglist, PREG_SET_ORDER); $values['coverimg'] = "<p id=\"showsetcover\">" . lang('message', 'post_newthread_set_cover') . "<span id=\"setcoverwait\"></span></p><script>if(\$('forward_a')){\$('forward_a').style.display='none';setTimeout(\"\$('forward_a').style.display=''\", 5000);};ajaxget('forum.php?mod=ajax&action=setthreadcover&tid={$tid}&pid={$pid}&fid={$_G['fid']}&imgurl={$imglist[0][2]}&newthread=1', 'showsetcover', 'setcoverwait')</script>"; $param['clean_msgforward'] = 1; $param['timeout'] = $param['refreshtime'] = 15; } } if ($threadimageaid) { if (!$threadimage) { $threadimage = C::t('forum_attachment_n')->fetch('tid:' . $tid, $threadimageaid); } $threadimage = daddslashes($threadimage); C::t('forum_threadimage')->insert(array('tid' => $tid, 'attachment' => $threadimage['attachment'], 'remote' => $threadimage['remote'])); } $statarr = array(0 => 'thread', 1 => 'poll', 2 => 'trade', 3 => 'reward', 4 => 'activity', 5 => 'debate', 127 => 'thread'); include_once libfile('function/stat'); updatestat($isgroup ? 'groupthread' : $statarr[$special]); if ($modnewthreads) { updatemoderate('tid', $tid); C::t('forum_forum')->update_forum_counter($_G['fid'], 0, 0, 1); manage_addnotify('verifythread'); return WebUtils::makeErrorInfo_oldVersion($res, 'post_newthread_mod_succeed', array('noError' => 1)); //showmessage('post_newthread_mod_succeed', $returnurl, $values, $param); } else { if ($displayorder >= 0 && helper_access::check_module('follow') && !empty($_GET['adddynamic']) && !$isanonymous) { require_once libfile('function/discuzcode'); require_once libfile('function/followcode'); $feedcontent = array('tid' => $tid, 'content' => followcode($message, $tid, $pid, 1000)); C::t('forum_threadpreview')->insert($feedcontent); C::t('forum_thread')->update_status_by_tid($tid, '512'); $followfeed = array('uid' => $_G['uid'], 'username' => $_G['username'], 'tid' => $tid, 'note' => '', 'dateline' => TIMESTAMP); $values['feedid'] = C::t('home_follow_feed')->insert($followfeed, true); C::t('common_member_count')->increase($_G['uid'], array('feeds' => 1)); } $feed = array('icon' => '', 'title_template' => '', 'title_data' => array(), 'body_template' => '', 'body_data' => array(), 'title_data' => array(), 'images' => array()); if ($displayorder != -4) { if ($digest) { updatepostcredits('+', $_G['uid'], 'digest', $_G['fid']); } //updatepostcredits('+', $_G['uid'], 'post', $_G['fid']); Mobcent::import(MOBCENT_APP_ROOT . '/components/discuz/source/function/function_post.php'); //Yii::import('application.components.discuz.source.function.function_post', true); mobcent_updatepostcredits('+', $_G['uid'], 'post', $_G['fid']); if ($isgroup) { C::t('forum_groupuser')->update_counter_for_user($_G['uid'], $_G['fid'], 1); } $subject = str_replace("\t", ' ', $subject); $lastpost = "{$tid}\t" . $subject . "\t{$_G['timestamp']}\t{$author}"; C::t('forum_forum')->update($_G['fid'], array('lastpost' => $lastpost)); C::t('forum_forum')->update_forum_counter($_G['fid'], 1, 1, 1); if ($_G['forum']['type'] == 'sub') { C::t('forum_forum')->update($_G['forum']['fup'], array('lastpost' => $lastpost)); } } if ($_G['forum']['status'] == 3) { C::t('forum_forumfield')->update($_G['fid'], array('lastupdate' => TIMESTAMP)); require_once libfile('function/grouplog'); updategroupcreditlog($_G['fid'], $_G['uid']); } /*如果显示地理位置,入库到表里*/ if ($jsonInfo['isShowPostion']) { $data = DB::query('INSERT INTO %t VALUES(null,%f,%f,%d,%d,%s)', array('home_surrounding_user', $jsonInfo['longitude'], $jsonInfo['latitude'], $tid, 3, (string) $jsonInfo['location'])); } /* //客户端发表主题积分入库 $temp = DB::fetch_first('SELECT extcredits3 FROM '.DB::table('common_credit_rule').' WHERE rid =%d ',array(1)); $extcredits3 = DB::fetch_first('SELECT extcredits3 FROM '.DB::table('common_member_count').' WHERE uid = %d',array($_G['uid'])); $temp = $extcredits3['extcredits3'] + $temp['extcredits3']; DB::query('UPDATE '.DB::table('common_member_count').' set extcredits3 = %d WHERE uid = %d',array($temp,$_G['uid'])); */ //showmessage('post_newthread_succeed', $returnurl, $values, $param); // return array('rs'=>1,'errcode'=>WebUtils::t('发贴成功')); return $this->makeErrorInfo($res, 'mobcent_post_newthread_success', array('noError' => 1)); } }
public function getClientApp($type, $platType) { // 判断客户端是否开启了小尾巴功能 $status = 0; if (WebUtils::getDzPluginAppbymeAppConfig('mobile_allow_sign_with_sign')) { $status = ForumUtils::getPostSendStatus($type, $platType); } return $status; }
private function _cancelActivityTopic($res, $tid, $uid, $data) { // from forum_misc.php DzForumActivityApply::deleteByTidUid($tid, $uid); DzForumActivity::updateApplyNumberByTid($tid); $thread = ForumUtils::getTopicInfo($tid); $message = cutstr(dhtmlspecialchars($data['message']), 200); if ($thread['authorid'] != $uid) { notification_add($thread['authorid'], 'activity', 'activity_cancel', array('tid' => $tid, 'subject' => $thread['subject'], 'reason' => $message)); } $res = $this->_makeErrorInfo($res, 'activity_cancel_success'); $res['rs'] = 1; return $res; }
private static function _getFids($fid) { return $fid == 0 ? ForumUtils::getForumShowFids() : array($fid); }
/** * 获取当前用户及其对应版块的权限 * * @param string $fids 版块id集合 * * @return array */ public static function getPermission($fids) { $permission = array(); global $_G; $tempGroupAllowPostPoll = $_G['group']['allowpostpoll']; $tempGroupAllowPostImage = $_G['group']['allowpostimage']; $tempGroupAllowPostAttach = $_G['group']['allowpostattach']; $tempGroupAttachExtensions = $_G['group']['attachextensions']; $forumInfos = ForumUtils::getForumInfos($fids); foreach ($forumInfos as $forum) { $fid = (int) $forum['fid']; ForumUtils::initForum($fid); $_G['group']['allowpostpoll'] = $tempGroupAllowPostPoll; // 获取上传图片权限 $_G['forum']['allowpostimage'] = isset($_G['forum']['allowpostimage']) ? $_G['forum']['allowpostimage'] : ''; $_G['group']['allowpostimage'] = $tempGroupAllowPostImage; $_G['group']['allowpostimage'] = $_G['forum']['allowpostimage'] != -1 && ($_G['forum']['allowpostimage'] == 1 || !$_G['forum']['postimageperm'] && $_G['group']['allowpostimage'] || $_G['forum']['postimageperm'] && forumperm($_G['forum']['postimageperm'])); $_G['group']['attachextensions'] = $tempGroupAttachExtensions; require_once libfile('function/upload'); $swfconfig = getuploadconfig($_G['uid'], $_G['fid']); $imgexts = str_replace(array(';', '*.'), array(', ', ''), $swfconfig['imageexts']['ext']); $allowpostimg = $_G['group']['allowpostimage'] && $imgexts; $allowPostImage = $allowpostimg ? 1 : 0; $allowAnonymous = $_G['forum']['allowanonymous'] || $_G['group']['allowanonymous'] ? 1 : 0; $_G['forum']['allowpostattach'] = isset($_G['forum']['allowpostattach']) ? $_G['forum']['allowpostattach'] : ''; $_G['group']['allowpostattach'] = $tempGroupAllowPostAttach; $_G['group']['allowpostattach'] = $_G['forum']['allowpostattach'] != -1 && ($_G['forum']['allowpostattach'] == 1 || !$_G['forum']['postattachperm'] && $_G['group']['allowpostattach'] || $_G['forum']['postattachperm'] && forumperm($_G['forum']['postattachperm'])); $allowPostAttachment = $_G['group']['allowpostattach'] ? 1 : 0; $topicClassfications = ForumUtils::getTopicClassificationInfos($fid); $permission[] = array('fid' => $fid, 'topic' => array('isHidden' => 0, 'isAnonymous' => $allowAnonymous, 'isOnlyAuthor' => 1, 'allowPostAttachment' => $allowPostAttachment, 'allowPostImage' => $allowPostImage, 'newTopicPanel' => ForumUtils::getNewTopicPanel(), 'classificationType_list' => $topicClassfications['types'], 'isOnlyTopicType' => $topicClassfications['requireTypes'] ? 1 : 0), 'post' => array('isHidden' => 0, 'isAnonymous' => $allowAnonymous, 'isOnlyAuthor' => 0, 'allowPostAttachment' => $allowPostAttachment, 'allowPostImage' => $allowPostImage)); } return $permission; }
private function _getForumInfo($forum) { $fid = (int) $forum['fid']; $forum = array_merge($forum, DzForumForum::getForumFieldByFid($fid)); $dateline = $this->_getDateLine($forum); // 判断该版块是否有权限访问 if (!forum($forum)) { return array(); } $matches = array(); preg_match('/<img src="(.+?)"/', $forum['icon'], $matches); $image = !empty($matches[1]) ? $matches[1] : ''; // $dateline = '0'; // if (is_array($forum['lastpost'])) { // $matches = array(); // preg_match('/<span title="(.+?)"/', $forum['lastpost']['dateline'], $matches); // $dateline = !empty($matches[1]) ? $matches[1] : $forum['lastpost']['dateline']; // $dateline = strtotime($dateline); // $dateline !== false or $dateline = '0'; // } $forumSubList = ForumUtils::getForumSubList($fid); $forumInfo = array(); $forumInfo['board_id'] = (int) $fid; $forumInfo['board_name'] = WebUtils::emptyHtml($forum['name']); $forumInfo['description'] = (string) WebUtils::emptyHtml($forum['description']); $forumInfo['board_child'] = count($forumSubList) > 0 ? 1 : 0; $forumInfo['board_img'] = WebUtils::getHttpFileName($image); $forumInfo['last_posts_date'] = !empty($dateline) ? $dateline . '000' : ''; $forumInfo['board_content'] = $forum['threads'] != 0 && !($forum['simple'] & 1) ? 1 : 0; $forumInfo['forumRedirect'] = $forum['redirect']; $todayPosts = (int) $forum['todayposts']; $threads = (int) $forum['threads']; $posts = (int) $forum['posts']; foreach ($forumSubList as $value) { $todayPosts += $value['todayposts']; $threads += $value['threads']; $posts += $value['posts']; } $forumInfo['td_posts_num'] = $todayPosts; $forumInfo['topic_total_num'] = $threads; $forumInfo['posts_total_num'] = $posts; return $forumInfo; }
private function _fieldInfo($topics) { $row = $rows = array(); foreach ($topics as $v) { $topicSummary = ForumUtils::getTopicSummary($v['tid']); $row['board_id'] = (int) $v['fid']; $row['topic_id'] = (int) $v['tid']; $row['type_id'] = (int) $v['typeid']; $row['sort_id'] = (int) $v['sortid']; $row['vote'] = ForumUtils::isVoteTopic($v['tid']) ? 1 : 0; $row['title'] = (string) WebUtils::emptyHtml($v['subject']); $row['subject'] = (string) WebUtils::emptyReturnLine($topicSummary['msg']); $row['user_id'] = (int) $v['authorid']; $row['last_reply_date'] = $v['lastpost'] . "000"; if ($row['last_reply_date'] == '000') { $row['last_reply_date'] = $v['dateline'] . "000"; } $row['user_nick_name'] = (string) $v['author']; $row['hits'] = (int) $v['views']; $row['replies'] = (int) $v['replies']; $row['top'] = ForumUtils::isTopTopic($v['tid']) ? 1 : 0; $row['status'] = (int) $v['status']; $row['essence'] = (int) $v['digest']; $row['hot'] = ForumUtils::isHotTopic($v['tid']) ? 1 : 0; $row['pic_path'] = ImageUtils::getThumbImage($topicSummary['image']); $rows[] = $row; } return $rows; }
private function _getListField($topicList) { global $_G; $forum = $_G['forum']; $isImageList = isset($_GET['isImageList']) ? $_GET['isImageList'] : 0; $list = array(); foreach ($topicList as $topic) { // 该主题是由别的版块移动过来的 $isTopicMoved = false; $movedTitle = ''; if ($topic['closed'] > 1) { $movedTitle = WebUtils::t('移动: '); $isTopicMoved = true; $topic['tid'] = $topic['closed']; } $tid = (int) $topic['tid']; $topicFid = (int) $topic['fid']; // 主题分类标题 $typeTitle = ''; if (WebUtils::getDzPluginAppbymeAppConfig('forum_allow_topictype_prefix')) { if (isset($forum['threadtypes']['prefix']) && $forum['threadtypes']['prefix'] == 1 && isset($forum['threadtypes']['types'][$topic['typeid']])) { $typeTitle = '[' . $forum['threadtypes']['types'][$topic['typeid']] . ']'; } } // 分类信息标题 $sortTitle = ''; if (WebUtils::getDzPluginAppbymeAppConfig('forum_allow_topicsort_prefix')) { if (!empty($forum['threadsorts']['prefix']) && isset($forum['threadsorts']['types'][$topic['sortid']])) { $sortTitle = '[' . $forum['threadsorts']['types'][$topic['sortid']] . ']'; } } $isTopicMoved && ($typeTitle = $sortTitle = ''); $topicInfo['board_id'] = $topicFid; $topicInfo['board_name'] = $fid != 0 ? $forum['name'] : ForumUtils::getForumName($topicFid); $topicInfo['board_name'] = WebUtils::emptyHtml($topicInfo['board_name']); $topicInfo['topic_id'] = $tid; $topicInfo['type'] = ForumUtils::getTopicType($topic); $topicInfo['title'] = $movedTitle . $typeTitle . $sortTitle . $topic['subject']; $topicInfo['title'] = WebUtils::emptyHtml($topicInfo['title']); // 修正帖子查看数 if (isset($_G['forum_thread']['views']) && $_G['forum_thread']['tid'] == $topic['tid'] && $_G['forum_thread']['views'] > $topic['views']) { $topic['views'] = $_G['forum_thread']['views']; } $topicInfo['user_id'] = (int) $topic['authorid']; $topicInfo['user_nick_name'] = $topic['author']; $topicInfo['last_reply_date'] = $topic['lastpost'] . '000'; $topicInfo['vote'] = ForumUtils::isVoteTopic($topic) ? 1 : 0; $topicInfo['hot'] = ForumUtils::isHotTopic($topic) ? 1 : 0; $topicInfo['hits'] = (int) $topic['views']; $topicInfo['replies'] = (int) $topic['replies']; $topicInfo['essence'] = ForumUtils::isMarrowTopic($topic) ? 1 : 0; $topicInfo['top'] = ForumUtils::isTopTopic($topic) ? 1 : 0; $topicInfo['status'] = (int) $topic['status']; $cache = Yii::app()->params['mobcent']['cache']['topicSummary']; $key = sprintf('mobcentTopicSummary_%s_%s_%s', $tid, $_G['groupid'], $isImageList); if (!$cache['enable'] || ($topicSummary = Yii::app()->cache->get($key)) === false) { $topicSummary = ForumUtils::getTopicSummary($tid, 'forum', true, array('imageList' => $isImageList, 'imageListLen' => 9, 'imageListThumb' => 1)); if ($cache['enable']) { Yii::app()->cache->set($key, $topicSummary, $cache['expire']); } } $topicInfo['subject'] = $topicSummary['msg']; // $topicInfo['pic_path'] = ImageUtils::getThumbImage($topicSummary['image']); $tempTopicInfo = ImageUtils::getThumbImageEx($topicSummary['image'], 15, true, false); $topicInfo['pic_path'] = $tempTopicInfo['image']; $topicInfo['ratio'] = $tempTopicInfo['ratio']; $topicInfo['userAvatar'] = UserUtils::getUserAvatar($topic['authorid']); $topicInfo['gender'] = (int) UserUtils::getUserGender($topic['authorid']); $topicInfo['recommendAdd'] = (int) ForumUtils::getRecommendAdd($tid); $topicInfo['isHasRecommendAdd'] = ForumUtils::isHasRecommendAdd($tid); $topicInfo['imageList'] = (array) $topicSummary['imageList']; $topicInfo['sourceWebUrl'] = (string) ForumUtils::getSourceWebUrl($tid, 'topic'); $tmpList = $list[] = $topicInfo; } return $list; }
public function actionPostInfo($pid, $tid = 1) { $postInfo = ForumUtils::getPostInfo($tid, $pid); echo WebUtils::jsonEncode($postInfo); }
public static function transPostContentToHtml($post) { Mobcent::import(sprintf('%s/forum_viewthread_%s.php', MOBCENT_APP_ROOT . '/components/discuz/forum', MobcentDiscuz::getMobcentDiscuzVersion())); ForumUtils::initForum($post['fid'], $post['tid']); loadcache('usergroups'); $userInfo = UserUtils::getUserInfo($post['authorid']); $post = array_merge($userInfo, $post); global $_G; // 处理主题价格 $_G['forum_threadpay'] = FALSE; if ($post['first']) { if ($_G['forum_thread']['price'] > 0 && $_G['forum_thread']['special'] == 0) { if ($_G['setting']['maxchargespan'] && TIMESTAMP - $_G['forum_thread']['dateline'] >= $_G['setting']['maxchargespan'] * 3600) { C::t('forum_thread')->update($_G['tid'], array('price' => 0), false, false, $archiveid); $_G['forum_thread']['price'] = 0; } else { $exemptvalue = $_G['forum']['ismoderator'] ? 128 : 16; if (!($_G['group']['exempt'] & $exemptvalue) && $_G['forum_thread']['authorid'] != $_G['uid']) { if (!C::t('common_credit_log')->count_by_uid_operation_relatedid($_G['uid'], 'BTC', $_G['tid'])) { require_once libfile('thread/pay', 'include'); $_G['forum_threadpay'] = TRUE; } } } } } $lastvisit = $_G['member']['lastvisit']; $ordertype = $maxposition = 0; // 处理附件 $_G['forum_attachpids'] = $_G['forum_attachtags'] = ''; $_G['tid'] = $post['tid']; // 去掉干扰码 $_G['forum']['jammer'] = 0; $post = viewthread_procpost($post, $lastvisit, $ordertype, $maxposition); $postlist[$post['pid']] = $post; if ($_G['forum_attachpids'] && !defined('IN_ARCHIVER')) { require_once libfile('function/attachment'); if (is_array($threadsortshow) && !empty($threadsortshow['sortaids'])) { $skipaids = $threadsortshow['sortaids']; } parseattach($_G['forum_attachpids'], $_G['forum_attachtags'], $postlist, $skipaids); } if (empty($postlist)) { showmessage('post_not_found'); } elseif (!defined('IN_MOBILE_API')) { foreach ($postlist as $pid => $post) { // 取出没有插入的附件 if (!empty($post['imagelist'])) { $postlist[$pid]['message'] .= showattach($post, 1); } if ($post['attachlist']) { $postlist[$pid]['message'] .= showattach($post); } $postlist[$pid]['message'] = preg_replace("/\\[attach\\]\\d+\\[\\/attach\\]/i", '', $postlist[$pid]['message']); } } if ($post['first'] && $_G['forum_threadpay']) { $postlist[$pid]['message'] = $thread['freemessage']; } // 处理屏蔽 if (!$_G['forum']['ismoderator'] && $postlist[$pid]['status'] & 1) { $postlist[$pid]['message'] = WebUtils::t('该帖被管理员或版主屏蔽'); } return $postlist[$post['pid']]; }
/** * 获取主题分类,分类信息 */ public static function getTopicClassificationInfos($fid = 0) { $fid > 0 && ForumUtils::initForum($fid); $infos = array('types' => array(), 'sorts' => array(), 'requireTypes' => false); // $field = DbUtils::getDzDbUtils(true)->queryRow(' // SELECT threadtypes, threadsorts // FROM %t // WHERE fid=%d // ', // array('forum_forumfield', $fid) // ); global $_G; $field = $_G['forum']; if (!empty($field)) { // $types = unserialize($field['threadtypes']); $types = $field['threadtypes']; if (!empty($types['types'])) { $infos['requireTypes'] = $types['required']; foreach ($types['types'] as $key => $value) { // 控制管理组专用@xushaowei if ($types['moderators'][$key] == 1) { continue; } $infos['types'][] = array('classificationType_id' => $key, 'classificationType_name' => WebUtils::emptyHtml($value)); } } // $sorts = unserialize($field['threadsorts']); $sorts = $field['threadsorts']; if (!empty($sorts['types'])) { foreach ($sorts['types'] as $key => $value) { $infos['sorts'][] = array('classificationTop_id' => $key, 'classificationTop_name' => WebUtils::emptyHtml($value)); } } } return $infos; }
private function _getTopicInfos($uid, $longitude, $latitude, $radius, $page, $pageSize) { $topicInfos = array('count' => 0, 'list' => array()); $count = SurroundingInfo::getTopicCountByTid($uid, $longitude, $latitude, $radius); $surroundTopics = SurroundingInfo::getAllTopicsByTid($uid, $longitude, $latitude, $radius, $page, $pageSize); $list = array(); foreach ($surroundTopics as $topic) { $topicInfo = array(); $topicId = (int) $topic['object_id']; // $tmpTopicInfo = ForumUtils::getTopicInfo($topicId); $tmpTopicInfo = $topic; if (!empty($tmpTopicInfo)) { $tmpUid = (int) $tmpTopicInfo['authorid']; $tmpFid = (int) $tmpTopicInfo['fid']; $topicInfo['distance'] = $topic['distance']; $topicInfo['location'] = $topic['location']; $topicInfo['board_id'] = $tmpFid; $topicInfo['board_name'] = ForumUtils::getForumName($tmpFid); $topicInfo['topic_id'] = $topicId; $topicInfo['title'] = $tmpTopicInfo['subject']; $topicInfo['uid'] = $tmpUid; $topicInfo['user_nick_name'] = $tmpTopicInfo['author']; $topicInfo['vote'] = ForumUtils::isVoteTopic($tmpTopicInfo) ? 1 : 0; $topicInfo['hot'] = ForumUtils::isHotTopic($tmpTopicInfo) ? 1 : 0; $topicInfo['hits'] = (int) $tmpTopicInfo['views']; $topicInfo['replies'] = (int) $tmpTopicInfo['replies']; $topicInfo['essence'] = ForumUtils::isMarrowTopic($tmpTopicInfo) ? 1 : 0; $topicInfo['top'] = ForumUtils::isTopTopic($tmpTopicInfo) ? 1 : 0; $topicInfo['last_reply_date'] = $tmpTopicInfo['lastpost'] . '000'; $topicInfo['replies'] = (int) $tmpTopicInfo['replies']; $topicSummary = ForumUtils::getTopicSummary($topicId); $topicInfo['subject'] = $topicSummary['msg']; $topicInfo['pic_path'] = $topicSummary['image']; // $topicInfo['type_id'] = (int)$tmpTopicInfo['typeid']; // $topicInfo['sort_id'] = (int)$tmpTopicInfo['sortid']; // $topicInfo['poll'] = $tmpTopicInfo['lastpost']; $list[] = $topicInfo; } } $topicInfos['count'] = $count; $topicInfos['list'] = $list; return $topicInfos; }
private function _getFids($fid) { if ($fid == 0) { $fids = ForumUtils::getForumShowFids(); } $fids[] = $fid; return $fids; }
private function _getPostInfo($tid, $pid) { $info = array(); $post = ForumUtils::getPostInfo($tid, $pid); if (!empty($post)) { $forumName = ForumUtils::getForumName($post['fid']); $threadPost = ForumUtils::getTopicPostInfo($tid); $topicContent = ForumUtils::getTopicContent($tid, $threadPost); $postContent = ForumUtils::getPostContent($tid, $pid, $post); $content = $this->_getContent($postContent, $topicContent); $info['board_name'] = $forumName; $info['board_id'] = (int) $post['fid']; $info['topic_id'] = (int) $tid; $info['topic_subject'] = $threadPost['subject']; $info['topic_content'] = $content['topic']; $info['topic_url'] = ''; $info['reply_content'] = $content['reply']; $info['reply_url'] = ''; $info['reply_remind_id'] = (int) $pid; $info['reply_nick_name'] = $post['author']; $info['user_id'] = (int) $post['authorid']; $info['icon'] = UserUtils::getUserAvatar($post['authorid']); $info['is_read'] = 1; $info['replied_date'] = $post['dateline'] . '000'; } return $info; }