Пример #1
0
    $artcnt = ARTICLE_PER_RSS;
    if ($total <= $artcnt) {
        $start = 1;
        $artcnt = $total;
    } else {
        $start = $total - $artcnt + 1;
    }
    $articles = bbs_getarticles($board, $start, $artcnt, $ftype) or die;
    $cc = count($articles);
    for ($i = $cc - 1; $i >= 0; $i--) {
        $origin = $articles[$i];
        $item = array();
        $item["title"] = htmlspecialchars($origin['TITLE'], ENT_QUOTES) . " ";
        $conurl = "bbscon.php?bid=" . $brdnum . "&amp;id=" . $origin['ID'];
        //you want the link to always work, so you don't want to add num
        //if ($ftype == $dir_modes["DIGEST"]) $conurl .= "&amp;ftype=".$ftype."&amp;num=".($start+$i);
        $item["link"] = SiteURL . $conurl;
        $item["author"] = $origin['OWNER'];
        $item["pubDate"] = gmt_date_format($origin['POSTTIME']);
        $item["guid"] = $item["link"];
        //TODO
        //$item["comments"] = ?? //TODO
        $filename = bbs_get_board_filename($board, $origin["FILENAME"]);
        $contents = bbs2_readfile_text($filename, DESC_CHAR_PER_RSS_ITEM, 0);
        if (is_string($contents)) {
            $item["description"] = "<![CDATA[" . $contents . "]]>";
        }
        $items[] = $item;
    }
}
output_rss($channel, $items);
Пример #2
0
$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"];
    $response->topic[$i]->last_reply_time = $article["LAST_POSTTIME"];
    $response->topic[$i]->last_reply_author = $article["LAST_OWNER"];
    $filename = bbs_get_board_filename($bname, $article["FILENAME"]);
    $ret = bbs_parse_article($filename, $arr, 1);
    if ($ret == 0) {
        $response->topic[$i]->brief = int_string(htmlspecialchars($arr["brief"]));
    }
    $i++;
}
int_finish($response);
Пример #3
0
    $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;
}
$channel["lastBuildDate"] = gmt_date_format($modifytime);
output_rss($channel, $items);
Пример #4
0
</select>
 [<a target="_blank" href="bbssig.php">查看签名档</a>]
<?php 
$bBackup = bbs_is_save2sent() != 0;
?>
<input type="checkbox" name="backup" value="1"<?php 
if ($bBackup) {
    echo " checked=\"checked\"";
}
?>
>保存到发件箱<br />
<textarea class="sb1" name="text" onkeydown='return textarea_okd(document.postform.submit, event);' rows="20" cols="80" wrap="physical">
<?php 
if (isset($file)) {
    if (isset($board)) {
        $filename = bbs_get_board_filename($board, $file);
        echo "\n【 在 " . $destuserid . " 的大作中提到: 】\n";
    } else {
        $filename = bbs_setmailfile($currentuser["userid"], $file);
        echo "\n【 在 " . $destuserid . " 的来信中提到: 】\n";
    }
    if (file_exists($filename)) {
        $fp = fopen($filename, "r");
        if ($fp) {
            $lines = 0;
            $buf = fgets($fp, 256);
            /* 取出第一行中 被引用文章的 作者信息 */
            $end = strrpos($buf, ")");
            $start = strpos($buf, ":");
            if ($start != FALSE && $end != FALSE) {
                $quser = substr($buf, $start + 2, $end - $start - 1);
Пример #5
0
 function bbs_get_board_index($board, $ftype)
 {
     global $currentuser;
     global $dir_index;
     global $dir_modes;
     if ($ftype == $dir_modes["SUPERFILTER"]) {
         $userid = $currentuser["userid"];
         if ($userid == "guest") {
             die;
         }
         /* TODO */
         return ".Search." . $userid;
     } else {
         return bbs_get_board_filename($board, $dir_index[$ftype]);
     }
 }
Пример #6
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();
}
Пример #7
0
}
if (!isset($_GET["id"])) {
    html_error_quit("´íÎóµÄÎÄÕºÅ");
}
$id = $_GET["id"];
settype($id, "integer");
if ($id == 0) {
    html_error_quit("´íÎóµÄÎÄÕºÅ.");
}
$articles = array();
$ftype = $dir_modes["NORMAL"];
$num = bbs_get_records_from_id($brdarr["NAME"], $id, $ftype, $articles);
if ($num == 0) {
    html_error_quit("´íÎóµÄÎÄÕºÅ.");
}
$filename = bbs_get_board_filename($brdarr["NAME"], $articles[1]["FILENAME"]);
if (!file_exists($filename)) {
    html_error_quit("´íÎóµÄÎÄÕºÅ...");
}
if (cache_header("public", @filemtime($filename), 300)) {
    return;
}
@($attachpos = $_GET["ap"]);
//pointer to the size after ATTACHMENT PAD
if ($attachpos != 0) {
    die;
    bbs_file_output_attachment($filename, $attachpos);
    exit;
}
page_header("ÍƼöÎÄÕÂÔĶÁ", "<a href='bbsrecommend.php'>ÍƼöÎÄÕÂ</a>");
?>