📄 atomic.php
字号:
if ($id != $articles[0]["ID"]) atomic_error("错误的文章号,原文可能已经被删除"); $article = $articles[0]; } $filename = bbs_get_board_filename($atomic_board, $article["FILENAME"]); $isnormalboard = bbs_normalboard($atomic_board); if ($isnormalboard) { if (cache_header("public",@filemtime($filename),300)) return; } if (!$atomic_ftype) { $idx = ($ptr == 'p') ? 0 : (($ptr == 'n') ? 2 : -1); if (($idx != -1) && $articles[$idx]["ID"] != 0) { header("Location: atomic.php" . $url . $articles[$idx]["ID"]); exit; } bbs_brcaddread($atomic_board, $article["ID"]); } atomic_header(); $html = '<p>'; if (!$atomic_ftype) { $html .= '<a href="?act=post&board='.$atomic_board.'">发表</a> <a href="?act=post&board='.$atomic_board.'&reid='.$id.'">回复</a> '; if (atomic_uploadable()) $html .= '<a href="?act=post&board='.$atomic_board.'&reid='.$id.'&upload=1">带附件回复</a> '; $html .= '<a href="' . $url . $article["ID"] . '&p=p">上篇</a> '; $html .= '<a href="' . $url . $article["ID"] . '&p=n">下篇</a> '; $html .= '<a href="' . $url . $article["ID"] . '&p=tp">主题上篇</a> '; $html .= '<a href="' . $url . $article["ID"] . '&p=tn">主题下篇</a> '; $html .= '<a href="' . $url . $article["GROUPID"] . '">楼主</a> '; $html .= '<a href="' . $url . $article["REID"] . '">溯源</a> '; } $html .= '<a href="?act=board&board='.$atomic_board.'&page='.intval(($num + ARTCNT - 1) / ARTCNT). ($atomic_ftype?"&ftype=".$atomic_ftype:"").'">回版面</a> '; $ourl = 'bbscon.php?bid=' . $atomic_brdnum . '&id=' . $article["ID"]; if ($atomic_ftype) $ourl .= "&ftype=".$atomic_ftype."&num=".$num; $html .= '<a href="' . $ourl . '">原文</a> '; $html .= '</p>'; echo $html; echo bbs2_readfile_text($filename, MAXCHAR, 2); if ($article["ATTACHPOS"]) echo '<p>本文含有附件: <a href="' . $ourl . '">原文链接</a></p>'; atomic_footer();}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();}function atomic_mail_header() { global $currentuser; if ( ! strcmp($currentuser["userid"], "guest") ) { atomic_error("游客没有信箱"); } atomic_header(); $html = "<p>" . $currentuser["userid"] . " 的信箱 <a href='?'>回首页</a></p>"; echo $html;}function atomic_mail() { global $currentuser; atomic_mail_header(); $mail_fullpath = bbs_setmailfile($currentuser["userid"],".DIR"); $mail_num = bbs_getmailnum2($mail_fullpath); if($mail_num <= 0 || $mail_num > 30000) atomic_error("读取邮件数据失败!"); $start = (isset($_GET["start"])) ? @intval($_GET["start"]) : 999999; $num = ARTCNT; if ($start > $mail_num - ARTCNT + 1) $start = $mail_num - ARTCNT + 1; if ($start <= 0) { $start = 1; if ($num > $mail_num) $num = $mail_num; } $maildata = bbs_getmails($mail_fullpath, $start - 1, $num); if ($maildata == FALSE) atomic_error("读取邮件数据失败!"); $html = '<form action="?" method="get"><input type="hidden" name="act" value="mail"/>'; $html .= '<a href="?act=mailpost">写信</a> '; if ($start > 1) { $i = $start - ARTCNT; if ($i < 1) $i = 1; $html .= '<a href="?act=mail&start=1">第一页</a> '; $html .= '<a href="?act=mail&start='.$i.'">上一页</a> '; } else { $html .= '第一页 上一页 '; } if ($start <= $mail_num - ARTCNT) { $i = $start + ARTCNT; if ($i > $mail_num) $i = $mail_num; $html .= '<a href="?act=mail&start='.$i.'">下一页</a> '; $html .= '<a href="?act=mail">最后一页</a> '; } else { $html .= '下一页 最后一页 '; } $html .= '<input type="submit" value="跳转到"/> 第 <input type="text" name="start" size="3" /> 篇</form>'; $html .= '<pre> 编号 发信者 日 期 标 题<br/>'; for ($i = 0; $i < count($maildata); $i++) { $article = $maildata[$i]; $title = $article["TITLE"]; if (strncmp($title, "Re: ", 4) != 0) $title = "★ " . $title; $html .= sprintf("%5d ", ($start+$i)); $html .= $maildata[$i]["FLAGS"]; $html .= sprintf(" %-12.12s ", $article["OWNER"]); $html .= strftime("%b %e ", $article["POSTTIME"]); $html .= ($maildata[$i]["ATTACHPOS"]>0) ? "@" : " "; $html .= "<a href='?act=mailread&num=".($start+$i)."'>".htmlspecialchars($title)." </a> (".sizestring($maildata[$i]['EFFSIZE']).")<br/>"; } $html .= "</pre>"; echo $html; atomic_footer();}function atomic_mailread() { global $currentuser; atomic_mail_header(); $mail_fullpath = bbs_setmailfile($currentuser["userid"],".DIR"); $mail_num = bbs_getmailnum2($mail_fullpath); if($mail_num <= 0 || $mail_num > 30000) atomic_error("读取邮件数据失败!"); if (isset($_GET["num"])) $num = @intval($_GET["num"]); else { atomic_error("错误的参数"); } if ($num <= 0 || $num > $mail_num) atomic_error("错误的参数"); $articles = array (); if( bbs_get_records_from_num($mail_fullpath, $num-1, $articles) ) { $filename = bbs_setmailfile($currentuser["userid"], $articles[0]["FILENAME"]); }else{ atomic_error("错误的参数"); } $html = "<p>"; $html .= '<a href="?act=mailpost">写信</a> <a href="?act=mailpost&num='.$num.'">回信</a> '; if($num > 1){ $html .= '<a href="?act=mailread&num=' . ($num-1) . '">上一篇</a> '; } $html .= '<a href="?act=mail&start=' . $num . '">收件箱</a> '; if($num < $mail_num){ $html .= '<a href="?act=mailread&num=' . ($num+1) . '">下一篇</a> '; } $html .= "</p>"; echo $html; echo bbs2_readfile_text($filename, 0, 2); bbs_setmailreaded($mail_fullpath,$num-1); atomic_footer();}function atomic_mailpost() { global $currentuser; atomic_mail_header(); if (!bbs_can_send_mail()) atomic_error("您不能发送信件"); $num = (isset($_GET["num"])) ? @intval($_GET["num"]) : 0; $mail_fullpath = bbs_setmailfile($currentuser["userid"],".DIR"); if ($num > 0) { $articles = array (); if( bbs_get_records_from_num($mail_fullpath, $num-1, $articles) ) { $title = $articles[0]["TITLE"]; $receiver = $articles[0]["OWNER"]; $shortfilename = $articles[0]["FILENAME"]; $filename = bbs_setmailfile($currentuser["userid"], $shortfilename); }else{ atomic_error("错误的参数"); } } if (isset($_GET["post"])) { $title = atomic_get_input(trim(@$_POST["title"])); if (!$title) $title = '无主题'; $content = atomic_get_input(@$_POST["text"]); $sig = $currentuser["signature"]; $backup = (bbs_is_save2sent() != 0); if ($num > 0) { $ret = bbs_postmail($mail_fullpath, $shortfilename, $num-1, $title, $content, $sig, $backup); } else { $incept = trim(@$_POST['userid']); if (!$incept) atomic_error("请输入收件人ID"); $lookupuser = array(); if (!bbs_getuser($incept,$lookupuser)) atomic_error("错误的收件人ID"); $incept = $lookupuser['userid']; if (!strcasecmp($incept,'guest')) atomic_error("不能发信给guest"); $ret = bbs_postmail($incept,$title,$content,$sig,$backup); } if ($ret < 0) { switch($ret) { case -1: case -2: atomic_error("无法创建文件"); break; case -3: atomic_error($incept." 拒收您的邮件"); break; case -4: atomic_error($incept." 的信箱已满"); break; case -5: atomic_error("两次发文/信间隔过密,请休息几秒再试!"); break; case -6: atomic_error("添加邮件列表出错"); break; case -7: atomic_error("邮件发送成功,但未能保存到发件箱"); break; case -8: atomic_error("找不到所回复的原信。"); break; case -100: atomic_error("错误的收件人ID"); break; default: atomic_error("系统错误,请联系管理员"); } } if ($num > 0) { $url = "?act=mailread&num=".$num; echo "发送成功!本页面将在3秒后自动返回<a href='$url'>原信件</a><meta http-equiv='refresh' content='3; url=" . $url . "'/>"; } else { $url = "?act=mail"; echo "发送成功!本页面将在3秒后自动返回<a href='$url'>信件列表</a><meta http-equiv='refresh' content='3; url=" . $url . "'/>"; } atomic_footer(); return; } if ($num > 0) { if(!strncmp($title,"Re: ",4)) $nowtitle = $title; else $nowtitle = "Re: " . $title; } else { $nowtitle = ""; } $html = "<form action='?act=mailpost&num=".$num."&post=1' method='post'>"; $html .= '标题: <input type="text" name="title" size="40" maxlength="100" value="' . ($nowtitle?htmlspecialchars($nowtitle,ENT_QUOTES)." ":"") . '"/><br/>'; if ($num > 0) { $html .= "收件人: " . $receiver . "<br/>"; } else { $html .= '收件人: <input type="text" name="userid"/><br/>'; } $html .= '<textarea name="text" rows="20" cols="80" wrap="physical">'; if ($num > 0) { $html .= "\n\n【 在 " . $receiver . " 的来信中提到: 】\n"; $fp = fopen($filename, "r"); if ($fp) { $lines = 0; for ($i = 0; $i < 4; $i++) { if (($buf = fgets($fp,500)) == FALSE) break; } while (1) { if (($buf = fgets($fp,500)) == FALSE) break; if (strncmp($buf, ": 【", 4) == 0) continue; if (strncmp($buf, ": : ", 4) == 0) continue; if (strncmp($buf, "--\n", 3) == 0) break; if (strncmp($buf,'\n',1) == 0) continue; if (++$lines > 10) { $html .= ": ...................\n"; break; } $html .= ": ". htmlspecialchars($buf); } fclose($fp); } } $html .= '</textarea><br/><input type="submit" value="发送" /></form>'; echo $html; atomic_footer();}function atomic_mainpage() { global $currentuser; atomic_header(); if ( strcmp($currentuser["userid"], "guest") ) { $html = "<p>欢迎 " . $currentuser["userid"] . ". <a href='?act=logout'>注销</a></p>"; $select = 0; if(bbs_load_favboard($select)!=-1) { $boards = bbs_fav_boards($select, 1); if ($boards) { $html .= "<p>顶层收藏夹: "; $brd_name = $boards["NAME"]; $brd_flag= $boards["FLAG"]; $brd_bid= $boards["BID"]; $rows = sizeof($brd_name); for ($i = 0; $i < $rows; $i++) { if ($brd_bid[$i] == -1) continue; if ($brd_flag[$i] == -1 ) continue; if ($brd_flag[$i] & BBS_BOARD_GROUP) continue; $html .= '<a href="?act=board&board=' . $brd_name[$i] . '">' . $brd_name[$i] . '</a> '; } $html .= '</p>'; } } $oldtotal = 0; $oldunread = 0; if (!bbs_getmailnum($currentuser["userid"],$total,$unread, $oldtotal, $oldunread)) { $unread = $total = 0; } $html .= "<p><a href='?act=mail'>信箱</a>: $total 封, 新信: $unread 封. <a href='?act=mailpost'>写信</a></p>"; echo $html; } else { echo <<<END<form action="bbslogin.php?mainurl=atomic.php" method="post">用户名: <input type="text" name="id" /> 密码: <input type="password" name="passwd" maxlength="39" /><input type="submit" value="登录"/></form>END; } atomic_show_boardjump(); if (is_null(UTF8SP)) { $url = $_SERVER['REQUEST_URI']; if (strstr($url, 'utf8=')) $url = substr($url, 0, strlen($url)-1); else if (!strstr($url, '?')) $url.= '?utf8='; echo "UTF8: <a href='" . $url . (UTF8 ? "0" : "1") . "'>" . (UTF8 ? "ON" : "OFF") . "</a>. "; } else { echo "UTF8: " . (UTF8 ? "ON" : "OFF") . ". "; } echo "文章显示长度限制: " . MAXCHAR . "."; atomic_footer();}?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -