Ejemplo n.º 1
0
                 $NewConfig = array("NumTopics" => $Config["NumTopics"] + 1, "DaysTopics" => $Config["DaysTopics"] + 1);
                 UpdateConfig($NewConfig);
                 //更新用户自身统计数据
                 UpdateUserInfo(array("Topics" => $CurUserInfo['Topics'] + 1, "LastPostTime" => $TimeStamp));
                 //标记附件所对应的帖子标签
                 $DB->query("UPDATE `" . $Prefix . "upload` SET PostID=? WHERE `PostID`=0 and `UserName`=?", array($PostID, $CurUserName));
                 //记录标签与TopicID的对应关系
                 foreach ($TagsID as $TagID) {
                     $DB->query("INSERT INTO `" . $Prefix . "posttags` \r\n\t\t\t\t\t\t\t(`TagID`, `TopicID`, `PostID`) \r\n\t\t\t\t\t\t\tVALUES (?,?,?)", array($TagID, $TopicID, $PostID));
                 }
                 //更新标签统计数据
                 if ($TagsExist) {
                     $DB->query("UPDATE `" . $Prefix . "tags` SET TotalPosts=TotalPosts+1, MostRecentPostTime=" . $TimeStamp . " WHERE `Name` in (?)", $TagsExist);
                 }
                 //添加提醒消息
                 AddingNotifications($Content, $TopicID, $PostID);
                 //清理首页内存缓存
                 if ($MCache) {
                     $MCache->delete(MemCachePrefix . 'Homepage');
                 }
                 //跳转到主题页
                 //header('location: '.$Config['WebsitePath'].'/t/'.$TopicID);
             }
         } else {
             $Error = $Lang['Tags_Empty'];
         }
     } else {
         $Error = str_replace('{{MaxPostChars}}', $Config['MaxPostChars'], str_replace('{{MaxTitleChars}}', $Config['MaxTitleChars'], $Lang['Too_Long']));
     }
 } else {
     $Error = $Lang['Title_Empty'];
Ejemplo n.º 2
0
 //往Posts表插入数据
 $PostData = array("ID" => null, "TopicID" => $TopicID, "IsTopic" => 0, "UserID" => $CurUserID, "UserName" => $CurUserName, "Subject" => $Topic['Topic'], "Content" => XssEscape($Content), "PostIP" => $CurIP, "PostTime" => $TimeStamp, "IsDel" => 0);
 $NewPostResult = $DB->query("INSERT INTO `" . $Prefix . "posts`(`ID`, `TopicID`, `IsTopic`, `UserID`, `UserName`, `Subject`, `Content`, `PostIP`, `PostTime`, `IsDel`) VALUES (:ID,:TopicID,:IsTopic,:UserID,:UserName,:Subject,:Content,:PostIP,:PostTime,:IsDel)", $PostData);
 $PostID = $DB->lastInsertId();
 if ($NewPostResult) {
     //更新全站统计数据
     $NewConfig = array("NumPosts" => $Config["NumPosts"] + 1, "DaysPosts" => $Config["DaysPosts"] + 1);
     UpdateConfig($NewConfig);
     //更新主题统计数据
     $DB->query("UPDATE `" . $Prefix . "topics` SET Replies=Replies+1,LastTime=?,LastName=? WHERE `ID`=?", array($TimeStamp > $Topic['LastTime'] ? $TimeStamp : $Topic['LastTime'], $CurUserName, $TopicID));
     //更新用户自身统计数据
     UpdateUserInfo(array("Replies" => $CurUserInfo['Replies'] + 1, "LastPostTime" => $TimeStamp));
     //标记附件所对应的帖子标签
     $DB->query("UPDATE `" . $Prefix . "upload` SET PostID=? WHERE `PostID`=0 and `UserName`=?", array($PostID, $CurUserName));
     //添加提醒消息
     AddingNotifications($Content, $TopicID, $PostID, $Topic['UserName']);
     if ($CurUserID != $Topic['UserID']) {
         $DB->query('INSERT INTO `' . $Prefix . 'notifications`(`ID`, `UserID`, `UserName`, `Type`, `TopicID`, `PostID`, `Time`, `IsRead`) VALUES (null,?,?,?,?,?,?,?)', array($Topic['UserID'], $CurUserName, 1, $TopicID, $PostID, $TimeStamp, 0));
         $DB->query('UPDATE `' . $Prefix . 'users` SET `NewMessage` = `NewMessage`+1 WHERE ID = :UserID', array('UserID' => $Topic['UserID']));
         //清理内存缓存
         if ($MCache) {
             $MCache->delete(MemCachePrefix . 'UserInfo_' . $Topic['UserID']);
         }
     }
     if ($MCache) {
         //清理首页内存缓存
         $MCache->delete(MemCachePrefix . 'Homepage');
         //清理主题缓存
         $MCache->delete(MemCachePrefix . 'Topic_' . $TopicID);
     }
     //跳转到主题页