Beispiel #1
0
/**
 * 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;
}
Beispiel #2
0
    html_error_quit("错误的参数");
}
$pagesize = 20;
$totalpage = ($num - 1) / $pagesize + 1;
$totalpage = intval($totalpage);
if ($pno < 1 || $pno > $totalpage) {
    $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"]);
Beispiel #3
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"];
}
$articles = array();
$num = bbs_get_records_from_id($brdarr["NAME"], $id, $dir_modes["NORMAL"], $articles);
if ($num == 0) {
    html_error_quit("错误的文章号");
}
if (bbs_is_member_read($brdarr) && no_member_read_perm($articles[1])) {
    html_error_quit("本版驻版可读,非本版驻版用户不能转寄本版文章!");
}
$brd_encode = urlencode($board);
bbs_board_nav_header($brdarr, "文章转寄");
if (!isset($_GET["do"])) {
    ?>
<form action="bbsfwd.php?do" method="post" class="medium"/>
<input type="hidden" name="board" value="<?php 
    echo $brdarr["NAME"];
    ?>
"/>
Beispiel #4
0
$brd_encode = urlencode($board);
if (bbs_checkpostperm($usernum, $brdnum) == 0) {
    html_error_quit("错误的讨论区或者您无权在此讨论区发表文章");
}
if (bbs_is_readonly_board($brdarr)) {
    html_error_quit("不能在只读讨论区发表文章");
}
$ftype = $dir_modes["NORMAL"];
bbs_board_nav_header($brdarr, "修改附件");
if (isset($_GET['id'])) {
    $id = intval($_GET['id']);
} else {
    html_error_quit("错误的文编号");
}
$articles = array();
$num = bbs_get_records_from_id($brdarr["NAME"], $id, $ftype, $articles);
if ($num == 0) {
    html_error_quit("错误的文编号");
}
@($action = $_GET["act"]);
$msg = "";
$ret = false;
if ($action == "delete") {
    @($act_attachnum = $_GET["attachnum"]);
    settype($act_attachnum, "integer");
    $ret = bbs_attachment_del($board, $id, $act_attachnum);
    if (!is_array($ret)) {
        $msg = "错误: " . bbs_error_get_desc($ret);
    } else {
        $msg = "删除附件成功";
    }
Beispiel #5
0
}
$board = $brdarr['NAME'];
$brd_encode = urlencode($board);
if (isset($_GET['id'])) {
    $id = intval($_GET['id']);
} else {
    html_error_quit('错误的文章ID');
}
if (!bbs_normalboard($board)) {
    if (bbs_checkreadperm($currentuser["index"], $bid) == 0) {
        html_error_quit("错误的讨论区");
    }
}
$ftype = $dir_modes["NORMAL"];
$articles = array();
$num = bbs_get_records_from_id($board, $id, $ftype, $articles);
if ($num == 0) {
    html_error_quit("错误的文章号,原文可能已经被删除");
}
$id = $articles[1]["ID"];
bbs_board_nav_header($brdarr, "文章推荐");
$confirmed = isset($_GET['do']) ? 1 : 0;
switch (bbs_docommend($board, $id, $confirmed)) {
    case 0:
        if ($confirmed) {
            html_success_quit("推荐成功!", array("<a href='bbsdoc.php?board=" . $brd_encode . "'>返回 " . $brdarr['DESC'] . "</a>", "<a href='bbscon.php?bid=" . $bid . "&id=" . $id . "'>返回《" . htmlspecialchars($articles[1]["TITLE"]) . "》</a>"));
        } else {
            // show recommend form below
        }
        break;
    case -1:
Beispiel #6
0
     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 . "&amp;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;
 }
 $article = $articles[1];
 if (!$article) {
     continue;
 }
 $contentfile = bbs_get_board_filename($brdname, $article["FILENAME"]);
 $content = bbs2_readfile_text($contentfile, DESC_CHAR_PER_RSS_ITEM, 0);
 if (is_string($content)) {
     $item["description"] = "<![CDATA[" . $content . "]]>";
 } else {
     continue;
 }
 $items[] = $item;
Beispiel #7
0
if (isset($_GET["reid"])) {
    $reid = $_GET["reid"];
    if (bbs_is_noreply_board($brdarr)) {
        html_error_quit("本版只可发表文章,不可回复文章!");
    }
} else {
    $reid = 0;
}
if (bbs_is_tmplpost_board($brdarr)) {
    header('Location:bbsshowtmpl.php?board=' . $board);
    exit;
}
settype($reid, "integer");
$articles = array();
if ($reid > 0) {
    $num = bbs_get_records_from_id($board, $reid, $dir_modes["NORMAL"], $articles);
    if ($num == 0) {
        html_error_quit("错误的 Re 文编号");
    }
    if ($articles[1]["FLAGS"][2] == 'y') {
        html_error_quit("该文不可回复!");
    }
    if (bbs_is_member_read($brdarr) && no_member_read_perm($articles[1])) {
        html_error_quit("本版驻版可读,非本版驻版用户不能回复本版文章!");
    }
}
$brd_encode = urlencode($board);
bbs_board_nav_header($brdarr, $reid ? "回复文章" : "发表文章");
if (!$reid) {
    $titkey = array();
    $count = bbs_gettitkey($board, $titkey, 1);
Beispiel #8
0
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) {
    $ret = bbs_get_records_from_id($bname, $request->reid, $dir_modes["NORMAL"], $articles);
    if ($ret == 0) {
        ie("no such article.");
    }
    if ($articles[1]["FLAGS"][2] == "y") {
        ie("reply is denied.");
    }
}
$ret = bbs_postarticle($bname, $title, $content, 0, $request->reid, 0, 0, 0, 0);
if ($ret < 0) {
    ie("error code: {$ret}.");
}
$response->id = $ret;
int_finish($response);
?>
Beispiel #9
0
switch ($ret) {
    case -1:
        html_error_quit("系统错误,请联系管理员");
        break;
    case -2:
        html_error_quit("错误的讨论区");
        break;
    case -3:
        html_error_quit("您尚无权限");
        break;
    default:
}
if (isset($_GET['id'])) {
    $articles = array();
    $id = $_GET['id'];
    if (bbs_get_records_from_id($board, $id, $dir_modes["NORMAL"], $articles) <= 0) {
        html_error_quit("错误的文章号");
    }
    $userid = $articles[1]["OWNER"];
}
$maxdenydays = $currentuser["userlevel"] & BBS_PERM_SYSOP ? 70 : 14;
?>
<table class="main wide adj">
<caption>封禁名单</caption>
<col class="center" width="60"/><col class="center" width="100"/><col width="*"/><col class="center" width="150"/><col class="center" width="60"/>
<tbody><tr><th>序号</th><th>用户名</th><th>理由</th><th>说明</th><th>修改</th><th>解封</th></tr>
<?php 
$i = 1;
foreach ($denyusers as $user) {
    echo '<tr><td>' . $i . '</td><td><a href="bbsqry.php?userid=' . $user['ID'] . '">' . $user['ID'] . '</a></td>' . '<td>' . htmlspecialchars($user['EXP']) . ' </td>' . '<td>' . htmlspecialchars($user['COMMENT']) . '</td>' . '<td><a href="bbsmodifydeny.php?board=' . $brd_encode . "&user="******">修改</a></td>' . '<td><a onclick="return confirm(\'确实解封吗?\')" href="' . $_SERVER['PHP_SELF'] . '?board=' . $brd_encode . '&act=del&userid=' . $user['ID'] . '">解封</a></td>' . '</tr>';
    $i++;
Beispiel #10
0
function atomic_post()
{
    global $currentuser, $atomic_board, $atomic_brdarr, $atomic_brdnum, $dir_modes, $utmpnum;
    atomic_get_board(TRUE);
    $reid = isset($_GET["reid"]) ? @intval($_GET["reid"]) : 0;
    if ($reid > 0) {
        if (bbs_is_noreply_board($atomic_brdarr)) {
            atomic_error("本版只可发表文章,不可回复文章!");
        }
        $articles = array();
        $num = bbs_get_records_from_id($atomic_board, $reid, $dir_modes["NORMAL"], $articles);
        if ($num == 0) {
            atomic_error("错误的 Re 文编号");
        }
        if ($articles[1]["FLAGS"][2] == 'y') {
            atomic_error("该文不可回复!");
        }
    }
    if (isset($_GET["post"])) {
        if (!isset($_POST["title"])) {
            atomic_error("没有指定文章标题!");
        }
        if (!isset($_POST["text"])) {
            atomic_error("没有指定文章内容!");
        }
        $title = atomic_get_input(trim($_POST["title"]));
        $text = atomic_get_input($_POST["text"]);
        if (isset($_GET["reid"])) {
            $reID = @intval($_GET["reid"]);
        } else {
            $reID = 0;
        }
        $outgo = bbs_is_outgo_board($atomic_brdarr) ? 1 : 0;
        $anony = 0;
        $attmsg = "";
        if (atomic_uploadable() && isset($_FILES['attachfile'])) {
            $attpost = $_FILES['attachfile'];
            @($errno = $attpost['error']);
            switch ($errno) {
                case UPLOAD_ERR_OK:
                    $ofile = $attpost['tmp_name'];
                    if (!file_exists($ofile)) {
                        $attmsg = "文件传输出错!";
                        break;
                    }
                    $oname = $attpost['name'];
                    $htmlname = htmlspecialchars(my_basename($oname));
                    if (!is_uploaded_file($ofile)) {
                        die;
                    }
                    if (compress_bmp($ofile, $oname)) {
                        $attmsg .= "过大 BMP 图片 " . $htmlname . " 被自动转换成 PNG 格式。<br/>";
                    }
                    $ret = bbs_upload_add_file($ofile, $oname);
                    if ($ret) {
                        $attmsg .= bbs_error_get_desc($ret);
                    } else {
                        $attmsg .= $htmlname . "上传成功!<br/>";
                    }
                    break;
                case UPLOAD_ERR_INI_SIZE:
                case UPLOAD_ERR_FORM_SIZE:
                    $attmsg = "文件超过预定的大小" . sizestring(BBS_MAXATTACHMENTSIZE) . "字节";
                    break;
                case UPLOAD_ERR_PARTIAL:
                    $attmsg = "文件传输出错!";
                    break;
                case UPLOAD_ERR_NO_FILE:
                    $attmsg = "没有文件上传!";
                    break;
                default:
                    $attmsg = "未知错误";
            }
        }
        $ret = bbs_postarticle($atomic_board, $title, $text, $currentuser["signature"], $reID, $outgo, $anony, 0, 0);
        switch ($ret) {
            case -1:
                atomic_error("错误的讨论区名称!");
                break;
            case -2:
                atomic_error("本版为二级目录版!");
                break;
            case -3:
                atomic_error("标题为空!");
                break;
            case -4:
                atomic_error("此讨论区是唯读的, 或是您尚无权限在此发表文章!");
                break;
            case -5:
                atomic_error("很抱歉, 你被版务人员停止了本版的post权利!");
                break;
            case -6:
                atomic_error("两次发文/信间隔过密,请休息几秒再试!");
                break;
            case -7:
                atomic_error("无法读取索引文件! 请通知站务人员, 谢谢! ");
                break;
            case -8:
                atomic_error("本文不可回复!");
                break;
            case -9:
                atomic_error("系统内部错误, 请迅速通知站务人员, 谢谢!");
                break;
            case -21:
                atomic_error("您的积分不符合当前讨论区的设定, 暂时无法在当前讨论区发表文章...");
                break;
        }
        atomic_header();
        $url = "?act=board&board=" . $atomic_board;
        if (isset($attmsg)) {
            echo $attmsg . "<br/>";
        }
        if ($ret == -10) {
            echo "<p>很抱歉,本文可能含有不当内容,需经审核方可发表。<br/><br/>" . "根据《帐号管理办法》,被系统过滤的文章视同公开发表。请耐心等待<br/>" . "站务人员的审核,不要多次尝试发表此文章。<br/><br/>" . "如有疑问,请致信 SYSOP 咨询。</p>";
            echo "返回<a href='{$url}'>版面文章列表</a>";
        } else {
            echo "发文成功!本页面将在3秒后自动返回<a href='{$url}'>版面文章列表</a><meta http-equiv='refresh' content='3; url=" . $url . "'/>";
        }
        atomic_footer();
        return;
    }
    if ($reid) {
        if (!strncmp($articles[1]["TITLE"], "Re: ", 4)) {
            $nowtitle = $articles[1]["TITLE"];
        } else {
            $nowtitle = "Re: " . $articles[1]["TITLE"];
        }
    } else {
        $nowtitle = "";
    }
    atomic_header();
    $html = "<p><a href='?act=board&board=" . $atomic_board . "'>" . $atomic_board . " 版</a>发表文章</p>";
    $html .= "<form action='?act=post&board=" . $atomic_board . "&reid=" . $reid . "&post=1' method='post'" . (isset($_GET['upload']) ? " enctype='multipart/form-data'>" : ">");
    $html .= '标题: <input type="text" name="title" size="40" maxlength="100" value="' . ($nowtitle ? htmlspecialchars($nowtitle, ENT_QUOTES) . " " : "") . '"/><br/>';
    $html .= '<textarea name="text" rows="20" cols="80" wrap="physical">';
    if ($reid > 0) {
        $filename = bbs_get_board_filename($atomic_board, $articles[1]["FILENAME"]);
        $q = @bbs_get_quote($filename);
        if ($q) {
            $html .= "\n" . $q;
        }
    }
    $html .= '</textarea><br/>';
    if (isset($_GET['upload'])) {
        $html .= '<input name="attachfile" type="file"/><br/>';
    }
    $html .= '<input type="submit" value="发表" /></form>';
    echo $html;
    atomic_footer();
}
Beispiel #11
0
 public function isReallyTop()
 {
     $a = array();
     return bbs_get_records_from_id($this->_board->NAME, $this->ID, 11, $a) != 0;
 }