if (strlen($threads) < 3 || strlen($threads) > $cfg_group_words * 2) { ShowMsg("主题内容字数应该在3-1000个汉字!", "-1"); exit; } if (ereg("{$cfg_notallowstr}", $subject) || ereg("{$cfg_notallowstr}", $threads)) { ShowMsg("含有非法字符!.", "-1"); exit; } $subject = preg_replace("/{$cfg_replacestr}/", "***", $subject); $threads = preg_replace("/{$cfg_replacestr}/", "***", $threads); $userip = GetIP(); $SetQuery = "INSERT INTO #@__group_threads(gid,smalltype,subject,author,authorid,dateline,lastpost,lastposter) "; $SetQuery .= "VALUES('{$id}','{$types}','{$subject}','" . $cfg_ml->M_UserName . "','" . $cfg_ml->M_ID . "','" . time() . "','" . time() . "','" . $cfg_ml->M_UserName . "');"; if ($db->ExecuteNoneQuery($SetQuery)) { $tid = $db->GetLastID(); $SetQuery = "INSERT INTO #@__group_posts(gid,tid,first,author,authorid,subject,dateline,message,useip) "; $SetQuery .= "VALUES('{$id}','{$tid}',1,'" . $cfg_ml->M_UserName . "','" . $cfg_ml->M_ID . "','{$subject}','" . time() . "','{$threads}','{$userip}');"; if ($db->ExecuteNoneQuery($SetQuery)) { Upcountgroups($id); $uid = $cfg_ml->M_ID; Upcontuserpost($id, $uid, "post"); } ShowMsg("成功发表一话题!", "viewthread.php?id={$id}&tid={$tid}"); exit; } else { echo $db->GetError(); ShowMsg("出错了!", "-1"); exit; } } require_once GROUP_TPL . "/postform.html";
} if (ereg("{$cfg_notallowstr}", $subject) || ereg("{$cfg_notallowstr}", $threads)) { ShowMsg("含有非法字符!", "-1"); exit; } $subject = preg_replace("/{$cfg_replacestr}/", "***", $subject); $threads = preg_replace("/{$cfg_replacestr}/", "***", $threads); $threads = str_replace('\\n', '<br>', $threads); $threads = preg_replace("'<div style=\"color:#ccc;\" id=\"lastedit\">.*?</div>'is", "", $threads); $userip = GetIP(); $SetQuery = "INSERT INTO #@__group_posts(gid,tid,first,author,authorid,subject,dateline,message,useip) "; $SetQuery .= "VALUES('{$id}','{$tid}',0,'" . $cfg_ml->M_UserName . "','" . $cfg_ml->M_ID . "','{$subject}','" . time() . "','{$threads}','{$userip}');"; if ($db->ExecuteNoneQuery($SetQuery)) { $uid = $cfg_ml->M_ID; $db->ExecuteNoneQuery("UPDATE #@__group_threads SET lastpost='" . time() . "',lastposter='" . $cfg_ml->M_UserName . "',replies=replies+1 WHERE tid='{$tid}';"); Upcontuserpost($id, $uid, "replies"); UpcontReplies($tid, $id); } ShowMsg("成功添加回复话题!", "viewthread.php?id={$id}&tid={$tid}"); exit; } else { if ($action == "edit" && ($ismaster || $cfg_ml->M_ID == $uid)) { $svali = GetCkVdValue(); if (strtolower($vdcode) != $svali || $svali == "") { ShowMsg("认证码错误!", "-1"); exit; } $subject = cn_substrR(trim(HtmlReplace($subject, 2)), 80); if (CountStrLen($subject) > 80) { ShowMsg("主题字数应该在3-80个汉字!", "-1"); exit;
if (is_array($result) && ($ismaster || $cfg_ml->M_ID == $result['authorid'])) { $jumpurl = "viewthread.php?id={$id}&tid={$tid}"; if ($result['first']) { //开始移除相关贴子 $db->ExecuteNoneQuery("DELETE FROM #@__group_posts WHERE tid='{$tid}'"); $db->ExecuteNoneQuery("DELETE FROM #@__group_threads WHERE tid='{$tid}'"); //更新统计 Upcountgroups($id); Upcontuserpost($id, $result['authorid'], "post"); $jumpurl = "groupdisplay.php?id={$id}"; } else { //移除指定贴子 $db->ExecuteNoneQuery("DELETE FROM #@__group_posts WHERE pid='{$pid}'"); } //更新回复统计 Upcontuserpost($id, $result['authorid'], "replies"); ShowMsg("成功删除帖子!", $jumpurl); exit; } else { ShowMsg("现您没该操作权限!", "-1"); exit; } } $sql = "SELECT pid,first,subject,authorid,author,dateline,message FROM #@__group_posts WHERE gid='{$id}' AND tid='{$tid}' ORDER BY dateline ASC"; $dl = new DataListCP(); $dl->pageSize = 5; $dl->SetParameter('id', $id); $dl->SetParameter("tid", $tid); //这两句的顺序不能更换 $dl->SetTemplate(GROUP_TPL . "/viewthread.html"); //载入模板