$firstpost['uid'] = $firstpost['authorid']; $firstpost['username'] = $firstpost['author']; } } if (!empty($firstpost) && !empty($thread) && $thread['displayorder'] != -1) { $_G['tid'] = $article['id']; $aids = array(); $firstpost['message'] = $content['content']; if ($thread['attachment']) { $_G['group']['allowgetimage'] = 1; if (preg_match_all("/\\[attach\\](\\d+)\\[\\/attach\\]/i", $firstpost['message'], $matchaids)) { $aids = $matchaids[1]; } } if ($aids) { parseforumattach($firstpost, $aids); } $content['content'] = $firstpost['message']; $content['pid'] = $firstpost['pid']; $org = $firstpost; $org_url = "forum.php?mod=viewthread&tid={$article['id']}"; } else { C::t('portal_article_title')->update($aid, array('id' => 0, 'idtype' => '')); C::t('portal_article_content')->update_by_aid($aid, array('id' => 0, 'idtype' => '')); } } elseif ($article['idtype'] == 'blogid') { $org = C::t('home_blog')->fetch($article['id']); if (empty($org)) { C::t('portal_article_title')->update($aid, array('id' => 0, 'idtype' => '')); dheader('location: ' . fetch_article_url($article)); exit;
/** * 获取文章内容 * * @param int|array $aid * @param int $page * @return array */ public static function getNewsContent($aid, $page = 1) { global $_G; $article = $aid; !is_array($aid) && ($article = PortalUtils::getNewsInfo($aid)); $content = C::t('portal_article_content')->fetch_by_aid_page($article['aid'], $page); if (empty($content)) { return $content; } $content['content'] = PortalUtils::preParseArticleContent($content['content']); require_once libfile('function/blog'); $content['content'] = blog_bbcode($content['content']); if ($article['idtype'] == 'tid' || $content['idtype'] == 'pid') { $thread = $firstpost = array(); require_once libfile('function/discuzcode'); require_once libfile('function/forum'); $thread = get_thread_by_tid($article['id']); if (!empty($thread)) { if ($content['idtype'] == 'pid') { $firstpost = C::t('forum_post')->fetch($thread['posttableid'], $content['id']); } else { $firstpost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($article['id']); } if ($firstpost && $firstpost['tid'] == $article['id']) { $firstpost['uid'] = $firstpost['authorid']; $firstpost['username'] = $firstpost['author']; } } if (!empty($firstpost) && !empty($thread) && $thread['displayorder'] != -1) { $_G['tid'] = $article['id']; $aids = array(); $firstpost['message'] = $content['content']; if ($thread['attachment']) { $_G['group']['allowgetimage'] = 1; if (preg_match_all("/\\[attach\\](\\d+)\\[\\/attach\\]/i", $firstpost['message'], $matchaids)) { $aids = $matchaids[1]; } } if ($aids) { parseforumattach($firstpost, $aids); } $content['content'] = $firstpost['message']; $content['pid'] = $firstpost['pid']; } else { C::t('portal_article_title')->update($aid, array('id' => 0, 'idtype' => '')); C::t('portal_article_content')->update_by_aid($aid, array('id' => 0, 'idtype' => '')); } } elseif ($article['idtype'] == 'blogid') { $content['content'] = ''; } return PortalUtils::transArticleContent($content['content']); }