+ Changed generating last post and post count in forum and topic.php
+ Deleted not used template file: post_add_body.tpl + Replaced MCP images git-svn-id: https://svn.pioder.pl/uf-svn/uF@21 72ec579a-5ced-4fa4-82f3-afba5d98df2f
This commit is contained in:
@@ -19,7 +19,7 @@ class Post
|
||||
$last = DataBase::new_id(POSTS_TABLE);
|
||||
#read last post in topic
|
||||
$sql = "SELECT * FROM ".POSTS_TABLE." WHERE t_id='$tid' ORDER BY tp_id DESC LIMIT 1;";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not last post information.');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not last post information.');
|
||||
$result = DataBase::fetch($query);
|
||||
$forum = $result['f_id'];//forum id
|
||||
$moderate = Forum::ForumInformation($forum,'moderate');
|
||||
@@ -29,20 +29,20 @@ class Post
|
||||
$time = time();
|
||||
#add new post
|
||||
$sql = "INSERT INTO `".POSTS_TABLE."` VALUES ('$last','$tid', '$uid', '$post', '".$_SERVER['HTTP_USER_AGENT']."', '$time', '$tpid', '$forum','$moderate','".$_SERVER['REMOTE_ADDR']."')";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not add new post.');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not add new post.');
|
||||
$result=User::UserInformation($uid,'posts');
|
||||
$result = $result+1;
|
||||
$sql="UPDATE ".TOPICS_TABLE." SET lastpost_time='$time' WHERE t_id='$tid' ";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not update user information.');
|
||||
TriggerStats($forum, 1);
|
||||
TriggerStats($tid, 2);
|
||||
$sql="UPDATE ".USERS_TABLE." SET posts='$result' WHERE u_id='$uid' ";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not update user information.');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not update user information.');
|
||||
return $tpid;
|
||||
}
|
||||
|
||||
function EditPost($postid, $text)
|
||||
{
|
||||
$sql = "UPDATE `".POSTS_TABLE."` SET text='$text' WHERE `p_id`='$postid';";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not edit post.');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not edit post.');
|
||||
}
|
||||
|
||||
function NewTopic($posttext, $ntopic, $forum, $uid, $sticky)
|
||||
@@ -51,21 +51,25 @@ class Post
|
||||
$moderate = Forum::ForumInformation($forum,'moderate');
|
||||
$time = time();
|
||||
$lastt=DataBase::new_id(TOPICS_TABLE);
|
||||
$sql = "INSERT INTO ".TOPICS_TABLE." VALUES ('$lastt', '$forum', '0', '$sticky', '$ntopic', '$uid','$time')";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not add new topic');
|
||||
$sql = "INSERT INTO ".TOPICS_TABLE." VALUES ('$lastt', '$forum', '0', '$sticky', '$ntopic', '$uid','$time', '', '')";
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not add new topic');
|
||||
//add post
|
||||
//select last post
|
||||
$last = DataBase::new_id(POSTS_TABLE);
|
||||
//add post
|
||||
$sql = "INSERT INTO ".POSTS_TABLE." VALUES ('$last','$lastt', '$uid', '$posttext','".$_SERVER['HTTP_USER_AGENT']."', '$time', '1', '$forum', '$moderate','".$_SERVER['REMOTE_ADDR']."');";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not add new post.');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not add new post.');
|
||||
$sql = "SELECT * FROM ".USERS_TABLE." WHERE u_id='$uid';";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information.');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain user information.');
|
||||
$result = DataBase::fetch($query);
|
||||
$result = $result['posts'];
|
||||
$result = $result+1;
|
||||
|
||||
TriggerStats($forum, 1);
|
||||
TriggerStats($lastt, 2);
|
||||
|
||||
$sql = "UPDATE ".USERS_TABLE." SET posts='$result' WHERE u_id='$uid' ";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not update user information.');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not update user information.');
|
||||
return $lastt;
|
||||
}
|
||||
|
||||
@@ -74,7 +78,7 @@ class Post
|
||||
$text ='';
|
||||
$result='';
|
||||
$sql = "SELECT * FROM ".SMILES_TABLE."";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Cold not obtain smiles information.');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Cold not obtain smiles information.');
|
||||
$i = 1;
|
||||
while($smile = DataBase::fetch($query))
|
||||
{
|
||||
@@ -98,7 +102,7 @@ class Post
|
||||
function SmilesReplace($text)
|
||||
{
|
||||
$sql = "SELECT * FROM ".SMILES_TABLE."";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain emoticons information.');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain emoticons information.');
|
||||
$i = 1;
|
||||
while($result = DataBase::fetch($query))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user