if (!$_GET["statnew"]) { $newtype = 7; } elseif (!$_GET["statnodes"]) { $newtype = 5; } elseif (!$_GET["statusers"]) { $newtype = 3; } else { $newtype = 1; } if (!$_GET["isgroup"] && !pc_is_groupwork($pcc)) { $newtype--; } $query = "UPDATE users SET createtime = createtime , pctype = " . $newtype . " WHERE uid = " . $pcc["UID"] . " LIMIT 1;"; mysql_query($query, $link); if ($_GET["isgroup"] && !pc_is_groupwork($pcc)) { pc_convertto_group($link, $pcc); } $action = "调整 " . $pcc["USER"] . " 的BLOG参数(N:" . $newtype . ";O:" . $pcc["TYPE"] . ")"; pc_logs($link, $action, "", $pcc["USER"]); unset($_GET["userid"]); } if ($_GET["userid"]) { $pcc = pc_load_infor($link, $_GET["userid"]); if (!$pcc) { html_error_quit($_GET["userid"] . "尚无BLOG"); exit; } ?> <form action="<?php echo $_SERVER["PHP_SELF"];
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; }