diff --git a/admin/admin_forums.php b/admin/admin_forums.php
index 3fd1319..2887aff 100644
--- a/admin/admin_forums.php
+++ b/admin/admin_forums.php
@@ -36,7 +36,7 @@ function GenerateDefaultDisplay()
$cache_id=1;
$sql = "SELECT * FROM ".FORUMS_TABLE." ORDER BY `c_id`, `sort`";
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain forum information.');
- while($result = @mysql_fetch_array($query))
+ while($result = DataBase::fetch($query))
{
$forum[$cache_id]['f_id'] = $result['f_id'];
$forum[$cache_id]['name'] = $result['name'];
@@ -59,7 +59,7 @@ function GenerateDefaultDisplay()
//add forums and categories
$sql = "SELECT * FROM `".CATS_TABLE."` ORDER BY `sort`";
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain categories information.');
- while($result = mysql_fetch_array($query))
+ while($result = DataBase::fetch($query))
{
$skin = array(
'category' => $result['name'],
@@ -115,11 +115,11 @@ switch($_GET['mode'])
{
$cat_name = strip_tags($_POST['cat_name']);
$sql = "SELECT `sort` FROM `".CATS_TABLE."` ORDER BY `sort` DESC LIMIT 1";
- $last = @mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain last category sort id'));
+ $last = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain last category sort id'));
$sort = $last ['sort'];
$sort = $sort+1;
$sql = "SELECT `c_id` FROM `".CATS_TABLE."` ORDER BY `c_id` DESC LIMIT 1";
- $last = @mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain last category id'));
+ $last = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain last category id'));
$last = $last['c_id'];
$last = $last +1;
$sql = "INSERT INTO `".CATS_TABLE."` VALUES ('$last','$cat_name','$sort')";
@@ -169,11 +169,11 @@ switch($_GET['mode'])
$forum_lock = (isset($_POST['forum_locked'])) ? 1 : 0;
$allow_moderate = (isset($_POST['allow_moderate'])) ? 1 : 0;
$sql = "SELECT `sort`, `c_id` FROM `".FORUMS_TABLE."` WHERE `c_id`='$forum_cat' ORDER BY `sort` DESC LIMIT 1";
- $last = @mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain last forum sort id'));
+ $last = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain last forum sort id'));
$sort = $last ['sort'];
$sort = $sort+1;
$sql = "SELECT `f_id` FROM `".FORUMS_TABLE."` ORDER BY `f_id` DESC LIMIT 1";
- $last = @mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain last forum id'));
+ $last = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain last forum id'));
$last = $last['f_id'];
$last = $last +1;
$sql = "INSERT INTO `".FORUMS_TABLE."` VALUES ('$last','$forum_lock','$allow_moderate', '$forum_name', '$forum_desc','$forum_cat','$sort')";
@@ -243,13 +243,13 @@ switch($_GET['mode'])
{
$i1 = $_GET['c'];
$sql = "SELECT `sort`, `c_id` FROM ".CATS_TABLE." WHERE `c_id`='$i1'";
- $s1 = @mysql_fetch_array(DataBase::sql_query($sql,'CRITICAL','Could not obtain category information.'));
+ $s1 = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain category information.'));
$s1 = $s1['sort'];
$s2 = $s1 -1;
if ($s1>1)
{
$sql = "SELECT `sort`, `c_id` FROM ".CATS_TABLE." WHERE `sort`='$s2'";
- $s2 = @mysql_fetch_array(DataBase::sql_query($sql,'CRITICAL','Could not obtain category information.'));
+ $s2 = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain category information.'));
$i2 = $s2['c_id'];
$s2 = $s2['sort'];
$sql = "UPDATE ".CATS_TABLE." SET `sort`='$s2' WHERE `c_id`='$i1'";
@@ -266,14 +266,14 @@ switch($_GET['mode'])
{
$i1 = $_GET['f'];
$sql = "SELECT `sort`, `c_id`, `f_id` FROM ".FORUMS_TABLE." WHERE `f_id`='$i1'";
- $s1 = @mysql_fetch_array(DataBase::sql_query($sql,'CRITICAL','Could not obtain forum information.'));
+ $s1 = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain forum information.'));
$cid = $s1['c_id'];
$s1 = $s1['sort'];
$s2 = $s1 -1;
if ($s1>1)
{
$sql = "SELECT `sort`, `c_id`, `f_id` FROM ".FORUMS_TABLE." WHERE `sort`='$s2' AND `c_id`='$cid'";
- $s2 = @mysql_fetch_array(DataBase::sql_query($sql,'CRITICAL','Could not forum forum information.'));
+ $s2 = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not forum forum information.'));
$i2 = $s2['f_id'];
$s2 = $s2['sort'];
$sql = "UPDATE ".FORUMS_TABLE." SET `sort`='$s2' WHERE `f_id`='$i1'";
@@ -306,15 +306,15 @@ switch($_GET['mode'])
$i1 = $_GET['c'];
$i2 = $i1 +1;
$sql = "SELECT `sort`, `c_id` FROM ".CATS_TABLE." WHERE `c_id`='$i1'";
- $s1 = @mysql_fetch_array(DataBase::sql_query($sql,'CRITICAL','Could not obtain category information.'));
+ $s1 = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain category information.'));
$s1 = $s1['sort'];
$s2 = $s1 +1;
$sql = "SELECT `c_id` FROM ".CATS_TABLE;
- $count = @mysql_num_rows(DataBase::sql_query($sql,'CRITICAL','Could not obtain category information.'));
+ $count = DataBase::num_rows(DataBase::sql_query($sql,'CRITICAL','Could not obtain category information.'));
if ($s1<$count)
{
$sql = "SELECT `sort`, `c_id` FROM ".CATS_TABLE." WHERE `sort`='$s2'";
- $s2 = @mysql_fetch_array(DataBase::sql_query($sql,'CRITICAL','Could not obtain category information.'));
+ $s2 = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain category information.'));
$i2 = $s2['c_id'];
$s2 = $s2['sort'];
$sql = "UPDATE ".CATS_TABLE." SET `sort`='$s2' WHERE `c_id`='$i1'";
@@ -332,16 +332,16 @@ switch($_GET['mode'])
$i1 = $_GET['f'];
$i2 = $i1 +1;
$sql = "SELECT `sort`, `c_id`, `f_id` FROM ".FORUMS_TABLE." WHERE `f_id`='$i1'";
- $s1 = @mysql_fetch_array(DataBase::sql_query($sql,'CRITICAL','Could not obtain forum information.'));
+ $s1 = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain forum information.'));
$cid = $s1['c_id'];
$s1 = $s1['sort'];
$s2 = $s1 +1;
$sql = "SELECT `f_id` FROM ".FORUMS_TABLE." WHERE `c_id`='$cid'";
- $count = @mysql_num_rows(DataBase::sql_query($sql,'CRITICAL','Could not obtain forum information.'));
+ $count = DataBase::num_rows(DataBase::sql_query($sql,'CRITICAL','Could not obtain forum information.'));
if ($s1<$count)
{
$sql = "SELECT `sort`, `f_id` FROM ".FORUMS_TABLE." WHERE `sort`='$s2'";
- $s2 = @mysql_fetch_array(DataBase::sql_query($sql,'CRITICAL','Could not obtain forum information.'));
+ $s2 = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain forum information.'));
$i2 = $s2['f_id'];
$s2 = $s2['sort'];
$sql = "UPDATE ".FORUMS_TABLE." SET `sort`='$s2' WHERE `f_id`='$i1'";
@@ -369,11 +369,11 @@ switch($_GET['mode'])
$cid = intval($_GET['c']);
$sql = "SELECT * FROM `".CATS_TABLE."` WHERE `c_id`='$cid'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain category information');
- $result = @mysql_fetch_array($query);
+ $result = DataBase::fetch($query);
$sort = $result['sort'];
$sql = "SELECT * FROM `".CATS_TABLE."` WHERE `sort`>'$sort'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain categories information');
- while($item = @mysql_fetch_array($query))
+ while($item = DataBase::fetch($query))
{
$new_sort = $item['sort']-1;
$cid2 = $item['c_id'];
@@ -382,7 +382,7 @@ switch($_GET['mode'])
}
$sql = "SELECT `f_id` FROM `".FORUMS_TABLE."` WHERE `c_id`='$cid'";
$query = DataBase::sql_query($sql, 'GENERAL','Could not obtain forum information.');
- while($item = @mysql_fetch_array($query))
+ while($item = DataBase::fetch($query))
{
$fid = $item['f_id'];
$sql="DELETE FROM `".POSTS_TABLE."` WHERE `f_id`='$fid'";
@@ -403,11 +403,11 @@ switch($_GET['mode'])
$fid = intval($_GET['f']);
$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);
$sort = $result['sort'];
$sql = "SELECT * FROM `".FORUMS_TABLE."` WHERE `sort`>'$sort'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain forums information');
- while($item = @mysql_fetch_array($query))
+ while($item = DataBase::fetch($query))
{
$new_sort = $item['sort']-1;
$fid1 = $item['f_id'];
@@ -439,7 +439,7 @@ switch($_GET['mode'])
{
$cat_name = strip_tags($_POST['cat_name']);
$sql = "SELECT `sort`, `c_id` FROM `".FORUMS_TABLE."` WHERE `c_id`='$cat_name' ORDER BY `sort` DESC LIMIT 1";
- $last = @mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain last forum sort id'));
+ $last = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain last forum sort id'));
$sort = $last ['sort'];
$sort = $sort+1;
$sql = "UPDATE `".CATS_TABLE."` SET `name`='$cat_name', `sort`='$sort' WHERE `c_id`='$cid'";
@@ -455,7 +455,7 @@ switch($_GET['mode'])
}
else
{
- $tmp = mysql_fetch_array(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'];
$_POST['cat_name'] = $tmp;
if($tmp['name']=='')
@@ -496,14 +496,14 @@ switch($_GET['mode'])
$forum_cat = $_POST['forum_cat'];
$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);
$actual_cid = $result['c_id'];
$sort = $result['sort'];
if ($actual_cid != $forum_cat)
{
$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');
- $result = @mysql_fetch_array($query);
+ $result = DataBase::fetch($query);
$sort = $result['sort']+1;
}
@@ -535,7 +535,7 @@ switch($_GET['mode'])
}
else
{
- $tmp = mysql_fetch_array(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'));
$_POST['forum_name'] = $tmp['name'];
$msg='./../skins/'.$default_skin.'/blank.tpl';
$_POST['forum_desc'] = $tmp['desc'];
diff --git a/admin/admin_groups.php b/admin/admin_groups.php
index aad455b..8c995e9 100644
--- a/admin/admin_groups.php
+++ b/admin/admin_groups.php
@@ -42,7 +42,7 @@ function GenerateDefaultDisplay()
include('./template/groups_beam_body.tpl');
$sql = "SELECT `g_id`, `name`, `desc` FROM `".GROUPS_TABLE."` ORDER BY `sort`";
$query = DataBase::sql_query($sql, 'GENERAL', 'Could not obtain groups information.');
- while($item = mysql_fetch_array($query))
+ while($item = DataBase::fetch($query))
{
$skin = array(
'g_id'=>$item['g_id'],
@@ -87,11 +87,11 @@ switch($_GET['mode'])
$group_name = htmlspecialchars($_POST['group_name']);
$group_desc = htmlspecialchars($_POST['group_desc']);
$group_mod = User::UserIdByNick(htmlspecialchars($_POST['group_mod']));
- $result = @mysql_fetch_array(DataBase::sql_query("SELECT `sort` FROM `".GROUPS_TABLE."`
+ $result = DataBase::fetch(DataBase::sql_query("SELECT `sort` FROM `".GROUPS_TABLE."`
ORDER BY `sort` DESC LIMIT 1",'GENERAL','Could not obtain last category sort id'));
$group_sort = $result['sort'];
$group_sort = $group_sort+1;
- $result = @mysql_fetch_array(DataBase::sql_query("SELECT
+ $result = DataBase::fetch(DataBase::sql_query("SELECT
`g_id` FROM ".GROUPS_TABLE." ORDER BY `g_id` DESC LIMIT 1",'GENERAL','Could not obtain last group id.'));
$group_id = $result['g_id'];
$group_id = $group_id+1;
@@ -161,7 +161,7 @@ switch($_GET['mode'])
else
{
$sql = "SELECT * FROM `".GROUPS_TABLE."` WHERE `g_id`='$gid'";
- $g = @mysql_fetch_array(DataBase::sql_query($sql, 'GENERAL','Could not obtain group information.'));
+ $g = DataBase::fetch(DataBase::sql_query($sql, 'GENERAL','Could not obtain group information.'));
$_POST['group_name'] = $g['name'];
$_POST['group_desc'] = $g['desc'];
$_POST['group_mod'] = User::UserInformation($g['m_id'],'nick');
@@ -188,13 +188,13 @@ switch($_GET['mode'])
{
$i1 = intval($_GET['id']);
$sql = "SELECT `sort`, `g_id` FROM ".GROUPS_TABLE." WHERE `g_id`='$i1'";
- $s1 = @mysql_fetch_array(DataBase::sql_query($sql,'CRITICAL','Could not obtain group information.'));
+ $s1 = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain group information.'));
$s1 = $s1['sort'];
$s2 = $s1 -1;
if ($s1>1)
{
$sql = "SELECT `sort`, `g_id` FROM ".GROUPS_TABLE." WHERE `sort`='$s2'";
- $s2 = @mysql_fetch_array(DataBase::sql_query($sql,'CRITICAL','Could not obtain group information.'));
+ $s2 = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain group information.'));
$i2 = $s2['g_id'];
$s2 = $s2['sort'];
$sql = "UPDATE ".GROUPS_TABLE." SET `sort`='$s2' WHERE `g_id`='$i1'";
@@ -213,15 +213,15 @@ switch($_GET['mode'])
$i1 = intval($_GET['id']);
$i2 = $i1 +1;
$sql = "SELECT `sort`, `g_id` FROM ".GROUPS_TABLE." WHERE `g_id`='$i1'";
- $s1 = @mysql_fetch_array(DataBase::sql_query($sql,'CRITICAL','Could not obtain group information.'));
+ $s1 = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain group information.'));
$s1 = $s1['sort'];
$s2 = $s1 +1;
$sql = "SELECT `g_id` FROM ".GROUPS_TABLE;
- $count = @mysql_num_rows(DataBase::sql_query($sql,'CRITICAL','Could not obtain group information.'));
+ $count = DataBase::num_rows(DataBase::sql_query($sql,'CRITICAL','Could not obtain group information.'));
if ($s1<$count)
{
$sql = "SELECT `sort`, `g_id` FROM ".GROUPS_TABLE." WHERE `sort`='$s2'";
- $s2 = @mysql_fetch_array(DataBase::sql_query($sql,'CRITICAL','Could not obtain group information.'));
+ $s2 = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain group information.'));
$i2 = $s2['g_id'];
$s2 = $s2['sort'];
$sql = "UPDATE ".GROUPS_TABLE." SET `sort`='$s2' WHERE `g_id`='$i1'";
diff --git a/admin/admin_script.php b/admin/admin_script.php
index 7874805..6e27bf2 100644
--- a/admin/admin_script.php
+++ b/admin/admin_script.php
@@ -34,7 +34,7 @@ function AddSkins()
global $forum_config;
$all='';
$query = DataBase::sql_query("SELECT `name`, `s_id` FROM `".SKINS_TABLE."`",'GENERAL','Could not obtain skins information');
- while($t = @mysql_fetch_array($query))
+ while($t = DataBase::fetch($query))
{
if ($t['s_id']==$forum_config['defaultskin'])
diff --git a/admin/admin_users.php b/admin/admin_users.php
index b474b12..d6f3c2f 100644
--- a/admin/admin_users.php
+++ b/admin/admin_users.php
@@ -196,7 +196,7 @@ switch($_GET['mode'])
}
}
$sql = "SELECT * FROM ".USERS_TABLE." WHERE `u_id`='$uid'";
- $userinfo = @mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain user information'));
+ $userinfo = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain user information'));
if ($userinfo['rank']=='')
{
admin_message_forum($lng['no_user'],'admin_users.php?mode=view');
@@ -296,7 +296,7 @@ switch($_GET['mode'])
$limit = 'LIMIT 0, 30';
$page=1;
}
- $count = @mysql_fetch_array(DataBase::sql_query("SELECT COUNT(`u_id`) as `u_id`
+ $count = DataBase::fetch(DataBase::sql_query("SELECT COUNT(`u_id`) as `u_id`
FROM ".USERS_TABLE,'GENERAL','Could not obtain count amout of users'));
$count = $count['u_id'];
$count = ceil($count /30);
@@ -429,7 +429,7 @@ switch($_GET['mode'])
}
}
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain user information.');
- while($result = mysql_fetch_array($query))
+ while($result = DataBase::fetch($query))
{
$skin = array(
'id'=>$result['u_id'],
diff --git a/admin/banlist.php b/admin/banlist.php
index 6d30a81..5af7d2b 100644
--- a/admin/banlist.php
+++ b/admin/banlist.php
@@ -113,7 +113,7 @@ switch($_GET['mode'])
{
message_forum($lng['no_ban_me'],'banlist.php?mode=view');
}
- $bid =$bid = @mysql_fetch_array(DataBase::sql_query("SELECT
+ $bid =$bid = DataBase::fetch(DataBase::sql_query("SELECT
`b_id` FROM ".BANLIST_TABLE." ORDER BY `b_id` DESC",'GENERAL',
'Could not obtain last ban id'));
$bid = $bid['b_id'];
@@ -167,7 +167,7 @@ switch($_GET['mode'])
{
message_forum($lng['no_ban_me'],'banlist.php?mode=view');
}
- $bid =$bid = @mysql_fetch_array(DataBase::sql_query("SELECT
+ $bid =$bid = DataBase::fetch(DataBase::sql_query("SELECT
`b_id` FROM ".BANLIST_TABLE." ORDER BY `b_id` DESC",'GENERAL',
'Could not obtain last ban id'));
$bid = $bid['b_id'];
@@ -214,7 +214,7 @@ switch($_GET['mode'])
$open = fopen($catalog.$_FILES['file']['name'],'r');
$file = fread($open, filesize($catalog.$_FILES['file']['name']));
$item = @explode("\n",$file);
- $bid = $bid = @mysql_fetch_array(DataBase::sql_query("SELECT
+ $bid = $bid = DataBase::fetch(DataBase::sql_query("SELECT
`b_id` FROM ".BANLIST_TABLE." ORDER BY `b_id` DESC",'GENERAL',
'Could not obtain last ban id'));
$bid = $bid['b_id'];
@@ -296,7 +296,7 @@ switch($_GET['mode'])
$bid = $_GET['id'];
$sql = "SELECT * FROM ".BANLIST_TABLE." WHERE `b_id`='$bid'";
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain banlist item information');
- $result = @mysql_fetch_array($query);
+ $result = DataBase::fetch($query);
$_POST['ip']=$result['IP'];
$_POST['motive'] = $result['motive'];
$_POST['u_id'] = ($result['u_id']>0) ? User::UserInformation($result['u_id'],'nick') : 'No profile';
@@ -327,7 +327,7 @@ switch($_GET['mode'])
case 'view':
{
$query = DataBase::sql_query("SELECT `u_id`, `nick` FROM ".USERS_TABLE,'GENERAL','Could not obtain user information');
- while($result = @mysql_fetch_array($query))
+ while($result = DataBase::fetch($query))
{
$user[$result['u_id']]['nick'] = $result['nick'];
}
@@ -344,14 +344,14 @@ switch($_GET['mode'])
);
Admin_Over::GenerateHeader();
include('./template/banlist_view_body.tpl');
- if (@mysql_num_rows($query)<1)
+ if (DataBase::num_rows($query)<1)
{
echo '
'.$lng['banlist_no_items'].'! |
';
}
else
{
- while($item = @mysql_fetch_array($query))
+ while($item = DataBase::fetch($query))
{
$skin = array(
'user_name'=>($item['u_id']>-1) ? $user[$item['u_id']]['nick'] : 'No profile',
diff --git a/admin/censorlist.php b/admin/censorlist.php
index 2766d30..128da68 100644
--- a/admin/censorlist.php
+++ b/admin/censorlist.php
@@ -51,7 +51,7 @@ switch($_GET['mode'])
$file = fread($open, filesize($catalog.$_FILES['file']['name']));
$item = @explode(',',$file);
$sql = "SELECT `w_id` FROM ".CENSORLIST_TABLE." ORDER BY `w_id` DESC";
- $last = @mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain last word id'));
+ $last = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain last word id'));
$last = $last['w_id'];
$last= $last +1;
for($i=0;$i'censorlist.php?mode=edit&w='.$wid,
@@ -160,14 +160,14 @@ switch($_GET['mode'])
);
Admin_Over::GenerateHeader();
include('./template/censorlist_view_body.tpl');
- if (@mysql_num_rows($query)<1)
+ if (DataBase::num_rows($query)<1)
{
echo '';
}
else
{
- while($item = @mysql_fetch_array($query))
+ while($item = DataBase::fetch($query))
{
$skin = array(
'L.word_name'=>$item['word'],
diff --git a/admin/check_script.php b/admin/check_script.php
index 0e0fd63..7ab980f 100644
--- a/admin/check_script.php
+++ b/admin/check_script.php
@@ -47,7 +47,7 @@ function check_size_md5($file)
function mysqlversion()
{
$temp = '';
- $result = mysql_fetch_array(DataBase::sql_query("SELECT VERSION() AS mysql_version",'GENERAL','Could not read mysql version.'));
+ $result = DataBase::fetch(DataBase::sql_query("SELECT VERSION() AS mysql_version",'GENERAL','Could not read mysql version.'));
$result = $result['mysql_version'];
for($i=0;$i<5;$i++)
{
@@ -63,7 +63,7 @@ function db_size()
$sql = "SHOW TABLE STATUS";
$db_size = 0;
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain database size');
- while ($result = @mysql_fetch_array($query))
+ while ($result = DataBase::fetch($query))
{
$db_size += $result['Index_length'];
}
@@ -146,7 +146,12 @@ $skin=array(
//php version
'L.php_version'=>$lng['php_version'],
'PHP.version'=>phpversion(),
-'PHP.value' => (phpversion()>='4.3.10') ? 'OK' : ' Error - No OK',
+'PHP.value' => (phpversion()>='5.0.7') ? 'OK' : ' Error - No OK',
+
+//extension MySQLi loaded?
+'L.mySQLi_loaded'=>$lng['mysqli_loaded'],
+'mySQLi_loaded'=>(extension_loaded('mysqli')) ? $lng['yes'] : $lng['no'],
+'mySQLi_loaded.value'=> (extension_loaded('mysqli')) ? 'OK' : ' Error - No OK',
//mysql version
'mySQL.version'=>$sql_version,
diff --git a/admin/smilelist.php b/admin/smilelist.php
index a65005b..e536392 100644
--- a/admin/smilelist.php
+++ b/admin/smilelist.php
@@ -49,7 +49,7 @@ switch($_GET['mode'])
{
$sql = "SELECT * FROM ".SMILES_TABLE." ORDER BY `s_id` DESC LIMIT 1";
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain smilelist item information');
- $result = @mysql_fetch_array($query);
+ $result = DataBase::fetch($query);
$smile_id = $result['s_id'];
$smile_id = $smile_id +1;
$smile_word = strip_tags($_POST['word']);
@@ -92,7 +92,7 @@ switch($_GET['mode'])
$open = @fopen($catalog.$_FILES['file']['name'],'r');
$file = @fread($open, filesize($catalog.$_FILES['file']['name']));
$item = @explode("\n",$file);
- $bid = $bid = @mysql_fetch_array(DataBase::sql_query("SELECT
+ $bid = $bid = DataBase::fetch(DataBase::sql_query("SELECT
`s_id` FROM ".SMILES_TABLE." ORDER BY `s_id` DESC",'GENERAL',
'Could not obtain last smile id'));
$sid = $sid['s_id'];
@@ -157,7 +157,7 @@ switch($_GET['mode'])
$sid = intval($_GET['id']);
$sql = "SELECT * FROM ".SMILES_TABLE." WHERE `s_id`='$sid'";
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain smilelist item information');
- $result = @mysql_fetch_array($query);
+ $result = DataBase::fetch($query);
if ($result['s_id']=='')
{
admin_message_forum($lng['no_smile'],'smilelist.php?mode=view');
@@ -198,14 +198,14 @@ switch($_GET['mode'])
);
Admin_Over::GenerateHeader();
include('./template/smilelist_view_body.tpl');
- if (@mysql_num_rows($query)<1)
+ if (DataBase::num_rows($query)<1)
{
echo ''.$lng['smilelist_no_items'].'! |
';
}
else
{
- while($item = @mysql_fetch_array($query))
+ while($item = DataBase::fetch($query))
{
$skin = array(
'smile_word'=>$item['smile'],
diff --git a/admin/styles.php b/admin/styles.php
index 3e8d26b..d2523fe 100644
--- a/admin/styles.php
+++ b/admin/styles.php
@@ -90,7 +90,7 @@ switch($_GET['mode'])
include('./template/skins_beam_body.tpl');
$sql = "SELECT * FROM ".SKINS_TABLE;
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain skins information');
- while ($item = @mysql_fetch_array($query))
+ while ($item = DataBase::fetch($query))
{
$skin=array(
'L.delete' => $lng['delete'],
diff --git a/admin/template/check_script.tpl b/admin/template/check_script.tpl
index 9bba17f..f3ff63f 100644
--- a/admin/template/check_script.tpl
+++ b/admin/template/check_script.tpl
@@ -23,6 +23,14 @@
+
+ = $skin['L.mySQLi_loaded']; ?> (= $skin['mySQLi_loaded']?>):
+ |
+
+ = $skin['mySQLi_loaded.value'] ?>
+ |
+
+
= $skin['L.mySQL_version']; ?> (= $skin['mySQL.version']?>):
|
diff --git a/common.php b/common.php
index f0f3d56..dcf61e3 100644
--- a/common.php
+++ b/common.php
@@ -13,10 +13,14 @@ if (is_dir('install'))
die('Please delete or rename catalog "install"');
}
+if (phpversion()<'5.0.7')
+{
+ die('µForum requires PHP 5.0.7 or later');
+}
//set global preferences from DataBase
$sql="SELECT * FROM ".CONFIG_TABLE."";
$query=DataBase::sql_query($sql,'CRITICAL','Could not obtain config information');
-while($result=mysql_fetch_array($query))
+while($result=DataBase::fetch($query))
{
if (($result['name']=='') or ($result['name']=='0'))
{
@@ -49,7 +53,7 @@ if ($_SESSION['uid']>0)
$ip = $_SERVER['REMOTE_ADDR'];
$uid = $_SESSION['uid'];
$sql = "SELECT `IP`, `u_id`, `motive` FROM ".BANLIST_TABLE." WHERE `IP`='$ip' OR `u_id`='$uid'";
- $result = mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not obtain ban information'));
+ $result = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain ban information'));
$motive = $result['motive'];
$db_ip = $result['IP'];
$db_uid = $result['u_id'];
@@ -73,7 +77,7 @@ else
$sql = "SELECT * FROM ".USERS_TABLE." WHERE `u_id`='-1'";
}
$query = DataBase::sql_query($sql, 'GENERAL','Could not obtain loged user information');
-$userdata = mysql_fetch_array($query);
+$userdata = DataBase::fetch($query);
define('RANK', $userdata['rank']);
define('TABLES_WIDTH',$forum_config['tables_width']);
diff --git a/forum.php b/forum.php
index 72ca266..5dee762 100644
--- a/forum.php
+++ b/forum.php
@@ -54,10 +54,10 @@ include('./skins/'.$default_skin.'/overall_header.tpl');
include('./skins/'.$default_skin.'/forum_body.tpl');
$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');
-$value = mysql_num_rows($query);
+$value = DataBase::num_rows($query);
if ($value>0)
{
- while($record = mysql_fetch_array($query))
+ while($record = DataBase::fetch($query))
{
$skin = array(
't_id'=>$record['t_id'],
diff --git a/groups.php b/groups.php
index a71171b..24bc67f 100644
--- a/groups.php
+++ b/groups.php
@@ -69,7 +69,7 @@ if(isset($_GET['mode']))
$_POST['delnick']='';
}
$sql = "SELECT `g_id`, `name`, `desc`, `m_id` FROM `".GROUPS_TABLE."` WHERE `g_id`='$gid'";
- $group = mysql_fetch_array(DataBase::sql_query($sql, 'GENERAL', 'Could not obtain groups information.'));
+ $group = DataBase::fetch(DataBase::sql_query($sql, 'GENERAL', 'Could not obtain groups information.'));
if ($group['g_id']=='')
{
message_forum($lng['no_group'], 'index.php');
@@ -90,10 +90,10 @@ if(isset($_GET['mode']))
include('./skins/'.$default_skin.'/group_view_head_body.tpl');
$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.');
- $amout = @mysql_num_rows($query);
+ $amout = DataBase::num_rows($query);
if ($amout>0)
{
- while($result = mysql_fetch_array($query))
+ while($result = DataBase::fetch($query))
{
$skin = array(
'id'=>$result['u_id'],
@@ -143,9 +143,9 @@ else
include('./skins/'.$default_skin.'/overall_header.tpl');
$sql = "SELECT `g_id`, `name`, `desc` FROM `".GROUPS_TABLE."` ORDER BY `sort`";
$query = DataBase::sql_query($sql, 'GENERAL', 'Could not obtain groups information.');
- if (@mysql_num_rows($query)>0)
+ if (DataBase::num_rows($query)>0)
{
- while($item = mysql_fetch_array($query))
+ while($item = DataBase::fetch($query))
{
$skin = array(
'g_id'=>$item['g_id'],
diff --git a/includes/admin/class_forum.php b/includes/admin/class_forum.php
index 4f99ca2..478d791 100644
--- a/includes/admin/class_forum.php
+++ b/includes/admin/class_forum.php
@@ -19,7 +19,7 @@ class Admin_Forum
$cat = Forum::ForumInformation($fid,'c_id');
$all='';
$query = DataBase::sql_query("SELECT `name`, `c_id` FROM `".CATS_TABLE."`",'GENERAL','Could not obtain category information');
- while($t = @mysql_fetch_array($query))
+ while($t = DataBase::fetch($query))
{
if ($t['c_id']==$cat)
diff --git a/includes/admin/class_main.php b/includes/admin/class_main.php
index 0f9e40d..4bcc81b 100644
--- a/includes/admin/class_main.php
+++ b/includes/admin/class_main.php
@@ -38,7 +38,7 @@ class Admin_Over
global $default_skin;
$all='';
$query = DataBase::sql_query("SELECT `name`, `s_id` FROM `".SKINS_TABLE."`",'GENERAL','Could not obtain skins information');
- while($t = @mysql_fetch_array($query))
+ while($t = DataBase::fetch($query))
{
if ($t['name']==$default_skin)
@@ -104,14 +104,14 @@ class Admin_Over
{
$result = User::UserInformation($_SESSION['uid'],'skin');
$sql = "SELECT * FROM `".SKINS_TABLE."` WHERE `s_id`='$result'";
- $result = mysql_fetch_array(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 = mysql_fetch_array(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'];
}
}
@@ -131,14 +131,14 @@ class Admin_Over
{
$sql = "SELECT `t_id` FROM ".TOPICS_TABLE.";";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain total posts information');
- $result = mysql_num_rows($query);
+ $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');
- $result = mysql_num_rows($query);
+ $result = DataBase::num_rows($query);
return($result);
}
function GenerateHeader()
diff --git a/includes/cache/cache_forums.php b/includes/cache/cache_forums.php
index c35d426..ee23c29 100644
--- a/includes/cache/cache_forums.php
+++ b/includes/cache/cache_forums.php
@@ -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 = @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['name']=='')
{
message_forum($lng['no_forum'],'index.php');
@@ -25,13 +25,13 @@ $forum = array(
);
$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 = @mysql_fetch_array($query))
+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');
-while($result = @mysql_fetch_array($query))
+while($result = DataBase::fetch($query))
{
$lastpost[$result['t_id']]['tp_id']=$result['tp_id'];
$lastpost[$result['t_id']]['u_id']=$result['u_id'];
@@ -65,7 +65,7 @@ else
$limit = 'LIMIT 0, '.$limiter;
$page=1;
}
-$count = @mysql_fetch_array(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 `f_id`='$fid'",'GENERAL','Could not obtain count amout of topics'));
$count = $count['t_id'];
$count = ceil($count / $limiter);
diff --git a/includes/cache/cache_index.php b/includes/cache/cache_index.php
index f2a46b1..de6a887 100644
--- a/includes/cache/cache_index.php
+++ b/includes/cache/cache_index.php
@@ -15,34 +15,23 @@ if(!defined('IN_uF'))
//cache forums and posts - version v1.0 Alpha 2---------------------------------
//
//lastpost in forum cache
-/*$sql = "SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".* FROM ".POSTS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".POSTS_TABLE.".u_id = ".USERS_TABLE.".u_id GROUP BY `f_id`, `ptime` ORDER BY `ptime`";
-$query = DataBase::sql_query($sql,'GENERAL','Could not obtain last post in topic', true);
-$post_count = @mysql_num_rows($query);
-while($result = @mysql_fetch_array($query))
-{
- $last_post[$result['f_id']]['tp_id'] = $result['tp_id'];
- $last_post[$result['f_id']]['u_id'] = $result['u_id'];
- $last_post[$result['f_id']]['t_id'] = $result['t_id'];
- $last_post[$result['f_id']]['time'] = $result['ptime'];
- $last_post[$result['f_id']]['user_rank'] = $result['rank'];
- $last_post[$result['f_id']]['user_nick'] = $result['nick'];
-}*/
//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.');
-while($result = @mysql_fetch_array($query))
+while($result = DataBase::fetch($query))
{
$forum[$cache_id]['f_id'] = $result['f_id'];
$forum[$cache_id]['name'] = $result['name'];
$forum[$cache_id]['desc'] = $result['desc'];
$forum[$cache_id]['c_id'] = $result['c_id'];
$forum[$cache_id]['sort'] = $result['sort'];
+ $forum[$cache_id]['lastpost'] = $result['lastpost'];
$count_forum[$result['f_id']] = $result['amout'];
$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');
-$lastuser = @mysql_fetch_array($query);
-$count_users = @mysql_num_rows($query) -1;
+$lastuser = DataBase::fetch($query);
+$count_users = DataBase::num_rows($query) -1;
?>
diff --git a/includes/cache/cache_topic.php b/includes/cache/cache_topic.php
index dbff6bc..4f1f66e 100644
--- a/includes/cache/cache_topic.php
+++ b/includes/cache/cache_topic.php
@@ -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 = @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['t_id']=='')
{
message_forum($lng['no_topic'], 'index.php');
@@ -30,8 +30,8 @@ $forum['moderate']=$result['moderate'];
$sql = "SELECT `u_id`,`value` FROM `".WARNINGS_TABLE."`";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user warns information');
-$result = mysql_num_rows($query);
-while ($result = @mysql_fetch_array($query))
+$result = DataBase::num_rows($query);
+while ($result = DataBase::fetch($query))
{
if(!isset($user_warnlevel[$result['u_id']]))
{
@@ -50,7 +50,7 @@ while ($result = @mysql_fetch_array($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.');
-while($result = @mysql_fetch_array($query))
+while($result = DataBase::fetch($query))
{
$user[$result['u_id']]['online']='1';
}
@@ -81,7 +81,7 @@ else
$limit = 'LIMIT 0, '.$limiter;
$page=1;
}
-$count = @mysql_fetch_array(DataBase::sql_query("SELECT COUNT(`p_id`) as `p_id`
+$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'));
$count = $count['p_id'];
$count = ceil($count / $limiter);
diff --git a/includes/classes/class_forum.php b/includes/classes/class_forum.php
index 03159cd..c0f3aec 100644
--- a/includes/classes/class_forum.php
+++ b/includes/classes/class_forum.php
@@ -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 ''.$lng['nopost'].'
';}
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 ''.GenerateTime($last_post[$forum]['time']).'
'.$lng['topic'].' #'.$topic.': '.$user_color_name.'
';
+ return ''.GenerateTime($lastpost[3]).'
'.$lng['topic'].' #'.$topic.': '.$user_color_name.'
';
}
}
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;
}
diff --git a/includes/classes/class_mod.php b/includes/classes/class_mod.php
index 6bdd52f..d4fafea 100644
--- a/includes/classes/class_mod.php
+++ b/includes/classes/class_mod.php
@@ -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;
diff --git a/includes/classes/class_posting.php b/includes/classes/class_posting.php
index 79d0435..0bc1a3e 100644
--- a/includes/classes/class_posting.php
+++ b/includes/classes/class_posting.php
@@ -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'];
diff --git a/includes/classes/class_topic.php b/includes/classes/class_topic.php
index 5192820..99b07be 100644
--- a/includes/classes/class_topic.php
+++ b/includes/classes/class_topic.php
@@ -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;
}
diff --git a/includes/classes/class_user.php b/includes/classes/class_user.php
index e7ca555..f541403 100644
--- a/includes/classes/class_user.php
+++ b/includes/classes/class_user.php
@@ -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)
{
diff --git a/includes/classes/secure.php b/includes/classes/secure.php
index d548b16..d26759d 100644
--- a/includes/classes/secure.php
+++ b/includes/classes/secure.php
@@ -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);
diff --git a/includes/db.php b/includes/db.php
index 5c89552..01bd14e 100644
--- a/includes/db.php
+++ b/includes/db.php
@@ -11,16 +11,35 @@ if ( !defined('IN_uF') )
{
die('Hacking attempt');
}
+
+$db;
+
class DataBase
{
function db_connect()
{
- $connect = mysql_pconnect(DB_HOST, DB_USER, DB_PASS) or message_die('CRITICAL',' Could not connect to database server.',mysql_error());
- mysql_query("SET NAMES 'utf8'",$connect);
- mysql_select_db(DB_NAME, $connect) or message_die('CRITICAL',' Could not connect to database.',mysql_error());
+ global $db;
+
+ $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);
+ }
+
+ if (!$db->set_charset("UTF8"))
+ {
+ 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);
+ }
}
+
function sql_query($sql, $type, $msg, $no_count = false)
{
+ global $db;
+
if (isset($_COOKIE['queries']))
{
$no_count = false;
@@ -30,11 +49,28 @@ class DataBase
}
}
//echo ''.$sql.'
'; //for optimizing only
- $query = mysql_query($sql) or message_die($type, $msg, mysql_error());
+ if (!$query = $db->query($sql))
+ {
+ message_die($type, $msg, $db->error);
+ }
+
return $query;
}
+
+ function fetch($query)
+ {
+ return $query->fetch_array();
+ }
+
+ function num_rows($query)
+ {
+ return $query->num_rows;
+ }
+
function new_id($table)
{
+ global $db;
+
//check table id
switch($table)
{
@@ -55,7 +91,7 @@ class DataBase
case WARNINGS_TABLE: { $id = 'w_id'; break; }
}
$sql = "SELECT `$id` FROM $table ORDER BY `$id` DESC LIMIT 1";
- $return_id = mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Error with obtain last id.
File: db.php, Line: '.__LINE__));
+ $return_id = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Error with obtain last id.
File: db.php, Line: '.__LINE__));
$return_id = $return_id[$id];
$return_id = $return_id+1;
return $return_id;
diff --git a/includes/emailer.php b/includes/emailer.php
index fa62469..e3b5e36 100644
--- a/includes/emailer.php
+++ b/includes/emailer.php
@@ -79,7 +79,7 @@ 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');
- while($item = @mysql_fetch_array($query))
+ while($item = DataBase::fetch($query))
{
SendEmail($item['email'], $title, $content);
}
diff --git a/includes/misc_functions.php b/includes/misc_functions.php
index 9045053..8f13df4 100644
--- a/includes/misc_functions.php
+++ b/includes/misc_functions.php
@@ -202,7 +202,7 @@ function AddSkins()
global $default_skin;
$all='';
$query = DataBase::sql_query("SELECT `name`, `s_id` FROM `".SKINS_TABLE."`",'GENERAL','Could not obtain skins information');
- while($t = @mysql_fetch_array($query))
+ while($t = DataBase::fetch($query))
{
if ($t['name']==$default_skin)
@@ -278,7 +278,7 @@ function TotalPosts()
{
$sql = "SELECT count(*) as `p_id` FROM ".POSTS_TABLE."";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain total posts information');
- $result = mysql_fetch_array($query);
+ $result = DataBase::fetch($query);
$result = $result['p_id'];
return($result);
@@ -338,15 +338,13 @@ function ViewSkinName()
$result = $forum_config['defaultskin'];
}
$sql = "SELECT * FROM `".SKINS_TABLE."` WHERE `s_id`='$result'";
- $result = mysql_fetch_array(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
@@ -356,8 +354,8 @@ function GenerateLastPost($id, $type)
{
$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);
- $post_count = @mysql_num_rows($query);
- $result = mysql_fetch_array($query);
+ $post_count = DataBase::num_rows($query);
+ $result = DataBase::fetch($query);
$last_post .= $result['tp_id'];
$last_post .= ':';
@@ -385,7 +383,55 @@ function GenerateLastPost($id, $type)
{
$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');
- $result = mysql_fetch_array($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'];
+
+ $sql = "UPDATE ".TOPICS_TABLE." SET
+ `lastpost`='$last_post'
+ WHERE `t_id`='$id'";
+ 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);
+ $post_count = DataBase::num_rows($query);
+ $result = DataBase::fetch($query);
+
+ $posts = $result['count'];
+
+ $sql = "UPDATE ".FORUMS_TABLE." SET
+ `posts`='$last_post'
+ WHERE `f_id`='$id'";
+ 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');
+ $result = DataBase::fetch($query);
$last_post .= $result['tp_id'];
$last_post .= ':';
diff --git a/includes/pms/pms_folder.php b/includes/pms/pms_folder.php
index f10825e..07da0e7 100644
--- a/includes/pms/pms_folder.php
+++ b/includes/pms/pms_folder.php
@@ -5,9 +5,9 @@
//
$sql = "SELECT `u_id`,`nick`,`rank` FROM `".USERS_TABLE."`";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain forums information');
-$user['count']= mysql_num_rows($query);
+$user['count']= DataBase::num_rows($query);
-while($result = mysql_fetch_array($query))
+while($result = DataBase::fetch($query))
{
$user[$result['u_id']]['u_id']=$result['u_id'];
$user[$result['u_id']]['nick']=$result['nick'];
@@ -53,7 +53,7 @@ switch($_GET['submode'])
}
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain messages information');
-$count = mysql_num_rows($query);
+$count = DataBase::num_rows($query);
if ($count==0)
{
@@ -61,7 +61,7 @@ if ($count==0)
}
else
{
- while($item=mysql_fetch_array($query))
+ while($item=DataBase::fetch($query))
{
$skin=array(
'mid'=>$item['m_id'],
diff --git a/includes/pms/pms_view.php b/includes/pms/pms_view.php
index 5ee9f72..8eeadeb 100644
--- a/includes/pms/pms_view.php
+++ b/includes/pms/pms_view.php
@@ -4,7 +4,7 @@
$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'];
@@ -34,7 +34,7 @@ switch($_GET['submode'])
}
}
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain messages information');
-$result = mysql_fetch_array($query);
+$result = DataBase::fetch($query);
//if message exist....
if ($result['m_id']=='')
{
@@ -69,7 +69,7 @@ if ($_GET['submode']=='user')
$sql = "SELECT * FROM ".USERS_TABLE." WHERE `u_id`='".$result['u_n_id']."'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information');
-$user = @mysql_fetch_array($query);
+$user = DataBase::fetch($query);
$folder = ($_GET['submode']=='author') ? ''.$lng['sentbox'].'' : ''.$lng['inbox'].'';
diff --git a/includes/pms/pms_write.php b/includes/pms/pms_write.php
index 77c0d22..4db6e39 100644
--- a/includes/pms/pms_write.php
+++ b/includes/pms/pms_write.php
@@ -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 = mysql_fetch_array(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']);
diff --git a/includes/sessions.php b/includes/sessions.php
index f2c1982..e3e1c62 100644
--- a/includes/sessions.php
+++ b/includes/sessions.php
@@ -58,8 +58,16 @@ function SessRegister()
SessDelete($uid);
$time = time();
$sql = "INSERT INTO ".SESSIONS_TABLE." VALUES ('', '".$_COOKIE[SESS_NAME]."','$uid','$time')";
- $result = @mysql_fetch_array(DataBase::sql_query($sql,'GENERAL','Could not add new session.',true));
- return $result;
+ $query = DataBase::sql_query($sql,'GENERAL','Could not add new session.',true);
+ if (DataBase::num_rows($query)>0)
+ {
+ $result = DataBase::fetch();
+ return $result;
+ }
+ else
+ {
+ return false;
+ }
}
}
@@ -76,7 +84,7 @@ function SessDelInvalid()
{
$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);
- $result = mysql_fetch_array($query);
+ $result = DataBase::fetch($query);
$result = $result['session_id'];
if ($_COOKIE[SESS_NAME]!=$result)
{
@@ -90,9 +98,13 @@ function SessDelete($uid)
{
$time = time();
$sql = "DELETE FROM ".SESSIONS_TABLE." WHERE u_id='$uid'";
- $result = @mysql_fetch_array(DataBase::sql_query($sql, 'GENERAL','Could not delete session',true));
- $_SESSION['sessionid']='0';
- return $result['count'];
+ $query = DataBase::sql_query($sql, 'GENERAL','Could not delete session',true);
+ if (DataBase::num_rows($query)>0)
+ {
+ $result = DataBase::fetch($query);
+ $_SESSION['sessionid']='0';
+ return $result['count'];
+ }
}
function SessView()
@@ -104,9 +116,9 @@ function SessView()
$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.');
- if (@mysql_num_rows($query)>0)
+ if (DataBase::num_rows($query)>0)
{
- while($result = @mysql_fetch_array($query))
+ while($result = DataBase::fetch($query))
{
$uid = $result['u_id'];
switch($result['rank'])
@@ -134,6 +146,6 @@ function SessView()
{
$name = ''.$lng['empty'].'';
}
- return array($name, @mysql_num_rows($query));
+ return array($name, DataBase::num_rows($query));
}
?>
diff --git a/index.php b/index.php
index 8299c4f..22809b5 100644
--- a/index.php
+++ b/index.php
@@ -55,7 +55,7 @@ include('./skins/'.$default_skin.'/index_body.tpl');
$isset_forum = array();
$sql = "SELECT * FROM `".CATS_TABLE."` ORDER BY `sort`";
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain categories information.');
-while($result = @mysql_fetch_array($query))
+while($result = DataBase::fetch($query))
{
$skin = array(
'category' => $result['name'],
@@ -70,7 +70,8 @@ while($result = @mysql_fetch_array($query))
if(!@in_array($forum[$i]['f_id'],$isset_forum))
{
array_push($isset_forum, $forum[$i]['f_id']);
- $postsinforum = (isset($count_forum[$forum[$i]['f_id']])) ? $count_forum[$forum[$i]['f_id']] : '0';
+ $lastpost = explode(':',$forum[$i]['lastpost']);
+ $postsinforum = (isset($count_forum[$forum[$i]['f_id']])) ? $count_forum[$forum[$i]['f_id']] : '0';
$skin = array(
'new_post' => Forum::LastPostImg($postsinforum),
'forum_name' => $forum[$i]['name'],
diff --git a/install/index.php b/install/index.php
index 5e2988d..a769680 100644
--- a/install/index.php
+++ b/install/index.php
@@ -136,7 +136,7 @@ switch($_GET['page'])
'L.value'=>$lng['value'],
'L.php_version'=>$lng['php_version'],
'PHP.version'=>phpversion(),
- 'PHP.value' => (phpversion()>='4.3.10') ? 'OK' : ' Error - No OK',
+ 'PHP.value' => (phpversion()>='5.0.7') ? 'OK' : ' Error - No OK',
'mySQL.version'=>mysql_get_client_info(),
'L.mySQL_version'=>$lng['mysql_version'],
'mySQL.value'=>(mysql_get_client_info()>='4.1') ? 'OK' : ' Error - No OK',
diff --git a/lngs/Polish/admin.php b/lngs/Polish/admin.php
index 434054a..c6b81ce 100644
--- a/lngs/Polish/admin.php
+++ b/lngs/Polish/admin.php
@@ -119,12 +119,13 @@ $lng['actual_sum']='Aktualna wartość';
$lng['files_is_good']='Wszystkie pliki są poprawne!';
$lng['files_not_good']='Nie wszystkie pliki są poprawne. Jest ich: ';
$lng['php_version']='Wersja PHP';
-$lng['mysql_version']='Wersja mySQL';
+$lng['mysql_version']='Wersja serwera MySQL';
$lng['not_writable']='Katalog nie do zapisu!';
$lng['is_writable']='Katalog do zapisu';
$lng['catalog']='Katalog';
$lng['db_size']='Wielkość bazy';
$lng['forum_size']='Wielkość plików forum';
+$lng['mysqli_loaded']='Rozszerzenie MySQLi załadowane';
//
//on forum config....--------------------------------------------------
//
diff --git a/login.php b/login.php
index 771361f..94c2e8d 100644
--- a/login.php
+++ b/login.php
@@ -66,7 +66,7 @@ if (isset($_GET['mode']))
$pass = md5(strip_tags($_POST['pass']));
$sql = "SELECT `u_id`, `nick`, `pass` FROM `".USERS_TABLE."` WHERE nick='$user'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user inforamtion');
- $result = @mysql_fetch_array($query);
+ $result = DataBase::fetch($query);
$nick = $result['nick'];
if ($result['nick']==$user)
{
diff --git a/posting.php b/posting.php
index ea4e7f3..1118850 100644
--- a/posting.php
+++ b/posting.php
@@ -298,7 +298,7 @@ switch(trim($_GET['mode']))
$_POST['textedit']='';
}
$sql = "SELECT `lock`, `name`, `f_id` FROM ".FORUMS_TABLE." WHERE `f_id`='".intval($_GET['f'])."'";
- $forum = mysql_fetch_array(DataBase::sql_query($sql, 'GENERAL', 'Could not obtain forum information'));
+ $forum = DataBase::fetch(DataBase::sql_query($sql, 'GENERAL', 'Could not obtain forum information'));
if($forum['name']=='')
{
message_forum($lng['no_forum'], 'index.php');
diff --git a/register.php b/register.php
index 367e671..ac3699b 100644
--- a/register.php
+++ b/register.php
@@ -53,7 +53,7 @@ if ( ereg ("^.+@.+\..+$", $_POST['email']))
{
$sql = "SELECT * FROM `".USERS_TABLE."` WHERE `nick`='$nick'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information.');
- $result = mysql_fetch_array($query);
+ $result = DataBase::fetch($query);
$result = $result['nick'];
if ($result!=$nick)
{
diff --git a/search.php b/search.php
index 61267ad..7a34a53 100644
--- a/search.php
+++ b/search.php
@@ -31,7 +31,7 @@ SessRegister();
SessDeleteOld();
$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');
-while($result = @mysql_fetch_array($query))
+while($result = DataBase::fetch($query))
{
$lastpost[$result['t_id']]['tp_id']=$result['tp_id'];
$lastpost[$result['t_id']]['u_id']=$result['u_id'];
@@ -41,7 +41,7 @@ while($result = @mysql_fetch_array($query))
}
$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 = @mysql_fetch_array($query))
+while($result = DataBase::fetch($query))
{
$count_topic[$result['t_id']]=$result['p_id'];
}
@@ -104,7 +104,7 @@ if ((isset($_POST['keywords'])) || ($_GET['content']=='lastposts') || ($_GET['co
{
if (isset($_GET['u']))
{
- $count = @mysql_fetch_array(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'));
$count = $count['t_id'];
$count = ceil($count / $limiter);
@@ -139,7 +139,7 @@ if ((isset($_POST['keywords'])) || ($_GET['content']=='lastposts') || ($_GET['co
$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`";
- $count = @mysql_fetch_array(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 = ceil($count / $limiter);
if ($count==0)
@@ -179,11 +179,11 @@ if ((isset($_POST['keywords'])) || ($_GET['content']=='lastposts') || ($_GET['co
include('./skins/'.$default_skin.'/overall_header.tpl');
include('./skins/'.$default_skin.'/forum_body.tpl');
$query = DataBase::sql_query($sql,'GENERAL', 'Could not obtain topics information');
- $value = mysql_num_rows($query);
+ $value = DataBase::num_rows($query);
if ($value>0)
{
$isset_topics = array();
- while($record = mysql_fetch_array($query))
+ while($record = DataBase::fetch($query))
{
if (!in_array($record['t_id'], $isset_topics))
{
diff --git a/shoutbox.php b/shoutbox.php
index 8ab9fdd..8bc423e 100644
--- a/shoutbox.php
+++ b/shoutbox.php
@@ -59,7 +59,7 @@ else
$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'];
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain shoutbox information');
-while($sb_msg = @mysql_fetch_array($query))
+while($sb_msg = DataBase::fetch($query))
{
$allow_del = (RANK>0) ? 'X ' : '';
$shoutbox_content .= '
diff --git a/topic.php b/topic.php
index 02a6560..ac5b9f8 100644
--- a/topic.php
+++ b/topic.php
@@ -55,7 +55,7 @@ include('./skins/'.$default_skin.'/topic_body.tpl');
$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.');
-while($item=mysql_fetch_array($query))
+while($item=DataBase::fetch($query))
{
$ua = UserAgent($item['user_agent']);
$warn_pool = ($forum_config['allow_warns'] && $forum_config['warns_in_topic'] ) ? (isset($user_warnlevel[$item['u_id']])) ?
diff --git a/user.php b/user.php
index c3536e1..36d717c 100644
--- a/user.php
+++ b/user.php
@@ -32,7 +32,7 @@ $uid = intval($_GET['id']);
//check online for user
$sql = "SELECT `s_id`, `u_id`, `time` FROM ".SESSIONS_TABLE." WHERE `u_id`='$uid' AND time+1250>".time()." LIMIT 1";
$query = DataBase::sql_query($sql, 'GENERAL', 'Could not read user active.');
-$result = @mysql_fetch_array($query);
+$result = DataBase::fetch($query);
if ($result['u_id']==$uid)
{
$active = 1;
@@ -45,8 +45,8 @@ unset($sql, $query, $result);
$userwarn = 0;
$sql = "SELECT `u_id`,`value` FROM `".WARNINGS_TABLE."` WHERE `u_id`='$uid'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user warns information');
-$result = mysql_num_rows($query);
-while ($result = @mysql_fetch_array($query))
+$result = DataBase::num_rows($query);
+while ($result = DataBase::fetch($query))
{
if ($result['value']=='-')
{
@@ -61,7 +61,7 @@ $userwarn = ($userwarn>0) ? $userwarn*10 : $userwarn;
//add skin variables
$sql = "SELECT * FROM `".USERS_TABLE."` WHERE u_id='$uid'";
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain user information');
-$user_info = @mysql_fetch_array($query);
+$user_info = DataBase::fetch($query);
if ($user_info['u_id']=='')
{
message_forum($lng['no_user'],'index.php');
diff --git a/users.php b/users.php
index ba43649..c1b4adf 100644
--- a/users.php
+++ b/users.php
@@ -53,7 +53,7 @@ else
$limit = 'LIMIT 0, '.$limiter;
$page=1;
}
-$count = @mysql_fetch_array(DataBase::sql_query("SELECT COUNT(`u_id`) as `u_id`
+$count = DataBase::fetch(DataBase::sql_query("SELECT COUNT(`u_id`) as `u_id`
FROM ".USERS_TABLE,'GENERAL','Could not obtain count amout of users'));
$count = $count['u_id'] -1;
$count = ceil($count / $limiter);
@@ -190,7 +190,7 @@ switch($_COOKIE['users_sort'])
}
}
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain user information.');
-while($result = mysql_fetch_array($query))
+while($result = DataBase::fetch($query))
{
$skin = array(
'id'=>$result['u_id'],
diff --git a/warns.php b/warns.php
index 71fdb49..ccfcf4b 100644
--- a/warns.php
+++ b/warns.php
@@ -121,7 +121,7 @@ switch(trim($_GET['mode']))
$uid = $_GET['id'];
$sql = "SELECT `u_id`, `nick` FROM `".USERS_TABLE."` WHERE `u_id`='$uid'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information');
- $user = @mysql_fetch_array($query);
+ $user = DataBase::fetch($query);
if ($user['u_id']=='')
{
message_forum($lng['no_user'],'index.php');
@@ -136,9 +136,9 @@ switch(trim($_GET['mode']))
include('./skins/'.$default_skin.'/warns_view_body.tpl');
$sql = "SELECT * FROM `".WARNINGS_TABLE."` WHERE `u_id`='$uid'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user warns information');
- $result = mysql_num_rows($query);
+ $result = DataBase::num_rows($query);
$warns_count = 0;
- while($item = mysql_fetch_array($query))
+ while($item = DataBase::fetch($query))
{
$skin = array(
'value'=>$item['value'],