$tmp=DataBase::fetch(DataBase::sql_query("SELECT `name` FROM `".CATS_TABLE."` WHERE `c_id`='$cid'",'GENERAL','Could not obtain category information'));
$tmp=DataBase::fetch(DataBase::sql_query("SELECT `name` FROM `".CATS_TABLE."` WHERE `c_id`='$cid'",GENERAL,'Could not obtain category information'));
$tmp=$tmp['name'];
$tmp=$tmp['name'];
$_POST['cat_name']=$tmp;
$_POST['cat_name']=$tmp;
if($tmp['name']=='')
if($tmp['name']=='')
@ -495,14 +495,14 @@ switch($_GET['mode'])
$forum_desc=strip_tags($_POST['forum_desc']);
$forum_desc=strip_tags($_POST['forum_desc']);
$forum_cat=$_POST['forum_cat'];
$forum_cat=$_POST['forum_cat'];
$sql="SELECT * FROM `".FORUMS_TABLE."` WHERE `f_id`='$fid'";
$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=DataBase::fetch($query);
$actual_cid=$result['c_id'];
$actual_cid=$result['c_id'];
$sort=$result['sort'];
$sort=$result['sort'];
if($actual_cid!=$forum_cat)
if($actual_cid!=$forum_cat)
{
{
$sql="SELECT * FROM `".FORUMS_TABLE."` WHERE `c_id`='$forum_cat' ORDER BY `sort` DESC LIMIT 1";
$sql="SELECT * FROM `".FORUMS_TABLE."` WHERE `c_id`='$forum_cat' ORDER BY `sort` DESC LIMIT 1";
$query=DataBase::sql_query($sql,'GENERAL','Could not obtain forums information');
$query=DataBase::sql_query($sql,GENERAL,'Could not obtain forums information');
$result=DataBase::fetch($query);
$result=DataBase::fetch($query);
$sort=$result['sort']+1;
$sort=$result['sort']+1;
}
}
@ -517,7 +517,7 @@ switch($_GET['mode'])
`c_id`='$forum_cat',
`c_id`='$forum_cat',
`sort`='$sort'
`sort`='$sort'
WHERE`f_id`='$fid'";
WHERE`f_id`='$fid'";
DataBase::sql_query($sql,'GENERAL','Could not update forum');
DataBase::sql_query($sql,GENERAL,'Could not update forum');
$tmp=DataBase::fetch(DataBase::sql_query("SELECT `name`, `desc` FROM `".FORUMS_TABLE."` WHERE `f_id`='$fid'",'GENERAL','Could not obtain forum information'));
$tmp=DataBase::fetch(DataBase::sql_query("SELECT `name`, `desc` FROM `".FORUMS_TABLE."` WHERE `f_id`='$fid'",GENERAL,'Could not obtain forum information'));
$sql="SELECT ".TOPICS_TABLE.".*, ".USERS_TABLE.".* FROM ".TOPICS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".TOPICS_TABLE.".author = ".USERS_TABLE.".u_id WHERE f_id='$fid' ORDER BY `sticky` DESC, `lastpost_time` DESC $limit;";
$query=DataBase::sql_query($sql,'GENERAL','Could not obtain topics information');
$sql="SELECT ".TOPICS_TABLE.".*, ".USERS_TABLE.".*, ".TOPICS_TABLE.".posts AS `postcount`, ".TOPICS_TABLE.".lastpost AS `topic_lastpost` FROM ".TOPICS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".TOPICS_TABLE.".author = ".USERS_TABLE.".u_id WHERE f_id='$fid' ORDER BY `sticky` DESC, `lastpost_time` DESC $limit;";
$query=DataBase::sql_query($sql,GENERAL,'Could not obtain topics information');
$sql="SELECT ".USERS_GROUP_TABLE.".*, ".USERS_TABLE.".* FROM `".USERS_GROUP_TABLE."` LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".u_id =".USERS_GROUP_TABLE.".u_id WHERE `g_id`='$gid'";
$sql="SELECT ".USERS_GROUP_TABLE.".*, ".USERS_TABLE.".* FROM `".USERS_GROUP_TABLE."` LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".u_id =".USERS_GROUP_TABLE.".u_id WHERE `g_id`='$gid'";
$query=DataBase::sql_query($sql,'GENERAL','Could not obtain users in groups information.');
$query=DataBase::sql_query($sql,GENERAL,'Could not obtain users in groups information.');
//cache forums and posts - version v1.0 Alpha 2---------------------------------
//cache forums and posts - version v1.0 Alpha 2---------------------------------
$default_skin=ViewSkinName();
$default_skin=ViewSkinName();
$sql="SELECT `name`,`lock` FROM ".FORUMS_TABLE." WHERE `f_id`='$fid' LIMIT 1";
$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']=='')
if($result['name']=='')
{
{
message_forum($lng['no_forum'],'index.php');
message_forum($lng['no_forum'],'index.php');
@ -23,14 +23,14 @@ $forum = array(
'name'=>$result['name'],
'name'=>$result['name'],
'lock'=>$result['lock']
'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))
while($result=DataBase::fetch($query))
{
{
$count_topic[$result['t_id']]=$result['p_id'];
$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`";
/*$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');
$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`";
$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.');
$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";
$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'));
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
else
{
{
@ -201,7 +201,7 @@ function AddSkins()
global$forum_config;
global$forum_config;
global$default_skin;
global$default_skin;
$all='';
$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))
while($t=DataBase::fetch($query))
{
{
@ -277,7 +277,7 @@ function IfModGroup($guid)
functionTotalPosts()
functionTotalPosts()
{
{
$sql="SELECT count(*) as `p_id` FROM ".POSTS_TABLE."";
$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=DataBase::fetch($query);
$result=$result['p_id'];
$result=$result['p_id'];
@ -338,13 +338,15 @@ function ViewSkinName()
$result=$forum_config['defaultskin'];
$result=$forum_config['defaultskin'];
}
}
$sql="SELECT * FROM `".SKINS_TABLE."` WHERE `s_id`='$result'";
$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'];
return$result['name'];
}
}
functionGenerateLastPost($id,$type)
functionGenerateLastPost($id,$type)
{
{
$last_post='';
switch($type)
switch($type)
{
{
/**fieldlastpostinforumformat
/**fieldlastpostinforumformat
@ -352,8 +354,8 @@ function GenerateLastPost($id, $type)
*/
*/
case1://for forum
case1://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);
$post_count=DataBase::num_rows($query);
$result=DataBase::fetch($query);
$result=DataBase::fetch($query);
@ -372,7 +374,7 @@ function GenerateLastPost($id, $type)
$sql="UPDATE ".FORUMS_TABLE." SET
$sql="UPDATE ".FORUMS_TABLE." SET
`lastpost`='$last_post'
`lastpost`='$last_post'
WHERE`f_id`='$id'";
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;
break;
}
}
@ -381,8 +383,8 @@ function GenerateLastPost($id, $type)
*/
*/
case2://for topic
case2://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);
$result=DataBase::fetch($query);
$last_post.=$result['tp_id'];
$last_post.=$result['tp_id'];
@ -396,60 +398,93 @@ function GenerateLastPost($id, $type)
$last_post.=$result['nick'];
$last_post.=$result['nick'];
$sql="UPDATE ".TOPICS_TABLE." SET
$sql="UPDATE ".TOPICS_TABLE." SET
`lastpost_time`='".$result['ptime']."',
`lastpost`='$last_post'
`lastpost`='$last_post'
WHERE`t_id`='$id'";
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;
break;
}
}
}
}
}
}
functionGeneratePosts($id,$type)
functionGeneratePosts($id,$type)
{
{
switch($type)
switch($type)
{
{
case1://for forum
case1://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);
$post_count=DataBase::num_rows($query);
$result=DataBase::fetch($query);
$result=DataBase::fetch($query);
$posts=$result['count'];
$posts=$result['cnt'];
$sql="UPDATE ".FORUMS_TABLE." SET
$sql="UPDATE ".FORUMS_TABLE." SET
`posts`='$last_post'
`posts`='$posts'
WHERE`f_id`='$id'";
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;
break;
}
}
/**fieldlastpostintopicformat
tp_id:u_id:ptime:rank:nick
*/
case2://for topic
case2://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);
$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
$sql="UPDATE ".TOPICS_TABLE." SET
`lastpost`='$last_post'
`posts`='$posts'
WHERE`t_id`='$id'";
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;
break;
}
}
}
}
}
}
functionUpdateConfigPosts()
{
$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');
$sql="INSERT INTO ".SESSIONS_TABLE." VALUES ('', '".$_COOKIE[SESS_NAME]."','$uid','$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)
if(DataBase::num_rows($query)>0)
{
{
$result=DataBase::fetch();
$result=DataBase::fetch();
@ -75,7 +75,7 @@ function SessDeleteOld()
{
{
$time=time();
$time=time();
$sql="DELETE FROM ".SESSIONS_TABLE." WHERE time+129600<$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);
}
}
functionSessDelInvalid()
functionSessDelInvalid()
@ -83,7 +83,7 @@ function SessDelInvalid()
if($_SESSION['uid']>0)
if($_SESSION['uid']>0)
{
{
$sql="SELECT `session_id`, `u_id` FROM ".SESSIONS_TABLE." WHERE `u_id`='".$_SESSION['uid']."'";
$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=DataBase::fetch($query);
$result=$result['session_id'];
$result=$result['session_id'];
if($_COOKIE[SESS_NAME]!=$result)
if($_COOKIE[SESS_NAME]!=$result)
@ -98,7 +98,7 @@ function SessDelete($uid)
{
{
$time=time();
$time=time();
$sql="DELETE FROM ".SESSIONS_TABLE." WHERE u_id='$uid'";
$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)
if(DataBase::num_rows($query)>0)
{
{
$result=DataBase::fetch($query);
$result=DataBase::fetch($query);
@ -115,7 +115,7 @@ function SessView()
$name='';
$name='';
$time=time();
$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;";
$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.');
$connect=@mysql_connect($_POST['mysql_host'],$_POST['mysql_user'],$_POST['mysql_pass'])ormessage_die('GENERAL','Could not connect to database server. Error with installation!',@mysql_error());
@fwrite(@fopen('../config.php','w'),$config_file)ormessage_die('GENERAL','Could not write config file. Error with installation!','');
$connect=@mysql_connect($_POST['mysql_host'],$_POST['mysql_user'],$_POST['mysql_pass'])ormessage_die(GENERAL,'Could not connect to database server. Error with installation!',@mysql_error());
@fwrite(@fopen('../config.php','w'),$config_file)ormessage_die(GENERAL,'Could not write config file. Error with installation!','');
@mysql_query("SET NAMES 'utf8'",$connect);
@mysql_query("SET NAMES 'utf8'",$connect);
@mysql_select_db($_POST['database'],$connect)ormessage_die('GENERAL','Could not connect to database. Error with installation!',@mysql_error());
@mysql_select_db($_POST['database'],$connect)ormessage_die(GENERAL,'Could not connect to database. Error with installation!',@mysql_error());
DataBase::sql_query($sql[$i],'ERROR','Error of SQL Query: '.$sql[$i].' Error with install script!');
DataBase::sql_query($sql[$i],'ERROR','Error of SQL Query: '.$sql[$i].' Error with install script!');
}
}
DataBase::sql_query("UPDATE `".$_POST['mysql_prefix']."config` SET `value`='".time()."' WHERE `name`='date_install'",'GENERAL','Could not update date install information');
DataBase::sql_query("UPDATE `".$_POST['mysql_prefix']."config` SET `value`='".time()."' WHERE `name`='date_install'",GENERAL,'Could not update date install information');
DataBase::sql_query("UPDATE `".$_POST['mysql_prefix']."config` SET `value`='".$patch."' WHERE `name`='forumpatch'",'GENERAL','Could not update date install information');
DataBase::sql_query("UPDATE `".$_POST['mysql_prefix']."config` SET `value`='".$patch."' WHERE `name`='forumpatch'",GENERAL,'Could not update date install information');
header('Location: index.php?page=step5');
header('Location: index.php?page=step5');
@ -250,11 +250,11 @@ switch($_GET['page'])
`regdate`='".time()."',
`regdate`='".time()."',
`lastvisit`='".time()."'
`lastvisit`='".time()."'
WHERE`u_id`='1';";
WHERE`u_id`='1';";
DataBase::sql_query($sql,'CRITICAL','Could not update user. Error with install script!');
DataBase::sql_query($sql,CRITICAL,'Could not update user. Error with install script!');
$sql="UPDATE `".POSTS_TABLE."` SET `ptime`='".time()."' WHERE `p_id`='1'";
$sql="UPDATE `".POSTS_TABLE."` SET `ptime`='".time()."' WHERE `p_id`='1'";
DataBase::sql_query($sql,'CRITICAL','Could not update post. Error with install script!');
DataBase::sql_query($sql,CRITICAL,'Could not update post. Error with install script!');
$sql="UPDATE `".TOPICS_TABLE."` SET `lastpost_time`='".time()."' WHERE `t_id`='1'";
$sql="UPDATE `".TOPICS_TABLE."` SET `lastpost_time`='".time()."' WHERE `t_id`='1'";
DataBase::sql_query($sql,'CRITICAL','Could not update topic. Error with install script!');
DataBase::sql_query($sql,CRITICAL,'Could not update topic. Error with install script!');
$sql="SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".* FROM ".POSTS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".u_id = ".POSTS_TABLE.".u_id ORDER BY `ptime`";
$sql="SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".* FROM ".POSTS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".u_id = ".POSTS_TABLE.".u_id 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');
$sql="SELECT COUNT(*) as `p_id`, `t_id` FROM ".POSTS_TABLE." GROUP BY `t_id`";
$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');
$query=DataBase::sql_query($sql,GENERAL,'Could not obtain amout of posts in forum');
while($result=DataBase::fetch($query))
while($result=DataBase::fetch($query))
{
{
$count_topic[$result['t_id']]=$result['p_id'];
$count_topic[$result['t_id']]=$result['p_id'];
@ -105,7 +105,7 @@ if ((isset($_POST['keywords'])) || ($_GET['content']=='lastposts') || ($_GET['co
if(isset($_GET['u']))
if(isset($_GET['u']))
{
{
$count=DataBase::fetch(DataBase::sql_query("SELECT COUNT(`t_id`) as `t_id`
$count=DataBase::fetch(DataBase::sql_query("SELECT COUNT(`t_id`) as `t_id`
FROM".TOPICS_TABLE."WHERE`author`='".intval($_GET['u'])."'",'GENERAL','Could not obtain count amout of topics'));
FROM".TOPICS_TABLE."WHERE`author`='".intval($_GET['u'])."'",GENERAL,'Could not obtain count amout of topics'));
$count=$count['t_id'];
$count=$count['t_id'];
$count=ceil($count/$limiter);
$count=ceil($count/$limiter);
if($count==0)
if($count==0)
@ -139,7 +139,7 @@ if ((isset($_POST['keywords'])) || ($_GET['content']=='lastposts') || ($_GET['co
$like_where.=' OR `text` LIKE \'%'.$keyword[$i].'%\'';
$like_where.=' OR `text` LIKE \'%'.$keyword[$i].'%\'';
}
}
$sql="SELECT COUNT(".TOPICS_TABLE.".t_id) as `count`, ".POSTS_TABLE.".* FROM ".TOPICS_TABLE." LEFT JOIN ".POSTS_TABLE." ON ".POSTS_TABLE.".t_id = ".TOPICS_TABLE.".t_id WHERE $like_where GROUP BY `t_id`";
$sql="SELECT COUNT(".TOPICS_TABLE.".t_id) as `count`, ".POSTS_TABLE.".* FROM ".TOPICS_TABLE." LEFT JOIN ".POSTS_TABLE." ON ".POSTS_TABLE.".t_id = ".TOPICS_TABLE.".t_id WHERE $like_where GROUP BY `t_id`";
$count=DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain count amout of topics'));
$count=DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain count amout of topics'));
$count=$count['count'];
$count=$count['count'];
$count=ceil($count/$limiter);
$count=ceil($count/$limiter);
if($count==0)
if($count==0)
@ -178,7 +178,7 @@ if ((isset($_POST['keywords'])) || ($_GET['content']=='lastposts') || ($_GET['co
DataBase::sql_query("DELETE FROM ".SHOUTBOX_TABLE." WHERE `m_id`='".intval($_GET['id'])."'",'GENERAL','Could not delete shoutbox message');
DataBase::sql_query("DELETE FROM ".SHOUTBOX_TABLE." WHERE `m_id`='".intval($_GET['id'])."'",GENERAL,'Could not delete shoutbox message');
}
}
break;
break;
}
}
@ -58,7 +58,7 @@ else
}
}
$shoutbox_content='';
$shoutbox_content='';
$sql="SELECT ".SHOUTBOX_TABLE.".*, ".USERS_TABLE.".* FROM ".SHOUTBOX_TABLE." LEFT JOIN ".USERS_TABLE." ON ".SHOUTBOX_TABLE.".u_id = ".USERS_TABLE.".u_id ORDER BY `mtime` $desc LIMIT ".$forum_config['shoutbox_max'];
$sql="SELECT ".SHOUTBOX_TABLE.".*, ".USERS_TABLE.".* FROM ".SHOUTBOX_TABLE." LEFT JOIN ".USERS_TABLE." ON ".SHOUTBOX_TABLE.".u_id = ".USERS_TABLE.".u_id ORDER BY `mtime` $desc LIMIT ".$forum_config['shoutbox_max'];
$query=DataBase::sql_query($sql,'CRITICAL','Could not obtain shoutbox information');
$query=DataBase::sql_query($sql,CRITICAL,'Could not obtain shoutbox information');
$sql="SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".*, ".USERS_TABLE.".u_id AS user_id,".SESSIONS_TABLE.".* FROM `".POSTS_TABLE."` LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".u_id = ".POSTS_TABLE.".u_id LEFT JOIN ".SESSIONS_TABLE." ON ".SESSIONS_TABLE.".u_id = ".POSTS_TABLE.".u_id WHERE t_id='$tid' ORDER BY tp_id $limit;";
$sql="SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".*, ".USERS_TABLE.".u_id AS user_id,".SESSIONS_TABLE.".* FROM `".POSTS_TABLE."` LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".u_id = ".POSTS_TABLE.".u_id LEFT JOIN ".SESSIONS_TABLE." ON ".SESSIONS_TABLE.".u_id = ".POSTS_TABLE.".u_id WHERE t_id='$tid' ORDER BY tp_id $limit;";
$query=DataBase::sql_query($sql,'CRITICAL','Could not obtain post information.');
$query=DataBase::sql_query($sql,CRITICAL,'Could not obtain post information.');