Пример #1
0
                break;
            case UPLOAD_ERR_PARTIAL:
                $msg = "文件传输出错!";
                break;
            case UPLOAD_ERR_NO_FILE:
                $msg = "没有文件上传!";
                break;
            default:
                $msg = "未知错误";
        }
    }
}
if (!is_array($ret)) {
    $attachments = bbs_attachment_list($board, $id);
    if (!is_array($attachments)) {
        html_error_quit(bbs_error_get_desc($attachments));
    }
} else {
    $attachments = $ret;
}
$filecount = count($attachments);
$totalsize = 0;
$allnames = array();
$allnames_p = array();
$allpos = array();
$alllen = array();
for ($i = 0; $i < $filecount; $i++) {
    $allnames[] = $attachments[$i]["name"];
    $allnames_p[] = "'" . addslashes($attachments[$i]["name"]) . "'";
    $allpos[] = $attachments[$i]["pos"];
    $alllen[] = $attachments[$i]["size"];
Пример #2
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();
}
Пример #3
0
     $ofile = $attpost['tmp_name'];
     if (!file_exists($ofile)) {
         $msg .= "文件传输出错!";
         break 2;
     }
     $oname = $attpost['name'];
     $htmlname = htmlspecialchars(my_basename($oname));
     if (!is_uploaded_file($ofile)) {
         die;
     }
     if (compress_bmp($ofile, $oname)) {
         $msg .= "过大 BMP 图片 " . $htmlname . " 被自动转换成 PNG 格式。<br/>";
     }
     $ret = bbs_upload_add_file($ofile, $oname);
     if ($ret) {
         $msg .= bbs_error_get_desc($ret);
     } else {
         $msg .= $htmlname . "上传成功!<br/>";
         continue 2;
     }
     break;
 case UPLOAD_ERR_INI_SIZE:
 case UPLOAD_ERR_FORM_SIZE:
     $msg .= "文件超过上限 " . sizestring(BBS_MAXATTACHMENTSIZE) . " 字节";
     break;
 case UPLOAD_ERR_PARTIAL:
     $msg .= "文件传输出错!";
     break;
 case UPLOAD_ERR_NO_FILE:
     continue 2;
     $msg .= "没有文件上传!";
Пример #4
0
    $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("错误的文编号");
}
$ret = bbs_article_deny_modify($board, $id);
if ($ret) {
    html_error_quit(bbs_error_get_desc($ret));
}
$brd_encode = urlencode($brdarr["NAME"]);
if (isset($_GET['do'])) {
    if (@$_POST["havemath"] == "1") {
        $is_tex = 1;
    } else {
        $is_tex = 0;
    }
    /*
    $ret = bbs_edittitle($board, $id, rtrim($_POST["title"]), $ftype, $is_tex);
    */
    $ret = bbs_updatearticle2($board, $id, rtrim($_POST["title"]), $_POST['text'], $ftype, -1, -1, $is_tex);
    if ($ret != 0) {
        switch ($ret) {
            case -1: