+ Changed from MySQL to MySQLi native driver.

+ Added 2 new functions in DataBase class: fetch($query) and num_rows($query)

git-svn-id: https://svn.pioder.pl/uf-svn/uF@20 72ec579a-5ced-4fa4-82f3-afba5d98df2f
This commit is contained in:
pioder
2009-05-03 10:50:00 +00:00
parent 6cc36dc266
commit b1f37b6ea5
43 changed files with 296 additions and 193 deletions

View File

@@ -19,7 +19,7 @@ class Forum
$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');
while($t = @mysql_fetch_array($query))
while($t = DataBase::fetch($query))
{
if ($t['f_id']==$forum)
@@ -39,7 +39,7 @@ class Forum
{
$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.');
$result = mysql_fetch_array($query);
$result = DataBase::fetch($query);
return $result['p_id'];
}
@@ -47,17 +47,18 @@ class Forum
{
global $lng;
global $user;
global $last_post;
global $lastpost;
global $userdata;
global $forum_config;
if ($posts==0) { return '<p align="center" class="fstandard">'.$lng['nopost'].'</p>';}
else
{
$id = $last_post[$forum]['tp_id'];
$topic = $last_post[$forum]['t_id'];
$userid = $last_post[$forum]['u_id'];
$un = $last_post[$forum]['user_nick'];
$rank = $last_post[$forum]['user_rank'];
$id = $lastpost[0];
$userid = $lastpost[1];
$topic = $lastpost[2];
$rank = $lastpost[4];
$un = $lastpost[5];
switch($rank)
{
case '0':
@@ -93,13 +94,13 @@ class Forum
{
$page='';
}
return '<p align="center"><span class="fverysmall"><b>'.GenerateTime($last_post[$forum]['time']).'</b><br></span> <a href="topic.php?t='.$topic.$page.'#p'.$id.'" class="fverysmall"><b>'.$lng['topic'].' #'.$topic.'</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($lastpost[3]).'</b><br></span> <a href="topic.php?t='.$topic.$page.'#p'.$id.'" class="fverysmall"><b>'.$lng['topic'].' #'.$topic.'</b></a><a class="fsmall">: </a><a href="user.php?id='.$userid.'" class="fverysmall">'.$user_color_name.'</a></p>';
}
}
function LastPostImg($postsinforum)
{
global $last_post;
global $lastpost;
global $i;
global $forum;
global $default_skin;
@@ -108,7 +109,7 @@ class Forum
{
if ($postsinforum>0)
{
if ($last_post[$forum[$i]['f_id']]['time']>$time)
if ($lastpost[3]>$time)
{
return 'folder_new_posts';
}
@@ -132,7 +133,7 @@ class Forum
{
$sql = "SELECT `f_id`, `$inf` FROM ".FORUMS_TABLE." WHERE f_id='$fid';";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain forum information.');
$result = mysql_fetch_array($query);
$result = DataBase::fetch($query);
$result = $result[$inf];
return $result;
}

View File

@@ -40,7 +40,7 @@ class Mod
{
$sql="SELECT * FROM ".POSTS_TABLE." WHERE `t_id`='$topicid'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain post information');
while($item = @mysql_fetch_array($query))
while($item = DataBase::fetch($query))
{
$uid = Topic::PostInformation($item['p_id'],'u_id');
$posts = User::UserInformation($uid,'posts');
@@ -84,7 +84,7 @@ class Mod
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.');
while($item=mysql_fetch_array($query))
while($item=DataBase::fetch($query))
{
$number = $item['tp_id'];
$number = $number-1;

View File

@@ -20,7 +20,7 @@ class Post
#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.');
$result = mysql_fetch_array($query);
$result = DataBase::fetch($query);
$forum = $result['f_id'];//forum id
$moderate = Forum::ForumInformation($forum,'moderate');
$tpid = $result['tp_id'];//post in topic id
@@ -61,7 +61,7 @@ class 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.');
$result = mysql_fetch_array($query);
$result = DataBase::fetch($query);
$result = $result['posts'];
$result = $result+1;
$sql = "UPDATE ".USERS_TABLE." SET posts='$result' WHERE u_id='$uid' ";
@@ -76,7 +76,7 @@ class Post
$sql = "SELECT * FROM ".SMILES_TABLE."";
$query = DataBase::sql_query($sql,'GENERAL','Cold not obtain smiles information.');
$i = 1;
while($smile = mysql_fetch_array($query))
while($smile = DataBase::fetch($query))
{
$action = "insertSmile('".$smile['url']."','".$smile['smile']."')";
$mouse = "this.style.cursor='hand';";
@@ -100,7 +100,7 @@ class Post
$sql = "SELECT * FROM ".SMILES_TABLE."";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain emoticons information.');
$i = 1;
while($result = mysql_fetch_array($query))
while($result = DataBase::fetch($query))
{
$smile[$i]['smile'] = $result['smile'];
$smile[$i]['url'] = $result['url'];

View File

@@ -116,7 +116,7 @@ class Topic
{
$sql = "SELECT * FROM ".TOPICS_TABLE." WHERE t_id='$tid';";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain topic information');
$result = mysql_fetch_array($query);
$result = DataBase::fetch($query);
$result = $result[$mode];
return $result;
}
@@ -125,7 +125,7 @@ class Topic
{
$sql = "SELECT * FROM ".POSTS_TABLE." WHERE p_id='$pid';";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain topic information');
$result = mysql_fetch_array($query);
$result = DataBase::fetch($query);
$result = $result[$mode];
return $result;
}

View File

@@ -25,7 +25,7 @@ class User
{
$sql = "SELECT `$inf` FROM ".USERS_TABLE." WHERE u_id='$uid';";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information.');
$result = mysql_fetch_array($query);
$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 = mysql_fetch_array(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=='')
{
@@ -120,7 +120,7 @@ class User
{
$sql = "SELECT * FROM ".USERS_TABLE." WHERE u_id='$uid'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user`s rank information.');
$result = mysql_fetch_array($query);
$result = DataBase::fetch($query);
$rank = $result['rank'];
if (($rank=='1') or ($rank=='2'))
{
@@ -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 = mysql_fetch_array(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)
{

View File

@@ -18,7 +18,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.');
$result = mysql_fetch_array($query);
$result = DataBase::fetch($query);
$result = $result['f_id'];
if ($result=='')
{
@@ -32,7 +32,7 @@ class Secure
{
$sql = "SELECT * FROM ".CENSORLIST_TABLE.";";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain censorlist information.');
while($word = mysql_fetch_array($query))
while($word = DataBase::fetch($query))
{
$text = str_replace($word['word'],'[censored]', $text);
}
@@ -69,7 +69,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.');
$result = mysql_fetch_array($query);
$result = DataBase::fetch($query);
$result = $result['m_id'];
if ($result=='')
{
@@ -81,7 +81,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.');
$result = mysql_fetch_array($query);
$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 = mysql_fetch_array(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 = mysql_fetch_array(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=='')
{
@@ -115,7 +115,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.');
$result = mysql_fetch_array($query);
$result = DataBase::fetch($query);
$result = $result['t_id'];
if ($result=='')
{
@@ -127,7 +127,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.');
$result = mysql_fetch_array($query);
$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 = mysql_fetch_array(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 = mysql_fetch_array(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 = mysql_fetch_array(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 = mysql_fetch_array(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 = mysql_fetch_array(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);