+ 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:
@@ -18,7 +18,7 @@ class Admin_Forum
|
||||
global $forum_config;
|
||||
$cat = Forum::ForumInformation($fid,'c_id');
|
||||
$all='';
|
||||
$query = DataBase::sql_query("SELECT `name`, `c_id` FROM `".CATS_TABLE."`",'GENERAL','Could not obtain category information');
|
||||
$query = DataBase::sql_query("SELECT `name`, `c_id` FROM `".CATS_TABLE."`",GENERAL,'Could not obtain category information');
|
||||
while($t = DataBase::fetch($query))
|
||||
{
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class Admin_Over
|
||||
global $forum_config;
|
||||
global $default_skin;
|
||||
$all='';
|
||||
$query = DataBase::sql_query("SELECT `name`, `s_id` FROM `".SKINS_TABLE."`",'GENERAL','Could not obtain skins information');
|
||||
$query = DataBase::sql_query("SELECT `name`, `s_id` FROM `".SKINS_TABLE."`",GENERAL,'Could not obtain skins information');
|
||||
while($t = DataBase::fetch($query))
|
||||
{
|
||||
|
||||
@@ -104,14 +104,14 @@ class Admin_Over
|
||||
{
|
||||
$result = User::UserInformation($_SESSION['uid'],'skin');
|
||||
$sql = "SELECT * FROM `".SKINS_TABLE."` WHERE `s_id`='$result'";
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain skin information.'));
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,CRITICAL,'Could not obtain skin information.'));
|
||||
return $result['name'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = $forum_config['defaultskin'];
|
||||
$sql = "SELECT * FROM `".SKINS_TABLE."` WHERE `s_id`='$result'";
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain skin information.'));
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,CRITICAL,'Could not obtain skin information.'));
|
||||
return $result['name'];
|
||||
}
|
||||
}
|
||||
@@ -130,14 +130,14 @@ class Admin_Over
|
||||
function TotalTopics()
|
||||
{
|
||||
$sql = "SELECT `t_id` FROM ".TOPICS_TABLE.";";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain total posts information');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain total posts information');
|
||||
$result = DataBase::num_rows($query);
|
||||
return($result);
|
||||
}
|
||||
function TotalPosts()
|
||||
{
|
||||
$sql = "SELECT `p_id` FROM ".POSTS_TABLE.";";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain total posts information');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain total posts information');
|
||||
$result = DataBase::num_rows($query);
|
||||
return($result);
|
||||
}
|
||||
|
||||
12
includes/cache/cache_forums.php
vendored
12
includes/cache/cache_forums.php
vendored
@@ -14,7 +14,7 @@ if(!defined('IN_uF'))
|
||||
//cache forums and posts - version v1.0 Alpha 2---------------------------------
|
||||
$default_skin = ViewSkinName();
|
||||
$sql = "SELECT `name`,`lock` FROM ".FORUMS_TABLE." WHERE `f_id`='$fid' LIMIT 1";
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain forum information'));
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain forum information'));
|
||||
if ($result['name']=='')
|
||||
{
|
||||
message_forum($lng['no_forum'],'index.php');
|
||||
@@ -23,14 +23,14 @@ $forum = array(
|
||||
'name'=>$result['name'],
|
||||
'lock'=>$result['lock']
|
||||
);
|
||||
$sql = "SELECT COUNT(*) as `p_id`, `t_id` FROM ".POSTS_TABLE." GROUP BY `t_id`";
|
||||
$query = DataBase::sql_query($sql,'GENERAL', 'Could not obtain amout of posts in forum');
|
||||
/*$sql = "SELECT COUNT(*) as `p_id`, `t_id` FROM ".POSTS_TABLE." GROUP BY `t_id`";
|
||||
$query = DataBase::sql_query($sql,GENERAL, 'Could not obtain amout of posts in forum');
|
||||
while($result = DataBase::fetch($query))
|
||||
{
|
||||
$count_topic[$result['t_id']]=$result['p_id'];
|
||||
}
|
||||
}*/
|
||||
/*$sql = "SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".* FROM ".POSTS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".u_id = ".POSTS_TABLE.".u_id WHERE `f_id`='$fid' ORDER BY `ptime`";
|
||||
$query = DataBase::sql_query($sql,'GENERAL', 'Could not obtain amout of posts in forum');
|
||||
$query = DataBase::sql_query($sql,GENERAL, 'Could not obtain amout of posts in forum');
|
||||
while($result = DataBase::fetch($query))
|
||||
{
|
||||
$lastpost[$result['t_id']]['tp_id']=$result['tp_id'];
|
||||
@@ -66,7 +66,7 @@ else
|
||||
$page=1;
|
||||
}
|
||||
$count = DataBase::fetch(DataBase::sql_query("SELECT COUNT(`t_id`) as `t_id`
|
||||
FROM ".TOPICS_TABLE." WHERE `f_id`='$fid'",'GENERAL','Could not obtain count amout of topics'));
|
||||
FROM ".TOPICS_TABLE." WHERE `f_id`='$fid'",GENERAL,'Could not obtain count amout of topics'));
|
||||
$count = $count['t_id'];
|
||||
$count = ceil($count / $limiter);
|
||||
if ($count==0)
|
||||
|
||||
4
includes/cache/cache_index.php
vendored
4
includes/cache/cache_index.php
vendored
@@ -18,7 +18,7 @@ if(!defined('IN_uF'))
|
||||
//cache forums --don't modify!!!
|
||||
$cache_id=1;
|
||||
$sql = "SELECT ".FORUMS_TABLE.".*, COUNT(".POSTS_TABLE.".p_id) as amout, ".POSTS_TABLE.".f_id AS count FROM ".FORUMS_TABLE." LEFT JOIN ".POSTS_TABLE." ON ".FORUMS_TABLE.".f_id= ".POSTS_TABLE.".f_id GROUP BY `f_id` ORDER BY `c_id`, `sort`";
|
||||
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain forum information.');
|
||||
$query = DataBase::sql_query($sql,CRITICAL,'Could not obtain forum information.');
|
||||
while($result = DataBase::fetch($query))
|
||||
{
|
||||
$forum[$cache_id]['f_id'] = $result['f_id'];
|
||||
@@ -31,7 +31,7 @@ while($result = DataBase::fetch($query))
|
||||
$cache_id+=1;
|
||||
}
|
||||
$sql = "SELECT `u_id`,`nick`, `regdate` AS count FROM ".USERS_TABLE." ORDER BY `regdate` DESC";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain amout of count users information');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain amout of count users information');
|
||||
$lastuser = DataBase::fetch($query);
|
||||
$count_users = DataBase::num_rows($query) -1;
|
||||
?>
|
||||
|
||||
8
includes/cache/cache_topic.php
vendored
8
includes/cache/cache_topic.php
vendored
@@ -13,7 +13,7 @@ if(!defined('IN_uF'))
|
||||
}
|
||||
//||topic.php script cache ------------------------------------------------------------------------------
|
||||
$sql = "SELECT ".TOPICS_TABLE.".*, ".TOPICS_TABLE.".name AS topic_name, ".TOPICS_TABLE.".lock AS topic_lock, ".FORUMS_TABLE.".* FROM ".TOPICS_TABLE." LEFT JOIN ".FORUMS_TABLE." ON ".TOPICS_TABLE.".f_id = ".FORUMS_TABLE.".f_id WHERE `t_id`='$tid' LIMIT 1";
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain forum information'));
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain forum information'));
|
||||
if ($result['t_id']=='')
|
||||
{
|
||||
message_forum($lng['no_topic'], 'index.php');
|
||||
@@ -29,7 +29,7 @@ $forum['moderate']=$result['moderate'];
|
||||
|
||||
|
||||
$sql = "SELECT `u_id`,`value` FROM `".WARNINGS_TABLE."`";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user warns information');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain user warns information');
|
||||
$result = DataBase::num_rows($query);
|
||||
while ($result = DataBase::fetch($query))
|
||||
{
|
||||
@@ -49,7 +49,7 @@ while ($result = DataBase::fetch($query))
|
||||
|
||||
//check online for user
|
||||
$sql = "SELECT `s_id`, `u_id`, `time` FROM ".SESSIONS_TABLE." WHERE time+1250>".time();
|
||||
$query = DataBase::sql_query($sql, 'GENERAL', 'Could not read user active.');
|
||||
$query = DataBase::sql_query($sql, GENERAL, 'Could not read user active.');
|
||||
while($result = DataBase::fetch($query))
|
||||
{
|
||||
$user[$result['u_id']]['online']='1';
|
||||
@@ -82,7 +82,7 @@ else
|
||||
$page=1;
|
||||
}
|
||||
$count = DataBase::fetch(DataBase::sql_query("SELECT COUNT(`p_id`) as `p_id`
|
||||
FROM ".POSTS_TABLE." WHERE `t_id`='$tid'",'GENERAL','Could not obtain count amout of posts'));
|
||||
FROM ".POSTS_TABLE." WHERE `t_id`='$tid'",GENERAL,'Could not obtain count amout of posts'));
|
||||
$count = $count['p_id'];
|
||||
$count = ceil($count / $limiter);
|
||||
if(isset($_GET['page']) && ($_GET['page']>$count))
|
||||
|
||||
@@ -18,7 +18,7 @@ class Forum
|
||||
global $forum_config;
|
||||
$forum = Topic::TopicInformation($tid,'f_id');
|
||||
$all='';
|
||||
$query = DataBase::sql_query("SELECT `name`, `f_id` FROM `".FORUMS_TABLE."` ORDER BY `f_id`",'GENERAL','Could not obtain forum information');
|
||||
$query = DataBase::sql_query("SELECT `name`, `f_id` FROM `".FORUMS_TABLE."` ORDER BY `f_id`",GENERAL,'Could not obtain forum information');
|
||||
while($t = DataBase::fetch($query))
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ class Forum
|
||||
function PostsInForum($forum_name)
|
||||
{
|
||||
$sql = "SELECT count(*) as `p_id` FROM ".POSTS_TABLE." WHERE f_id='$forum_name'";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain posts information.');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain posts information.');
|
||||
$result = DataBase::fetch($query);
|
||||
return $result['p_id'];
|
||||
}
|
||||
@@ -132,7 +132,7 @@ class Forum
|
||||
function ForumInformation($fid, $inf)
|
||||
{
|
||||
$sql = "SELECT `f_id`, `$inf` FROM ".FORUMS_TABLE." WHERE f_id='$fid';";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain forum information.');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain forum information.');
|
||||
$result = DataBase::fetch($query);
|
||||
$result = $result[$inf];
|
||||
return $result;
|
||||
|
||||
@@ -16,9 +16,9 @@ class Mod
|
||||
function MoveTopic($tid, $fid)
|
||||
{
|
||||
$sql = "UPDATE `".TOPICS_TABLE."` SET `f_id`='$fid' WHERE `t_id`='$tid'";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not update topic');
|
||||
DataBase::sql_query($sql,GENERAL,'Could not update topic');
|
||||
$sql = "UPDATE `".POSTS_TABLE."` SET `f_id`='$fid' WHERE `t_id`='$tid'";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not update post');
|
||||
DataBase::sql_query($sql,GENERAL,'Could not update post');
|
||||
}
|
||||
|
||||
function TopicLocked($tid)
|
||||
@@ -39,37 +39,37 @@ class Mod
|
||||
function DeleteTopic($topicid)
|
||||
{
|
||||
$sql="SELECT * FROM ".POSTS_TABLE." WHERE `t_id`='$topicid'";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain post information');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain post information');
|
||||
while($item = DataBase::fetch($query))
|
||||
{
|
||||
$uid = Topic::PostInformation($item['p_id'],'u_id');
|
||||
$posts = User::UserInformation($uid,'posts');
|
||||
$posts = $posts -1;
|
||||
$sql = "UPDATE `".USERS_TABLE."` SET `posts`='$posts' WHERE `u_id`='$uid'";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not update user amout of posts');
|
||||
DataBase::sql_query($sql,GENERAL,'Could not update user amout of posts');
|
||||
}
|
||||
$sql = "DELETE FROM ".POSTS_TABLE." WHERE t_id='$topicid';";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not delete topic posts.');
|
||||
DataBase::sql_query($sql,GENERAL,'Could not delete topic posts.');
|
||||
$sql = "DELETE FROM ".TOPICS_TABLE." WHERE t_id='$topicid';";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not delete topic posts.');
|
||||
DataBase::sql_query($sql,GENERAL,'Could not delete topic posts.');
|
||||
}
|
||||
|
||||
function LockTopic($topicid)
|
||||
{
|
||||
$sql = "UPDATE `".TOPICS_TABLE."` SET `lock` = '1' WHERE `t_id` =$topicid;";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not lock topic.');
|
||||
DataBase::sql_query($sql,GENERAL,'Could not lock topic.');
|
||||
}
|
||||
|
||||
function StickTopic($topicid, $mode)
|
||||
{
|
||||
$sql = "UPDATE `".TOPICS_TABLE."` SET `sticky` = '$mode' WHERE `t_id` =$topicid;";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not stick topic.');
|
||||
DataBase::sql_query($sql,GENERAL,'Could not stick topic.');
|
||||
}
|
||||
|
||||
function UnlockTopic($topicid)
|
||||
{
|
||||
$sql = "UPDATE `".TOPICS_TABLE."` SET `lock` = '0' WHERE `t_id` =$topicid;";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not unlock topic.');
|
||||
DataBase::sql_query($sql,GENERAL,'Could not unlock topic.');
|
||||
}
|
||||
|
||||
function DeletePost($postid)
|
||||
@@ -79,25 +79,25 @@ class Mod
|
||||
$posts = User::UserInformation($uid,'posts');
|
||||
$posts = $posts -1;
|
||||
$sql = "UPDATE `".USERS_TABLE."` SET `posts`='$posts' WHERE `u_id`='$uid'";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not update user amout of posts');
|
||||
DataBase::sql_query($sql,GENERAL,'Could not update user amout of posts');
|
||||
$sql2 = "DELETE FROM ".POSTS_TABLE." WHERE p_id='$postid';";
|
||||
DataBase::sql_query($sql2,'GENERAL','Could not delete post.');
|
||||
DataBase::sql_query($sql2,GENERAL,'Could not delete post.');
|
||||
$sql = "SELECT * FROM ".POSTS_TABLE." WHERE p_id>'$postid' AND `t_id`='$tid';";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain post information.');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain post information.');
|
||||
while($item=DataBase::fetch($query))
|
||||
{
|
||||
$number = $item['tp_id'];
|
||||
$number = $number-1;
|
||||
$number2 = $item['p_id'];
|
||||
$sql3 = "UPDATE `".POSTS_TABLE."` SET `tp_id` = '$number' WHERE `p_id` =$number2;";
|
||||
DataBase::sql_query($sql3,'GENERAL','Could not update post.');
|
||||
DataBase::sql_query($sql3,GENERAL,'Could not update post.');
|
||||
}
|
||||
}
|
||||
|
||||
function AcceptPost($postid)
|
||||
{
|
||||
$sql = "UPDATE `".POSTS_TABLE."` SET `moderated`='0' WHERE `p_id`='$postid'";
|
||||
DataBase::sql_query($sql, 'GENERAL', 'Could not accept post');
|
||||
DataBase::sql_query($sql, GENERAL, 'Could not accept post');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -50,12 +50,12 @@ class Pms
|
||||
function DeleteMsgUser($mid)
|
||||
{
|
||||
$sql = "DELETE FROM `".PM_INBOX_TABLE."` WHERE `m_id`='$mid'";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not delete message in inbox');
|
||||
DataBase::sql_query($sql,GENERAL,'Could not delete message in inbox');
|
||||
}
|
||||
function DeleteMsgAuthor($mid)
|
||||
{
|
||||
$sql = "DELETE FROM `".PM_SENTBOX_TABLE."` WHERE `m_id`='$mid'";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not delete message in sentbox');
|
||||
DataBase::sql_query($sql,GENERAL,'Could not delete message in sentbox');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,14 +66,14 @@ class NewMessage
|
||||
$last = DataBase::new_id(PM_INBOX_TABLE);
|
||||
$time = time();
|
||||
$sql = "INSERT INTO `".PM_INBOX_TABLE."` VALUES ('$last', '$uid', '$name', '$text', '$time', '$unid','0')";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not add new message at inbox');
|
||||
DataBase::sql_query($sql,GENERAL,'Could not add new message at inbox');
|
||||
}
|
||||
function AddToSentbox($text, $name, $unid, $uid)
|
||||
{
|
||||
$last=DataBase::new_id(PM_SENTBOX_TABLE);
|
||||
$time = time();
|
||||
$sql = "INSERT INTO `".PM_SENTBOX_TABLE."` VALUES ('$last', '$uid', '$name', '$text', '$time', '$unid')";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not add new message at inbox');
|
||||
DataBase::sql_query($sql,GENERAL,'Could not add new message at inbox');
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -16,13 +16,15 @@ class Topic
|
||||
function LastPostInTopic($topic)
|
||||
{
|
||||
global $lng;
|
||||
global $lastpost;
|
||||
global $last_post;
|
||||
global $forum_config;
|
||||
global $userdata;
|
||||
$id = $lastpost[$topic]['tp_id'];
|
||||
$userid = $lastpost[$topic]['u_id'];
|
||||
$un = $lastpost[$topic]['user_nick'];
|
||||
$rank = $lastpost[$topic]['user_rank'];
|
||||
|
||||
$id = $last_post[0];
|
||||
$userid = $last_post[1];
|
||||
$un = $last_post[4];
|
||||
$rank = $last_post[3];
|
||||
|
||||
switch($rank)
|
||||
{
|
||||
case '0':
|
||||
@@ -58,18 +60,18 @@ class Topic
|
||||
{
|
||||
$page='';
|
||||
}
|
||||
return '<p align="center"><span class="fverysmall"><b>'.GenerateTime($lastpost[$topic]['time']).'</b><br></span> <a href="topic.php?t='.$topic.$page.'#p'.$id.'" class="fverysmall"><b>Post #'.$id.'</b></a><a class="fsmall">: </a><a href="user.php?id='.$userid.'" class="fverysmall">'.$user_color_name.'</a></p>';
|
||||
return '<p align="center"><span class="fverysmall"><b>'.GenerateTime($last_post[2]).'</b><br></span> <a href="topic.php?t='.$topic.$page.'#p'.$id.'" class="fverysmall"><b>Post #'.$id.'</b></a><a class="fsmall">: </a><a href="user.php?id='.$userid.'" class="fverysmall">'.$user_color_name.'</a></p>';
|
||||
}
|
||||
|
||||
function LastPostImg()
|
||||
{
|
||||
global $lastpost;
|
||||
global $last_post;
|
||||
global $record;
|
||||
global $default_skin;
|
||||
$time = time()-129600;
|
||||
if ($_SESSION['uid']>0)
|
||||
{
|
||||
if ($lastpost[$record['t_id']]['time']>$time)
|
||||
if ($last_post[2]>$time)
|
||||
{
|
||||
return 'folder_new_posts';
|
||||
}
|
||||
@@ -115,7 +117,7 @@ class Topic
|
||||
function TopicInformation($tid, $mode)
|
||||
{
|
||||
$sql = "SELECT * FROM ".TOPICS_TABLE." WHERE t_id='$tid';";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain topic information');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain topic information');
|
||||
$result = DataBase::fetch($query);
|
||||
$result = $result[$mode];
|
||||
return $result;
|
||||
@@ -124,7 +126,7 @@ class Topic
|
||||
function PostInformation($pid, $mode)
|
||||
{
|
||||
$sql = "SELECT * FROM ".POSTS_TABLE." WHERE p_id='$pid';";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain topic information');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain topic information');
|
||||
$result = DataBase::fetch($query);
|
||||
$result = $result[$mode];
|
||||
return $result;
|
||||
|
||||
@@ -24,7 +24,7 @@ class User
|
||||
function UserInformation($uid, $inf)
|
||||
{
|
||||
$sql = "SELECT `$inf` 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[$inf];
|
||||
return $result;
|
||||
@@ -33,7 +33,7 @@ class User
|
||||
function UserIdByNick($nick)
|
||||
{
|
||||
$sql = "SELECT * FROM `".USERS_TABLE."` WHERE `nick`='$nick';";
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain user information.'));
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain user information.'));
|
||||
$result = $result['u_id'];
|
||||
/*if ($result=='')
|
||||
{
|
||||
@@ -46,13 +46,13 @@ class User
|
||||
{
|
||||
$last= DataBase::new_id(USERS_GROUP_TABLE);
|
||||
$sql = "INSERT INTO `".USERS_GROUP_TABLE."` VALUES ('$last','$uid', '$gid')";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not add user to group.');
|
||||
DataBase::sql_query($sql,GENERAL,'Could not add user to group.');
|
||||
}
|
||||
|
||||
function DeleteFromGroup($uid, $gid)
|
||||
{
|
||||
$sql = "DELETE FROM `".USERS_GROUP_TABLE."` WHERE `u_id`='$uid' AND `g_id`='$gid'";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not delete user for group.');
|
||||
DataBase::sql_query($sql,GENERAL,'Could not delete user for group.');
|
||||
}
|
||||
|
||||
function LogedAs($sid, $uid)
|
||||
@@ -119,7 +119,7 @@ class User
|
||||
if ($uid>0)
|
||||
{
|
||||
$sql = "SELECT * FROM ".USERS_TABLE." WHERE u_id='$uid'";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user`s rank information.');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain user`s rank information.');
|
||||
$result = DataBase::fetch($query);
|
||||
$rank = $result['rank'];
|
||||
if (($rank=='1') or ($rank=='2'))
|
||||
@@ -156,7 +156,7 @@ class User
|
||||
`view_shoutbox` = '$allow_shoutbox',
|
||||
`limit_users` = '$limit_users'
|
||||
WHERE `u_id` ='$uid' LIMIT 1 ;";
|
||||
DataBase::sql_query($sql,'CRITICAL','Could not update user information');
|
||||
DataBase::sql_query($sql,CRITICAL,'Could not update user information');
|
||||
}
|
||||
|
||||
function UpdateAdminPools($uid, $posts, $rank, $active, $nick)
|
||||
@@ -167,7 +167,7 @@ class User
|
||||
`active` = '$active',
|
||||
`nick` = '$nick'
|
||||
WHERE `u_id` ='$uid' LIMIT 1 ;";
|
||||
DataBase::sql_query($sql,'CRITICAL','Could not update user information');
|
||||
DataBase::sql_query($sql,CRITICAL,'Could not update user information');
|
||||
}
|
||||
|
||||
function UpdatePassword($uid, $pass)
|
||||
@@ -175,7 +175,7 @@ class User
|
||||
$sql ="UPDATE `".USERS_TABLE."` SET
|
||||
`pass` = '$pass'
|
||||
WHERE `u_id` ='$uid' LIMIT 1 ;";
|
||||
DataBase::sql_query($sql,'CRITICAL','Could not update user information');
|
||||
DataBase::sql_query($sql,CRITICAL,'Could not update user information');
|
||||
}
|
||||
|
||||
function CreateProfile($nick, $pass, $email, $gg, $allow_gg, $allow_email, $allow_qr, $sig, $av, $interests)
|
||||
@@ -185,7 +185,7 @@ class User
|
||||
$time = time();
|
||||
$sql = "INSERT INTO ".USERS_TABLE." VALUES
|
||||
('$last', '$nick', '$pass', '$email', '0', '$time', '0', '$gg', '$allow_gg', '$allow_email', '$allow_qr', '".$forum_config['view_shoutbox']."', '".$forum_config['defaultskin']."', '".$forum_config['defaultlang']."','".$forum_config['limit_tpid']."', '".$forum_config['limit_ftid']."', '".$forum_config['limit_users']."', '$sig', '$av', '1','0','$interests');";
|
||||
DataBase::sql_query($sql,'CRITICAL','Could not create new user');
|
||||
DataBase::sql_query($sql,CRITICAL,'Could not create new user');
|
||||
}
|
||||
|
||||
function UserMsgs()
|
||||
@@ -194,7 +194,7 @@ class User
|
||||
if($uid>0)
|
||||
{
|
||||
$sql = "SELECT count(*) as `m_id` FROM ".PM_INBOX_TABLE." WHERE `u_id`='$uid' AND `read`='0'";
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain amounts PM of User.'));
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain amounts PM of User.'));
|
||||
$result = $result['m_id'];
|
||||
if ($result>0)
|
||||
{
|
||||
@@ -210,14 +210,14 @@ class User
|
||||
function UserAddWarn($uid, $value, $motive)
|
||||
{
|
||||
$sql = "INSERT INTO `".WARNINGS_TABLE."` ( `w_id` , `u_id` , `value` , `motive` ) VALUES('','$uid','$value','$motive');";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not add new warn.');
|
||||
DataBase::sql_query($sql,GENERAL,'Could not add new warn.');
|
||||
if (User::UserLevelWarns($uid)==100)
|
||||
{
|
||||
$ban_ip = '0.0.0.0';
|
||||
$ban_uid = $uid;
|
||||
$ban_motive = $lng['warns_ban'];
|
||||
$sql = "INSERT INTO ".BANLIST_TABLE." VALUES ('', '$ban_uid', '$ban_ip', '$ban_motive')";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not update add ban.');
|
||||
DataBase::sql_query($sql,GENERAL,'Could not update add ban.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ class Secure
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT * FROM ".FORUMS_TABLE." WHERE f_id='$fid'";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain forum information.');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain forum information.');
|
||||
$result = DataBase::fetch($query);
|
||||
$result = $result['f_id'];
|
||||
if ($result=='')
|
||||
@@ -31,7 +31,7 @@ class Secure
|
||||
if ($forum_config['use_censorlist'])
|
||||
{
|
||||
$sql = "SELECT * FROM ".CENSORLIST_TABLE.";";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain censorlist information.');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain censorlist information.');
|
||||
while($word = DataBase::fetch($query))
|
||||
{
|
||||
$text = str_replace($word['word'],'[censored]', $text);
|
||||
@@ -68,7 +68,7 @@ class Secure
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT * FROM ".PM_INBOX_TABLE." WHERE m_id='$mid'";
|
||||
$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['m_id'];
|
||||
if ($result=='')
|
||||
@@ -80,7 +80,7 @@ class Secure
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT * FROM ".PM_SENTBOX_TABLE." WHERE m_id='$mid'";
|
||||
$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['u_n_id'];
|
||||
if ($result!=$_SESSION['uid'])
|
||||
@@ -92,7 +92,7 @@ class Secure
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT * FROM ".PM_INBOX_TABLE." WHERE m_id='$mid'";
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain user information.'));
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain user information.'));
|
||||
$result = $result['u_id'];
|
||||
if ($result!=$_SESSION['uid'])
|
||||
{
|
||||
@@ -103,7 +103,7 @@ class Secure
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT * FROM ".PM_SENTBOX_TABLE." WHERE m_id='$mid'";
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain user information.'));
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain user information.'));
|
||||
$result = $result['m_id'];
|
||||
if ($result=='')
|
||||
{
|
||||
@@ -114,7 +114,7 @@ class Secure
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT * FROM `".TOPICS_TABLE."` WHERE `t_id`='$tid'";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain topic information.');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain topic information.');
|
||||
$result = DataBase::fetch($query);
|
||||
$result = $result['t_id'];
|
||||
if ($result=='')
|
||||
@@ -126,7 +126,7 @@ class Secure
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT * FROM ".POSTS_TABLE." WHERE p_id='$pid'";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain topic information.');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain topic information.');
|
||||
$result = DataBase::fetch($query);
|
||||
$result = $result['p_id'];
|
||||
if ($result=='')
|
||||
@@ -138,7 +138,7 @@ class Secure
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT * FROM ".USERS_TABLE." WHERE u_id='$uid'";
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain user information.'));
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain user information.'));
|
||||
$result = $result['u_id'];
|
||||
if (($result=='') or ($result=='-1'))
|
||||
{
|
||||
@@ -149,7 +149,7 @@ class Secure
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT `g_id` FROM `".GROUPS_TABLE."` WHERE g_id='$gid'";
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain group information.'));
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain group information.'));
|
||||
$result = $result['g_id'];
|
||||
if ($result=='')
|
||||
{
|
||||
@@ -170,10 +170,10 @@ class Secure
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT `f_id`,`lock` FROM `".TOPICS_TABLE."` WHERE `t_id`='$tid'";
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain topic information'));
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain topic information'));
|
||||
$fid = $result['f_id'];
|
||||
$sql2 = "SELECT `lock` FROM `".FORUMS_TABLE."` WHERE `f_id`='$fid'";
|
||||
$result2 = DataBase::fetch(DataBase::sql_query($sql2,'GENERAL','Could not obtain forum information'));
|
||||
$result2 = DataBase::fetch(DataBase::sql_query($sql2,GENERAL,'Could not obtain forum information'));
|
||||
if (($result['lock']=='1') or ($result2['lock']=='1'))
|
||||
{
|
||||
message_forum($lng['no_posting_topic_locked'],'topic.php?t='.$tid);
|
||||
@@ -183,7 +183,7 @@ class Secure
|
||||
{
|
||||
global $lng;
|
||||
$sql = "SELECT `lock` FROM `".FORUMS_TABLE."` WHERE `f_id`='$fid'";
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain forum information'));
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain forum information'));
|
||||
if ($result['lock']=='1')
|
||||
{
|
||||
message_forum($lng['no_posting_forum_locked'],'forum.php?f='.$fid);
|
||||
|
||||
@@ -44,25 +44,6 @@ define('FOOTER_TEXT','<span class="copyright" >Powered by <b>µForum</b></s
|
||||
//hash for password
|
||||
define('PASSWD_HASH','bJVhVFCthvhVhKBU6GUbhUBU6VI7BiU6fV7G76Kbug6FU67VsaVYat5FJUHssaYVY5fV5GUHI76uKYTjYKKTatastYKYTYKg6ds7IRdsagI565JTrJ4NFGagGKLULygaTJHgfYDRZagGHJ65KL7iryikuuyriMYIYYUyugFTDeRnLKJNuyTDTRsERy78IJOhHCTDYjomLKBJDF5THNNBjyFCDYekjnKBUYgIHnUIbyuG6UyHNKJjnKHVut6FBYlH987g6GIUBbg76V5NNLUBH76BKLBi76FVtjN76Gi77ggYVCx3 R4SGhfGLHIH64XFGBUNLJOgfvc4Y3ScvmljmOBVc4klJKNIuBGVY6 MbvhGCRGgJLjKFHrYYJnKJGFHTfJJjnLK');
|
||||
|
||||
function array_push_associative(&$arr)
|
||||
{
|
||||
$ret = '';
|
||||
$args = func_get_args();
|
||||
foreach ($args as $arg)
|
||||
{
|
||||
if (is_array($arg))
|
||||
{
|
||||
foreach ($arg as $key => $value)
|
||||
{
|
||||
$arr[$key] = $value;
|
||||
$ret++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$arr[$arg] = "";
|
||||
}
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
define('CRITICAL', 'Critical Error');
|
||||
define('GENERAL', 'General Error');
|
||||
?>
|
||||
|
||||
@@ -23,16 +23,16 @@ class DataBase
|
||||
$db = new mysqli(DB_HOST, DB_USER, DB_PASS);
|
||||
if (mysqli_connect_errno() != 0)
|
||||
{
|
||||
message_die('CRITICAL',' Could not connect to database server.',$db->error);
|
||||
message_die(CRITICAL,' Could not connect to database server.',$db->error);
|
||||
}
|
||||
|
||||
if (!$db->set_charset("UTF8"))
|
||||
{
|
||||
message_die('CRITICAL', 'Could not set character set UTF-8', $db->error);
|
||||
message_die(CRITICAL, 'Could not set character set UTF-8', $db->error);
|
||||
}
|
||||
if (!$db->select_db(DB_NAME))
|
||||
{
|
||||
message_die('CRITICAL',' Could not select database.', $db->error);
|
||||
message_die(CRITICAL,' Could not select database.', $db->error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,12 +59,20 @@ class DataBase
|
||||
|
||||
function fetch($query)
|
||||
{
|
||||
return $query->fetch_array();
|
||||
return $query->fetch_assoc();
|
||||
}
|
||||
|
||||
function num_rows($query)
|
||||
{
|
||||
return $query->num_rows;
|
||||
// return $query->num_rows;
|
||||
if ($query===true || $query===false)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return mysqli_num_rows($query);
|
||||
}
|
||||
}
|
||||
|
||||
function new_id($table)
|
||||
@@ -91,7 +99,7 @@ class DataBase
|
||||
case WARNINGS_TABLE: { $id = 'w_id'; break; }
|
||||
}
|
||||
$sql = "SELECT `$id` FROM $table ORDER BY `$id` DESC LIMIT 1";
|
||||
$return_id = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Error with obtain last id.<br> File: db.php, Line: '.__LINE__));
|
||||
$return_id = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Error with obtain last id.<br> File: db.php, Line: '.__LINE__));
|
||||
$return_id = $return_id[$id];
|
||||
$return_id = $return_id+1;
|
||||
return $return_id;
|
||||
|
||||
@@ -38,7 +38,7 @@ function SendEmail($email, $title, $content)
|
||||
#send email - do it!
|
||||
if ( !mail($email, $title, $email_content, $email_headers ))
|
||||
{
|
||||
message_die('GENERAL','Could not send email from: '.$email.'. sorry :(','');
|
||||
message_die(GENERAL,'Could not send email from: '.$email.'. sorry :(','');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ function SendForgotPassEmail($newpass)
|
||||
function SendMassEmail($title,$content)
|
||||
{
|
||||
$sql = "SELECT `email`,`u_id` FROM ".USERS_TABLE." WHERE `u_id`>0";
|
||||
$query = DataBase::sql_query($sql,'CRITICAL','Could not read users table');
|
||||
$query = DataBase::sql_query($sql,CRITICAL,'Could not read users table');
|
||||
while($item = DataBase::fetch($query))
|
||||
{
|
||||
SendEmail($item['email'], $title, $content);
|
||||
|
||||
@@ -19,8 +19,8 @@ function message_die($type, $msm, $sql)
|
||||
<table align="left" border="1" style="border-collapse: collapse; border-color: grey" width="500">
|
||||
<tr>
|
||||
<td bgcolor="" align="left">
|
||||
<font face="Verdana" style="font-size: 18pt; font-weight: bold" color="red">DSF v'.VERSION.' - ';
|
||||
$msg .= ($type='CRITICAL') ? 'CRITICAL ERROR' : 'GENERAL ERROR' ;
|
||||
<font face="Verdana" style="font-size: 18pt; font-weight: bold" color="red">µForum v'.VERSION.' - ';
|
||||
$msg .= $type;
|
||||
$msg .= '</font>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -19,7 +19,7 @@ function SetCounter()
|
||||
{
|
||||
setcookie('forum_visited','1');
|
||||
$visit_count = $forum_config['forum_counter'] +1;
|
||||
DataBase::sql_query("UPDATE `".CONFIG_TABLE."` SET `value`='$visit_count' WHERE `name`='forum_counter'",'GENERAL','Could not update forum counter');
|
||||
DataBase::sql_query("UPDATE `".CONFIG_TABLE."` SET `value`='$visit_count' WHERE `name`='forum_counter'",GENERAL,'Could not update forum counter');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -201,7 +201,7 @@ function AddSkins()
|
||||
global $forum_config;
|
||||
global $default_skin;
|
||||
$all='';
|
||||
$query = DataBase::sql_query("SELECT `name`, `s_id` FROM `".SKINS_TABLE."`",'GENERAL','Could not obtain skins information');
|
||||
$query = DataBase::sql_query("SELECT `name`, `s_id` FROM `".SKINS_TABLE."`",GENERAL,'Could not obtain skins information');
|
||||
while($t = DataBase::fetch($query))
|
||||
{
|
||||
|
||||
@@ -277,7 +277,7 @@ function IfModGroup($guid)
|
||||
function TotalPosts()
|
||||
{
|
||||
$sql = "SELECT count(*) as `p_id` FROM ".POSTS_TABLE."";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain total posts information');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain total posts information');
|
||||
$result = DataBase::fetch($query);
|
||||
$result = $result['p_id'];
|
||||
|
||||
@@ -338,13 +338,15 @@ function ViewSkinName()
|
||||
$result = $forum_config['defaultskin'];
|
||||
}
|
||||
$sql = "SELECT * FROM `".SKINS_TABLE."` WHERE `s_id`='$result'";
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain skin information.'));
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql,CRITICAL,'Could not obtain skin information.'));
|
||||
|
||||
return $result['name'];
|
||||
}
|
||||
|
||||
function GenerateLastPost($id, $type)
|
||||
{
|
||||
$last_post = '';
|
||||
|
||||
switch ($type)
|
||||
{
|
||||
/** field lastpost in forum format
|
||||
@@ -352,8 +354,8 @@ function GenerateLastPost($id, $type)
|
||||
*/
|
||||
case 1: //for forum
|
||||
{
|
||||
$sql = "SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".* FROM ".POSTS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".POSTS_TABLE.".u_id = ".USERS_TABLE.".u_id WHERE `f_id`='$id' ORDER BY `ptime` LIMIT 1";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain last post in forum', true);
|
||||
$sql = "SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".* FROM ".POSTS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".POSTS_TABLE.".u_id = ".USERS_TABLE.".u_id WHERE `f_id`='$id' ORDER BY `ptime` DESC LIMIT 1";
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain last post in forum', true);
|
||||
$post_count = DataBase::num_rows($query);
|
||||
$result = DataBase::fetch($query);
|
||||
|
||||
@@ -372,7 +374,7 @@ function GenerateLastPost($id, $type)
|
||||
$sql = "UPDATE ".FORUMS_TABLE." SET
|
||||
`lastpost`='$last_post'
|
||||
WHERE `f_id`='$id'";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not update lastpost in forum');
|
||||
DataBase::sql_query($sql,GENERAL,'Could not update lastpost in forum');
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -381,8 +383,8 @@ function GenerateLastPost($id, $type)
|
||||
*/
|
||||
case 2: //for topic
|
||||
{
|
||||
$sql = "SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".* FROM ".POSTS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".u_id = ".POSTS_TABLE.".u_id WHERE `t_id`='$id' ORDER BY `ptime` LIMIT 1";
|
||||
$query = DataBase::sql_query($sql,'GENERAL', 'Could not obtain amout of posts in topic');
|
||||
$sql = "SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".* FROM ".POSTS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".u_id = ".POSTS_TABLE.".u_id WHERE `t_id`='$id' ORDER BY `ptime` DESC LIMIT 1";
|
||||
$query = DataBase::sql_query($sql,GENERAL, 'Could not obtain amout of posts in topic');
|
||||
$result = DataBase::fetch($query);
|
||||
|
||||
$last_post .= $result['tp_id'];
|
||||
@@ -396,60 +398,93 @@ function GenerateLastPost($id, $type)
|
||||
$last_post .= $result['nick'];
|
||||
|
||||
$sql = "UPDATE ".TOPICS_TABLE." SET
|
||||
`lastpost_time`='".$result['ptime']."',
|
||||
`lastpost`='$last_post'
|
||||
WHERE `t_id`='$id'";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not update lastpost in topic');
|
||||
DataBase::sql_query($sql,GENERAL,'Could not update lastpost in topic');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function GeneratePosts($id, $type)
|
||||
{
|
||||
{
|
||||
switch ($type)
|
||||
{
|
||||
case 1: //for forum
|
||||
{
|
||||
$sql = "SELECT COUNT (`p_id`) AS 'count', `f_id` FROM ".POSTS_TABLE." WHERE `f_id`='$id'";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain posts in forum', true);
|
||||
$sql = "SELECT COUNT(p_id) AS cnt, `f_id` FROM ".POSTS_TABLE." WHERE `f_id`='$id'";
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain posts in forum', true);
|
||||
$post_count = DataBase::num_rows($query);
|
||||
$result = DataBase::fetch($query);
|
||||
|
||||
$posts = $result['count'];
|
||||
$posts = $result['cnt'];
|
||||
|
||||
$sql = "UPDATE ".FORUMS_TABLE." SET
|
||||
`posts`='$last_post'
|
||||
`posts`='$posts'
|
||||
WHERE `f_id`='$id'";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not update lastpost in forum');
|
||||
DataBase::sql_query($sql,GENERAL,'Could not update lastpost in forum');
|
||||
break;
|
||||
}
|
||||
|
||||
/** field lastpost in topic format
|
||||
tp_id:u_id:ptime:rank:nick
|
||||
*/
|
||||
case 2: //for topic
|
||||
{
|
||||
$sql = "SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".* FROM ".POSTS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".u_id = ".POSTS_TABLE.".u_id WHERE `t_id`='$id' ORDER BY `ptime` LIMIT 1";
|
||||
$query = DataBase::sql_query($sql,'GENERAL', 'Could not obtain amout of posts in topic');
|
||||
$sql = "SELECT COUNT(p_id) AS cnt, t_id FROM ".POSTS_TABLE." WHERE `t_id`='$id'";
|
||||
$query = DataBase::sql_query($sql,GENERAL, 'Could not obtain posts count in topic');
|
||||
$result = DataBase::fetch($query);
|
||||
|
||||
$last_post .= $result['tp_id'];
|
||||
$last_post .= ':';
|
||||
$last_post .= $result['u_id'];
|
||||
$last_post .= ':';
|
||||
$last_post .= $result['ptime'];
|
||||
$last_post .= ':';
|
||||
$last_post .= $result['rank'];
|
||||
$last_post .= ':';
|
||||
$last_post .= $result['nick'];
|
||||
$posts = $result['cnt'];
|
||||
|
||||
$sql = "UPDATE ".TOPICS_TABLE." SET
|
||||
`lastpost`='$last_post'
|
||||
`posts`='$posts'
|
||||
WHERE `t_id`='$id'";
|
||||
DataBase::sql_query($sql,'GENERAL','Could not update lastpost in topic');
|
||||
DataBase::sql_query($sql,GENERAL,'Could not update post count in topic');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function UpdateConfigPosts()
|
||||
{
|
||||
$sql = "SELECT count(`p_id`) AS `count` FROM ".POSTS_TABLE;
|
||||
$query = DataBase::sql_query($sql, GENERAL, 'Could not obtain posts count.');
|
||||
$result = DataBase::fetch($query);
|
||||
$cnt = $result['count'];
|
||||
|
||||
unset ($sql, $query, $result);
|
||||
|
||||
$sql = "UPDATE ".CONFIG_TABLE." SET
|
||||
`value`='$cnt'
|
||||
WHERE `name`='posts'";
|
||||
DataBase::sql_query($sql, GENERAL, 'Could not update posts count in config table');
|
||||
}
|
||||
function TriggerStats($id, $type)
|
||||
{
|
||||
GeneratePosts($id, $type);
|
||||
GenerateLastPost($id, $type);
|
||||
UpdateConfigPosts();
|
||||
}
|
||||
|
||||
function array_push_associative(&$arr)
|
||||
{
|
||||
$ret = '';
|
||||
$args = func_get_args();
|
||||
foreach ($args as $arg)
|
||||
{
|
||||
if (is_array($arg))
|
||||
{
|
||||
foreach ($arg as $key => $value)
|
||||
{
|
||||
$arr[$key] = $value;
|
||||
$ret++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$arr[$arg] = "";
|
||||
}
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
//private messsages cache - v1.0 Alpha 2
|
||||
//
|
||||
$sql = "SELECT `u_id`,`nick`,`rank` FROM `".USERS_TABLE."`";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain forums information');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain forums information');
|
||||
$user['count']= DataBase::num_rows($query);
|
||||
|
||||
while($result = DataBase::fetch($query))
|
||||
@@ -52,7 +52,7 @@ switch($_GET['submode'])
|
||||
}
|
||||
}
|
||||
|
||||
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain messages information');
|
||||
$query = DataBase::sql_query($sql,CRITICAL,'Could not obtain messages information');
|
||||
$count = DataBase::num_rows($query);
|
||||
|
||||
if ($count==0)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
//smiles cache
|
||||
$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))
|
||||
{
|
||||
@@ -33,7 +33,7 @@ switch($_GET['submode'])
|
||||
break;
|
||||
}
|
||||
}
|
||||
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain messages information');
|
||||
$query = DataBase::sql_query($sql,CRITICAL,'Could not obtain messages information');
|
||||
$result = DataBase::fetch($query);
|
||||
//if message exist....
|
||||
if ($result['m_id']=='')
|
||||
@@ -63,12 +63,12 @@ switch($_GET['submode'])
|
||||
}
|
||||
if ($_GET['submode']=='user')
|
||||
{
|
||||
DataBase::sql_query("UPDATE ".PM_INBOX_TABLE." SET `read`='1' WHERE `m_id`='$mid'", 'GENERAL', 'Could not update message.');
|
||||
DataBase::sql_query("UPDATE ".PM_INBOX_TABLE." SET `read`='1' WHERE `m_id`='$mid'", GENERAL, 'Could not update message.');
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM ".USERS_TABLE." WHERE `u_id`='".$result['u_n_id']."'";
|
||||
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information');
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain user information');
|
||||
$user = DataBase::fetch($query);
|
||||
|
||||
$folder = ($_GET['submode']=='author') ? '<a href="pms.php?mode=folder&submode=sentbox" class="navigator">'.$lng['sentbox'].'</a>' : '<a href="pms.php?mode=folder&submode=inbox" class="navigator">'.$lng['inbox'].'</a>';
|
||||
|
||||
@@ -8,7 +8,7 @@ if ((isset($_POST['textedit'])) and (isset($_POST['nmsg'])) and (isset($_POST['u
|
||||
{
|
||||
$nick = strip_tags($_POST['username']);
|
||||
$sql = "SELECT * FROM `".USERS_TABLE."` WHERE `nick`='$nick'";
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql, 'CRITICAL','Could not obtain user information.'));
|
||||
$result = DataBase::fetch(DataBase::sql_query($sql, CRITICAL,'Could not obtain user information.'));
|
||||
if ($result['u_id']!='')
|
||||
{
|
||||
$_POST['textedit'] = Secure::TagsReplace($_POST['textedit']);
|
||||
|
||||
@@ -58,7 +58,7 @@ function SessRegister()
|
||||
SessDelete($uid);
|
||||
$time = time();
|
||||
$sql = "INSERT INTO ".SESSIONS_TABLE." VALUES ('', '".$_COOKIE[SESS_NAME]."','$uid','$time')";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not add new session.',true);
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not add new session.',true);
|
||||
if (DataBase::num_rows($query)>0)
|
||||
{
|
||||
$result = DataBase::fetch();
|
||||
@@ -75,7 +75,7 @@ function SessDeleteOld()
|
||||
{
|
||||
$time = time();
|
||||
$sql = "DELETE FROM ".SESSIONS_TABLE." WHERE time+129600<$time;";
|
||||
DataBase::sql_query($sql, 'GENERAL','Could not delete session',true);
|
||||
DataBase::sql_query($sql, GENERAL,'Could not delete session',true);
|
||||
}
|
||||
|
||||
function SessDelInvalid()
|
||||
@@ -83,7 +83,7 @@ function SessDelInvalid()
|
||||
if ($_SESSION['uid']>0)
|
||||
{
|
||||
$sql = "SELECT `session_id`, `u_id` FROM ".SESSIONS_TABLE." WHERE `u_id`='".$_SESSION['uid']."'";
|
||||
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain session information',true);
|
||||
$query = DataBase::sql_query($sql,GENERAL,'Could not obtain session information',true);
|
||||
$result = DataBase::fetch($query);
|
||||
$result = $result['session_id'];
|
||||
if ($_COOKIE[SESS_NAME]!=$result)
|
||||
@@ -98,7 +98,7 @@ function SessDelete($uid)
|
||||
{
|
||||
$time = time();
|
||||
$sql = "DELETE FROM ".SESSIONS_TABLE." WHERE u_id='$uid'";
|
||||
$query = DataBase::sql_query($sql, 'GENERAL','Could not delete session',true);
|
||||
$query = DataBase::sql_query($sql, GENERAL,'Could not delete session',true);
|
||||
if (DataBase::num_rows($query)>0)
|
||||
{
|
||||
$result = DataBase::fetch($query);
|
||||
@@ -115,7 +115,7 @@ function SessView()
|
||||
$name = '';
|
||||
$time = time();
|
||||
$sql = "SELECT ".SESSIONS_TABLE.".*, ".USERS_TABLE.".*, ".SESSIONS_TABLE.".u_id AS u_id FROM ".SESSIONS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".SESSIONS_TABLE.".u_id = ".USERS_TABLE.".u_id WHERE time+1250>$time;";
|
||||
$query = DataBase::sql_query($sql, 'GENERAL','Could not obtain sessions information.');
|
||||
$query = DataBase::sql_query($sql, GENERAL,'Could not obtain sessions information.');
|
||||
if (DataBase::num_rows($query)>0)
|
||||
{
|
||||
while($result = DataBase::fetch($query))
|
||||
|
||||
Reference in New Issue
Block a user