Пример #1
0
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();
}
Пример #2
0
        $redirt_id = $id;
    } else {
        $redirt_id = $articles[0]["ID"];
    }
    bbs_brcaddread($brdarr["NAME"], $redirt_id);
    $url = "Location: " . "bbscon.php?bid=" . $brdnum . "&id=" . $redirt_id;
    if (defined("ENABLE_JSMATH") && $use_tex && $articles[0]["IS_TEX"]) {
        $url .= "&tex=yes";
    }
    header($url);
    exit;
} elseif ($ptr == "tp") {
    if ($isnormalboard && cache_header("public", $indexModify, 10)) {
        exit;
    }
    $articles = bbs_get_threads_from_id($brdnum, $id, $dir_modes["NORMAL"], -1);
    if ($articles == FALSE) {
        $redirt_id = $id;
    } else {
        $redirt_id = $articles[0]["ID"];
    }
    bbs_brcaddread($brdarr["NAME"], $redirt_id);
    $url = "Location: " . "bbscon.php?bid=" . $brdnum . "&id=" . $redirt_id;
    if (defined("ENABLE_JSMATH") && $use_tex && $articles[0]["IS_TEX"]) {
        $url .= "&tex=yes";
    }
    header($url);
    exit;
}
if (isset($_GET["ftype"])) {
    $ftype = intval($_GET["ftype"]);
Пример #3
0
 /**
  * function tNext get the next article in same threads
  *
  * @return mixed success Article|fail false
  * @access public
  */
 public function tNext()
 {
     $info = bbs_get_threads_from_id($this->_board->BID, $this->ID, 0, 1);
     if (!$info) {
         return false;
     }
     return new Article($info[0], $this->_board);
 }