コード例 #1
0
ファイル: topics.php プロジェクト: bianle/www2
$pagecount = ceil($total / PAGE_SIZE);
if ($page < 0) {
    $page = 0;
}
if ($page > $pagecount) {
    $page = $pagecount;
}
if ($page == 0) {
    $page = $pagecount;
}
$start = ($page - 1) * PAGE_SIZE + 1;
$count = PAGE_SIZE;
if ($page == $pagecount) {
    cache_header("nocache");
} else {
    $origin_if = bbs_get_board_index($bname, $dir_modes["ORIGIN"]);
    if (cache_header("public", @filemtime($origin_if), 10)) {
        exit;
    }
}
$articles = bbs_getarticles($bname, $start, $count, $dir_modes["ORIGIN"]);
if ($articles == FALSE) {
    ie("cannot read index.");
}
$response->pagecount = $pagecount;
$arr = array();
$i = 0;
foreach ($articles as $article) {
    $response->topic[$i]->id = $article["ID"];
    $response->topic[$i]->title = int_string(htmlspecialchars($article["TITLE"]));
    $response->topic[$i]->author = $article["OWNER"];
コード例 #2
0
ファイル: bbstcon.php プロジェクト: bianle/www2
    $pno = 1;
}
$startnum = ($pno - 1) * $pagesize;
$endnum = $startnum + $pagesize;
if ($endnum > $num) {
    $endnum = $num;
}
bbs_checkorigin($board);
$origins = array();
$origin_num = bbs_get_records_from_id($board, $gid, $dir_modes["ORIGIN"], $origins);
if ($origin_num == 0) {
    $origins[0]["ID"] = $origins[2]["ID"] = $gid;
}
if ($isnormalboard) {
    /* cache 判断索引修改时间 - atppp */
    $dotdirname = bbs_get_board_index($board, $dir_modes["NORMAL"]);
    if (cache_header("public", @filemtime($dotdirname), 300)) {
        return;
    }
}
page_header("同主题-" . htmlspecialchars($brdarr["DESC"]) . "-" . htmlspecialchars($articles[0]["TITLE"]), "<a href=\"bbsdoc.php?board=" . $brd_encode . "\">" . htmlspecialchars($brdarr["DESC"]) . "</a>");
?>
<a name="top"></a>
<h1 class="ttit">同主题阅读:<?php 
echo htmlspecialchars($articles[0]["TITLE"]);
?>
 </h1>
