function pc_add_member($link, $pc, $userid) { global $currentuser, $pcconfig; if (!$pc || !is_array($pc)) { return FALSE; } if (!pc_is_groupwork($pc)) { return FALSE; } $lookupuser = array(); if (bbs_getuser($userid, $lookupuser) == 0) { return FALSE; } $userid = $lookupuser["userid"]; $query = "INSERT INTO `members` ( `uid` , `username` ) " . "VALUES ( '" . intval($pc["UID"]) . "', '" . addslashes($userid) . "' );"; if (!mysql_query($query, $link)) { return FALSE; } $action = "ADD MEMBER: " . $userid; if (!pc_group_logs($link, $pc, $action)) { exit("群体BLOG LOG错误"); } $title = $userid . " 由 " . $currentuser["userid"] . " 授予 " . $pc["USER"] . " 群体BLOG的权利"; $content = " 欢迎加入 " . $pc["USER"] . "/" . undo_html_format($pc["NAME"]) . " 大家庭"; // post announcement bbs_postarticle($pcconfig["APPBOARD"], preg_replace("/\\\\(['|\"|\\\\])/", "\$1", $title), preg_replace("/\\\\(['|\"|\\\\])/", "\$1", $content), 0, 0, 0, 0); // post mail bbs_postmail($userid, preg_replace("/\\\\(['|\"|\\\\])/", "\$1", $title), preg_replace("/\\\\(['|\"|\\\\])/", "\$1", $content), 0, 0); return TRUE; }
ie("board is readonly."); } if (!bbs_checkpostperm($uid, $bid)) { ie("post is denied."); } $title = rtrim($request->title); if ($title == "") { ie("empty title."); } if ($request->content == "") { ie("empty content."); } $articles = array(); if ($request->reid > 0) { $ret = bbs_get_records_from_id($bname, $request->reid, $dir_modes["NORMAL"], $articles); if ($ret == 0) { ie("no such article."); } if ($articles[1]["FLAGS"][2] == "y") { ie("reply is denied."); } } $ret = bbs_postarticle($bname, $title, $content, 0, $request->reid, 0, 0, 0, 0); if ($ret < 0) { ie("error code: {$ret}."); } $response->id = $ret; int_finish($response); ?>
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 pc_add_users($link, $userid, $corpusname, $manual, $blogtype = "", $groupmanager = "") { global $pcconfig, $currentuser, $bbsman_modes; if (!$userid || !$corpusname) { return -1; } if (!$blogtype) { $blogtype = "normal"; } if ($blogtype == "normal") { $lookupuser = array(); if (bbs_getuser($userid, $lookupuser) == 0) { return -2; } $userid = $lookupuser["userid"]; } else { if (!$pcconfig["TYPES"][$blogtype]) { return -3; } $userid = $pcconfig["TYPES"][$blogtype] . '.' . $userid; if (!$groupmanager) { return -4; } $lookupuser = array(); if (bbs_getuser($groupmanager, $lookupuser) == 0) { return -4; } $groupmanager = $lookupuser["userid"]; } //更新申请表 if ($manual) { $query = "INSERT INTO `newapply` ( `naid` , `username` , `appname` , `appself` , `appdirect` , `hostname` , `apptime` , `manager` , `management` ) " . "VALUES ('', '" . addslashes($userid) . "', '" . addslashes($corpusname) . "', '', '', '" . addslashes($_SERVER["REMOTE_ADDR"]) . "', NOW( ) , '" . addslashes($currentuser["userid"]) . "' , '0');"; } else { $query = "UPDATE newapply SET apptime = apptime ,manager = '" . addslashes($currentuser["userid"]) . "',management = '0' WHERE username = '******'"; } // ORDER BY naid DESC LIMIT 1 ;"; if (!mysql_query($query, $link)) { $errstr = "MySQL Error: " . mysql_error($link); pc_db_close($link); exit($errstr); } if (pc_load_infor($link, $userid)) { return -5; } if ($manual) { $query = "SELECT username FROM newapply WHERE management != 1 AND management != 3 AND management != 0 AND username = '******' LIMIT 0 , 1;"; $result = mysql_query($query, $link); if ($rows = mysql_fetch_array($result)) { return -6; } } //分配个人空间 if ($pcconfig["USERFILES"]) { $userfile_limit = $pcconfig["USERFILESLIMIT"]; $userfile_num_limit = $pcconfig["USERFILESNUMLIMIT"]; } else { $userfile_limit = $userfile_num_limit = 0; } //添加用户 $query = "INSERT INTO `users` ( `uid` , `username` , `corpusname` , `description` , `theme` , `nodelimit` , `dirlimit` , `createtime` , `style` , `backimage` , `visitcount` , `nodescount` , `logoimage` , `modifytime` , `links` , `htmleditor` , `indexnodechars` , `indexnodes` , `useremail` , `favmode` , `updatetime` , `userinfor` , `pctype` ,`defaulttopic`,`userfile`,`filelimit`) " . "VALUES ('', '" . addslashes($userid) . "', '" . addslashes($corpusname) . "', '" . addslashes($corpusname) . "' , 'others', '300', '300', NOW( ) , '0', '' , '0', '0', '' , NOW( ) , '', '1', '600', '5', '', '0', NOW( ) , '' , '0' , '其他类别' , '" . $userfile_limit . "','" . $userfile_num_limit . "');"; if (!mysql_query($query, $link)) { $errstr = "MySQL Error: " . mysql_error($link); pc_db_close($link); exit($errstr); } //log一下 if ($blogtype != "normal") { $action = $groupmanager . " 申请建立群体Blog:" . $userid . "(www)"; pc_logs($link, $action, "", $userid); } $action = $currentuser["userid"] . " 通过 " . $userid . " 的BLOG申请(www)"; pc_logs($link, $action, "", $userid); //发布公告 if ($blogtype == "normal") { bbs_user_setflag($userid, BBS_PCORP_FLAG, 1); $annTitle = "[公告] 批准 " . $userid . " 的 Blog 申请"; $annBody = "\n\n 根据用户 " . $userid . " 申请,经审核、讨论后决定开通该用户\n" . " Blog ,Blog 名称“" . $corpusname . "”。\n\n" . " Blog 大部分功能提供在web 模式下,Blog 名称、描述、\n" . " 分类等属性请用户在web 登录后自行修改。\n\n"; } else { $annTitle = "[公告] 开设 " . $userid . " 群体Blog"; $annBody = "\n\n 根据用户 " . $groupmanager . " 申请,经审核、讨论后决定开设\n" . " " . $userid . " 群体Blog,Blog 名称“" . $corpusname . "”。\n\n" . " Blog 大部分功能提供在web 模式下,Blog 名称、描述、\n" . " 分类等属性请群体Blog管理员在web 登录后自行修改。\n\n"; } $ret = bbs_postarticle($pcconfig["APPBOARD"], preg_replace("/\\\\(['|\"|\\\\])/", "\$1", $annTitle), preg_replace("/\\\\(['|\"|\\\\])/", "\$1", $annBody), 0, 0, 0, 0); if ($ret != 0) { return -7; } //发信件给用户 $ret = bbs_postmail($blogtype == "normal" ? $userid : $groupmanager, preg_replace("/\\\\(['|\"|\\\\])/", "\$1", $annTitle), preg_replace("/\\\\(['|\"|\\\\])/", "\$1", $annBody), 0, 0); if ($ret < 0) { return -8; } //标记公告 //bbs_bmmanage($pcconfig["APPBOARD"],$ret,$bbsman_modes["MARK"],0); if ($manual && $blogtype != "normal") { $pcc = pc_load_infor($link, $userid); if (!$pcc) { return -9; } pc_convertto_group($link, $pcc); pc_add_member($link, $pcc, $groupmanager); } return 0; }
html_init("gb2312"); html_error_quit("对不起,您不能进行Blog申请,请联系管理员"); exit; } $apptitle = "[申请] " . $currentuser["userid"] . " 申请建立水木BLOG"; $appbody = "(1) BLOG名称:" . $_POST["appname"] . "\n\n\n" . "(2) 申请人 ID 及简要自我介绍\n" . " ID:" . $currentuser["userid"] . "\n" . " \n" . $_POST["appself"] . "\n\n\n" . "(3) 经营方向:(您对您个人Blog的初步规划)\n " . $_POST["appdirect"] . "\n\n"; $appself = "ID:" . $currentuser["userid"] . "\n" . "自我介绍:\n" . $_POST["appself"]; $query = "INSERT INTO `newapply` ( `naid` , `username` , `appname` , `appself` , `appdirect` , `hostname` , `apptime` , `manager` , `management` ) " . "VALUES ('', '" . $currentuser["userid"] . "', '" . addslashes($_POST["appname"]) . "', '" . addslashes($appself) . "', '" . addslashes($_POST["appdirect"]) . "', '" . addslashes($_SERVER["REMOTE_ADDR"]) . "', NOW( ) , NULL , '1');"; if (!mysql_query($query, $link)) { pc_db_close($link); html_init("gb2312"); html_error_quit("十分抱歉,由于系统原因,您的申请尚未登记入库。请重新填写一次"); exit; } pc_db_close($link); $ret = bbs_postarticle($pcconfig["APPBOARD"], preg_replace("/\\\\(['|\"|\\\\])/", "\$1", $apptitle), preg_replace("/\\\\(['|\"|\\\\])/", "\$1", $appbody), 0, 0, 0, 0); switch ($ret) { case -1: html_error_quit("错误的讨论区名称!"); break; case -2: html_error_quit("本版为二级目录版!"); break; case -3: html_error_quit("标题为空!"); break; case -4: html_error_quit("此讨论区是唯读的, 或是您尚无权限在此发表文章!"); break; case -5: html_error_quit("很抱歉, 你被版务人员停止了本版的post权利!");
if (bbs_checkreadperm($usernum, $brdnum) == 0) { html_error_quit("错误的讨论区2"); } if (isset($_POST["big5"])) { $big5 = $_POST["big5"]; } else { $big5 = 0; } settype($big5, "integer"); if (isset($_POST["noansi"])) { $noansi = $_POST["noansi"]; } else { $noansi = 0; } settype($noansi, "integer"); $ret = bbs_postarticle($brdarr["NAME"], preg_replace("/\\\\(['|\"|\\\\])/", "\$1", pc_fwd_getsubject($node)), preg_replace("/\\\\(['|\"|\\\\])/", "\$1", pc_fwd_getbody($node)), 0, 0, 1, 0); switch ($ret) { case -1: html_error_quit("错误的讨论区名称!"); break; case -2: html_error_quit("本版为二级目录版!"); break; case -3: html_error_quit("标题为空!"); break; case -4: html_error_quit("此讨论区是唯读的, 或是您尚无权限在此发表文章!"); break; case -5: html_error_quit("很抱歉, 你被版务人员停止了本版的post权利!");
function svEndVote($link, $svid, $annType, $annBoard) { global $currentuser, $sysVoteConfig; $this->user = $currentuser; $vote = sysvote_load_vote_infor($link, $svid); //初始化各个变量 $ann = "⊙ 投票开启于:" . $vote[created] . " 类别:系统投票\n" . "⊙ 主题:" . $vote[ori][subject] . "\n" . "⊙ 投票说明:\n\n" . $vote[ori][description] . "\n\n\n" . ($voteres = array()); for ($i = 0; $i < count($vote[probs]); $i++) { $etemNum[$i] = count($vote[probs][$i][etems]); for ($j = 0; $j < $etemNum[$i]; $j++) { $voteres[$i][$j + 1] = 0; } if ($vote[probs][$i][type] == 4) { $voteres[$i][0] = "本题通过投票征集的意见如下:"; } if ($vote[probs][$i][type] == 2 || $vote[probs][$i][type] == 3) { $voteres[$i][$etemNum[$i] + 1] = "本题通过投票征集的意见如下:"; } } //进行结果统计 $query = "SELECT * FROM sysvote_users WHERE svid = '" . $vote[svid] . "' ORDER BY suid"; $result = mysql_query($query, $link); $voteUserNum = mysql_num_rows($result); for ($k = 0; $k < $voteUserNum; $k++) { $rows = mysql_fetch_array($result); $userres = explode("|", $rows[voteinfo]); for ($i = 0; $i < count($vote[probs]); $i++) { if ($vote[probs][$i][type] == 4) { $voteres[$i][0] .= "\n☆─────────────────────────────────────☆\n " . $rows[userid] . " 于 " . time_format($rows[votetime]) . " 说道: \n" . base64_decode($userres[$i]); } elseif ($vote[probs][$i][type] == 1 || $vote[probs][$i][type] == 3) { $etemres = explode("&", $userres[$i]); for ($l = 0; $l < $etemNum[$i]; $l++) { $voteres[$i][(int) $etemres[$l]]++; } if ($vote[probs][$i][type] == 3 && $etemres[count($etemres) - 1]) { $voteres[$i][$etemNum[$i] + 1] .= "\n☆─────────────────────────────────────☆\n " . $rows[userid] . " 于 " . time_format($rows[votetime]) . " 说道: \n" . base64_decode($etemres[count($etemres) - 1]); } } elseif ($vote[probs][$i][type] == 2) { $etemres = explode("&", $userres[$i]); $voteres[$i][(int) $etemres[0]]++; if ($etemres[1]) { $voteres[$i][$etemNum[$i] + 1] .= "\n☆─────────────────────────────────────☆\n " . $rows[userid] . " 于 " . time_format($rows[votetime]) . " 说道: \n" . base64_decode($etemres[1]); } } else { $voteres[$i][(int) $userres[$i]]++; } } // i 循环 题目 } // k 循环 , 用户 //生成投票结果 $ann = "⊙ 参与投票的用户数:" . $voteUserNum . "\n" . "⊙ 投票结果:\n\n\n"; // $res的结构 : 参与投票的用户数量|题目1|...|题目n|文本输出 $res = $voteUserNum; if ($voteUserNum == 0) { $voteUserNum = 1; } $probType = array("单项选择", "多项选择", "单项选择(可发表意见)", "多项选择(可发表意见)", "问答"); for ($i = 0; $i < count($vote[probs]); $i++) { $ann .= "\n\n\n————————————————┤问题 " . ($i + 1) . "├————————————————\n" . "问题 " . ($i + 1) . ":" . $vote[probs][$i][prob] . "\n" . "类型:" . $probType[$vote[probs][$i][type]] . "\n"; if ($vote[probs][$i][type] == 4) { $ann .= "\n" . $voteres[$i][0]; //问答 $res .= "|" . base64_encode($voteres[$i][0]); } else { $res .= "|"; for ($j = 0; $j < $etemNum[$i]; $j++) { if ($j != 0) { $res .= ","; } $res .= $voteres[$i][$j + 1]; $ann .= "\n选项 " . ($j + 1) . ":" . $vote[probs][$i][etems][$j] . " 票数:" . $voteres[$i][$j + 1] . " 约占" . (int) ($voteres[$i][$j + 1] * 1000 / $voteUserNum) / 10 . "%"; } // j 循环 选项 if ($vote[probs][$i][type] == 2 || $vote[probs][$i][type] == 3) { $ann .= "\n\n" . $voteres[$i][$etemNum[$i] + 1]; $res .= "," . base64_encode($voteres[$i][$etemNum[$i] + 1]); } } } // i 循环 题目 $res .= "|" . base64_encode($ann); $voteLog = $vote[logs] . "\n管理员 " . $this->user["userid"] . " 于 " . date("Y-m-d H:i:s") . " 自 " . $_SERVER["REMOTE_ADDR"] . " 结束本次投票;"; $query = "UPDATE sysvote_votes SET active = 0 , results = '" . $res . "' , logs = '" . $voteLog . "' WHERE svid = '" . $vote[svid] . "';"; mysql_query($query, $link); $query = "DELETE FROM sysvote_users WHERE svid = " . $vote[svid]; mysql_query($query, $link); if ($annType == 1) { $annBoard = "vote"; } elseif ($annType == 2) { $annBoard = $sysVoteConfig["BOARD"]; } elseif ($annType == 3) { $brdArr = array(); $boardID = bbs_getboard($annBoard, $brdArr); if ($boardID == 0) { html_error_quit("指定的版面不存在!"); } } if ($annType != 0) { $title = "[公告] 系统投票结果"; $content = "【此篇文章是由自动发信系统所张贴】\n\n" . $ann; $ret = bbs_postarticle($annBoard, $title, $content, 0, 0, 0, 0); } }
/** * function reply similar to Article::post * * @param string $sub subject * @param string $con content * @param int $sig signature * @param int $email 1:mail when has reply 0:no mail * @param int $anony 1:post with anonymous * @param int $outgo 1:outgo post * @param int $tex no use * @return int new article id * @access public * @throws ArticlePostException with error code */ public function reply($sub, $con, $sig, $email = 0, $anony = 0, $outgo = 0, $tex = 0) { $code = null; $ret = bbs_postarticle($this->_board->NAME, $sub, $con, $sig, $this->ID, $outgo, $anony, $email, $tex); switch ($ret) { case -1: $code = ECode::$BOARD_UNKNOW; break; case -2: $code = ECode::$POST_ISBOARD; break; case -3: $code = ECode::$POST_NOSUB; break; case -4: $code = ECode::$BOARD_READONLY; break; case -5: $code = ECode::$POST_BAN; break; case -6: $code = ECode::$POST_FREQUENT; break; case -7: $code = ECode::$SYS_INDEX; break; case -8: $code = ECode::$ARTICLE_NOREPLY; break; case -9: $code = ECode::$SYS_ERROR; break; case -10: $code = ECode::$POST_WAIT; break; } if (!is_null($code)) { throw new ArticlePostException($code); } return $ret; }
$anony = isset($_POST["anony"]) ? intval($_POST["anony"]) : 0; bbs_board_nav_header($brdArr, $reID ? "回复文章" : "发表文章"); if ($tmpl & $reID > 0) { $filename = "boards/" . $boardName . "/" . $articles[1]["FILENAME"]; $contents .= bbs_get_quote($filename); } $title = rtrim($_POST["title"]); if (isset($_POST["titkey"])) { $tk = intval(@$_POST["titkey"]); $titkey = array(); $count = bbs_gettitkey($boardName, $titkey, 1); if ($tk > 0 && $tk <= $count) { $title = '[' . $titkey[$tk - 1]["desc"] . ']' . $title; } } $ret = bbs_postarticle($boardName, $title, $tmpl ? $contents : $_POST["text"], intval(@$_POST["signature"]), $reID, $outgo, $anony, @intval($_POST["mailback"]), $is_tex); switch ($ret) { case -1: html_error_quit("错误的讨论区名称!"); break; case -2: html_error_quit("本版为二级目录版!"); break; case -3: html_error_quit("标题为空!"); break; case -4: html_error_quit("此讨论区是唯读的, 或是您尚无权限在此发表文章!"); break; case -5: html_error_quit("很抱歉, 你被版务人员停止了本版的post权利!");