} if (bbs_checkpostperm($usernum, $brdnum) == 0) { html_error_quit("错误的讨论区或者您无权在此讨论区发表文章"); } if (bbs_deny_me($userid, $board)) { html_error_quit("您被管理员取消了本版的发文权限"); } if (bbs_is_readonly_board($brdarr)) { html_error_quit("不能在只读讨论区发表文章"); } if (bbs_member_post_perm($usernum, $brdnum) == 0) { html_error_quit("本版为驻版可写版面,非驻版用户不能发表文章"); } 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 文编号");
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(); }