| 1 |
sysadm |
1.1 |
<?
|
| 2 |
|
|
// Prevent load standalone
|
| 3 |
|
|
if (!isset($result_set))
|
| 4 |
|
|
{
|
| 5 |
|
|
exit();
|
| 6 |
|
|
}
|
| 7 |
|
|
?>
|
| 8 |
|
|
<html>
|
| 9 |
|
|
<head>
|
| 10 |
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
| 11 |
|
|
<title>发表文章</title>
|
| 12 |
|
|
<link rel="stylesheet" href="<? echo get_theme_view_file("css"); ?>" type="text/css">
|
| 13 |
|
|
<script type="text/javascript" src="../js/nw_open.js"></script>
|
| 14 |
|
|
<script type="text/javascript" src="../js/lml_assistant.js"></script>
|
| 15 |
|
|
<script src="../js/polyfill.min.js"></script>
|
| 16 |
|
|
<script src="../js/axios.min.js"></script>
|
| 17 |
|
|
<script type="text/javascript">
|
| 18 |
|
|
function refresh_err_msg(errorFieldMap)
|
| 19 |
|
|
{
|
| 20 |
|
|
document.getElementsByName("err_msg").forEach(element => {
|
| 21 |
|
|
element.innerHTML = (errorFieldMap.has(element.id) ? errorFieldMap.get(element.id) : "");
|
| 22 |
|
|
});
|
| 23 |
|
|
}
|
| 24 |
|
|
|
| 25 |
|
|
function refresh_textarea(updateFieldMap)
|
| 26 |
|
|
{
|
| 27 |
|
|
document.getElementsByName("textarea").forEach(element => {
|
| 28 |
|
|
if (updateFieldMap.has(element.id))
|
| 29 |
|
|
{
|
| 30 |
|
|
element.value = updateFieldMap.get(element.id);
|
| 31 |
|
|
}
|
| 32 |
|
|
});
|
| 33 |
|
|
}
|
| 34 |
|
|
|
| 35 |
|
|
function post_article(f)
|
| 36 |
|
|
{
|
| 37 |
|
|
instance.post('post_service.php', {
|
| 38 |
|
|
id: <? echo $result_set["data"]["id"]; ?>,
|
| 39 |
|
|
reply_id: <? echo $result_set["data"]["reply_id"]; ?>,
|
| 40 |
|
|
sid: <? echo $result_set["data"]["sid"]; ?>,
|
| 41 |
|
|
title: f.textarea_title.value,
|
| 42 |
|
|
transship: (f.transship != null && f.transship.checked ? "1" : "0"),
|
| 43 |
|
|
content: f.textarea_content.value,
|
| 44 |
|
|
emoji: f.emoji.value,
|
| 45 |
|
|
sign_id: f.sign_id.value,
|
| 46 |
|
|
reply_note: (f.reply_note.checked ? "1" : "0"),
|
| 47 |
|
|
attachment: f.attachment.files,
|
| 48 |
|
|
}, {
|
| 49 |
|
|
headers: {
|
| 50 |
|
|
'Content-Type': 'multipart/form-data',
|
| 51 |
|
|
}
|
| 52 |
|
|
})
|
| 53 |
|
|
.then(function (response) {
|
| 54 |
|
|
var ret = response.data;
|
| 55 |
|
|
var errorFieldMap = new Map();
|
| 56 |
|
|
var updateFieldMap = new Map();
|
| 57 |
|
|
switch (ret.return.code)
|
| 58 |
|
|
{
|
| 59 |
|
|
case 0: // OK
|
| 60 |
|
|
var returnPath = "view_article.php?id=" + ret.return.aid + "#" + ret.return.aid;
|
| 61 |
|
|
document.location = returnPath;
|
| 62 |
|
|
refresh_err_msg(errorFieldMap);
|
| 63 |
|
|
break;
|
| 64 |
|
|
case -1: // Input validation failed
|
| 65 |
|
|
ret.return.errorFields.forEach(field => {
|
| 66 |
|
|
errorFieldMap.set("err_msg_" + field.id, "<br />" + field.errMsg);
|
| 67 |
|
|
updateFieldMap.set("textarea_" + field.id, field.updateValue);
|
| 68 |
|
|
});
|
| 69 |
|
|
refresh_err_msg(errorFieldMap);
|
| 70 |
|
|
refresh_textarea(updateFieldMap);
|
| 71 |
|
|
break;
|
| 72 |
|
|
case -2: // Internal error
|
| 73 |
|
|
console.log(ret.return.message);
|
| 74 |
|
|
errorFieldMap.set("err_msg_prompt", "内部错误");
|
| 75 |
|
|
refresh_err_msg(errorFieldMap);
|
| 76 |
|
|
break;
|
| 77 |
|
|
default:
|
| 78 |
|
|
console.log(ret.return.code);
|
| 79 |
|
|
break;
|
| 80 |
|
|
}
|
| 81 |
|
|
})
|
| 82 |
|
|
.catch(function (error) {
|
| 83 |
|
|
console.log(error);
|
| 84 |
|
|
});
|
| 85 |
|
|
|
| 86 |
|
|
return false;
|
| 87 |
|
|
}
|
| 88 |
|
|
|
| 89 |
|
|
function upload_del(id)
|
| 90 |
|
|
{
|
| 91 |
|
|
if (window.confirm('真的要删除吗?') == false)
|
| 92 |
|
|
{
|
| 93 |
|
|
return false;
|
| 94 |
|
|
}
|
| 95 |
|
|
|
| 96 |
|
|
instance.post('upload_del.php', {
|
| 97 |
|
|
aid: id
|
| 98 |
|
|
})
|
| 99 |
|
|
.then(function (response) {
|
| 100 |
|
|
var ret = response.data;
|
| 101 |
|
|
var errorFieldMap = new Map();
|
| 102 |
|
|
switch (ret.return.code)
|
| 103 |
|
|
{
|
| 104 |
|
|
case 0: // OK
|
| 105 |
|
|
case 1: // Already deleted
|
| 106 |
|
|
document.getElementById("attachment_" + id).style.display = "none";
|
| 107 |
|
|
refresh_err_msg(errorFieldMap);
|
| 108 |
|
|
break;
|
| 109 |
|
|
case -1: // Input validation failed
|
| 110 |
|
|
errorFieldMap.set("err_msg_attachment", "<br />" + ret.return.message);
|
| 111 |
|
|
refresh_err_msg(errorFieldMap);
|
| 112 |
|
|
break;
|
| 113 |
|
|
case -2: // Internal error
|
| 114 |
|
|
console.log(ret.return.message);
|
| 115 |
|
|
errorFieldMap.set("err_msg_prompt", "内部错误");
|
| 116 |
|
|
refresh_err_msg(errorFieldMap);
|
| 117 |
|
|
break;
|
| 118 |
|
|
default:
|
| 119 |
|
|
console.log(ret.return.code);
|
| 120 |
|
|
break;
|
| 121 |
|
|
}
|
| 122 |
|
|
})
|
| 123 |
|
|
.catch(function (error) {
|
| 124 |
|
|
console.log(error);
|
| 125 |
|
|
});
|
| 126 |
|
|
|
| 127 |
|
|
return false;
|
| 128 |
|
|
}
|
| 129 |
|
|
|
| 130 |
|
|
const instance = axios.create({
|
| 131 |
|
|
withCredentials: true,
|
| 132 |
|
|
timeout: 3000,
|
| 133 |
|
|
baseURL: document.location.protocol + '//' + document.location.hostname + (document.location.port=='' ? '' : (':' + document.location.port)) + '/bbs/',
|
| 134 |
|
|
});
|
| 135 |
|
|
|
| 136 |
|
|
window.addEventListener("load", () => {
|
| 137 |
|
|
var f = document.getElementById("post_form");
|
| 138 |
|
|
f.addEventListener("submit", (e) => {
|
| 139 |
|
|
e.preventDefault();
|
| 140 |
|
|
post_article(f);
|
| 141 |
|
|
});
|
| 142 |
|
|
});
|
| 143 |
|
|
|
| 144 |
|
|
</script>
|
| 145 |
|
|
</head>
|
| 146 |
|
|
<body>
|
| 147 |
|
|
<center>
|
| 148 |
|
|
<table border="0" cellpadding="1" cellspacing="0" width="770">
|
| 149 |
|
|
<tr>
|
| 150 |
|
|
<td>
|
| 151 |
|
|
<a class="s2" href="main.php?sid=<? echo $result_set["data"]["sid"]; ?>"><? echo $BBS_name; ?></a>>><a class="s2" href="bbs.php?sid=<? echo $result_set["data"]["sid"]; ?>"><? echo $result_set["data"]["section_title"]; ?></a>>><?
|
| 152 |
|
|
if ($result_set["data"]["id"] == 0)
|
| 153 |
|
|
{
|
| 154 |
|
|
if ($result_set["data"]["reply_id"] > 0)
|
| 155 |
|
|
{
|
| 156 |
|
|
?><a class="s2" href="view_article.php?id=<? echo $result_set["data"]["reply_id"] . "#" . $result_set["data"]["reply_id"]; ?>"><? echo split_line(htmlspecialchars($result_set["data"]["title"], ENT_HTML401, 'UTF-8'), "", 65, 2, "<br />"); ?></a>>><a class="s2" href="#">回复文章</a><?
|
| 157 |
|
|
}
|
| 158 |
|
|
else
|
| 159 |
|
|
{
|
| 160 |
|
|
?><a class="s2" href="#">发表新文章</a><?
|
| 161 |
|
|
}
|
| 162 |
|
|
}
|
| 163 |
|
|
else
|
| 164 |
|
|
{
|
| 165 |
|
|
?><a class="s2" href="view_article.php?id=<? echo $result_set["data"]["id"] . "#" . $result_set["data"]["id"]; ?>"><? echo split_line(htmlspecialchars($result_set["data"]["title"], ENT_HTML401, 'UTF-8'), "", 65, 2, "<br />"); ?></a>>><a class="s2" href="#">修改文章</a><?
|
| 166 |
|
|
}
|
| 167 |
|
|
?>
|
| 168 |
|
|
</td>
|
| 169 |
|
|
</tr>
|
| 170 |
|
|
</table>
|
| 171 |
|
|
<form method="POST" ENCTYPE="multipart/form-data" id="post_form" name="post_form" action="#">
|
| 172 |
|
|
<table border="0" cellpadding="5" cellspacing="0" width="770">
|
| 173 |
|
|
<tr>
|
| 174 |
|
|
<td colspan="2" align="center" style="color:red;">别忙着发贴,请先看一下<a class="s0" href="doc/management.xml" target=_blank>《论坛管理章程》</a>吧!<br>
|
| 175 |
|
|
(请对您的言论负责,遵守有关法律、法规,尊重网络道德)</td>
|
| 176 |
|
|
</tr>
|
| 177 |
|
|
<tr height="10">
|
| 178 |
|
|
<td colspan="2" align="center"><span id="err_msg_prompt" name="err_msg" style="color: red;"></span></td>
|
| 179 |
|
|
</tr>
|
| 180 |
|
|
<tr>
|
| 181 |
|
|
<td width="10%" align="right">标题<span id="err_msg_title" name="err_msg" style="color: red;"></span></td>
|
| 182 |
|
|
<td width="90%">
|
| 183 |
|
|
<input type="text" name="textarea" id="textarea_title" size="80" <? echo ($result_set["data"]["id"] != 0 ? "readonly" : ""); ?> value="<? echo ($result_set["data"]["reply_id"] > 0 ? split_line(htmlspecialchars($result_set["data"]["title"], ENT_QUOTES | ENT_HTML401, 'UTF-8'), "Re: ", 80, 1) : htmlspecialchars($result_set["data"]["title"], ENT_QUOTES | ENT_HTML401, 'UTF-8')); ?>">
|
| 184 |
|
|
<?
|
| 185 |
|
|
if ($result_set["data"]["id"] == 0 && $result_set["data"]["reply_id"] == 0)
|
| 186 |
|
|
{
|
| 187 |
|
|
?>
|
| 188 |
|
|
<input type="checkbox" name="transship">转载
|
| 189 |
|
|
<?
|
| 190 |
|
|
}
|
| 191 |
|
|
?></td>
|
| 192 |
|
|
</tr>
|
| 193 |
|
|
<tr>
|
| 194 |
|
|
<td align="right">正文<span id="err_msg_content" name="err_msg" style="color: red;"></span></td>
|
| 195 |
|
|
<td>
|
| 196 |
|
|
<textarea name="textarea" id="textarea_content" cols="80" rows="25"><?
|
| 197 |
|
|
if ($result_set["data"]["reply_id"] == 0)
|
| 198 |
|
|
{
|
| 199 |
|
|
echo htmlspecialchars($result_set["data"]["content"], ENT_HTML401, 'UTF-8');
|
| 200 |
|
|
}
|
| 201 |
|
|
else if ($quote)
|
| 202 |
|
|
{
|
| 203 |
|
|
?>
|
| 204 |
|
|
|
| 205 |
|
|
|
| 206 |
|
|
|
| 207 |
|
|
【 在 <? echo htmlspecialchars($result_set["data"]["r_username"], ENT_HTML401, 'UTF-8'); ?> (<? echo htmlspecialchars($result_set["data"]["r_nickname"], ENT_HTML401, 'UTF-8'); ?>) 的大作中提到: 】
|
| 208 |
|
|
<?
|
| 209 |
|
|
echo htmlspecialchars(LMLtagFilter(LML(split_line($result_set["data"]["content"], ": ", 76, 20), false, false, 1024)), ENT_HTML401, 'UTF-8');
|
| 210 |
|
|
}
|
| 211 |
|
|
?></textarea>
|
| 212 |
|
|
</td>
|
| 213 |
|
|
</tr>
|
| 214 |
|
|
<tr>
|
| 215 |
|
|
<td align="right"><a class="s0" href="doc/lml.htm" target=_blank>LML</a>助手</td>
|
| 216 |
|
|
<td>
|
| 217 |
|
|
<INPUT type="button" value="B" onclick="b_bold(content)" style="font-weight:bold; width:25px;">
|
| 218 |
|
|
<INPUT type="button" value="I" onclick="b_italic(content)" style="font-style:italic; width:25px;">
|
| 219 |
|
|
<INPUT type="button" value="U" onclick="b_underline(content)" style="text-decoration:underline; width:25px;">
|
| 220 |
|
|
<INPUT type="button" value="[" onclick="b_left(content)" style="width:20px;">
|
| 221 |
|
|
<INPUT type="button" value="]" onclick="b_right(content)" style="width:20px;">
|
| 222 |
|
|
<INPUT type="button" value="Aa" onclick="b_size(content)" style="width:30px;">
|
| 223 |
|
|
<INPUT type="button" value="A" onclick="b_color(content)" style="font-weight:bold; color:red; width:25px;">
|
| 224 |
|
|
<INPUT type="button" value="@" onclick="b_email(content)" style="width:25px;">
|
| 225 |
|
|
<INPUT type="button" value="Link" onclick="b_link(content)" style="text-decoration:underline; color:blue; width:40px;">
|
| 226 |
|
|
<INPUT type="button" value="主题" onclick="b_article(content)" style="text-decoration:underline; color:green; width:40px;">
|
| 227 |
|
|
<INPUT type="button" value="图片" onclick="b_image(content)" style="width:40px;">
|
| 228 |
|
|
<INPUT type="button" value="字幕" onclick="b_marquee(content)" style="width:40px;">
|
| 229 |
|
|
</td>
|
| 230 |
|
|
</tr>
|
| 231 |
|
|
<tr>
|
| 232 |
|
|
<td align="right">上传附件<span id="err_msg_attachment" name="err_msg" style="color: red;"></span></td>
|
| 233 |
|
|
<td>
|
| 234 |
|
|
单个文件大小不能超过<? echo $BBS_upload_size_limit; ?>M,
|
| 235 |
|
|
单次上传不超过<? echo $BBS_upload_count_limit; ?>个文件<br />
|
| 236 |
|
|
文件类型限于BMP,GIF,JPEG,PNG,TIFF,TXT,ZIP,RAR<br />
|
| 237 |
|
|
<INPUT TYPE=FILE SIZE=40 name="attachment[]" id="attachment" multiple>
|
| 238 |
|
|
<?
|
| 239 |
|
|
if ($result_set["data"]["id"] != 0) // Modify article
|
| 240 |
|
|
{
|
| 241 |
|
|
if (count($result_set["data"]["attachments"]) > 0)
|
| 242 |
|
|
{
|
| 243 |
|
|
?>
|
| 244 |
|
|
<hr width="80%" align="left" />已上传附件<br />
|
| 245 |
|
|
<?
|
| 246 |
|
|
}
|
| 247 |
|
|
|
| 248 |
|
|
foreach ($result_set["data"]["attachments"] as $aid => $attachment)
|
| 249 |
|
|
{
|
| 250 |
|
|
$filename = $attachment["filename"];
|
| 251 |
|
|
$ext = strtolower(substr($filename, (strrpos($filename, ".") ? strrpos($filename, ".") + 1 : 0)));
|
| 252 |
|
|
?>
|
| 253 |
|
|
<span id="attachment_<? echo $aid; ?>"><img src="images/closed.gif"><a class="s2" href="dl_file.php?aid=<? echo $aid; ?>" target="_target"><? echo $filename; ?></a> (<? echo $attachment["size"]; ?>字节)
|
| 254 |
|
|
<?
|
| 255 |
|
|
if ($attachment["check"] == 0)
|
| 256 |
|
|
{
|
| 257 |
|
|
?><font color="red">未审核</font><?
|
| 258 |
|
|
}
|
| 259 |
|
|
?>
|
| 260 |
|
|
<a class="s2" href="#" onclick="return upload_del(<? echo $aid; ?>);">删除</a>
|
| 261 |
|
|
<br /></span>
|
| 262 |
|
|
<?
|
| 263 |
|
|
}
|
| 264 |
|
|
}
|
| 265 |
|
|
?>
|
| 266 |
|
|
</td>
|
| 267 |
|
|
</tr>
|
| 268 |
|
|
<tr>
|
| 269 |
|
|
<td align="right">表情<span id="err_msg_emoji" name="err_msg" style="color: red;"></span></td>
|
| 270 |
|
|
<td><?
|
| 271 |
|
|
for ($i = 1; $i <= $BBS_emoji_count; $i++)
|
| 272 |
|
|
{
|
| 273 |
|
|
?><input type="radio" name="emoji" value="<? echo $i; ?>" <? echo ($i == $result_set["data"]["emoji"] ? "checked" : ""); ?>><img src="images/expression/<? echo $i; ?>.gif" width="15" height="15" alt="<? echo $i; ?>.gif"><?
|
| 274 |
|
|
if (($i % 12)==0)
|
| 275 |
|
|
{
|
| 276 |
|
|
?><br><?
|
| 277 |
|
|
}
|
| 278 |
|
|
}
|
| 279 |
|
|
?></td>
|
| 280 |
|
|
</tr>
|
| 281 |
|
|
<?
|
| 282 |
|
|
if ($result_set["data"]["id"] == 0)
|
| 283 |
|
|
{
|
| 284 |
|
|
?>
|
| 285 |
|
|
<tr>
|
| 286 |
|
|
<td align="right">签名<span id="err_msg_sign" name="err_msg" style="color: red;"></span></td>
|
| 287 |
|
|
<td>
|
| 288 |
|
|
<input type="radio" id="sign_id_0" name="sign_id" value="0" checked>不使用
|
| 289 |
|
|
<input type="radio" id="sign_id_1" name="sign_id" value="1">1
|
| 290 |
|
|
<input type="radio" id="sign_id_2" name="sign_id" value="2">2
|
| 291 |
|
|
<input type="radio" id="sign_id_3" name="sign_id" value="3">3
|
| 292 |
|
|
<a class="s0" href="preference.php" target=_blank>设置个人签名</a>
|
| 293 |
|
|
</td>
|
| 294 |
|
|
</tr>
|
| 295 |
|
|
<?
|
| 296 |
|
|
}
|
| 297 |
|
|
else
|
| 298 |
|
|
{
|
| 299 |
|
|
?>
|
| 300 |
|
|
<input type="hidden" id="sign_id_0" name="sign_id" value="0">
|
| 301 |
|
|
<?
|
| 302 |
|
|
}
|
| 303 |
|
|
?>
|
| 304 |
|
|
<tr>
|
| 305 |
|
|
<td align="right"></td>
|
| 306 |
|
|
<td><input type="checkbox" name="reply_note" id="reply_note" <? echo ($result_set["data"]["reply_note"] ? "checked":""); ?>>有人回复该主题时通知我</td>
|
| 307 |
|
|
</tr>
|
| 308 |
|
|
</table>
|
| 309 |
|
|
<p><input type="submit" value="提交" name="submit"> <input type="reset" value="重填" name="reset"></p>
|
| 310 |
|
|
</center>
|
| 311 |
|
|
</form>
|
| 312 |
|
|
<?
|
| 313 |
|
|
include "./foot.inc.php";
|
| 314 |
|
|
?>
|
| 315 |
|
|
</body>
|
| 316 |
|
|
</html>
|