public function article($article, $options = array()) { $default = array('threads' => false, 'single' => false, 'content' => false); $options = $this->_init_options($options, $default); $u = User::getInstance(); $ret = array(); $ret['id'] = $article->ID; $ret['group_id'] = $article->GROUPID; $ret['reply_id'] = $article->REID; $ret['flag'] = $this->_article_get_flag($article); $ret['position'] = $article->getPos(); $ret['is_top'] = $article->isTop(); $ret['is_subject'] = $article->isSubject(); $ret['has_attachment'] = $article->hasAttach(); $ret['is_admin'] = $article->hasEditPerm($u); $ret['title'] = $article->TITLE; try { $ret['user'] = $this->user(User::getInstance($article->OWNER)); } catch (Exception $e) { $ret['user'] = $article->OWNER; } $ret['post_time'] = $article->POSTTIME; $ret['board_name'] = $article->getBoard()->NAME; if ($options['content']) { $ret['content'] = $article->getContent(); $ret['attachment'] = $this->attachment($article); bbs_brcaddread($article->getBoard()->NAME, $article->ID); } if ($options['single']) { $ret['previous_id'] = ($tmp = $article->pre()) ? $tmp->ID : null; $ret['next_id'] = ($tmp = $article->next()) ? $tmp->ID : null; $ret['threads_previous_id'] = ($tmp = $article->tPre()) ? $tmp->ID : null; $ret['threads_next_id'] = ($tmp = $article->tNext()) ? $tmp->ID : null; } if ($options['threads']) { $ret['id'] = $article->LAST->GROUPID; if (!$article->isSubject()) { //the threads deleted, user is null $ret['user'] = null; } $ret['reply_count'] = $article->articleNum; $ret['last_reply_user_id'] = $article->LAST->OWNER; $ret['last_reply_time'] = $article->LAST->POSTTIME; } return $ret; }
echo $startnum; ?> ,<?php echo $origins[0]["ID"]; ?> ,<?php echo $origins[2]["ID"]; ?> ); o.h(); <?php $strs = array(); for ($i = $startnum; $i < $endnum; $i++) { $article = $articles[$i]; $strs[] = "[" . $article["ID"] . ",'" . $article["OWNER"] . "']"; bbs_brcaddread($board, $article["ID"]); } $arts = "[" . implode(",", $strs) . "]"; ?> o.o(<?php echo $arts; ?> );o.h(); //--> </script> <div class="oper"> <?php bbs_add_super_fav('[同主题] ' . $articles[0]['TITLE'], 'bbstcon.php?board=' . $board . '&gid=' . $gid); ?> | <a href="javascript:history.go(-1)">后退</a> | <a href="bbsdoc.php?board=<?php
o.h(1); att = new attWriter(<?php echo $brdnum; ?> ,<?php echo $id; ?> ,<?php echo $ftype; ?> ,<?php echo $num; ?> ,<?php echo $cacheable ? "1" : "0"; ?> ); <?php $s = bbs2_readfile($filename); if (is_string($s)) { echo $s; } ?> o.h(0);o.t(); //--> </script> <?php if ($ftype == 0) { bbs_brcaddread($brdarr["NAME"], $articles[1]["ID"]); } page_footer();
function atomic_article() { global $currentuser, $atomic_board, $atomic_brdarr, $atomic_brdnum, $dir_modes, $atomic_ftype; atomic_get_board(); $id = @intval($_GET["id"]); if ($id <= 0) { atomic_error("错误的文章号"); } $url = "?act=article&board=" . $atomic_board . "&id="; @($ptr = $_GET["p"]); // 同主题的指示在这里处理 if ($ptr == "tn" || $ptr == "tp") { $articles = bbs_get_threads_from_id($atomic_brdnum, $id, $dir_modes["NORMAL"], $ptr == "tp" ? -1 : 1); if ($articles == FALSE) { $redirt_id = $id; } else { $redirt_id = $articles[0]["ID"]; } header("Location: atomic.php" . $url . $redirt_id); exit; } $total = bbs_countarticles($atomic_brdnum, $atomic_ftype); if ($total <= 0) { atomic_error("错误的文章号,原文可能已经被删除"); } if (!$atomic_ftype) { $articles = array(); $num = bbs_get_records_from_id($atomic_board, $id, $atomic_ftype, $articles); if ($num <= 0) { atomic_error("错误的文章号,原文可能已经被删除"); } $article = $articles[1]; } else { $num = @intval($_GET["num"]); if ($num <= 0 || $num > $total) { atomic_error("错误的文章号,原文可能已经被删除"); } if (($articles = bbs_getarticles($atomic_board, $num, 1, $atomic_ftype)) === false) { atomic_error("错误的文章号,原文可能已经被删除"); } if ($id != $articles[0]["ID"]) { atomic_error("错误的文章号,原文可能已经被删除"); } $article = $articles[0]; } $filename = bbs_get_board_filename($atomic_board, $article["FILENAME"]); $isnormalboard = bbs_normalboard($atomic_board); if ($isnormalboard) { if (cache_header("public", @filemtime($filename), 300)) { return; } } if (!$atomic_ftype) { $idx = $ptr == 'p' ? 0 : ($ptr == 'n' ? 2 : -1); if ($idx != -1 && $articles[$idx]["ID"] != 0) { header("Location: atomic.php" . $url . $articles[$idx]["ID"]); exit; } bbs_brcaddread($atomic_board, $article["ID"]); } atomic_header(); $html = '<p>'; if (!$atomic_ftype) { $html .= '<a href="' . $url . $article["ID"] . '&p=tn">主题下篇</a> '; $html .= '<a href="' . $url . $article["GROUPID"] . '">楼主</a> '; $html .= '<a href="?act=post&board=' . $atomic_board . '">发表</a> <a href="?act=post&board=' . $atomic_board . '&reid=' . $id . '">回复</a> '; if (atomic_uploadable()) { $html .= '<a href="?act=post&board=' . $atomic_board . '&reid=' . $id . '&upload=1">带附件回复</a> '; } $html .= '<a href="' . $url . $article["ID"] . '&p=p">上篇</a> '; $html .= '<a href="' . $url . $article["ID"] . '&p=n">下篇</a> '; $html .= '<a href="' . $url . $article["ID"] . '&p=tp">主题上篇</a> '; $html .= '<a href="' . $url . $article["REID"] . '">溯源</a> '; } $html .= '<a href="?act=board&board=' . $atomic_board . '&page=' . intval(($num + ARTCNT - 1) / ARTCNT) . ($atomic_ftype ? "&ftype=" . $atomic_ftype : "") . '">回版面</a> '; $ourl = 'bbscon.php?bid=' . $atomic_brdnum . '&id=' . $article["ID"]; if ($atomic_ftype) { $ourl .= "&ftype=" . $atomic_ftype . "&num=" . $num; } $html .= '<a href="' . $ourl . '">原文</a> '; $html .= '</p>'; echo $html; echo bbs2_readfile_text($filename, MAXCHAR, 2); if ($article["ATTACHPOS"]) { echo '<p>本文含有附件: <a href="' . $ourl . '">原文链接</a></p>'; } atomic_footer(); }
public function ajax_single() { if (!isset($this->params['id'])) { $this->error(ECode::$ARTICLE_NONE); } $id = $this->params['id']; try { $article = Article::getInstance($id, $this->_board); } catch (ArticleNullException $e) { $this->error(ECode::$ARTICLE_NONE); } App::import('vendor', 'inc/wrapper'); $wrapper = Wrapper::getInstance(); $ret = $wrapper->article($article, array('single' => true, 'content' => false)); $u = User::getInstance(); $ret['allow_post'] = $this->_board->hasPostPerm($u); $ret['is_bm'] = $u->isBM($this->_board) || $u->isAdmin(); $content = $article->getHtml(true); if (Configure::read("ubb.parse")) { //remove ubb of nickname in first and title second line preg_match("'^(.*?<br \\/>.*?<br \\/>)'", $content, $res); $content = preg_replace("'(^.*?<br \\/>.*?<br \\/>)'", '', $content); $content = XUBB::remove($res[1]) . $content; $content = XUBB::parse($content); } $ret['content'] = $content; bbs_brcaddread($this->_board->NAME, $article->ID); $this->set('no_html_data', $ret); }
public function single() { $this->notice = "版面-{$this->_board->DESC}({$this->_board->NAME})"; if ($this->_board->getMode() == BOARD::$THREAD) { $this->_board->setMode(BOARD::$NORMAL); } App::import('Sanitize'); try { $gid = $this->params['gid']; $article = Article::getInstance($gid, $this->_board); } catch (ArticleNullException $e) { $this->error(ECode::$ARTICLE_NONE); } $u = User::getInstance(); $bm = $u->isBM($this->_board) || $u->isAdmin(); $info = array(); $content = $article->getPlant(); $content = preg_replace("/ /", " ", $content); $content = preg_replace("/ /", " ", $content); preg_match("|※ 修改:·([\\S]+) .*?FROM:[\\s]*([0-9a-zA-Z.:*]+)|", $content, $m); preg_match("|※ 来源:.*FROM:[\\s]*([0-9a-zA-Z.:*]+)|", $content, $f); $m = empty($m) ? "" : "<br />修改:{$m[1]} FROM {$m[2]}"; $f = empty($f) ? "" : "<br />FROM {$f[1]}"; $s = ($pos = strpos($content, "<br/><br/>")) === false ? 0 : $pos + 10; $e = ($pos = strpos($content, "<br/>--<br/>")) === false ? strlen($content) : $pos + 7; $content = preg_replace(array("'^(<br/>)+'", "|(<br/>)+--\$|"), array("", "<br>--"), substr($content, $s, $e - $s)) . $m . $f; $content = $article->parseAtt($content, 'middle'); if (Configure::read("ubb.parse")) { $content = XUBB::parse($content); } bbs_brcaddread($this->_board->NAME, $article->ID); $info = array("aid" => $article->ID, "gid" => $article->GROUPID, "rid" => $article->REID, "op" => $article->OWNER == $u->userid || $bm ? 1 : 0, "time" => date("Y-m-d H:i:s", $article->POSTTIME), "poster" => $article->OWNER, "content" => $content, "subject" => $article->isSubject(), "pre" => ($a = $article->pre()) ? $a->ID : false, "next" => ($a = $article->next()) ? $a->ID : false, "tPre" => ($a = $article->tPre()) ? $a->ID : false, "tNext" => ($a = $article->tNext()) ? $a->ID : false); $this->set("bName", $this->_board->NAME); $this->set("mode", $this->_board->getMode()); $this->set("canPost", $this->_board->hasPostPerm($u)); $this->set("title", Sanitize::html($article->TITLE)); $this->set($info); }