function html_init($charset, $title = "", $otherheader = "", $new_style = 0) { global $cachemode; global $currentuser; if ($cachemode == "") { cache_header("nocache"); } echo '<?xml version="1.0" encoding="' . $charset . '"?>' . "\n"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?> "/> <script src="bbs.js"></script> <?php if (func_num_args() > 1) { ?> <title><?php echo $title; ?> </title> <?php } if ($new_style == 9) { ?> <link rel="stylesheet" type="text/css" href="bbsleft.css"/> <?php } else { ?> <link rel="stylesheet" type="text/css" href="default.css"/> <?php } echo $otherheader; ?> </head> <?php if ($_SERVER["PHP_SELF"] != "/bbsgetmsg.php" && isset($currentuser["userid"]) && $currentuser["userid"] != "guest" && bbs_checkwebmsg()) { ?> <script type="text/javascript"> if (top.fmsg && !top.fmsg.form0) top.fmsg.location.reload(); </script> <?php } }
} else { //фум╗д©б╪╟ФцФё║ё║ } } $brd_link = "bbsdoc.php?board=" . urlencode($brd_name[$j]); if ($j != $brd_num - 1) { $innerHtml .= "<div class='lb'><div class='mi'><a href='" . $brd_link . "'>" . $brd_desc[$j] . "</a></div></div>"; } else { $innerHtml .= "<div class='lmi'><a href='" . $brd_link . "'>" . $brd_desc[$j] . "</a></div>"; } } if (!$innerHtml) { $innerHtml = "-©уд©б╪-"; } $innerHtml = "<div class='b1'>" . $innerHtml . "</div>"; cache_header("nocache"); ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> </head> <script src="static/www2-main.js"></script> <script src="static/bbsleft.js"></script> <body> <script type="text/javascript"><!-- parent.document.getElementById('<?php echo $subMenu; ?> ').innerHTML = "<?php echo $innerHtml; ?>
$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++) { $filename = bbs_get_board_filename($bname, $articles[$i]["FILENAME"]);
if (!$pc) { html_error_quit("文件不存在"); } if ($f->access == 2) { if (!pc_is_admin($currentuser, $pc)) { html_error_quit("文件不存在"); } } if ($f->access == 1) { if (!pc_is_friend($currentuser["userid"], $pc["USER"])) { html_error_quit("文件不存在"); } } } } pc_db_close($link); if (!$pcconfig["USERFILEPERM"] || $f->access == 0) { if (cache_header("public", $f->filetime, 600)) { return; } } if (!($file = fopen($f->filepath, "rb"))) { html_error_quit("文件不存在"); } Header("Content-type: " . $f->filetype); Header("Accept-Ranges: bytes"); Header("Content-Length: " . filesize($f->filepath)); Header("Content-Disposition: inline;filename=" . $f->filename); echo fread($file, filesize($f->filepath)); fclose($file); exit;
var c = new docWriter('<?php echo addslashes($brdarr["NAME"]); ?> ',<?php echo $bid; ?> ,0,0,-1,0,0,0,0); </script> <?php } else { $board = ''; bbs_ann_header($board); print "<h1 class=\"bt\">{$title}</h1>"; } } else { $dotnames = BBS_HOME . '/' . $path . '/.Names'; if (cache_header('public', filemtime($dotnames), 300)) { return; } $bid = 0; bbs_ann_header(); print "<h1 class=\"bt\">{$title}</h1>"; } bbs_ann_display_articles($articles, $isBoard); bbs_ann_xsearch($board); if ($up_cnt >= 2) { bbs_ann_foot($up_dirs[$up_cnt - 2]); } else { bbs_ann_foot(''); } page_footer();
$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(); if ($total > 0) { $artcnt = ARTICLE_PER_RSS;
} else { html_error_quit("´íÎóµÄÌÖÂÛÇø"); } $brdarr = array(); $brdnum = bbs_getboard($board, $brdarr); if ($brdnum == 0) { html_error_quit("´íÎóµÄÌÖÂÛÇø"); } if (bbs_checkreadperm($usernum, $brdnum) == 0) { html_error_quit("´íÎóµÄÌÖÂÛÇø"); } $top_file = bbs_get_vote_filename($brdarr["NAME"], "notes"); $isnormalboard = bbs_normalboard($board); if ($isnormalboard) { $mt = file_exists($top_file) ? @filemtime($top_file) : time(); if (cache_header("public", $mt, 1800)) { return; } } bbs_board_nav_header($brdarr, "±¸Íü¼"); $brd_encode = urlencode($brdarr["NAME"]); ?> <link rel="stylesheet" type="text/css" href="static/www2-ansi.css"/> <script type="text/javascript" src="static/www2-addons.js"></script> <div id="divNote" class="AnsiArticleBW"><div id="dn1"> <script type="text/javascript"><!-- <?php $s = false; if (file_exists($top_file)) { $s = bbs2_readfile($top_file); }
html_error_quit('╡╩╢Фтз╦цд©б╪'); } bbs_set_onboard($bid, 1); if (bbs_normalboard($board)) { if (cache_header('public', filemtime($filename), 300)) { return; } } } else { $board = ''; if (cache_header('public', filemtime($filename), 300)) { return; } } } else { if (cache_header('public', filemtime($filename), 300)) { return; } $bid = 0; } } @($attachpos = intval($_GET["ap"])); //pointer to the size after ATTACHMENT PAD if ($attachpos) { bbs_file_output_attachment($filename, $attachpos); exit; } if ($bid) { page_header("╬╚╩╙гЬндубтд╤а", "<a href=\"bbsdoc.php?board=" . $brdarr["NAME"] . "\">" . htmlspecialchars($brdarr["DESC"]) . "</a>"); echo '<h1>' . $brdarr["NAME"] . ' ╟Ф (╬╚╩╙гЬ)</h1>'; } else {
if (bbs_club_flag($board) > 0) { $isclub = 1; } else { $isclub = 0; } bbs_set_onboard($brdnum, 1); if ($ftype == $dir_modes["ORIGIN"]) { bbs_checkorigin($board); } else { if ($ftype == $dir_modes["MARK"]) { bbs_checkmark($board); } } if (!$managemode && $isnormalboard && (isset($_GET["page"]) || $ftype)) { $dotdirname = bbs_get_board_index($board, $ftype); if (cache_header("public", @filemtime($dotdirname), $ftype == $dir_modes["NORMAL"] ? 10 : 300)) { return; } } if (isset($_POST['act'])) { do_manage_function($board); } $show_none = 0; $total = bbs_countarticles($brdnum, $ftype); if ($total <= 0) { $show_none = 1; } if (!$show_none) { if (isset($_GET["page"])) { $page = $_GET["page"]; } elseif (isset($_POST["page"])) {
function page_header($title, $flag = "", $otherheaders = false) { /* * $flag: FALSE - no header * string - parent */ global $cachemode; global $currentuser; global $headershown; if ($headershown) { return; } $headershown = true; if ($cachemode == "") { cache_header("nocache"); } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"/> <title><?php echo $title; ?> </title> <?php if (defined("www2dev")) { echo "<script>var gwww2dev=true;</script>"; } if (defined("ENABLE_JSMATH")) { echo "<script> var gjsmath=true;</script>"; } ?> <script src="static/www2-main.js" type="text/javascript"></script> <script>writeCss();</script> <?php if ($otherheaders) { echo $otherheaders; } ?> </head> <?php if ($flag === FALSE) { return; } if (isset($currentuser["userid"]) && $currentuser["userid"] != "guest" && bbs_checkwebmsg()) { ?> <script type="text/javascript">alertmsg();</script> <?php } ?> <body> <div class="nav smaller"><a href="<?php echo MAINPAGE_FILE; ?> "><?php echo BBS_FULL_NAME; ?> </a><span id="idExp"></span><?php if ($flag) { echo " → " . $flag; } ?> → <?php echo $title; ?> </div> <?php }
} if (!$ftype && $ptr == 'n' && $articles[2]["ID"] != 0) { if ($isnormalboard && cache_header("public", $indexModify, 10)) { exit; } bbs_brcaddread($brdarr["NAME"], $articles[2]["ID"]); $url = "Location: " . "bbscon.php?bid=" . $brdnum . "&id=" . $articles[2]["ID"]; if (defined("ENABLE_JSMATH") && $use_tex && $articles[2]["IS_TEX"]) { $url .= "&tex=yes"; } header($url); exit; } $filename = bbs_get_board_filename($board, $article["FILENAME"]); if ($isnormalboard && $ftype != $dir_modes["DELETED"]) { if (cache_header("public", @filemtime($filename), 300)) { return; } $cacheable = true; } else { $cacheable = false; } @($attachpos = $_GET["ap"]); //pointer to the size after ATTACHMENT PAD if ($attachpos != 0) { die; // atppp 20060223 bbs_file_output_attachment($filename, $attachpos); exit; } $page_title = "<a href=\"bbsdoc.php?board=" . $brdarr["NAME"] . "\">" . htmlspecialchars($brdarr["DESC"]) . "</a>";
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(); }
<?php require "www2-funcs.php"; require "www2-board.php"; login_init(); $xmls = array(array("/xml/rcmdbrd.xml", "推荐讨论区", "EnglishName"), array("/xml/board.xml", "讨论区人气排名", "EnglishName"), array("/xml/newboards.xml", "新开讨论区", "filename")); $index = @intval($_GET["flag"]); if ($index < 0 || $index >= sizeof($xmls)) { $index = 0; } $xmlfile = $xmls[$index][0]; $xmltitle = $xmls[$index][1]; $nodename = $xmls[$index][2]; $boardrank_file = BBS_HOME . $xmlfile; if (cache_header("public", filemtime($boardrank_file), 3600)) { return; } $doc = domxml_open_file($boardrank_file); if (!$doc) { html_error_quit("目前尚无" . $xmltitle); } $root = $doc->document_element(); $boards = $root->child_nodes(); $brdarr = array(); page_header($xmltitle); ?> <script type="text/javascript"><!-- var ta = new tabWriter(1,'main wide','<?php echo $xmltitle; ?> ',
} $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); ?> ',<?php
function pc_cache($modifytime) { $lastmodifytime = time_format($modifytime); $lastmodifytime = strtotime($lastmodifytime); if (cache_header("public", $lastmodifytime, 300)) { return TRUE; } else { return FALSE; } }
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"]; $response->topic[$i]->reply = $article["REPLYCOUNT"];
static function CacheHeader() { include_once FORUM_ROOT . '/app_resources/includes/cacher/interface.php'; cache_header(); }