/** * get hot threads of a borad * bbs_get_hot_threads(string board) * @author: windinsn */ function bbs_get_hot_threads($board, $num, &$threads, &$err) { global $db; $brdarr = array(); $bid = bbs_getboard($board, $brdarr); if (!$bid) { $err = '版面 ' . $board . ' 不存在'; return false; } $board = $brdarr['NAME']; $tt = date('Ymd') . "000000"; $sql = 'SELECT threadid,userid,title,time AS created,MAX(time) AS changed,count(DISTINCT userid) AS count FROM postlog WHERE time>=' . $tt . ' AND bname = \'' . addslashes($board) . '\' GROUP BY threadid ORDER BY count DESC , id DESC LIMIT 0 , ' . intval($num) * 2 . ';'; if (!$db->query($sql, 1)) { $err = $db->err; return false; } $threads = array(); $n = 0; for ($i = 0; $i < $db->nums; $i++) { $title = $db->arrays[$i]['title']; $gid = $db->arrays[$i]['threadid']; $articles = array(); if (bbs_get_records_from_id($board, $gid, 0, $articles) <= 0) { continue; } if (substr($title, 0, 4) == 'Re: ') { $title = substr($title, 4); } $threads[] = array('gid' => $gid, 'userid' => $db->arrays[$i]['userid'], 'created' => $db->arrays[$i]['created'], 'changed' => $db->arrays[$i]['changed'], 'count' => $db->arrays[$i]['count'], 'title' => $title); $n++; if ($n == $num) { break; } } return true; }
bbs_session_modify_user_mode(BBS_MODE_READING); $gid = $_GET["gid"]; settype($gid, "integer"); $start = isset($_GET["start"]) ? $_GET["start"] : 0; settype($start, "integer"); $pno = isset($_GET["pno"]) ? $_GET["pno"] : 0; settype($pno, "integer"); if ($gid < 0) { $gid = 0; } if ($start <= 0) { $start = $gid; } $board = $_GET["board"]; $brdarr = array(); $bid = bbs_getboard($board, $brdarr); if ($bid == 0) { html_error_quit("错误的讨论区"); } $board = $brdarr["NAME"]; $board_desc = $brdarr["DESC"]; $brd_encode = urlencode($board); //$isnormalboard = bbs_normalboard($board); $lookupuser = array(); $guestUID = bbs_getuser("guest", $lookupuser); $isnormalboard = bbs_checkreadperm($guestUID, $bid); //bbs_set_onboard($bid,1); $usernum = $currentuser["index"]; if (!$isnormalboard && bbs_checkreadperm($usernum, $bid) == 0) { html_error_quit("错误的讨论区"); }
require "www2-funcs.php"; require "www2-board.php"; login_init(); bbs_session_modify_user_mode(BBS_MODE_READING); assert_login(); if (!isset($_GET["board"]) && !isset($_POST["board"])) { html_error_quit("错误的讨论区"); } if (isset($_GET["board"])) { $board = $_GET["board"]; } else { $board = $_POST["board"]; } $brdarr = array(); $brdnum = bbs_getboard($board, $brdarr); if ($brdnum == 0) { html_error_quit("错误的讨论区"); } $usernum = $currentuser["index"]; if (bbs_checkreadperm($usernum, $brdnum) == 0) { html_error_quit("错误的讨论区"); } if (!isset($_GET["id"]) && !isset($_POST["id"])) { html_error_quit("错误的文章号"); } if (isset($_GET["id"])) { $id = $_GET["id"]; } else { $id = $_POST["id"]; }
<div class="mi"><a href="pc/pcnsearch.php">日志搜索</a></div> <?php @(include "pc/pcconf.php"); if (isset($pcconfig["BOARD"])) { ?> <div class="mi"><a href="bbsdoc.php?board=<?php echo $pcconfig["BOARD"]; ?> ">Blog论坛</a></div> <?php } if ($currentuser && $currentuser["index"]) { //blog manage menu if (isset($pcconfig["BOARD"])) { $brdarr = array(); $pcconfig["BRDNUM"] = bbs_getboard($pcconfig["BOARD"], $brdarr); if (bbs_is_bm($pcconfig["BRDNUM"], $currentuser["index"])) { ?> <div class="mi"><a href="pc/pcadmin_rec.php">Blog管理</a></div> <?php } } } //blog manage menu ?> <div class="lmi"><a href="pc/index.php?id=SYSOP">帮助主题</a></div> </div> <?php } // defined(BBS_HAVE_BLOG) if ($currentuser["userid"] != "guest") {
$channel["description"] .= "十大热门话题"; $channel["lastBuildDate"] = gmt_date_format(time()); $doc = domxml_open_file($xmlfile); if (!$doc) { return; } $root = $doc->document_element(); $boards = $root->child_nodes(); $brdarr = array(); $item = array(); while ($board = array_shift($boards)) { if ($board->node_type() == XML_TEXT_NODE) { continue; } $brdname = find_content($board, "board"); $brdnum = bbs_getboard($brdname, $brdarr); if ($brdnum == 0) { continue; } $brdname = urlencode($brdarr["NAME"]); $gid = find_content($board, "groupid"); $item["title"] = htmlspecialchars("[" . $brdarr["DESC"] . "] " . find_content($board, "title")); $item["link"] = SiteURL . "bbstcon.php?board=" . $brdname . "&gid=" . $gid; $item["author"] = find_content($board, "author"); $item["pubDate"] = gmt_date_format(find_content($board, "time")); $item["guid"] = $item["link"]; $articles = array(); $num = bbs_get_records_from_id($brdname, $gid, $dir_modes["NORMAL"], $articles); if ($num <= 0) { continue; }
if ($request->userid == "guest" || bbs_checkpasswd($request->userid, $request->passwd) != 0) { ie("invalid user."); } $bid = $request->bid; $userec = array(); bbs_getuser($request->userid, $userec); $uid = $userec["index"]; $bname = bbs_getbname($bid); if ($bname == "") { ie("board not found."); } if (!bbs_checkreadperm($uid, $bid)) { ie("permission denied."); } $barr = array(); bbs_getboard($bname, $barr); if (bbs_is_readonly_board($barr)) { ie("board is readonly."); } if (!bbs_checkpostperm($uid, $bid)) { ie("post is denied."); } $title = rtrim($request->title); if ($title == "") { ie("empty title."); } if ($request->content == "") { ie("empty content."); } $articles = array(); if ($request->reid > 0) {
function display_g_articles($brdarr, $articles, $start, $order = FALSE) { ?> <table class="main wide adj"> <caption>推荐文章</caption> <col width="5%" class="center"/><col width="55%"/><col width="15%" class="center"/><col width="15%" class="center"/><col width="10%" class="center"/> <tbody> <tr><th>#</th><th>标题</th><th>推荐人</th><th>版面</th><th> </th></tr> <?php $brd_encode = urlencode($brdarr["NAME"]); $i = 0; // foreach ($articles as $article) for (; $i < 20; $i++) { if (!($article = @$articles[19 - $i])) { continue; } $title = $article["TITLE"]; if (strncmp($title, "Re: ", 4) != 0) { $title = "● " . $title; } $flags = $article["FLAGS"]; ?> <tr> <td><?php echo $start + 19 - $i; ?> </td> <td><a href="bbsrecon.php?id=<?php echo $article["ID"]; ?> "><?php echo htmlspecialchars($title); ?> </a></td> <td><a href="bbsqry.php?userid=<?php echo $article["OWNER"]; ?> "><?php echo $article["OWNER"]; ?> </a></td> <td><a href="bbsdoc.php?board=<?php echo $article["O_BOARD"]; ?> "><?php $brddarr = array(); if (bbs_getboard($article["O_BOARD"], $brddarr)) { echo $brddarr["DESC"]; } ?> </a></td> <td><a href="bbscon.php?bid=<?php echo $article["O_BID"]; ?> &id=<?php echo $article["O_ID"]; ?> ">阅读原文</a></td> </tr> <?php } ?> </table> <?php }
require "www2-funcs.php"; require "www2-board.php"; login_init(); bbs_session_modify_user_mode(BBS_MODE_READING); $brdarr = array(); if (isset($_GET["bid"])) { $brdnum = $_GET["bid"]; settype($brdnum, "integer"); if ($brdnum == 0) { html_error_quit("错误的讨论区!"); } $board = bbs_getbname($brdnum); if (!$board) { html_error_quit("错误的讨论区"); } if ($brdnum != bbs_getboard($board, $brdarr)) { html_error_quit("错误的讨论区"); } } else { html_error_quit("错误的讨论区"); } //$isnormalboard=bbs_normalboard($board); $lookupuser = array(); $guestUID = bbs_getuser("guest", $lookupuser); $isnormalboard = bbs_checkreadperm($guestUID, $brdnum); $usernum = $currentuser["index"]; if (!$isnormalboard && bbs_checkreadperm($usernum, $brdnum) == 0) { html_error_quit("错误的讨论区"); } bbs_set_onboard($brdnum, 1); if (isset($_GET["id"])) {
function atomic_ann() { global $currentuser; $file = false; $path = @trim($_GET['path']); if (isset($_GET['file'])) { $path = trim($_GET['file']); if ($path[0] == '/') { $path = "0Announce" . $path; } else { $path = "0Announce/" . $path; } $file = $path; $modfile = $file; } else { if ($path[0] == '/') { $path1 = "0Announce" . $path; } else { $path1 = "0Announce/" . $path; } $modfile = $path1 . "/.Names"; } if (strstr($path, '.Names') || strstr($path, '..') || strstr($path, 'SYSHome')) { atomic_error('不存在该目录'); } $boardName = ''; $articles = array(); $path_tmp = ''; if ($file === false) { $ret = bbs_read_ann_dir($path, $boardName, $path_tmp, $articles); switch ($ret) { case -1: atomic_error('精华区目录不存在'); case -2: atomic_error('无法加载目录文件'); case -3: break; case -9: atomic_error('系统错误'); default: } $path = $path_tmp; } else { if (bbs_ann_traverse_check($path, $currentuser["userid"]) < 0) { atomic_error("错误的目录"); } } $parent = ''; $up_dirs = array(); $up_cnt = bbs_ann_updirs($path, $boardName, $up_dirs); $cacheit = true; if ($up_cnt >= 2) { $parent = $up_dirs[$up_cnt - 2]; } if ($boardName) { $brdArr = array(); $boardID = bbs_getboard($boardName, $brdArr); $boardArr = $brdArr; if ($boardID) { $boardName = $boardArr['NAME']; $usernum = $currentuser['index']; if (bbs_checkreadperm($usernum, $boardID) == 0) { foundErr('不存在该目录'); } bbs_set_onboard($boardID, 1); if (!bbs_normalboard($boardName)) { $cacheit = false; } } else { $boardName = ''; } } else { $boardID = 0; } if ($cacheit) { if (cache_header('public', @filemtime($modfile), 300)) { return; } } atomic_header(); $html = "<p>"; if ($boardID) { $html .= "<a href='?act=board&board=" . $boardName . "'>回 " . $boardName . " 版面</a> "; } if ($parent) { $html .= "<a href='?act=ann&path=" . $parent . "'>回上级目录</a> "; } $html .= "<a href='?'>回首页</a></p>"; if ($file !== false) { echo $html; echo bbs2_readfile_text($file, MAXCHAR, 2); } else { $html .= "<pre> 编号 [类别] 标 题 整 理 编辑日期\n"; if (count($articles) >= 0) { $i = 1; foreach ($articles as $article) { switch ($article['FLAG']) { case 0: continue 2; case 1: $alt = '目录'; $url = '?act=ann&path=' . urlencode($article['PATH']); break; case 2: case 3: default: $alt = '文件'; $url = '?act=ann&file=' . urlencode($article['PATH']); } $html .= sprintf("%5d ", $i) . "[" . $alt . "]"; $html .= $article['FLAG'] == 3 ? "@" : " "; $title = sprintf("%-37.37s", trim($article['TITLE'])); $html .= '<a href="' . $url . '">' . htmlspecialchars($title) . ' </a>'; $bm = explode(' ', trim($article['BM'])); $html .= sprintf(" %-12.12s ", $bm[0]); $html .= date('Y-m-d', $article['TIME']) . "\n"; $i++; } } $html .= "</pre>"; echo $html; } atomic_footer(); }
require_once 'www2-board.php'; login_init(); bbs_session_modify_user_mode(BBS_MODE_CSIE_ANNOUNCE); if (isset($_GET["p"])) { $numpath = $_GET["p"]; $brdarr = array(); $bid = $numpath; settype($bid, "integer"); if ($bid == 0) { html_error_quit("错误的版面"); } $board = bbs_getbname($bid); if (!$board) { html_error_quit("错误的讨论区"); } if ($bid != bbs_getboard($board, $brdarr)) { html_error_quit("错误的讨论区"); } $board = $brdarr['NAME']; $path = bbs_ann_num2path($numpath, $currentuser["userid"]); if ($path == false) { html_error_quit("错误的文章"); } $path = substr($path, 10, strlen($path) - 9); } else { if (isset($_GET['path'])) { $path = trim($_GET['path']); } else { $path = ""; } }
} $link = pc_db_connect(); if ($_POST["board"]) { $query = "SELECT nodes.uid,nid,subject,htmltag,body,users.username,corpusname " . "FROM nodes,users " . "WHERE nodes.uid = users.uid " . " AND access = 0 " . " AND type = 0 " . " AND nid = " . $nid . " " . "LIMIT 0 , 1;"; } else { $query = "SELECT uid FROM nodes WHERE access = 0 AND type = 0 AND nid = " . $nid . " LIMIT 0 , 1;"; } $result = mysql_query($query, $link); $node = mysql_fetch_array($result); if (!$node) { html_error_quit("对不起,您要转载的文章不存在"); exit; } if ($_POST["board"]) { $brdarr = array(); $brdnum = bbs_getboard($_POST["board"], $brdarr); if ($brdnum == 0) { html_error_quit("错误的讨论区1"); } $usernum = $currentuser["index"]; if (bbs_checkreadperm($usernum, $brdnum) == 0) { html_error_quit("错误的讨论区2"); } if (isset($_POST["big5"])) { $big5 = $_POST["big5"]; } else { $big5 = 0; } settype($big5, "integer"); if (isset($_POST["noansi"])) { $noansi = $_POST["noansi"];
function svEndVote($link, $svid, $annType, $annBoard) { global $currentuser, $sysVoteConfig; $this->user = $currentuser; $vote = sysvote_load_vote_infor($link, $svid); //初始化各个变量 $ann = "⊙ 投票开启于:" . $vote[created] . " 类别:系统投票\n" . "⊙ 主题:" . $vote[ori][subject] . "\n" . "⊙ 投票说明:\n\n" . $vote[ori][description] . "\n\n\n" . ($voteres = array()); for ($i = 0; $i < count($vote[probs]); $i++) { $etemNum[$i] = count($vote[probs][$i][etems]); for ($j = 0; $j < $etemNum[$i]; $j++) { $voteres[$i][$j + 1] = 0; } if ($vote[probs][$i][type] == 4) { $voteres[$i][0] = "本题通过投票征集的意见如下:"; } if ($vote[probs][$i][type] == 2 || $vote[probs][$i][type] == 3) { $voteres[$i][$etemNum[$i] + 1] = "本题通过投票征集的意见如下:"; } } //进行结果统计 $query = "SELECT * FROM sysvote_users WHERE svid = '" . $vote[svid] . "' ORDER BY suid"; $result = mysql_query($query, $link); $voteUserNum = mysql_num_rows($result); for ($k = 0; $k < $voteUserNum; $k++) { $rows = mysql_fetch_array($result); $userres = explode("|", $rows[voteinfo]); for ($i = 0; $i < count($vote[probs]); $i++) { if ($vote[probs][$i][type] == 4) { $voteres[$i][0] .= "\n☆─────────────────────────────────────☆\n " . $rows[userid] . " 于 " . time_format($rows[votetime]) . " 说道: \n" . base64_decode($userres[$i]); } elseif ($vote[probs][$i][type] == 1 || $vote[probs][$i][type] == 3) { $etemres = explode("&", $userres[$i]); for ($l = 0; $l < $etemNum[$i]; $l++) { $voteres[$i][(int) $etemres[$l]]++; } if ($vote[probs][$i][type] == 3 && $etemres[count($etemres) - 1]) { $voteres[$i][$etemNum[$i] + 1] .= "\n☆─────────────────────────────────────☆\n " . $rows[userid] . " 于 " . time_format($rows[votetime]) . " 说道: \n" . base64_decode($etemres[count($etemres) - 1]); } } elseif ($vote[probs][$i][type] == 2) { $etemres = explode("&", $userres[$i]); $voteres[$i][(int) $etemres[0]]++; if ($etemres[1]) { $voteres[$i][$etemNum[$i] + 1] .= "\n☆─────────────────────────────────────☆\n " . $rows[userid] . " 于 " . time_format($rows[votetime]) . " 说道: \n" . base64_decode($etemres[1]); } } else { $voteres[$i][(int) $userres[$i]]++; } } // i 循环 题目 } // k 循环 , 用户 //生成投票结果 $ann = "⊙ 参与投票的用户数:" . $voteUserNum . "\n" . "⊙ 投票结果:\n\n\n"; // $res的结构 : 参与投票的用户数量|题目1|...|题目n|文本输出 $res = $voteUserNum; if ($voteUserNum == 0) { $voteUserNum = 1; } $probType = array("单项选择", "多项选择", "单项选择(可发表意见)", "多项选择(可发表意见)", "问答"); for ($i = 0; $i < count($vote[probs]); $i++) { $ann .= "\n\n\n————————————————┤问题 " . ($i + 1) . "├————————————————\n" . "问题 " . ($i + 1) . ":" . $vote[probs][$i][prob] . "\n" . "类型:" . $probType[$vote[probs][$i][type]] . "\n"; if ($vote[probs][$i][type] == 4) { $ann .= "\n" . $voteres[$i][0]; //问答 $res .= "|" . base64_encode($voteres[$i][0]); } else { $res .= "|"; for ($j = 0; $j < $etemNum[$i]; $j++) { if ($j != 0) { $res .= ","; } $res .= $voteres[$i][$j + 1]; $ann .= "\n选项 " . ($j + 1) . ":" . $vote[probs][$i][etems][$j] . " 票数:" . $voteres[$i][$j + 1] . " 约占" . (int) ($voteres[$i][$j + 1] * 1000 / $voteUserNum) / 10 . "%"; } // j 循环 选项 if ($vote[probs][$i][type] == 2 || $vote[probs][$i][type] == 3) { $ann .= "\n\n" . $voteres[$i][$etemNum[$i] + 1]; $res .= "," . base64_encode($voteres[$i][$etemNum[$i] + 1]); } } } // i 循环 题目 $res .= "|" . base64_encode($ann); $voteLog = $vote[logs] . "\n管理员 " . $this->user["userid"] . " 于 " . date("Y-m-d H:i:s") . " 自 " . $_SERVER["REMOTE_ADDR"] . " 结束本次投票;"; $query = "UPDATE sysvote_votes SET active = 0 , results = '" . $res . "' , logs = '" . $voteLog . "' WHERE svid = '" . $vote[svid] . "';"; mysql_query($query, $link); $query = "DELETE FROM sysvote_users WHERE svid = " . $vote[svid]; mysql_query($query, $link); if ($annType == 1) { $annBoard = "vote"; } elseif ($annType == 2) { $annBoard = $sysVoteConfig["BOARD"]; } elseif ($annType == 3) { $brdArr = array(); $boardID = bbs_getboard($annBoard, $brdArr); if ($boardID == 0) { html_error_quit("指定的版面不存在!"); } } if ($annType != 0) { $title = "[公告] 系统投票结果"; $content = "【此篇文章是由自动发信系统所张贴】\n\n" . $ann; $ret = bbs_postarticle($annBoard, $title, $content, 0, 0, 0, 0); } }
if ($ret < 0) { html_error_quit("加入/修改讨论区失败" . $ret); } else { if ($bnum == 0) { echo "新讨论区成立"; } else { echo "修改讨论区成功"; } } } else { $explains = array(); $explain_num = bbs_get_explain($explains); if (isset($_GET["board"])) { $board = $_GET["board"]; $nowbh = array(); $bnum = bbs_getboard($board, $nowbh); } else { $board = ""; $bnum = 0; } ?> <center><p><?php echo BBS_FULL_NAME; ?> -- <?php if ($bnum) { echo "修改版面属性"; } else { echo "新增版面"; }
<?php session_start(); require "www2-funcs.php"; require "www2-board.php"; login_init(); assert_login(); if (!isset($_GET["board"])) { html_error_quit("未指定发文版面!"); } $boardName = $_GET["board"]; $brdArr = array(); $boardID = bbs_getboard($boardName, $brdArr); if ($boardID == 0) { html_error_quit("指定的版面不存在!"); } $boardName = $brdArr["NAME"]; $usernum = $currentuser["index"]; if (bbs_checkreadperm($usernum, $boardID) == 0) { html_error_quit("您无权阅读该版!"); } if (bbs_is_readonly_board($brdArr)) { html_error_quit("本版为只读讨论区!"); } if (bbs_checkpostperm($usernum, $boardID) == 0) { html_error_quit("您无权在该版面发文!"); } if ($currentuser['score_user'] < 2000) { $code = @$_POST['code']; if (!$code) { html_error_quit('请输入验证码');
function gen_commend_html() { # load xml doc $commend_file = BBS_HOME . "/xml/commend.xml"; if (!file_exists($commend_file)) { return; } $doc = domxml_open_file($commend_file); if (!$doc) { return; } $root = $doc->document_element(); $boards = $root->child_nodes(); $brdarr = array(); ?> <div align="center"><table cellpadding="0" cellspacing="0" class="recommend_title"> <tr> <td> 推荐文章</td> </tr> </table></div> <table border="0" cellpadding="0" cellspacing="0" class="RecommendTable" align="center"> <tr><td height=10 colspan=2></td></tr> <?php # shift through the array while ($board = array_shift($boards)) { if ($board->node_type() == XML_TEXT_NODE) { continue; } $commend_title = find_content($board, "title"); $commend_author = find_content($board, "author"); $commend_o_board = find_content($board, "o_board"); $commend_o_id = find_content($board, "o_id"); $commend_id = find_content($board, "id"); $commend_o_groupid = find_content($board, "o_groupid"); $commend_brief = find_content($board, "brief"); $brdnum = bbs_getboard($commend_o_board, $brdarr); if ($brdnum == 0) { continue; } $brd_encode = urlencode($brdarr["NAME"]); ?> <tr> <td class="RecommendTitle"><script type="text/javascript">putImage("recommend.gif","");</script> <a href="bbsrecon.php?id=<?php echo $commend_id; ?> "><?php echo htmlspecialchars($commend_title); ?> </a></td><td class="RecommendLink"><div align="right">[<a href="bbsdoc.php?board=<?php echo $brd_encode; ?> "><?php echo htmlspecialchars($brdarr["DESC"]); ?> </a>] [<a href="bbstcon.php?board=<?php echo $brd_encode; ?> &gid=<?php echo $commend_o_groupid; ?> ">同主题阅读原文</a>]</div> </td></tr><tr><td colspan=2><dl style="MARGIN-TOP: 1px;MARGIN-BOTTOM: 5px; MARGIN-LEFT: 25px;"><dt> <?php echo htmlspecialchars($commend_brief); ?> </dl> </td> </tr> <?php } ?> <tr><td width="100%" height=15 align="right" colspan=2><a href="bbsrecommend.php">更多推荐文章</a></td></tr> </table> <?php }