+ 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:
@@ -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'];
|
||||
|
||||
Reference in New Issue
Block a user