$mail_title = $_GET["title"]; } else { $mail_path = ".DIR"; //default is .DIR $mail_title = "收件箱"; } if (isset($_GET["start"])) { $start = $_GET["start"]; } else { $start = 999999; } //default*/ if (strstr($mail_path, '..')) { html_error_quit("读取邮件数据失败!"); } $mail_fullpath = bbs_setmailfile($currentuser["userid"], $mail_path); $mail_num = bbs_getmailnum2($mail_fullpath); if ($mail_num < 0 || $mail_num > 30000) { html_error_quit("Too many mails!"); } $num = 19; if ($start > $mail_num - 19) { $start = $mail_num - 19; } if ($start < 0) { $start = 0; if ($num > $mail_num) { $num = $mail_num; } } $maildata = bbs_getmails($mail_fullpath, $start, $num);
<?php require "www2-funcs.php"; login_init(); page_header($currentuser["userid"] . " 的信箱"); assert_login(); $mail_fullpath = bbs_setmailfile($currentuser["userid"], ".DIR"); $mail_num = bbs_getmailnum2($mail_fullpath); if ($mail_num < 0 || $mail_num > 30000) { html_error_quit("Too many mails!"); } $maildata = bbs_getmails($mail_fullpath, 0, $mail_num); if ($maildata == FALSE) { html_error_quit("读取邮件数据失败!"); } mailbox_header("新信件列表"); ?> <table class="main wide adj"> <caption>新信件列表</caption> <col class="center"/><col class="center"/><col class="center"/><col class="center"/><col/> <tbody><tr><th>序号</th><th>状态</th><th>发信人</th><th>日期</th><th>信件标题</th> <?php $newtotal = 0; $start = 0; for ($i = 0; $i < $mail_num; $i++) { if ($maildata[$i]["FLAGS"][0] == 'N') { $newtotal++; ?> <tr><td><?php echo $start + $i + 1; ?>
} $dir = bbs_setmailfile($currentuser["userid"], $dirname); $total = bbs_getmailnum2($dir); if ($total <= 0 || $total > 30000) { html_error_quit("读取邮件数据失败!"); } if ($num < 0 || $num >= $total) { html_error_quit("错误的参数"); } $articles = array(); if (bbs_get_records_from_num($dir, $num, $articles)) { $file = $articles[0]["FILENAME"]; } else { html_error_quit("错误的参数"); } $filename = bbs_setmailfile($currentuser["userid"], $file); if (!file_exists($filename)) { html_error_quit("信件不存在..."); } @($attachpos = $_GET["ap"]); //pointer to the size after ATTACHMENT PAD if ($attachpos != 0) { bbs_file_output_attachment($filename, $attachpos); exit; } mailbox_header("信件阅读"); ?> <div class="large"> <div class="article"> <script type="text/javascript"><!-- <?php
<?php require "www2-funcs.php"; login_init(); assert_login(); mailbox_header("发送信件"); $mailfile = @$_POST["file"]; $dirfile = @$_POST["dir"]; if (strstr($dirfile, '..')) { die; } $maildir = bbs_setmailfile($currentuser["userid"], $dirfile); $num = @intval($_POST["num"]); if (!bbs_can_send_mail($mailfile ? 1 : 0)) { html_error_quit("您不能发送信件"); } if ($mailfile == "") { $incept = trim(@$_POST['userid']); if (!$incept) { html_error_quit("请输入收件人ID"); } $lookupuser = array(); if (!bbs_getuser($incept, $lookupuser)) { html_error_quit("错误的收件人ID"); } $incept = $lookupuser['userid']; if (!strcasecmp($incept, 'guest')) { html_error_quit("不能发信给guest"); } if (!bbs_sufficient_score_to_sendmail($incept)) { html_error_quit("您积分不足,不能给 " . $incept . " 发信!");
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"); } if (!bbs_sufficient_score_to_sendmail($incept)) { atomic_error("积分不足,不能发信给" . $incept); } $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(); }
<?php require "www2-funcs.php"; login_init(); assert_login(); $dirname = $_POST["dir"]; $title = urldecode($_POST["title"]); $dstart = $_POST["dstart"]; $dend = $_POST["dend"]; $dtype = $_POST["dtype"]; if (strstr($dirname, '..')) { html_error_quit("��ȡ�ʼ�����ʧ��!"); } $mail_fullpath = bbs_setmailfile($currentuser["userid"], $dirname); $mail_num = bbs_getmailnum2($mail_fullpath); if ($dstart < 1 || $dstart > $mail_num || $dend < 1 || $dend > $mail_num || $dstart > $dend) { html_error_quit("����ɾ����ʼ����������������������룡"); } mailbox_header("����ɾ��"); ?> <form action="bbsmailact.php?act=move&<?php echo "dir=" . urlencode($dirname) . "&title=" . urlencode($title); ?> " method="POST" class="small"> <fieldset><legend>����ɾ��</legend> �������ƣ�<b class="red"><?php echo $title; ?> </b><br/> ��ʼ�ʼ���ţ�<b class="red"><?php echo $dstart;
} } //system mailboxs $mail_box = array(".DIR", ".SENT", ".DELETED"); $mail_boxtitle = array("收件箱", "发件箱", "垃圾箱"); $mail_boxnums = array(bbs_getmailnum2(bbs_setmailfile($currentuser["userid"], ".DIR")), bbs_getmailnum2(bbs_setmailfile($currentuser["userid"], ".SENT")), bbs_getmailnum2(bbs_setmailfile($currentuser["userid"], ".DELETED"))); //custom mailboxs $mail_cusbox = bbs_loadmaillist($currentuser["userid"]); $totle_mails = $mail_boxnums[0] + $mail_boxnums[1] + $mail_boxnums[2]; $i = 2; if ($mail_cusbox != -1) { foreach ($mail_cusbox as $mailbox) { $i++; $mail_box[$i] = $mailbox["pathname"]; $mail_boxtitle[$i] = $mailbox["boxname"]; $mail_boxnums[$i] = bbs_getmailnum2(bbs_setmailfile($currentuser["userid"], $mailbox["pathname"])); $totle_mails += $mail_boxnums[$i]; } } $mailboxnum = $i + 1; $mail_used_space = bbs_getmailusedspace(); bbs_getmailnum($currentuser["userid"], $total, $unread, 0, 0); ?> <table class="main wide adj"> <col class="center"/><col class="center"/><col class="center"/><col class="center"/> <caption>您的邮箱中共有 <?php echo $totle_mails; ?> 封邮件,占用空间 <?php echo $mail_used_space; ?>
public function getFileName() { return bbs_setmailfile($this->_box->user->userid, $this->FILENAME); }