コード例 #1
0
ファイル: viewthread.php プロジェクト: Mushan3420/BigApp-PHP7
 function output()
 {
     global $_G, $thread;
     if (true === BigAppConf::$debug) {
         $_G['trace'][] = __CLASS__ . '::' . __FUNCTION__;
     }
     if ($GLOBALS['hiddenreplies']) {
         foreach ($GLOBALS['postlist'] as $k => $post) {
             if (!$post['first'] && $_G['uid'] != $post['authorid'] && $_G['uid'] != $_G['forum_thread']['authorid'] && !$_G['forum']['ismoderator']) {
                 $GLOBALS['postlist'][$k]['message'] = lang('plugin/mobile', 'mobile_post_author_visible');
                 $GLOBALS['postlist'][$k]['attachments'] = array();
             }
         }
     }
     $_G['thread']['lastpost'] = dgmdate($_G['thread']['lastpost']);
     $_G['thread']['ordertype'] = $GLOBALS['ordertype'];
     if (!empty($_GET['viewpid'])) {
         $GLOBALS['postlist'][$_GET['viewpid']] = $GLOBALS['post'];
     }
     if (!$_G['thread']['maxposition']) {
         $_G['thread']['maxposition'] = "1";
     }
     if ($GLOBALS['rushreply']) {
         $_G['thread']['rushreply'] = $GLOBALS['rushreply'];
         $_G['thread']['rushresult'] = $GLOBALS['rushresult'];
     }
     foreach ($GLOBALS['comments'] as $pid => $comments) {
         $comments = bigapp_core::getvalues($comments, array('/^\\d+$/'), array('id', 'tid', 'pid', 'author', 'authorid', 'dateline', 'comment', 'avatar'));
         foreach ($comments as $k => $c) {
             $comments[$k]['avatar'] = avatar($c['authorid'], 'small', true);
             $comments[$k]['dateline'] = dgmdate($c['dateline'], 'u');
         }
         $GLOBALS['comments'][$pid] = $comments;
     }
     $variable = array('thread' => $_G['thread'], 'fid' => $_G['fid'], 'postlist' => array_values(bigapp_core::getvalues($GLOBALS['postlist'], array('/^\\d+$/'), array('uid', 'pid', 'tid', 'author', 'first', 'dbdateline', 'dateline', 'username', 'adminid', 'memberstatus', 'authorid', 'username', 'groupid', 'memberstatus', 'status', 'message', 'number', 'memberstatus', 'groupid', 'attachment', 'attachments', 'attachlist', 'imagelist', 'anonymous', 'extcredits2', 'posts', 'threads', 'authortitle', 'position', 'postreview', 'isWater'))), 'allowpostcomment' => $_G['setting']['allowpostcomment'], 'comments' => $GLOBALS['comments'], 'commentcount' => $GLOBALS['commentcount'], 'imagelist' => array(), 'ppp' => $_G['ppp'], 'totalpage' => $GLOBALS['totalpage'], 'setting_rewriterule' => $_G['setting']['rewriterule'], 'setting_rewritestatus' => $_G['setting']['rewritestatus'], 'forum_threadpay' => $_G['forum_threadpay'], 'cache_custominfo_postno' => $_G['cache']['custominfo']['postno']);
     //帖子举报
     $variable['report']['enable'] = '1';
     $variable['report']['handlekey'] = 'miscreport' . $variable['postlist'][0]['tid'];
     $language_file = 'source/language/lang_template.php';
     if (file_exists($language_file)) {
         require_once $language_file;
     }
     $report_msg = explode(",", $lang['report_reason_message']);
     foreach ($report_msg as $key => $msg) {
         #$report_msg[$key] = preg_replace('/[|\'/', '', $msg);
         $msg = str_replace('[', '', $msg);
         $msg = str_replace(']', '', $msg);
         $msg = str_replace("'", "", $msg);
         $report_msg[$key] = $msg;
     }
     if (empty($report_msg[0])) {
         $variable['report']['content'] = array();
     } else {
         $variable['report']['content'] = $report_msg;
     }
     foreach ($variable['postlist'] as &$_item) {
         $_item['dateline'] = preg_replace('/<.*?\\>/', '', $_item['dateline']);
     }
     unset($_item);
     if (!empty($GLOBALS['threadsortshow'])) {
         $optionlist = array();
         foreach ($GLOBALS['threadsortshow']['optionlist'] as $key => $val) {
             $val['optionid'] = $key;
             $optionlist[] = $val;
         }
         if (!empty($optionlist)) {
             $GLOBALS['threadsortshow']['optionlist'] = $optionlist;
             $GLOBALS['threadsortshow']['threadsortname'] = $_G['forum']['threadsorts']['types'][$thread['sortid']];
         }
     }
     $threadsortshow = bigapp_core::getvalues($GLOBALS['threadsortshow'], array('/^(?!typetemplate).*$/'));
     if (!empty($threadsortshow)) {
         $variable['threadsortshow'] = $threadsortshow;
     }
     foreach ($variable['postlist'] as $k => &$post) {
         if (!$_G['forum']['ismoderator'] && $_G['setting']['bannedmessages'] & 1 && ($post['authorid'] && !$post['username'] || $_G['thread']['digest'] == 0 && ($post['groupid'] == 4 || $post['groupid'] == 5 || $post['memberstatus'] == '-1'))) {
             $message = lang('forum/template', 'message_banned');
         } elseif (!$_G['forum']['ismoderator'] && $post['status'] & 1) {
             $message = lang('forum/template', 'message_single_banned');
         } elseif ($GLOBALS['needhiddenreply']) {
             $message = lang('forum/template', 'message_ishidden_hiddenreplies');
         } elseif ($post['first'] && $_G['forum_threadpay']) {
             $message = lang('forum/template', 'pay_threads') . ' ' . $GLOBALS['thread']['price'] . ' ' . $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]]['unit'] . $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][1]]['title'];
         } elseif ($_G['forum_discuzcode']['passwordlock']) {
             $message = lang('forum/template', 'message_password_exists');
         } else {
             $message = '';
         }
         //回帖举报
         ##############################
         /*if($_G['uid'] != $variable['postlist'][$k]['authorid']) {
         				$variable['postlist'][$k]['report']['enable'] = '1';
         				$variable['postlist'][$k]['report']['handlekey']='miscreport'.$variable['postlist'][$k]['pid'];
         				$variable['postlist'][$k]['report']['content'] = lang('plugin/bigapp', 'report_reason_message');
         		} else {
         				$variable['postlist'][$k]['report']['enable'] = '0';
         		}*/
         ##############################
         if ($message) {
             $variable['postlist'][$k]['message'] = $message;
         }
         if ($post['anonymous'] && !$_G['forum']['ismoderator']) {
             $variable['postlist'][$k]['username'] = $variable['postlist'][$k]['author'] = $_G['setting']['anonymoustext'];
             $variable['postlist'][$k]['adminid'] = $variable['postlist'][$k]['groupid'] = $variable['postlist'][$k]['authorid'] = 0;
             if ($post['first']) {
                 $variable['thread']['authorid'] = 0;
             }
         }
         if (strpos($variable['postlist'][$k]['message'], '[/tthread]') !== FALSE) {
             $matches = array();
             preg_match('/\\[tthread=(.+?),(.+?)\\](.*?)\\[\\/tthread\\]/', $variable['postlist'][$k]['message'], $matches);
             $variable['postlist'][$k]['message'] = preg_replace('/\\[tthread=(.+?)\\](.*?)\\[\\/tthread\\]/', lang('plugin/qqconnect', 'connect_tthread_message', array('username' => $matches[1], 'nick' => $matches[2])), $variable['postlist'][$k]['message']);
         }
         $variable['postlist'][$k]['message'] = preg_replace("/<a\\shref=\"([^\"]+?)\"\\starget=\"_blank\">\\[viewimg\\]<\\/a>/is", "<img src=\"\\1\" />", $variable['postlist'][$k]['message']);
         $variable['postlist'][$k]['message'] = BigAppAPI::_findimg($variable['postlist'][$k]['message']);
         $variable['postlist'][$k]['message'] = str_replace('!post_hide_reply_hidden!', lang('plugin/bigapp', 'post_hide_reply_hide'), $variable['postlist'][$k]['message']);
         $variable['postlist'][$k]['message'] = str_replace('post_hide_reply_hidden', lang('plugin/bigapp', 'post_hide_reply_hide'), $variable['postlist'][$k]['message']);
         if ($GLOBALS['aimgs'][$post['pid']]) {
             $imagelist = array();
             foreach ($GLOBALS['aimgs'][$post['pid']] as $aid) {
                 $extra = '';
                 $url = BigAppAPI::_parseimg('', $GLOBALS['postlist'][$post['pid']]['attachments'][$aid]['url'] . $GLOBALS['postlist'][$post['pid']]['attachments'][$aid]['attachment'], '');
                 if ($GLOBALS['postlist'][$post['pid']]['attachments'][$aid]['thumb']) {
                     $extra = 'file="' . $url . '" ';
                     $url .= '.thumb.jpg';
                 }
                 $extra .= 'attach="' . $post['pid'] . '" ';
                 if (strexists($variable['postlist'][$k]['message'], '[attach]' . $aid . '[/attach]')) {
                     $variable['postlist'][$k]['message'] = str_replace('[attach]' . $aid . '[/attach]', '<div class="img"><img src="' . $url . '" ' . $extra . '/></div>', $variable['postlist'][$k]['message']);
                     unset($variable['postlist'][$k]['attachments'][$aid]);
                 } elseif (!in_array($aid, $_G['forum_attachtags'][$post['pid']])) {
                     $imagelist[] = $aid;
                 }
             }
             $variable['postlist'][$k]['imagelist'] = $imagelist;
         }
         $variable['postlist'][$k]['message'] = preg_replace("/\\[attach\\]\\d+\\[\\/attach\\]/i", '', $variable['postlist'][$k]['message']);
         $variable['postlist'][$k]['message'] = preg_replace('/(&nbsp;){2,}/', '', $variable['postlist'][$k]['message']);
         $variable['postlist'][$k]['dateline'] = strip_tags($post['dateline']);
         $variable['postlist'][$k]['groupiconid'] = bigapp_core::usergroupIconId($post['groupid']);
         if ($post['first']) {
             $post['recommends'] = $_G['thread']['recommends'];
             $post['recommend_add'] = $_G['thread']['recommend_add'];
             $post['recommend_sub'] = $_G['thread']['recommend_sub'];
             $post['enable_recommend'] = 0;
             if (($_G['group']['allowrecommend'] || !$_G['uid']) && $_G['setting']['recommendthread']['status']) {
                 $post['enable_recommend'] = 1;
                 $post['click2login'] = 0;
                 if (!$_G['uid']) {
                     $post['click2login'] = 1;
                 }
             }
             $post['addtext'] = $_G['setting']['recommendthread']['addtext'];
             $post['subtext'] = $_G['setting']['recommendthread']['subtracttext'];
             $post['recommend_value'] = $_G['group']['allowrecommend'];
             $post['recommended'] = 0;
             if (C::t('forum_memberrecommend')->fetch_by_recommenduid_tid($_G['uid'], $post['tid'])) {
                 $post['recommended'] = 1;
             }
         } else {
             $post['enable_support'] = 0;
             @preg_match('/^x([0-9\\.]+)/i', $_G['setting']['version'], $matches);
             $num = 0;
             if (isset($matches[1])) {
                 $num = $matches[1];
             }
             if ($num >= 3.1 && !$_G['forum_thread']['special'] && !$rushreply && !$hiddenreplies && $_G['setting']['repliesrank'] && !$post['first'] && !($post['isWater'] && $_G['setting']['filterednovote'])) {
                 $post['enable_support'] = 1;
                 $post['click2login'] = 0;
                 if (!$_G['uid']) {
                     $post['click2login'] = 1;
                 }
             }
             if (function_exists('iconv')) {
                 $post['supporttext'] = iconv('UTF-8', CHARSET . '//ignore', '支持');
                 $post['opposetext'] = iconv('UTF-8', CHARSET . '//ignore', '反对');
             } else {
                 $post['supporttext'] = mb_convert_encoding('支持', CHARSET, 'UTF-8');
                 $post['opposetext'] = mb_convert_encoding('反对', CHARSET, 'UTF-8');
             }
             $post['support'] = 0;
             $post['oppose'] = 0;
             if (isset($post['postreview']['support'])) {
                 $post['support'] = $post['postreview']['support'];
             }
             if (isset($post['postreview']['against'])) {
                 $post['oppose'] = $post['postreview']['against'];
             }
             unset($post['isWater']);
             unset($post['postreview']);
         }
     }
     unset($post);
     foreach ($GLOBALS['aimgs'] as $pid => $aids) {
         foreach ($aids as $aid) {
             $variable['imagelist'][] = $GLOBALS['postlist'][$pid]['attachments'][$aid]['url'] . $GLOBALS['postlist'][$pid]['attachments'][$aid]['attachment'];
         }
     }
     $variable['special_poll'] = BigAppAPI::getPollInfo();
     if (!empty($GLOBALS['rewardprice'])) {
         $variable['special_reward']['rewardprice'] = $GLOBALS['rewardprice'] . ' ' . $_G['setting']['extcredits'][$_G['setting']['creditstransextra'][2]]['title'];
         $variable['special_reward']['bestpost'] = $GLOBALS['bestpost'];
     }
     if (!empty($GLOBALS['trades'])) {
         $variable['special_trade'] = $GLOBALS['trades'];
     }
     if (!empty($GLOBALS['debate'])) {
         $variable['special_debate'] = $GLOBALS['debate'];
     }
     if (!empty($GLOBALS['activity'])) {
         $variable['special_activity'] = $GLOBALS['activity'];
         $variable['special_activity']['allapplynum'] = $GLOBALS['allapplynum'];
         if ($_G['setting']['activitycredit'] && $GLOBALS['activity']['credit'] && !$GLOBALS['applied']) {
             $variable['special_activity']['creditcost'] = $GLOBALS['activity']['credit'] . ' ' . $_G['setting']['extcredits'][$_G['setting']['activitycredit']]['title'];
         }
         $setting = array();
         foreach ($GLOBALS['activity']['ufield']['userfield'] as $field) {
             $setting[$field] = $_G['cache']['profilesetting'][$field];
         }
         $variable['special_activity']['joinfield'] = bigapp_core::getvalues($setting, array('/./'), array('fieldid', 'formtype', 'available', 'title', 'formtype', 'choices'));
         $variable['special_activity']['userfield'] = $GLOBALS['ufielddata']['userfield'];
         $variable['special_activity']['extfield'] = $GLOBALS['ufielddata']['extfield'];
         $variable['special_activity']['basefield'] = bigapp_core::getvalues($GLOBALS['applyinfo'], array('message', 'payment'));
         $variable['special_activity']['closed'] = $GLOBALS['activityclose'];
         if ($GLOBALS['applied'] && $GLOBALS['isverified'] < 2) {
             if (!$GLOBALS['isverified']) {
                 $variable['special_activity']['status'] = 'wait';
             } else {
                 $variable['special_activity']['status'] = 'joined';
             }
             if (!$GLOBALS['activityclose']) {
                 $variable['special_activity']['button'] = 'cancel';
             }
         } elseif (!$GLOBALS['activityclose']) {
             if ($GLOBALS['isverified'] != 2) {
                 $variable['special_activity']['status'] = 'join';
             } else {
                 $variable['special_activity']['status'] = 'complete';
             }
             $variable['special_activity']['button'] = 'join';
         }
     }
     $variable['forum']['password'] = $variable['forum']['password'] ? '1' : '0';
     BigAppAPI::modifyPost2($variable['postlist']);
     if (isset($variable['thread']['tid'])) {
         $variable['thread']['share_url'] = rtrim(ApiUtils::getDzRoot(), '/') . '/forum.php?mod=viewthread&tid=' . $variable['thread']['tid'];
     } else {
         $variable['thread']['share_url'] = '';
     }
     $variable['jump#pid'] = isset($_G['jump#pid']) ? $_G['jump#pid'] : "0";
     $variable['page'] = isset($_G['page']) ? $_G['page'] : "1";
     bigapp_core::result(bigapp_core::variable($variable));
 }
コード例 #2
0
ファイル: myportal.php プロジェクト: Mushan3420/BigApp-PHP7
 public function filterContent($content)
 {
     $content = preg_replace("/<a[^>]*>(.*)<\\/a>/isU", '${1}', $content);
     $content = preg_replace("/<img(.*)?src=/isU", '<img src=', $content);
     $content = BigAppAPI::_findimg($content);
     $content = preg_replace("/\\[attach\\]\\d+\\[\\/attach\\]/i", '', $content);
     $content = preg_replace('/(&nbsp;){2,}/', '', $content);
     return $content;
 }