<script type="text/javascript"><!--
var o = new tconWriter('<?php 
echo addslashes($board);
?>
コード例 #3
0
ファイル: topic.php プロジェクト: bianle/www2
$articles = array();
$ret = bbs_get_threads_from_gid($bid, $id, 1, $articles, $haveprev);
if ($ret == 0) {
    ie("cannot read threads.");
}
$pagecount = ceil($ret / THREAD_PAGE_SIZE);
if ($page < 1) {
    $page = 1;
}
if ($page > $pagecount) {
    $page = $pagecount;
}
if ($page == $pagecount) {
    cache_header("nocache");
} else {
    $all_if = bbs_get_board_index($bname, $dir_modes["NORMAL"]);
    if (cache_header("public", @filemtime($all_if), 300)) {
        exit;
    }
}
$response->pagecount = $pagecount;
$start = ($page - 1) * THREAD_PAGE_SIZE;
if ($start > $ret - 1) {
    $start = $ret - 1;
}
$end = $start + THREAD_PAGE_SIZE - 1;
if ($end > $ret - 1) {
    $end = $ret - 1;
}
$ii = 0;
for ($i = $start; $i <= $end; $i++) {
コード例 #4
0
ファイル: rss.php プロジェクト: bianle/www2
    if ($type == "m") {
        $ftype = $dir_modes["MARK"];
        $title = $desc = "保留区";
        bbs_checkmark($board);
    } else {
        if ($type == "o") {
            $ftype = $dir_modes["ORIGIN"];
            $title = "";
            $desc = "主题";
        } else {
            die;
            //TODO?
        }
    }
}
$dotdirname = bbs_get_board_index($board, $ftype);
$modifytime = @filemtime($dotdirname);
if (cache_header("public", $modifytime, 1800)) {
    return;
}
$channel = array();
$htmlboardDesc = BBS_FULL_NAME . " " . $board . "/" . htmlspecialchars($brdarr["DESC"], ENT_QUOTES) . " ";
$channel["title"] = $htmlboardDesc . $title;
$channel["description"] = $htmlboardDesc . " 版面" . $desc . "索引";
$channel["link"] = SiteURL . "frames.html?mainurl=" . urlencode("bbsdoc.php?board=" . $board);
/* TODO: ftype? */
$channel["language"] = "zh-cn";
$channel["generator"] = "KBS RSS Generator";
$channel["lastBuildDate"] = gmt_date_format($modifytime);
$total = bbs_countarticles($brdnum, $ftype);
$items = array();
コード例 #5
0
ファイル: bbscon.php プロジェクト: bianle/www2
$usernum = $currentuser["index"];
if (!$isnormalboard && bbs_checkreadperm($usernum, $brdnum) == 0) {
    html_error_quit("错误的讨论区");
}
bbs_set_onboard($brdnum, 1);
if (isset($_GET["id"])) {
    $id = $_GET["id"];
} else {
    html_error_quit("错误的文章号");
}
settype($id, "integer");
$use_tex = 0;
if (@$_GET["tex"] == "yes") {
    $use_tex = 1;
}
$indexModify = @filemtime(bbs_get_board_index($board, $dir_modes["NORMAL"]));
// 获取上一篇或下一篇,同主题上一篇或下一篇的指示
@($ptr = $_GET["p"]);
// 同主题的指示在这里处理
if ($ptr == "tn") {
    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;
コード例 #6
0
ファイル: atomic.php プロジェクト: bianle/www2
function atomic_board()
{
    global $currentuser, $atomic_board, $atomic_brdarr, $atomic_brdnum, $dir_modes, $atomic_ftype;
    atomic_get_board();
    $isnormalboard = bbs_normalboard($atomic_board);
    if ($isnormalboard && (isset($_GET["page"]) || $atomic_ftype)) {
        $dotdirname = bbs_get_board_index($atomic_board, $atomic_ftype);
        if (cache_header("public", @filemtime($dotdirname), $atomic_ftype ? 300 : 10)) {
            return;
        }
    }
    atomic_header();
    atomic_show_boardjump();
    $total = bbs_countarticles($atomic_brdnum, $atomic_ftype);
    if ($total <= 0) {
        atomic_error("本讨论区目前没有文章");
    }
    $page = isset($_GET["page"]) ? @intval($_GET["page"]) : 0;
    if (isset($_GET["start"])) {
        $page = (@intval($_GET["start"]) + ARTCNT - 1) / ARTCNT;
    }
    settype($page, "integer");
    $start = $page > 0 ? ($page - 1) * ARTCNT + 1 : 0;
    if ($start == 0 || $start > $total - ARTCNT + 1) {
        if ($total <= ARTCNT) {
            $start = 1;
            $page = 1;
        } else {
            $start = $total - ARTCNT + 1;
            $page = ($start + ARTCNT - 1) / ARTCNT + 1;
        }
    } else {
        $page = ($start + ARTCNT - 1) / ARTCNT;
    }
    settype($page, "integer");
    $articles = bbs_getarticles($atomic_board, $start, ARTCNT, $atomic_ftype);
    if ($articles == FALSE) {
        atomic_error("读取文章列表失败");
    }
    $html = '<form action="?" method="get"><input type="hidden" name="act" value="board"/>';
    if ($atomic_ftype) {
        $html .= '<input type="hidden" name="ftype" value="' . $atomic_ftype . '"/>';
    }
    $html .= '<input type="hidden" name="board" value="' . $atomic_board . '"/>';
    $html .= '<a href="?act=post&board=' . $atomic_board . '">发表</a> ';
    if (atomic_uploadable()) {
        $html .= '<a href="?act=post&board=' . $atomic_board . '&upload=1">带附件发表</a> ';
    }
    $bl = '?act=board&board=' . $atomic_board;
    if ($atomic_ftype) {
        $bl .= '&ftype=' . $atomic_ftype;
    }
    if ($page > 1) {
        $html .= '<a href="' . $bl . '&page=1">第一页</a> ';
        $html .= '<a href="' . $bl . '&page=' . ($page - 1) . '">上页</a> ';
    } else {
        $html .= '第一页 上页 ';
    }
    if ($start <= $total - 20) {
        $html .= '<a href="' . $bl . '&page=' . ($page + 1) . '">下页</a> ';
        $html .= '<a href="' . $bl . '">最后一页</a> ';
    } else {
        $html .= '下页 最后一页 ';
    }
    $html .= '<input type="submit" value="跳转到"/> 第 <input type="text" name="start" size="3" /> 篇 ';
    if ($atomic_ftype != $dir_modes["NORMAL"]) {
        $html .= "<a href='?act=board&board=" . $atomic_board . "'>版面</a> ";
    } else {
        $html .= "<b>版面</b> ";
    }
    if ($atomic_ftype != $dir_modes["DIGEST"]) {
        $html .= "<a href='?act=board&board=" . $atomic_board . "&ftype=" . $dir_modes["DIGEST"] . "'>文摘</a> ";
    } else {
        $html .= "<b>文摘</b> ";
    }
    if ($atomic_ftype != $dir_modes["MARK"]) {
        $html .= "<a href='?act=board&board=" . $atomic_board . "&ftype=" . $dir_modes["MARK"] . "'>保留</a> ";
    } else {
        $html .= "<b>保留</b> ";
    }
    $ann_path = bbs_getannpath($atomic_board);
    if ($ann_path != FALSE) {
        if (!strncmp($ann_path, "0Announce/", 10)) {
            $ann_path = substr($ann_path, 9);
        }
    }
    $html .= "<a href='?act=ann&path=" . $ann_path . "'>精华</a> ";
    $html .= "</form>";
    $html .= "<pre> 编号   刊 登 者     日  期  文章标题<br/>";
    $i = 0;
    foreach ($articles as $article) {
        $title = $article["TITLE"];
        if (strncmp($title, "Re: ", 4) != 0) {
            $title = "● " . $title;
        }
        $flags = $article["FLAGS"];
        if (!strncmp($flags, "D", 1) || !strncmp($flags, "d", 1)) {
            $html .= " [提示] ";
        } else {
            $html .= sprintf("%5d ", $start + $i);
            if ($flags[0] == 'N' || $flags[0] == '*') {
                $html .= " ";
                //$flags[0];  //不要未读标记 windinsn
            } else {
                $html .= $flags[0];
            }
            $html .= " ";
        }
        $html .= sprintf("%-12.12s ", $article["OWNER"]);
        $html .= strftime("%b %e ", $article["POSTTIME"]);
        $html .= $flags[3];
        $articleurl = "?act=article&board=" . $atomic_board . "&id=" . $article["ID"];
        if ($atomic_ftype) {
            $articleurl .= "&ftype=" . $atomic_ftype . "&num=" . ($start + $i);
        }
        $html .= "<a href='" . $articleurl . "'>" . htmlspecialchars($title) . " </a><br/>";
        $i++;
    }
    $html .= "</pre>";
    echo $html;
    atomic_footer();
}