Browse Source

+ 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
master
pioder 15 years ago
parent
commit
b1f37b6ea5
43 changed files with 296 additions and 193 deletions
  1. +26
    -26
      admin/admin_forums.php
  2. +9
    -9
      admin/admin_groups.php
  3. +1
    -1
      admin/admin_script.php
  4. +3
    -3
      admin/admin_users.php
  5. +7
    -7
      admin/banlist.php
  6. +5
    -5
      admin/censorlist.php
  7. +8
    -3
      admin/check_script.php
  8. +5
    -5
      admin/smilelist.php
  9. +1
    -1
      admin/styles.php
  10. +8
    -0
      admin/template/check_script.tpl
  11. +7
    -3
      common.php
  12. +2
    -2
      forum.php
  13. +5
    -5
      groups.php
  14. +1
    -1
      includes/admin/class_forum.php
  15. +5
    -5
      includes/admin/class_main.php
  16. +4
    -4
      includes/cache/cache_forums.php
  17. +4
    -15
      includes/cache/cache_index.php
  18. +5
    -5
      includes/cache/cache_topic.php
  19. +13
    -12
      includes/classes/class_forum.php
  20. +2
    -2
      includes/classes/class_mod.php
  21. +4
    -4
      includes/classes/class_posting.php
  22. +2
    -2
      includes/classes/class_topic.php
  23. +4
    -4
      includes/classes/class_user.php
  24. +13
    -13
      includes/classes/secure.php
  25. +41
    -5
      includes/db.php
  26. +1
    -1
      includes/emailer.php
  27. +55
    -9
      includes/misc_functions.php
  28. +4
    -4
      includes/pms/pms_folder.php
  29. +3
    -3
      includes/pms/pms_view.php
  30. +1
    -1
      includes/pms/pms_write.php
  31. +21
    -9
      includes/sessions.php
  32. +3
    -2
      index.php
  33. +1
    -1
      install/index.php
  34. +2
    -1
      lngs/Polish/admin.php
  35. +1
    -1
      login.php
  36. +1
    -1
      posting.php
  37. +1
    -1
      register.php
  38. +6
    -6
      search.php
  39. +1
    -1
      shoutbox.php
  40. +1
    -1
      topic.php
  41. +4
    -4
      user.php
  42. +2
    -2
      users.php
  43. +3
    -3
      warns.php

+ 26
- 26
admin/admin_forums.php View File

@ -36,7 +36,7 @@ function GenerateDefaultDisplay()
$cache_id=1; $cache_id=1;
$sql = "SELECT * FROM ".FORUMS_TABLE." ORDER BY `c_id`, `sort`"; $sql = "SELECT * FROM ".FORUMS_TABLE." ORDER BY `c_id`, `sort`";
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain forum information.'); $query = DataBase::sql_query($sql,'CRITICAL','Could not obtain forum information.');
while($result = @mysql_fetch_array($query))
while($result = DataBase::fetch($query))
{ {
$forum[$cache_id]['f_id'] = $result['f_id']; $forum[$cache_id]['f_id'] = $result['f_id'];
$forum[$cache_id]['name'] = $result['name']; $forum[$cache_id]['name'] = $result['name'];
@ -59,7 +59,7 @@ function GenerateDefaultDisplay()
//add forums and categories //add forums and categories
$sql = "SELECT * FROM `".CATS_TABLE."` ORDER BY `sort`"; $sql = "SELECT * FROM `".CATS_TABLE."` ORDER BY `sort`";
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain categories information.'); $query = DataBase::sql_query($sql,'CRITICAL','Could not obtain categories information.');
while($result = mysql_fetch_array($query))
while($result = DataBase::fetch($query))
{ {
$skin = array( $skin = array(
'category' => $result['name'], 'category' => $result['name'],
@ -115,11 +115,11 @@ switch($_GET['mode'])
{ {
$cat_name = strip_tags($_POST['cat_name']); $cat_name = strip_tags($_POST['cat_name']);
$sql = "SELECT `sort` FROM `".CATS_TABLE."` ORDER BY `sort` DESC LIMIT 1"; $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 = $last ['sort'];
$sort = $sort+1; $sort = $sort+1;
$sql = "SELECT `c_id` FROM `".CATS_TABLE."` ORDER BY `c_id` DESC LIMIT 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['c_id'];
$last = $last +1; $last = $last +1;
$sql = "INSERT INTO `".CATS_TABLE."` VALUES ('$last','$cat_name','$sort')"; $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; $forum_lock = (isset($_POST['forum_locked'])) ? 1 : 0;
$allow_moderate = (isset($_POST['allow_moderate'])) ? 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"; $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 = $last ['sort'];
$sort = $sort+1; $sort = $sort+1;
$sql = "SELECT `f_id` FROM `".FORUMS_TABLE."` ORDER BY `f_id` DESC LIMIT 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['f_id'];
$last = $last +1; $last = $last +1;
$sql = "INSERT INTO `".FORUMS_TABLE."` VALUES ('$last','$forum_lock','$allow_moderate', '$forum_name', '$forum_desc','$forum_cat','$sort')"; $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']; $i1 = $_GET['c'];
$sql = "SELECT `sort`, `c_id` FROM ".CATS_TABLE." WHERE `c_id`='$i1'"; $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']; $s1 = $s1['sort'];
$s2 = $s1 -1; $s2 = $s1 -1;
if ($s1>1) if ($s1>1)
{ {
$sql = "SELECT `sort`, `c_id` FROM ".CATS_TABLE." WHERE `sort`='$s2'"; $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']; $i2 = $s2['c_id'];
$s2 = $s2['sort']; $s2 = $s2['sort'];
$sql = "UPDATE ".CATS_TABLE." SET `sort`='$s2' WHERE `c_id`='$i1'"; $sql = "UPDATE ".CATS_TABLE." SET `sort`='$s2' WHERE `c_id`='$i1'";
@ -266,14 +266,14 @@ switch($_GET['mode'])
{ {
$i1 = $_GET['f']; $i1 = $_GET['f'];
$sql = "SELECT `sort`, `c_id`, `f_id` FROM ".FORUMS_TABLE." WHERE `f_id`='$i1'"; $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']; $cid = $s1['c_id'];
$s1 = $s1['sort']; $s1 = $s1['sort'];
$s2 = $s1 -1; $s2 = $s1 -1;
if ($s1>1) if ($s1>1)
{ {
$sql = "SELECT `sort`, `c_id`, `f_id` FROM ".FORUMS_TABLE." WHERE `sort`='$s2' AND `c_id`='$cid'"; $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']; $i2 = $s2['f_id'];
$s2 = $s2['sort']; $s2 = $s2['sort'];
$sql = "UPDATE ".FORUMS_TABLE." SET `sort`='$s2' WHERE `f_id`='$i1'"; $sql = "UPDATE ".FORUMS_TABLE." SET `sort`='$s2' WHERE `f_id`='$i1'";
@ -306,15 +306,15 @@ switch($_GET['mode'])
$i1 = $_GET['c']; $i1 = $_GET['c'];
$i2 = $i1 +1; $i2 = $i1 +1;
$sql = "SELECT `sort`, `c_id` FROM ".CATS_TABLE." WHERE `c_id`='$i1'"; $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']; $s1 = $s1['sort'];
$s2 = $s1 +1; $s2 = $s1 +1;
$sql = "SELECT `c_id` FROM ".CATS_TABLE; $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) if ($s1<$count)
{ {
$sql = "SELECT `sort`, `c_id` FROM ".CATS_TABLE." WHERE `sort`='$s2'"; $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']; $i2 = $s2['c_id'];
$s2 = $s2['sort']; $s2 = $s2['sort'];
$sql = "UPDATE ".CATS_TABLE." SET `sort`='$s2' WHERE `c_id`='$i1'"; $sql = "UPDATE ".CATS_TABLE." SET `sort`='$s2' WHERE `c_id`='$i1'";
@ -332,16 +332,16 @@ switch($_GET['mode'])
$i1 = $_GET['f']; $i1 = $_GET['f'];
$i2 = $i1 +1; $i2 = $i1 +1;
$sql = "SELECT `sort`, `c_id`, `f_id` FROM ".FORUMS_TABLE." WHERE `f_id`='$i1'"; $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']; $cid = $s1['c_id'];
$s1 = $s1['sort']; $s1 = $s1['sort'];
$s2 = $s1 +1; $s2 = $s1 +1;
$sql = "SELECT `f_id` FROM ".FORUMS_TABLE." WHERE `c_id`='$cid'"; $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) if ($s1<$count)
{ {
$sql = "SELECT `sort`, `f_id` FROM ".FORUMS_TABLE." WHERE `sort`='$s2'"; $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']; $i2 = $s2['f_id'];
$s2 = $s2['sort']; $s2 = $s2['sort'];
$sql = "UPDATE ".FORUMS_TABLE." SET `sort`='$s2' WHERE `f_id`='$i1'"; $sql = "UPDATE ".FORUMS_TABLE." SET `sort`='$s2' WHERE `f_id`='$i1'";
@ -369,11 +369,11 @@ switch($_GET['mode'])
$cid = intval($_GET['c']); $cid = intval($_GET['c']);
$sql = "SELECT * FROM `".CATS_TABLE."` WHERE `c_id`='$cid'"; $sql = "SELECT * FROM `".CATS_TABLE."` WHERE `c_id`='$cid'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain category information'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain category information');
$result = @mysql_fetch_array($query);
$result = DataBase::fetch($query);
$sort = $result['sort']; $sort = $result['sort'];
$sql = "SELECT * FROM `".CATS_TABLE."` WHERE `sort`>'$sort'"; $sql = "SELECT * FROM `".CATS_TABLE."` WHERE `sort`>'$sort'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain categories information'); $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; $new_sort = $item['sort']-1;
$cid2 = $item['c_id']; $cid2 = $item['c_id'];
@ -382,7 +382,7 @@ switch($_GET['mode'])
} }
$sql = "SELECT `f_id` FROM `".FORUMS_TABLE."` WHERE `c_id`='$cid'"; $sql = "SELECT `f_id` FROM `".FORUMS_TABLE."` WHERE `c_id`='$cid'";
$query = DataBase::sql_query($sql, 'GENERAL','Could not obtain forum information.'); $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']; $fid = $item['f_id'];
$sql="DELETE FROM `".POSTS_TABLE."` WHERE `f_id`='$fid'"; $sql="DELETE FROM `".POSTS_TABLE."` WHERE `f_id`='$fid'";
@ -403,11 +403,11 @@ switch($_GET['mode'])
$fid = intval($_GET['f']); $fid = intval($_GET['f']);
$sql = "SELECT * FROM `".FORUMS_TABLE."` WHERE `f_id`='$fid'"; $sql = "SELECT * FROM `".FORUMS_TABLE."` WHERE `f_id`='$fid'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain forum information'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain forum information');
$result = @mysql_fetch_array($query);
$result = DataBase::fetch($query);
$sort = $result['sort']; $sort = $result['sort'];
$sql = "SELECT * FROM `".FORUMS_TABLE."` WHERE `sort`>'$sort'"; $sql = "SELECT * FROM `".FORUMS_TABLE."` WHERE `sort`>'$sort'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain forums information'); $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; $new_sort = $item['sort']-1;
$fid1 = $item['f_id']; $fid1 = $item['f_id'];
@ -439,7 +439,7 @@ switch($_GET['mode'])
{ {
$cat_name = strip_tags($_POST['cat_name']); $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"; $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 = $last ['sort'];
$sort = $sort+1; $sort = $sort+1;
$sql = "UPDATE `".CATS_TABLE."` SET `name`='$cat_name', `sort`='$sort' WHERE `c_id`='$cid'"; $sql = "UPDATE `".CATS_TABLE."` SET `name`='$cat_name', `sort`='$sort' WHERE `c_id`='$cid'";
@ -455,7 +455,7 @@ switch($_GET['mode'])
} }
else 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']; $tmp = $tmp['name'];
$_POST['cat_name'] = $tmp; $_POST['cat_name'] = $tmp;
if($tmp['name']=='') if($tmp['name']=='')
@ -496,14 +496,14 @@ switch($_GET['mode'])
$forum_cat = $_POST['forum_cat']; $forum_cat = $_POST['forum_cat'];
$sql = "SELECT * FROM `".FORUMS_TABLE."` WHERE `f_id`='$fid'"; $sql = "SELECT * FROM `".FORUMS_TABLE."` WHERE `f_id`='$fid'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain forum information'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain forum information');
$result = @mysql_fetch_array($query);
$result = DataBase::fetch($query);
$actual_cid = $result['c_id']; $actual_cid = $result['c_id'];
$sort = $result['sort']; $sort = $result['sort'];
if ($actual_cid != $forum_cat) if ($actual_cid != $forum_cat)
{ {
$sql = "SELECT * FROM `".FORUMS_TABLE."` WHERE `c_id`='$forum_cat' ORDER BY `sort` DESC LIMIT 1"; $sql = "SELECT * FROM `".FORUMS_TABLE."` WHERE `c_id`='$forum_cat' ORDER BY `sort` DESC LIMIT 1";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain forums information'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain forums information');
$result = @mysql_fetch_array($query);
$result = DataBase::fetch($query);
$sort = $result['sort']+1; $sort = $result['sort']+1;
} }
@ -535,7 +535,7 @@ switch($_GET['mode'])
} }
else 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']; $_POST['forum_name'] = $tmp['name'];
$msg='./../skins/'.$default_skin.'/blank.tpl'; $msg='./../skins/'.$default_skin.'/blank.tpl';
$_POST['forum_desc'] = $tmp['desc']; $_POST['forum_desc'] = $tmp['desc'];

+ 9
- 9
admin/admin_groups.php View File

@ -42,7 +42,7 @@ function GenerateDefaultDisplay()
include('./template/groups_beam_body.tpl'); include('./template/groups_beam_body.tpl');
$sql = "SELECT `g_id`, `name`, `desc` FROM `".GROUPS_TABLE."` ORDER BY `sort`"; $sql = "SELECT `g_id`, `name`, `desc` FROM `".GROUPS_TABLE."` ORDER BY `sort`";
$query = DataBase::sql_query($sql, 'GENERAL', 'Could not obtain groups information.'); $query = DataBase::sql_query($sql, 'GENERAL', 'Could not obtain groups information.');
while($item = mysql_fetch_array($query))
while($item = DataBase::fetch($query))
{ {
$skin = array( $skin = array(
'g_id'=>$item['g_id'], 'g_id'=>$item['g_id'],
@ -87,11 +87,11 @@ switch($_GET['mode'])
$group_name = htmlspecialchars($_POST['group_name']); $group_name = htmlspecialchars($_POST['group_name']);
$group_desc = htmlspecialchars($_POST['group_desc']); $group_desc = htmlspecialchars($_POST['group_desc']);
$group_mod = User::UserIdByNick(htmlspecialchars($_POST['group_mod'])); $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')); ORDER BY `sort` DESC LIMIT 1",'GENERAL','Could not obtain last category sort id'));
$group_sort = $result['sort']; $group_sort = $result['sort'];
$group_sort = $group_sort+1; $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.')); `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 = $result['g_id'];
$group_id = $group_id+1; $group_id = $group_id+1;
@ -161,7 +161,7 @@ switch($_GET['mode'])
else else
{ {
$sql = "SELECT * FROM `".GROUPS_TABLE."` WHERE `g_id`='$gid'"; $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_name'] = $g['name'];
$_POST['group_desc'] = $g['desc']; $_POST['group_desc'] = $g['desc'];
$_POST['group_mod'] = User::UserInformation($g['m_id'],'nick'); $_POST['group_mod'] = User::UserInformation($g['m_id'],'nick');
@ -188,13 +188,13 @@ switch($_GET['mode'])
{ {
$i1 = intval($_GET['id']); $i1 = intval($_GET['id']);
$sql = "SELECT `sort`, `g_id` FROM ".GROUPS_TABLE." WHERE `g_id`='$i1'"; $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']; $s1 = $s1['sort'];
$s2 = $s1 -1; $s2 = $s1 -1;
if ($s1>1) if ($s1>1)
{ {
$sql = "SELECT `sort`, `g_id` FROM ".GROUPS_TABLE." WHERE `sort`='$s2'"; $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']; $i2 = $s2['g_id'];
$s2 = $s2['sort']; $s2 = $s2['sort'];
$sql = "UPDATE ".GROUPS_TABLE." SET `sort`='$s2' WHERE `g_id`='$i1'"; $sql = "UPDATE ".GROUPS_TABLE." SET `sort`='$s2' WHERE `g_id`='$i1'";
@ -213,15 +213,15 @@ switch($_GET['mode'])
$i1 = intval($_GET['id']); $i1 = intval($_GET['id']);
$i2 = $i1 +1; $i2 = $i1 +1;
$sql = "SELECT `sort`, `g_id` FROM ".GROUPS_TABLE." WHERE `g_id`='$i1'"; $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']; $s1 = $s1['sort'];
$s2 = $s1 +1; $s2 = $s1 +1;
$sql = "SELECT `g_id` FROM ".GROUPS_TABLE; $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) if ($s1<$count)
{ {
$sql = "SELECT `sort`, `g_id` FROM ".GROUPS_TABLE." WHERE `sort`='$s2'"; $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']; $i2 = $s2['g_id'];
$s2 = $s2['sort']; $s2 = $s2['sort'];
$sql = "UPDATE ".GROUPS_TABLE." SET `sort`='$s2' WHERE `g_id`='$i1'"; $sql = "UPDATE ".GROUPS_TABLE." SET `sort`='$s2' WHERE `g_id`='$i1'";

+ 1
- 1
admin/admin_script.php View File

@ -34,7 +34,7 @@ function AddSkins()
global $forum_config; global $forum_config;
$all=''; $all='';
$query = DataBase::sql_query("SELECT `name`, `s_id` FROM `".SKINS_TABLE."`",'GENERAL','Could not obtain skins information'); $query = DataBase::sql_query("SELECT `name`, `s_id` FROM `".SKINS_TABLE."`",'GENERAL','Could not obtain skins information');
while($t = @mysql_fetch_array($query))
while($t = DataBase::fetch($query))
{ {
if ($t['s_id']==$forum_config['defaultskin']) if ($t['s_id']==$forum_config['defaultskin'])

+ 3
- 3
admin/admin_users.php View File

@ -196,7 +196,7 @@ switch($_GET['mode'])
} }
} }
$sql = "SELECT * FROM ".USERS_TABLE." WHERE `u_id`='$uid'"; $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']=='') if ($userinfo['rank']=='')
{ {
admin_message_forum($lng['no_user'],'admin_users.php?mode=view'); admin_message_forum($lng['no_user'],'admin_users.php?mode=view');
@ -296,7 +296,7 @@ switch($_GET['mode'])
$limit = 'LIMIT 0, 30'; $limit = 'LIMIT 0, 30';
$page=1; $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')); FROM ".USERS_TABLE,'GENERAL','Could not obtain count amout of users'));
$count = $count['u_id']; $count = $count['u_id'];
$count = ceil($count /30); $count = ceil($count /30);
@ -429,7 +429,7 @@ switch($_GET['mode'])
} }
} }
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain user information.'); $query = DataBase::sql_query($sql,'CRITICAL','Could not obtain user information.');
while($result = mysql_fetch_array($query))
while($result = DataBase::fetch($query))
{ {
$skin = array( $skin = array(
'id'=>$result['u_id'], 'id'=>$result['u_id'],

+ 7
- 7
admin/banlist.php View File

@ -113,7 +113,7 @@ switch($_GET['mode'])
{ {
message_forum($lng['no_ban_me'],'banlist.php?mode=view'); 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', `b_id` FROM ".BANLIST_TABLE." ORDER BY `b_id` DESC",'GENERAL',
'Could not obtain last ban id')); 'Could not obtain last ban id'));
$bid = $bid['b_id']; $bid = $bid['b_id'];
@ -167,7 +167,7 @@ switch($_GET['mode'])
{ {
message_forum($lng['no_ban_me'],'banlist.php?mode=view'); 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', `b_id` FROM ".BANLIST_TABLE." ORDER BY `b_id` DESC",'GENERAL',
'Could not obtain last ban id')); 'Could not obtain last ban id'));
$bid = $bid['b_id']; $bid = $bid['b_id'];
@ -214,7 +214,7 @@ switch($_GET['mode'])
$open = fopen($catalog.$_FILES['file']['name'],'r'); $open = fopen($catalog.$_FILES['file']['name'],'r');
$file = fread($open, filesize($catalog.$_FILES['file']['name'])); $file = fread($open, filesize($catalog.$_FILES['file']['name']));
$item = @explode("\n",$file); $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', `b_id` FROM ".BANLIST_TABLE." ORDER BY `b_id` DESC",'GENERAL',
'Could not obtain last ban id')); 'Could not obtain last ban id'));
$bid = $bid['b_id']; $bid = $bid['b_id'];
@ -296,7 +296,7 @@ switch($_GET['mode'])
$bid = $_GET['id']; $bid = $_GET['id'];
$sql = "SELECT * FROM ".BANLIST_TABLE." WHERE `b_id`='$bid'"; $sql = "SELECT * FROM ".BANLIST_TABLE." WHERE `b_id`='$bid'";
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain banlist item information'); $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['ip']=$result['IP'];
$_POST['motive'] = $result['motive']; $_POST['motive'] = $result['motive'];
$_POST['u_id'] = ($result['u_id']>0) ? User::UserInformation($result['u_id'],'nick') : 'No profile'; $_POST['u_id'] = ($result['u_id']>0) ? User::UserInformation($result['u_id'],'nick') : 'No profile';
@ -327,7 +327,7 @@ switch($_GET['mode'])
case 'view': case 'view':
{ {
$query = DataBase::sql_query("SELECT `u_id`, `nick` FROM ".USERS_TABLE,'GENERAL','Could not obtain user information'); $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']; $user[$result['u_id']]['nick'] = $result['nick'];
} }
@ -344,14 +344,14 @@ switch($_GET['mode'])
); );
Admin_Over::GenerateHeader(); Admin_Over::GenerateHeader();
include('./template/banlist_view_body.tpl'); include('./template/banlist_view_body.tpl');
if (@mysql_num_rows($query)<1)
if (DataBase::num_rows($query)<1)
{ {
echo '<tr><td width="'.TABLES_WIDTH.'" colspan="5" height="19" echo '<tr><td width="'.TABLES_WIDTH.'" colspan="5" height="19"
class="fitem"><p class="fstandard" align="center">'.$lng['banlist_no_items'].'!</p></td></tr>'; class="fitem"><p class="fstandard" align="center">'.$lng['banlist_no_items'].'!</p></td></tr>';
} }
else else
{ {
while($item = @mysql_fetch_array($query))
while($item = DataBase::fetch($query))
{ {
$skin = array( $skin = array(
'user_name'=>($item['u_id']>-1) ? $user[$item['u_id']]['nick'] : 'No profile', 'user_name'=>($item['u_id']>-1) ? $user[$item['u_id']]['nick'] : 'No profile',

+ 5
- 5
admin/censorlist.php View File

@ -51,7 +51,7 @@ switch($_GET['mode'])
$file = fread($open, filesize($catalog.$_FILES['file']['name'])); $file = fread($open, filesize($catalog.$_FILES['file']['name']));
$item = @explode(',',$file); $item = @explode(',',$file);
$sql = "SELECT `w_id` FROM ".CENSORLIST_TABLE." ORDER BY `w_id` DESC"; $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['w_id'];
$last= $last +1; $last= $last +1;
for($i=0;$i<count($item);$i++) for($i=0;$i<count($item);$i++)
@ -91,7 +91,7 @@ switch($_GET['mode'])
{ {
$word = strip_tags($_POST['word']); $word = strip_tags($_POST['word']);
$sql = "SELECT `w_id` FROM ".CENSORLIST_TABLE." ORDER BY `w_id` DESC"; $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['w_id'];
$last= $last +1; $last= $last +1;
DataBase::sql_query("INSERT INTO ".CENSORLIST_TABLE." VALUES ('$last','$word')",'GENERAL','Could not add censored word.'); DataBase::sql_query("INSERT INTO ".CENSORLIST_TABLE." VALUES ('$last','$word')",'GENERAL','Could not add censored word.');
@ -128,7 +128,7 @@ switch($_GET['mode'])
$wid = intval($_GET['w']); $wid = intval($_GET['w']);
$sql = "SELECT * FROM ".CENSORLIST_TABLE." WHERE `w_id`='$wid'"; $sql = "SELECT * FROM ".CENSORLIST_TABLE." WHERE `w_id`='$wid'";
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain censorlist words'); $query = DataBase::sql_query($sql,'CRITICAL','Could not obtain censorlist words');
$result = @mysql_fetch_array($query);
$result = DataBase::fetch($query);
$_POST['word']=$result['word']; $_POST['word']=$result['word'];
$skin = array( $skin = array(
'action'=>'censorlist.php?mode=edit&w='.$wid, 'action'=>'censorlist.php?mode=edit&w='.$wid,
@ -160,14 +160,14 @@ switch($_GET['mode'])
); );
Admin_Over::GenerateHeader(); Admin_Over::GenerateHeader();
include('./template/censorlist_view_body.tpl'); include('./template/censorlist_view_body.tpl');
if (@mysql_num_rows($query)<1)
if (DataBase::num_rows($query)<1)
{ {
echo '<table class="maintable"><tr><td width="'.TABLES_WIDTH.'" colspan="8" height="19" echo '<table class="maintable"><tr><td width="'.TABLES_WIDTH.'" colspan="8" height="19"
class="fitem"><p class="fstandard" align="center">'.$lng['no_words'].'!</p></td></tr></table>'; class="fitem"><p class="fstandard" align="center">'.$lng['no_words'].'!</p></td></tr></table>';
} }
else else
{ {
while($item = @mysql_fetch_array($query))
while($item = DataBase::fetch($query))
{ {
$skin = array( $skin = array(
'L.word_name'=>$item['word'], 'L.word_name'=>$item['word'],

+ 8
- 3
admin/check_script.php View File

@ -47,7 +47,7 @@ function check_size_md5($file)
function mysqlversion() function mysqlversion()
{ {
$temp = ''; $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']; $result = $result['mysql_version'];
for($i=0;$i<5;$i++) for($i=0;$i<5;$i++)
{ {
@ -63,7 +63,7 @@ function db_size()
$sql = "SHOW TABLE STATUS"; $sql = "SHOW TABLE STATUS";
$db_size = 0; $db_size = 0;
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain database size'); $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']; $db_size += $result['Index_length'];
} }
@ -146,7 +146,12 @@ $skin=array(
//php version //php version
'L.php_version'=>$lng['php_version'], 'L.php_version'=>$lng['php_version'],
'PHP.version'=>phpversion(), 'PHP.version'=>phpversion(),
'PHP.value' => (phpversion()>='4.3.10') ? '<font color="green">OK</font>' : ' <font color="red">Error - No OK</font>',
'PHP.value' => (phpversion()>='5.0.7') ? '<font color="green">OK</font>' : ' <font color="red">Error - No OK</font>',
//extension MySQLi loaded?
'L.mySQLi_loaded'=>$lng['mysqli_loaded'],
'mySQLi_loaded'=>(extension_loaded('mysqli')) ? $lng['yes'] : $lng['no'],
'mySQLi_loaded.value'=> (extension_loaded('mysqli')) ? '<font color="green">OK</font>' : ' <font color="red">Error - No OK</font>',
//mysql version //mysql version
'mySQL.version'=>$sql_version, 'mySQL.version'=>$sql_version,

+ 5
- 5
admin/smilelist.php View File

@ -49,7 +49,7 @@ switch($_GET['mode'])
{ {
$sql = "SELECT * FROM ".SMILES_TABLE." ORDER BY `s_id` DESC LIMIT 1"; $sql = "SELECT * FROM ".SMILES_TABLE." ORDER BY `s_id` DESC LIMIT 1";
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain smilelist item information'); $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 = $result['s_id'];
$smile_id = $smile_id +1; $smile_id = $smile_id +1;
$smile_word = strip_tags($_POST['word']); $smile_word = strip_tags($_POST['word']);
@ -92,7 +92,7 @@ switch($_GET['mode'])
$open = @fopen($catalog.$_FILES['file']['name'],'r'); $open = @fopen($catalog.$_FILES['file']['name'],'r');
$file = @fread($open, filesize($catalog.$_FILES['file']['name'])); $file = @fread($open, filesize($catalog.$_FILES['file']['name']));
$item = @explode("\n",$file); $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', `s_id` FROM ".SMILES_TABLE." ORDER BY `s_id` DESC",'GENERAL',
'Could not obtain last smile id')); 'Could not obtain last smile id'));
$sid = $sid['s_id']; $sid = $sid['s_id'];
@ -157,7 +157,7 @@ switch($_GET['mode'])
$sid = intval($_GET['id']); $sid = intval($_GET['id']);
$sql = "SELECT * FROM ".SMILES_TABLE." WHERE `s_id`='$sid'"; $sql = "SELECT * FROM ".SMILES_TABLE." WHERE `s_id`='$sid'";
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain smilelist item information'); $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']=='') if ($result['s_id']=='')
{ {
admin_message_forum($lng['no_smile'],'smilelist.php?mode=view'); admin_message_forum($lng['no_smile'],'smilelist.php?mode=view');
@ -198,14 +198,14 @@ switch($_GET['mode'])
); );
Admin_Over::GenerateHeader(); Admin_Over::GenerateHeader();
include('./template/smilelist_view_body.tpl'); include('./template/smilelist_view_body.tpl');
if (@mysql_num_rows($query)<1)
if (DataBase::num_rows($query)<1)
{ {
echo '<table class="maintable"><tr><td width="'.TABLES_WIDTH.'" colspan="8" height="19" echo '<table class="maintable"><tr><td width="'.TABLES_WIDTH.'" colspan="8" height="19"
class="fitem"><p class="fstandard" align="center">'.$lng['smilelist_no_items'].'!</p></td></tr></table>'; class="fitem"><p class="fstandard" align="center">'.$lng['smilelist_no_items'].'!</p></td></tr></table>';
} }
else else
{ {
while($item = @mysql_fetch_array($query))
while($item = DataBase::fetch($query))
{ {
$skin = array( $skin = array(
'smile_word'=>$item['smile'], 'smile_word'=>$item['smile'],

+ 1
- 1
admin/styles.php View File

@ -90,7 +90,7 @@ switch($_GET['mode'])
include('./template/skins_beam_body.tpl'); include('./template/skins_beam_body.tpl');
$sql = "SELECT * FROM ".SKINS_TABLE; $sql = "SELECT * FROM ".SKINS_TABLE;
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain skins information'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain skins information');
while ($item = @mysql_fetch_array($query))
while ($item = DataBase::fetch($query))
{ {
$skin=array( $skin=array(
'L.delete' => $lng['delete'], 'L.delete' => $lng['delete'],

+ 8
- 0
admin/template/check_script.tpl View File

@ -23,6 +23,14 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td class="fitem" align="right" width="40%" height="19">
<span class="fstandard"><?= $skin['L.mySQLi_loaded']; ?> (<?= $skin['mySQLi_loaded']?>):&nbsp;&nbsp;</span>
</td>
<td class="fitem" width="60%" height="19">
<span class="fstandard"><b><?= $skin['mySQLi_loaded.value'] ?></b></span>
</td>
</tr>
<tr>
<td class="fitem" align="right" width="40%" height="19"> <td class="fitem" align="right" width="40%" height="19">
<span class="fstandard"><?= $skin['L.mySQL_version']; ?> (<?= $skin['mySQL.version']?>):&nbsp;&nbsp;</span> <span class="fstandard"><?= $skin['L.mySQL_version']; ?> (<?= $skin['mySQL.version']?>):&nbsp;&nbsp;</span>
</td> </td>

+ 7
- 3
common.php View File

@ -13,10 +13,14 @@ if (is_dir('install'))
die('<font color="red" face="Verdana" size="6">Please delete or rename catalog "install"</font>'); die('<font color="red" face="Verdana" size="6">Please delete or rename catalog "install"</font>');
} }
if (phpversion()<'5.0.7')
{
die('&micro;Forum requires PHP 5.0.7 or later');
}
//set global preferences from DataBase //set global preferences from DataBase
$sql="SELECT * FROM ".CONFIG_TABLE.""; $sql="SELECT * FROM ".CONFIG_TABLE."";
$query=DataBase::sql_query($sql,'CRITICAL','Could not obtain config information'); $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')) if (($result['name']=='') or ($result['name']=='0'))
{ {
@ -49,7 +53,7 @@ if ($_SESSION['uid']>0)
$ip = $_SERVER['REMOTE_ADDR']; $ip = $_SERVER['REMOTE_ADDR'];
$uid = $_SESSION['uid']; $uid = $_SESSION['uid'];
$sql = "SELECT `IP`, `u_id`, `motive` FROM ".BANLIST_TABLE." WHERE `IP`='$ip' OR `u_id`='$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']; $motive = $result['motive'];
$db_ip = $result['IP']; $db_ip = $result['IP'];
$db_uid = $result['u_id']; $db_uid = $result['u_id'];
@ -73,7 +77,7 @@ else
$sql = "SELECT * FROM ".USERS_TABLE." WHERE `u_id`='-1'"; $sql = "SELECT * FROM ".USERS_TABLE." WHERE `u_id`='-1'";
} }
$query = DataBase::sql_query($sql, 'GENERAL','Could not obtain loged user information'); $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('RANK', $userdata['rank']);
define('TABLES_WIDTH',$forum_config['tables_width']); define('TABLES_WIDTH',$forum_config['tables_width']);

+ 2
- 2
forum.php View File

@ -54,10 +54,10 @@ include('./skins/'.$default_skin.'/overall_header.tpl');
include('./skins/'.$default_skin.'/forum_body.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;"; $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'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain topics information');
$value = mysql_num_rows($query);
$value = DataBase::num_rows($query);
if ($value>0) if ($value>0)
{ {
while($record = mysql_fetch_array($query))
while($record = DataBase::fetch($query))
{ {
$skin = array( $skin = array(
't_id'=>$record['t_id'], 't_id'=>$record['t_id'],

+ 5
- 5
groups.php View File

@ -69,7 +69,7 @@ if(isset($_GET['mode']))
$_POST['delnick']=''; $_POST['delnick']='';
} }
$sql = "SELECT `g_id`, `name`, `desc`, `m_id` FROM `".GROUPS_TABLE."` WHERE `g_id`='$gid'"; $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']=='') if ($group['g_id']=='')
{ {
message_forum($lng['no_group'], 'index.php'); message_forum($lng['no_group'], 'index.php');
@ -90,10 +90,10 @@ if(isset($_GET['mode']))
include('./skins/'.$default_skin.'/group_view_head_body.tpl'); 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'"; $sql = "SELECT ".USERS_GROUP_TABLE.".*, ".USERS_TABLE.".* FROM `".USERS_GROUP_TABLE."` LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".u_id =".USERS_GROUP_TABLE.".u_id WHERE `g_id`='$gid'";
$query = DataBase::sql_query($sql, 'GENERAL', 'Could not obtain users in groups information.'); $query = DataBase::sql_query($sql, 'GENERAL', 'Could not obtain users in groups information.');
$amout = @mysql_num_rows($query);
$amout = DataBase::num_rows($query);
if ($amout>0) if ($amout>0)
{ {
while($result = mysql_fetch_array($query))
while($result = DataBase::fetch($query))
{ {
$skin = array( $skin = array(
'id'=>$result['u_id'], 'id'=>$result['u_id'],
@ -143,9 +143,9 @@ else
include('./skins/'.$default_skin.'/overall_header.tpl'); include('./skins/'.$default_skin.'/overall_header.tpl');
$sql = "SELECT `g_id`, `name`, `desc` FROM `".GROUPS_TABLE."` ORDER BY `sort`"; $sql = "SELECT `g_id`, `name`, `desc` FROM `".GROUPS_TABLE."` ORDER BY `sort`";
$query = DataBase::sql_query($sql, 'GENERAL', 'Could not obtain groups information.'); $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( $skin = array(
'g_id'=>$item['g_id'], 'g_id'=>$item['g_id'],

+ 1
- 1
includes/admin/class_forum.php View File

@ -19,7 +19,7 @@ class Admin_Forum
$cat = Forum::ForumInformation($fid,'c_id'); $cat = Forum::ForumInformation($fid,'c_id');
$all=''; $all='';
$query = DataBase::sql_query("SELECT `name`, `c_id` FROM `".CATS_TABLE."`",'GENERAL','Could not obtain category information'); $query = DataBase::sql_query("SELECT `name`, `c_id` FROM `".CATS_TABLE."`",'GENERAL','Could not obtain category information');
while($t = @mysql_fetch_array($query))
while($t = DataBase::fetch($query))
{ {
if ($t['c_id']==$cat) if ($t['c_id']==$cat)

+ 5
- 5
includes/admin/class_main.php View File

@ -38,7 +38,7 @@ class Admin_Over
global $default_skin; global $default_skin;
$all=''; $all='';
$query = DataBase::sql_query("SELECT `name`, `s_id` FROM `".SKINS_TABLE."`",'GENERAL','Could not obtain skins information'); $query = DataBase::sql_query("SELECT `name`, `s_id` FROM `".SKINS_TABLE."`",'GENERAL','Could not obtain skins information');
while($t = @mysql_fetch_array($query))
while($t = DataBase::fetch($query))
{ {
if ($t['name']==$default_skin) if ($t['name']==$default_skin)
@ -104,14 +104,14 @@ class Admin_Over
{ {
$result = User::UserInformation($_SESSION['uid'],'skin'); $result = User::UserInformation($_SESSION['uid'],'skin');
$sql = "SELECT * FROM `".SKINS_TABLE."` WHERE `s_id`='$result'"; $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']; return $result['name'];
} }
else else
{ {
$result = $forum_config['defaultskin']; $result = $forum_config['defaultskin'];
$sql = "SELECT * FROM `".SKINS_TABLE."` WHERE `s_id`='$result'"; $sql = "SELECT * FROM `".SKINS_TABLE."` WHERE `s_id`='$result'";
$result = 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']; return $result['name'];
} }
} }
@ -131,14 +131,14 @@ class Admin_Over
{ {
$sql = "SELECT `t_id` FROM ".TOPICS_TABLE.";"; $sql = "SELECT `t_id` FROM ".TOPICS_TABLE.";";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain total posts information'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain total posts information');
$result = mysql_num_rows($query);
$result = DataBase::num_rows($query);
return($result); return($result);
} }
function TotalPosts() function TotalPosts()
{ {
$sql = "SELECT `p_id` FROM ".POSTS_TABLE.";"; $sql = "SELECT `p_id` FROM ".POSTS_TABLE.";";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain total posts information'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain total posts information');
$result = mysql_num_rows($query);
$result = DataBase::num_rows($query);
return($result); return($result);
} }
function GenerateHeader() function GenerateHeader()

+ 4
- 4
includes/cache/cache_forums.php View File

@ -14,7 +14,7 @@ if(!defined('IN_uF'))
//cache forums and posts - version v1.0 Alpha 2--------------------------------- //cache forums and posts - version v1.0 Alpha 2---------------------------------
$default_skin = ViewSkinName(); $default_skin = ViewSkinName();
$sql = "SELECT `name`,`lock` FROM ".FORUMS_TABLE." WHERE `f_id`='$fid' LIMIT 1"; $sql = "SELECT `name`,`lock` FROM ".FORUMS_TABLE." WHERE `f_id`='$fid' LIMIT 1";
$result = @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']=='') if ($result['name']=='')
{ {
message_forum($lng['no_forum'],'index.php'); 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`"; $sql = "SELECT COUNT(*) as `p_id`, `t_id` FROM ".POSTS_TABLE." GROUP BY `t_id`";
$query = DataBase::sql_query($sql,'GENERAL', 'Could not obtain amout of posts in forum'); $query = DataBase::sql_query($sql,'GENERAL', 'Could not obtain amout of posts in forum');
while($result = @mysql_fetch_array($query))
while($result = DataBase::fetch($query))
{ {
$count_topic[$result['t_id']]=$result['p_id']; $count_topic[$result['t_id']]=$result['p_id'];
} }
/*$sql = "SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".* FROM ".POSTS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".u_id = ".POSTS_TABLE.".u_id WHERE `f_id`='$fid' ORDER BY `ptime`"; /*$sql = "SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".* FROM ".POSTS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".u_id = ".POSTS_TABLE.".u_id WHERE `f_id`='$fid' ORDER BY `ptime`";
$query = DataBase::sql_query($sql,'GENERAL', 'Could not obtain amout of posts in forum'); $query = DataBase::sql_query($sql,'GENERAL', 'Could not obtain amout of posts in forum');
while($result = @mysql_fetch_array($query))
while($result = DataBase::fetch($query))
{ {
$lastpost[$result['t_id']]['tp_id']=$result['tp_id']; $lastpost[$result['t_id']]['tp_id']=$result['tp_id'];
$lastpost[$result['t_id']]['u_id']=$result['u_id']; $lastpost[$result['t_id']]['u_id']=$result['u_id'];
@ -65,7 +65,7 @@ else
$limit = 'LIMIT 0, '.$limiter; $limit = 'LIMIT 0, '.$limiter;
$page=1; $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')); FROM ".TOPICS_TABLE." WHERE `f_id`='$fid'",'GENERAL','Could not obtain count amout of topics'));
$count = $count['t_id']; $count = $count['t_id'];
$count = ceil($count / $limiter); $count = ceil($count / $limiter);

+ 4
- 15
includes/cache/cache_index.php View File

@ -15,34 +15,23 @@ if(!defined('IN_uF'))
//cache forums and posts - version v1.0 Alpha 2--------------------------------- //cache forums and posts - version v1.0 Alpha 2---------------------------------
// //
//lastpost in forum cache //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 forums --don't modify!!!
$cache_id=1; $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`"; $sql = "SELECT ".FORUMS_TABLE.".*, COUNT(".POSTS_TABLE.".p_id) as amout, ".POSTS_TABLE.".f_id AS count FROM ".FORUMS_TABLE." LEFT JOIN ".POSTS_TABLE." ON ".FORUMS_TABLE.".f_id= ".POSTS_TABLE.".f_id GROUP BY `f_id` ORDER BY `c_id`, `sort`";
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain forum information.'); $query = DataBase::sql_query($sql,'CRITICAL','Could not obtain forum information.');
while($result = @mysql_fetch_array($query))
while($result = DataBase::fetch($query))
{ {
$forum[$cache_id]['f_id'] = $result['f_id']; $forum[$cache_id]['f_id'] = $result['f_id'];
$forum[$cache_id]['name'] = $result['name']; $forum[$cache_id]['name'] = $result['name'];
$forum[$cache_id]['desc'] = $result['desc']; $forum[$cache_id]['desc'] = $result['desc'];
$forum[$cache_id]['c_id'] = $result['c_id']; $forum[$cache_id]['c_id'] = $result['c_id'];
$forum[$cache_id]['sort'] = $result['sort']; $forum[$cache_id]['sort'] = $result['sort'];
$forum[$cache_id]['lastpost'] = $result['lastpost'];
$count_forum[$result['f_id']] = $result['amout']; $count_forum[$result['f_id']] = $result['amout'];
$cache_id+=1; $cache_id+=1;
} }
$sql = "SELECT `u_id`,`nick`, `regdate` AS count FROM ".USERS_TABLE." ORDER BY `regdate` DESC"; $sql = "SELECT `u_id`,`nick`, `regdate` AS count FROM ".USERS_TABLE." ORDER BY `regdate` DESC";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain amout of count users information'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain amout of count users information');
$lastuser = @mysql_fetch_array($query);
$count_users = @mysql_num_rows($query) -1;
$lastuser = DataBase::fetch($query);
$count_users = DataBase::num_rows($query) -1;
?> ?>

+ 5
- 5
includes/cache/cache_topic.php View File

@ -13,7 +13,7 @@ if(!defined('IN_uF'))
} }
//||topic.php script cache ------------------------------------------------------------------------------ //||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"; $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']=='') if ($result['t_id']=='')
{ {
message_forum($lng['no_topic'], 'index.php'); message_forum($lng['no_topic'], 'index.php');
@ -30,8 +30,8 @@ $forum['moderate']=$result['moderate'];
$sql = "SELECT `u_id`,`value` FROM `".WARNINGS_TABLE."`"; $sql = "SELECT `u_id`,`value` FROM `".WARNINGS_TABLE."`";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user warns information'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain user warns information');
$result = 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']])) if(!isset($user_warnlevel[$result['u_id']]))
{ {
@ -50,7 +50,7 @@ while ($result = @mysql_fetch_array($query))
//check online for user //check online for user
$sql = "SELECT `s_id`, `u_id`, `time` FROM ".SESSIONS_TABLE." WHERE time+1250>".time(); $sql = "SELECT `s_id`, `u_id`, `time` FROM ".SESSIONS_TABLE." WHERE time+1250>".time();
$query = DataBase::sql_query($sql, 'GENERAL', 'Could not read user active.'); $query = DataBase::sql_query($sql, 'GENERAL', 'Could not read user active.');
while($result = @mysql_fetch_array($query))
while($result = DataBase::fetch($query))
{ {
$user[$result['u_id']]['online']='1'; $user[$result['u_id']]['online']='1';
} }
@ -81,7 +81,7 @@ else
$limit = 'LIMIT 0, '.$limiter; $limit = 'LIMIT 0, '.$limiter;
$page=1; $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')); FROM ".POSTS_TABLE." WHERE `t_id`='$tid'",'GENERAL','Could not obtain count amout of posts'));
$count = $count['p_id']; $count = $count['p_id'];
$count = ceil($count / $limiter); $count = ceil($count / $limiter);

+ 13
- 12
includes/classes/class_forum.php View File

@ -19,7 +19,7 @@ class Forum
$forum = Topic::TopicInformation($tid,'f_id'); $forum = Topic::TopicInformation($tid,'f_id');
$all=''; $all='';
$query = DataBase::sql_query("SELECT `name`, `f_id` FROM `".FORUMS_TABLE."` ORDER BY `f_id`",'GENERAL','Could not obtain forum information'); $query = DataBase::sql_query("SELECT `name`, `f_id` FROM `".FORUMS_TABLE."` ORDER BY `f_id`",'GENERAL','Could not obtain forum information');
while($t = @mysql_fetch_array($query))
while($t = DataBase::fetch($query))
{ {
if ($t['f_id']==$forum) 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'"; $sql = "SELECT count(*) as `p_id` FROM ".POSTS_TABLE." WHERE f_id='$forum_name'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain posts information.'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain posts information.');
$result = mysql_fetch_array($query);
$result = DataBase::fetch($query);
return $result['p_id']; return $result['p_id'];
} }
@ -47,17 +47,18 @@ class Forum
{ {
global $lng; global $lng;
global $user; global $user;
global $last_post;
global $lastpost;
global $userdata; global $userdata;
global $forum_config; global $forum_config;
if ($posts==0) { return '<p align="center" class="fstandard">'.$lng['nopost'].'</p>';} if ($posts==0) { return '<p align="center" class="fstandard">'.$lng['nopost'].'</p>';}
else 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) switch($rank)
{ {
case '0': case '0':
@ -93,13 +94,13 @@ class Forum
{ {
$page=''; $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) function LastPostImg($postsinforum)
{ {
global $last_post;
global $lastpost;
global $i; global $i;
global $forum; global $forum;
global $default_skin; global $default_skin;
@ -108,7 +109,7 @@ class Forum
{ {
if ($postsinforum>0) if ($postsinforum>0)
{ {
if ($last_post[$forum[$i]['f_id']]['time']>$time)
if ($lastpost[3]>$time)
{ {
return 'folder_new_posts'; return 'folder_new_posts';
} }
@ -132,7 +133,7 @@ class Forum
{ {
$sql = "SELECT `f_id`, `$inf` FROM ".FORUMS_TABLE." WHERE f_id='$fid';"; $sql = "SELECT `f_id`, `$inf` FROM ".FORUMS_TABLE." WHERE f_id='$fid';";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain forum information.'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain forum information.');
$result = mysql_fetch_array($query);
$result = DataBase::fetch($query);
$result = $result[$inf]; $result = $result[$inf];
return $result; return $result;
} }

+ 2
- 2
includes/classes/class_mod.php View File

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

+ 4
- 4
includes/classes/class_posting.php View File

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

+ 2
- 2
includes/classes/class_topic.php View File

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

+ 4
- 4
includes/classes/class_user.php View File

@ -25,7 +25,7 @@ class User
{ {
$sql = "SELECT `$inf` FROM ".USERS_TABLE." WHERE u_id='$uid';"; $sql = "SELECT `$inf` FROM ".USERS_TABLE." WHERE u_id='$uid';";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information.'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information.');
$result = mysql_fetch_array($query);
$result = DataBase::fetch($query);
$result = $result[$inf]; $result = $result[$inf];
return $result; return $result;
} }
@ -33,7 +33,7 @@ class User
function UserIdByNick($nick) function UserIdByNick($nick)
{ {
$sql = "SELECT * FROM `".USERS_TABLE."` WHERE `nick`='$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']; $result = $result['u_id'];
/*if ($result=='') /*if ($result=='')
{ {
@ -120,7 +120,7 @@ class User
{ {
$sql = "SELECT * FROM ".USERS_TABLE." WHERE u_id='$uid'"; $sql = "SELECT * FROM ".USERS_TABLE." WHERE u_id='$uid'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user`s rank information.'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain user`s rank information.');
$result = mysql_fetch_array($query);
$result = DataBase::fetch($query);
$rank = $result['rank']; $rank = $result['rank'];
if (($rank=='1') or ($rank=='2')) if (($rank=='1') or ($rank=='2'))
{ {
@ -194,7 +194,7 @@ class User
if($uid>0) if($uid>0)
{ {
$sql = "SELECT count(*) as `m_id` FROM ".PM_INBOX_TABLE." WHERE `u_id`='$uid' AND `read`='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']; $result = $result['m_id'];
if ($result>0) if ($result>0)
{ {

+ 13
- 13
includes/classes/secure.php View File

@ -18,7 +18,7 @@ class Secure
global $lng; global $lng;
$sql = "SELECT * FROM ".FORUMS_TABLE." WHERE f_id='$fid'"; $sql = "SELECT * FROM ".FORUMS_TABLE." WHERE f_id='$fid'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain forum information.'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain forum information.');
$result = mysql_fetch_array($query);
$result = DataBase::fetch($query);
$result = $result['f_id']; $result = $result['f_id'];
if ($result=='') if ($result=='')
{ {
@ -32,7 +32,7 @@ class Secure
{ {
$sql = "SELECT * FROM ".CENSORLIST_TABLE.";"; $sql = "SELECT * FROM ".CENSORLIST_TABLE.";";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain censorlist information.'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain censorlist information.');
while($word = mysql_fetch_array($query))
while($word = DataBase::fetch($query))
{ {
$text = str_replace($word['word'],'[censored]', $text); $text = str_replace($word['word'],'[censored]', $text);
} }
@ -69,7 +69,7 @@ class Secure
global $lng; global $lng;
$sql = "SELECT * FROM ".PM_INBOX_TABLE." WHERE m_id='$mid'"; $sql = "SELECT * FROM ".PM_INBOX_TABLE." WHERE m_id='$mid'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information.'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information.');
$result = mysql_fetch_array($query);
$result = DataBase::fetch($query);
$result = $result['m_id']; $result = $result['m_id'];
if ($result=='') if ($result=='')
{ {
@ -81,7 +81,7 @@ class Secure
global $lng; global $lng;
$sql = "SELECT * FROM ".PM_SENTBOX_TABLE." WHERE m_id='$mid'"; $sql = "SELECT * FROM ".PM_SENTBOX_TABLE." WHERE m_id='$mid'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information.'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information.');
$result = mysql_fetch_array($query);
$result = DataBase::fetch($query);
$result = $result['u_n_id']; $result = $result['u_n_id'];
if ($result!=$_SESSION['uid']) if ($result!=$_SESSION['uid'])
{ {
@ -92,7 +92,7 @@ class Secure
{ {
global $lng; global $lng;
$sql = "SELECT * FROM ".PM_INBOX_TABLE." WHERE m_id='$mid'"; $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']; $result = $result['u_id'];
if ($result!=$_SESSION['uid']) if ($result!=$_SESSION['uid'])
{ {
@ -103,7 +103,7 @@ class Secure
{ {
global $lng; global $lng;
$sql = "SELECT * FROM ".PM_SENTBOX_TABLE." WHERE m_id='$mid'"; $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']; $result = $result['m_id'];
if ($result=='') if ($result=='')
{ {
@ -115,7 +115,7 @@ class Secure
global $lng; global $lng;
$sql = "SELECT * FROM `".TOPICS_TABLE."` WHERE `t_id`='$tid'"; $sql = "SELECT * FROM `".TOPICS_TABLE."` WHERE `t_id`='$tid'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain topic information.'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain topic information.');
$result = mysql_fetch_array($query);
$result = DataBase::fetch($query);
$result = $result['t_id']; $result = $result['t_id'];
if ($result=='') if ($result=='')
{ {
@ -127,7 +127,7 @@ class Secure
global $lng; global $lng;
$sql = "SELECT * FROM ".POSTS_TABLE." WHERE p_id='$pid'"; $sql = "SELECT * FROM ".POSTS_TABLE." WHERE p_id='$pid'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain topic information.'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain topic information.');
$result = mysql_fetch_array($query);
$result = DataBase::fetch($query);
$result = $result['p_id']; $result = $result['p_id'];
if ($result=='') if ($result=='')
{ {
@ -138,7 +138,7 @@ class Secure
{ {
global $lng; global $lng;
$sql = "SELECT * FROM ".USERS_TABLE." WHERE u_id='$uid'"; $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']; $result = $result['u_id'];
if (($result=='') or ($result=='-1')) if (($result=='') or ($result=='-1'))
{ {
@ -149,7 +149,7 @@ class Secure
{ {
global $lng; global $lng;
$sql = "SELECT `g_id` FROM `".GROUPS_TABLE."` WHERE g_id='$gid'"; $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']; $result = $result['g_id'];
if ($result=='') if ($result=='')
{ {
@ -170,10 +170,10 @@ class Secure
{ {
global $lng; global $lng;
$sql = "SELECT `f_id`,`lock` FROM `".TOPICS_TABLE."` WHERE `t_id`='$tid'"; $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']; $fid = $result['f_id'];
$sql2 = "SELECT `lock` FROM `".FORUMS_TABLE."` WHERE `f_id`='$fid'"; $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')) if (($result['lock']=='1') or ($result2['lock']=='1'))
{ {
message_forum($lng['no_posting_topic_locked'],'topic.php?t='.$tid); message_forum($lng['no_posting_topic_locked'],'topic.php?t='.$tid);
@ -183,7 +183,7 @@ class Secure
{ {
global $lng; global $lng;
$sql = "SELECT `lock` FROM `".FORUMS_TABLE."` WHERE `f_id`='$fid'"; $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') if ($result['lock']=='1')
{ {
message_forum($lng['no_posting_forum_locked'],'forum.php?f='.$fid); message_forum($lng['no_posting_forum_locked'],'forum.php?f='.$fid);

+ 41
- 5
includes/db.php View File

@ -11,16 +11,35 @@ if ( !defined('IN_uF') )
{ {
die('Hacking attempt'); die('Hacking attempt');
} }
$db;
class DataBase class DataBase
{ {
function db_connect() 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) function sql_query($sql, $type, $msg, $no_count = false)
{ {
global $db;
if (isset($_COOKIE['queries'])) if (isset($_COOKIE['queries']))
{ {
$no_count = false; $no_count = false;
@ -30,11 +49,28 @@ class DataBase
} }
} }
//echo '<span class="fsmall">'.$sql.'<br></span>'; //for optimizing only //echo '<span class="fsmall">'.$sql.'<br></span>'; //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; return $query;
} }
function fetch($query)
{
return $query->fetch_array();
}
function num_rows($query)
{
return $query->num_rows;
}
function new_id($table) function new_id($table)
{ {
global $db;
//check table id //check table id
switch($table) switch($table)
{ {
@ -55,7 +91,7 @@ class DataBase
case WARNINGS_TABLE: { $id = 'w_id'; break; } case WARNINGS_TABLE: { $id = 'w_id'; break; }
} }
$sql = "SELECT `$id` FROM $table ORDER BY `$id` DESC LIMIT 1"; $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.<br> File: db.php, Line: '.__LINE__));
$return_id = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Error with obtain last id.<br> File: db.php, Line: '.__LINE__));
$return_id = $return_id[$id]; $return_id = $return_id[$id];
$return_id = $return_id+1; $return_id = $return_id+1;
return $return_id; return $return_id;

+ 1
- 1
includes/emailer.php View File

@ -79,7 +79,7 @@ function SendMassEmail($title,$content)
{ {
$sql = "SELECT `email`,`u_id` FROM ".USERS_TABLE." WHERE `u_id`>0"; $sql = "SELECT `email`,`u_id` FROM ".USERS_TABLE." WHERE `u_id`>0";
$query = DataBase::sql_query($sql,'CRITICAL','Could not read users table'); $query = DataBase::sql_query($sql,'CRITICAL','Could not read users table');
while($item = @mysql_fetch_array($query))
while($item = DataBase::fetch($query))
{ {
SendEmail($item['email'], $title, $content); SendEmail($item['email'], $title, $content);
} }

+ 55
- 9
includes/misc_functions.php View File

@ -202,7 +202,7 @@ function AddSkins()
global $default_skin; global $default_skin;
$all=''; $all='';
$query = DataBase::sql_query("SELECT `name`, `s_id` FROM `".SKINS_TABLE."`",'GENERAL','Could not obtain skins information'); $query = DataBase::sql_query("SELECT `name`, `s_id` FROM `".SKINS_TABLE."`",'GENERAL','Could not obtain skins information');
while($t = @mysql_fetch_array($query))
while($t = DataBase::fetch($query))
{ {
if ($t['name']==$default_skin) if ($t['name']==$default_skin)
@ -278,7 +278,7 @@ function TotalPosts()
{ {
$sql = "SELECT count(*) as `p_id` FROM ".POSTS_TABLE.""; $sql = "SELECT count(*) as `p_id` FROM ".POSTS_TABLE."";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain total posts information'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain total posts information');
$result = mysql_fetch_array($query);
$result = DataBase::fetch($query);
$result = $result['p_id']; $result = $result['p_id'];
return($result); return($result);
@ -338,15 +338,13 @@ function ViewSkinName()
$result = $forum_config['defaultskin']; $result = $forum_config['defaultskin'];
} }
$sql = "SELECT * FROM `".SKINS_TABLE."` WHERE `s_id`='$result'"; $sql = "SELECT * FROM `".SKINS_TABLE."` WHERE `s_id`='$result'";
$result = 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']; return $result['name'];
} }
function GenerateLastPost($id, $type) function GenerateLastPost($id, $type)
{
$last_post = '';
{
switch ($type) switch ($type)
{ {
/** field lastpost in forum format /** 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"; $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); $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 .= $result['tp_id'];
$last_post .= ':'; $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"; $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'); $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 .= $result['tp_id'];
$last_post .= ':'; $last_post .= ':';

+ 4
- 4
includes/pms/pms_folder.php View File

@ -5,9 +5,9 @@
// //
$sql = "SELECT `u_id`,`nick`,`rank` FROM `".USERS_TABLE."`"; $sql = "SELECT `u_id`,`nick`,`rank` FROM `".USERS_TABLE."`";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain forums information'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain forums information');
$user['count']= 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']]['u_id']=$result['u_id'];
$user[$result['u_id']]['nick']=$result['nick']; $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'); $query = DataBase::sql_query($sql,'CRITICAL','Could not obtain messages information');
$count = mysql_num_rows($query);
$count = DataBase::num_rows($query);
if ($count==0) if ($count==0)
{ {
@ -61,7 +61,7 @@ if ($count==0)
} }
else else
{ {
while($item=mysql_fetch_array($query))
while($item=DataBase::fetch($query))
{ {
$skin=array( $skin=array(
'mid'=>$item['m_id'], 'mid'=>$item['m_id'],

+ 3
- 3
includes/pms/pms_view.php View File

@ -4,7 +4,7 @@
$sql = "SELECT * FROM ".SMILES_TABLE.""; $sql = "SELECT * FROM ".SMILES_TABLE."";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain emoticons information.'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain emoticons information.');
$i = 1; $i = 1;
while($result = mysql_fetch_array($query))
while($result = DataBase::fetch($query))
{ {
$smile[$i]['smile'] = $result['smile']; $smile[$i]['smile'] = $result['smile'];
$smile[$i]['url'] = $result['url']; $smile[$i]['url'] = $result['url'];
@ -34,7 +34,7 @@ switch($_GET['submode'])
} }
} }
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain messages information'); $query = DataBase::sql_query($sql,'CRITICAL','Could not obtain messages information');
$result = mysql_fetch_array($query);
$result = DataBase::fetch($query);
//if message exist.... //if message exist....
if ($result['m_id']=='') if ($result['m_id']=='')
{ {
@ -69,7 +69,7 @@ if ($_GET['submode']=='user')
$sql = "SELECT * FROM ".USERS_TABLE." WHERE `u_id`='".$result['u_n_id']."'"; $sql = "SELECT * FROM ".USERS_TABLE." WHERE `u_id`='".$result['u_n_id']."'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information');
$user = @mysql_fetch_array($query);
$user = DataBase::fetch($query);
$folder = ($_GET['submode']=='author') ? '<a href="pms.php?mode=folder&amp;submode=sentbox" class="navigator">'.$lng['sentbox'].'</a>' : '<a href="pms.php?mode=folder&amp;submode=inbox" class="navigator">'.$lng['inbox'].'</a>'; $folder = ($_GET['submode']=='author') ? '<a href="pms.php?mode=folder&amp;submode=sentbox" class="navigator">'.$lng['sentbox'].'</a>' : '<a href="pms.php?mode=folder&amp;submode=inbox" class="navigator">'.$lng['inbox'].'</a>';

+ 1
- 1
includes/pms/pms_write.php View File

@ -8,7 +8,7 @@ if ((isset($_POST['textedit'])) and (isset($_POST['nmsg'])) and (isset($_POST['u
{ {
$nick = strip_tags($_POST['username']); $nick = strip_tags($_POST['username']);
$sql = "SELECT * FROM `".USERS_TABLE."` WHERE `nick`='$nick'"; $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']!='') if ($result['u_id']!='')
{ {
$_POST['textedit'] = Secure::TagsReplace($_POST['textedit']); $_POST['textedit'] = Secure::TagsReplace($_POST['textedit']);

+ 21
- 9
includes/sessions.php View File

@ -58,8 +58,16 @@ function SessRegister()
SessDelete($uid); SessDelete($uid);
$time = time(); $time = time();
$sql = "INSERT INTO ".SESSIONS_TABLE." VALUES ('', '".$_COOKIE[SESS_NAME]."','$uid','$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']."'"; $sql = "SELECT `session_id`, `u_id` FROM ".SESSIONS_TABLE." WHERE `u_id`='".$_SESSION['uid']."'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain session information',true); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain session information',true);
$result = mysql_fetch_array($query);
$result = DataBase::fetch($query);
$result = $result['session_id']; $result = $result['session_id'];
if ($_COOKIE[SESS_NAME]!=$result) if ($_COOKIE[SESS_NAME]!=$result)
{ {
@ -90,9 +98,13 @@ function SessDelete($uid)
{ {
$time = time(); $time = time();
$sql = "DELETE FROM ".SESSIONS_TABLE." WHERE u_id='$uid'"; $sql = "DELETE FROM ".SESSIONS_TABLE." WHERE u_id='$uid'";
$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() function SessView()
@ -104,9 +116,9 @@ function SessView()
$time = time(); $time = time();
$sql = "SELECT ".SESSIONS_TABLE.".*, ".USERS_TABLE.".*, ".SESSIONS_TABLE.".u_id AS u_id FROM ".SESSIONS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".SESSIONS_TABLE.".u_id = ".USERS_TABLE.".u_id WHERE time+1250>$time;"; $sql = "SELECT ".SESSIONS_TABLE.".*, ".USERS_TABLE.".*, ".SESSIONS_TABLE.".u_id AS u_id FROM ".SESSIONS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".SESSIONS_TABLE.".u_id = ".USERS_TABLE.".u_id WHERE time+1250>$time;";
$query = DataBase::sql_query($sql, 'GENERAL','Could not obtain sessions information.'); $query = DataBase::sql_query($sql, 'GENERAL','Could not obtain sessions information.');
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']; $uid = $result['u_id'];
switch($result['rank']) switch($result['rank'])
@ -134,6 +146,6 @@ function SessView()
{ {
$name = '<span class="userlink">'.$lng['empty'].'</span>'; $name = '<span class="userlink">'.$lng['empty'].'</span>';
} }
return array($name, @mysql_num_rows($query));
return array($name, DataBase::num_rows($query));
} }
?> ?>

+ 3
- 2
index.php View File

@ -55,7 +55,7 @@ include('./skins/'.$default_skin.'/index_body.tpl');
$isset_forum = array(); $isset_forum = array();
$sql = "SELECT * FROM `".CATS_TABLE."` ORDER BY `sort`"; $sql = "SELECT * FROM `".CATS_TABLE."` ORDER BY `sort`";
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain categories information.'); $query = DataBase::sql_query($sql,'CRITICAL','Could not obtain categories information.');
while($result = @mysql_fetch_array($query))
while($result = DataBase::fetch($query))
{ {
$skin = array( $skin = array(
'category' => $result['name'], 'category' => $result['name'],
@ -70,7 +70,8 @@ while($result = @mysql_fetch_array($query))
if(!@in_array($forum[$i]['f_id'],$isset_forum)) if(!@in_array($forum[$i]['f_id'],$isset_forum))
{ {
array_push($isset_forum, $forum[$i]['f_id']); 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( $skin = array(
'new_post' => Forum::LastPostImg($postsinforum), 'new_post' => Forum::LastPostImg($postsinforum),
'forum_name' => $forum[$i]['name'], 'forum_name' => $forum[$i]['name'],

+ 1
- 1
install/index.php View File

@ -136,7 +136,7 @@ switch($_GET['page'])
'L.value'=>$lng['value'], 'L.value'=>$lng['value'],
'L.php_version'=>$lng['php_version'], 'L.php_version'=>$lng['php_version'],
'PHP.version'=>phpversion(), 'PHP.version'=>phpversion(),
'PHP.value' => (phpversion()>='4.3.10') ? '<font color="green">OK</font>' : ' <font color="red">Error - No OK</font>',
'PHP.value' => (phpversion()>='5.0.7') ? '<font color="green">OK</font>' : ' <font color="red">Error - No OK</font>',
'mySQL.version'=>mysql_get_client_info(), 'mySQL.version'=>mysql_get_client_info(),
'L.mySQL_version'=>$lng['mysql_version'], 'L.mySQL_version'=>$lng['mysql_version'],
'mySQL.value'=>(mysql_get_client_info()>='4.1') ? '<font color="green">OK</font>' : ' <font color="red">Error - No OK</font>', 'mySQL.value'=>(mysql_get_client_info()>='4.1') ? '<font color="green">OK</font>' : ' <font color="red">Error - No OK</font>',

+ 2
- 1
lngs/Polish/admin.php View File

@ -119,12 +119,13 @@ $lng['actual_sum']='Aktualna wartość';
$lng['files_is_good']='Wszystkie pliki są poprawne!'; $lng['files_is_good']='Wszystkie pliki są poprawne!';
$lng['files_not_good']='Nie wszystkie pliki są poprawne. Jest ich: '; $lng['files_not_good']='Nie wszystkie pliki są poprawne. Jest ich: ';
$lng['php_version']='Wersja PHP'; $lng['php_version']='Wersja PHP';
$lng['mysql_version']='Wersja mySQL';
$lng['mysql_version']='Wersja serwera MySQL';
$lng['not_writable']='Katalog nie do zapisu!'; $lng['not_writable']='Katalog nie do zapisu!';
$lng['is_writable']='Katalog do zapisu'; $lng['is_writable']='Katalog do zapisu';
$lng['catalog']='Katalog'; $lng['catalog']='Katalog';
$lng['db_size']='Wielkość bazy'; $lng['db_size']='Wielkość bazy';
$lng['forum_size']='Wielkość plików forum'; $lng['forum_size']='Wielkość plików forum';
$lng['mysqli_loaded']='Rozszerzenie MySQLi załadowane';
// //
//on forum config....-------------------------------------------------- //on forum config....--------------------------------------------------
// //

+ 1
- 1
login.php View File

@ -66,7 +66,7 @@ if (isset($_GET['mode']))
$pass = md5(strip_tags($_POST['pass'])); $pass = md5(strip_tags($_POST['pass']));
$sql = "SELECT `u_id`, `nick`, `pass` FROM `".USERS_TABLE."` WHERE nick='$user'"; $sql = "SELECT `u_id`, `nick`, `pass` FROM `".USERS_TABLE."` WHERE nick='$user'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user inforamtion'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain user inforamtion');
$result = @mysql_fetch_array($query);
$result = DataBase::fetch($query);
$nick = $result['nick']; $nick = $result['nick'];
if ($result['nick']==$user) if ($result['nick']==$user)
{ {

+ 1
- 1
posting.php View File

@ -298,7 +298,7 @@ switch(trim($_GET['mode']))
$_POST['textedit']=''; $_POST['textedit']='';
} }
$sql = "SELECT `lock`, `name`, `f_id` FROM ".FORUMS_TABLE." WHERE `f_id`='".intval($_GET['f'])."'"; $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']=='') if($forum['name']=='')
{ {
message_forum($lng['no_forum'], 'index.php'); message_forum($lng['no_forum'], 'index.php');

+ 1
- 1
register.php View File

@ -53,7 +53,7 @@ if ( ereg ("^.+@.+\..+$", $_POST['email']))
{ {
$sql = "SELECT * FROM `".USERS_TABLE."` WHERE `nick`='$nick'"; $sql = "SELECT * FROM `".USERS_TABLE."` WHERE `nick`='$nick'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information.'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information.');
$result = mysql_fetch_array($query);
$result = DataBase::fetch($query);
$result = $result['nick']; $result = $result['nick'];
if ($result!=$nick) if ($result!=$nick)
{ {

+ 6
- 6
search.php View File

@ -31,7 +31,7 @@ SessRegister();
SessDeleteOld(); 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`"; $sql = "SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".* FROM ".POSTS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".u_id = ".POSTS_TABLE.".u_id ORDER BY `ptime`";
$query = DataBase::sql_query($sql,'GENERAL', 'Could not obtain amout of posts in forum'); $query = DataBase::sql_query($sql,'GENERAL', 'Could not obtain amout of posts in forum');
while($result = @mysql_fetch_array($query))
while($result = DataBase::fetch($query))
{ {
$lastpost[$result['t_id']]['tp_id']=$result['tp_id']; $lastpost[$result['t_id']]['tp_id']=$result['tp_id'];
$lastpost[$result['t_id']]['u_id']=$result['u_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`"; $sql = "SELECT COUNT(*) as `p_id`, `t_id` FROM ".POSTS_TABLE." GROUP BY `t_id`";
$query = DataBase::sql_query($sql,'GENERAL', 'Could not obtain amout of posts in forum'); $query = DataBase::sql_query($sql,'GENERAL', 'Could not obtain amout of posts in forum');
while($result = @mysql_fetch_array($query))
while($result = DataBase::fetch($query))
{ {
$count_topic[$result['t_id']]=$result['p_id']; $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'])) 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')); FROM ".TOPICS_TABLE." WHERE `author`='".intval($_GET['u'])."'",'GENERAL','Could not obtain count amout of topics'));
$count = $count['t_id']; $count = $count['t_id'];
$count = ceil($count / $limiter); $count = ceil($count / $limiter);
@ -139,7 +139,7 @@ if ((isset($_POST['keywords'])) || ($_GET['content']=='lastposts') || ($_GET['co
$like_where .=' OR `text` LIKE \'%'.$keyword[$i].'%\''; $like_where .=' OR `text` LIKE \'%'.$keyword[$i].'%\'';
} }
$sql = "SELECT COUNT(".TOPICS_TABLE.".t_id) as `count`, ".POSTS_TABLE.".* FROM ".TOPICS_TABLE." LEFT JOIN ".POSTS_TABLE." ON ".POSTS_TABLE.".t_id = ".TOPICS_TABLE.".t_id WHERE $like_where GROUP BY `t_id`"; $sql = "SELECT COUNT(".TOPICS_TABLE.".t_id) as `count`, ".POSTS_TABLE.".* FROM ".TOPICS_TABLE." LEFT JOIN ".POSTS_TABLE." ON ".POSTS_TABLE.".t_id = ".TOPICS_TABLE.".t_id WHERE $like_where GROUP BY `t_id`";
$count = @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 = $count['count'];
$count = ceil($count / $limiter); $count = ceil($count / $limiter);
if ($count==0) 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.'/overall_header.tpl');
include('./skins/'.$default_skin.'/forum_body.tpl'); include('./skins/'.$default_skin.'/forum_body.tpl');
$query = DataBase::sql_query($sql,'GENERAL', 'Could not obtain topics information'); $query = DataBase::sql_query($sql,'GENERAL', 'Could not obtain topics information');
$value = mysql_num_rows($query);
$value = DataBase::num_rows($query);
if ($value>0) if ($value>0)
{ {
$isset_topics = array(); $isset_topics = array();
while($record = mysql_fetch_array($query))
while($record = DataBase::fetch($query))
{ {
if (!in_array($record['t_id'], $isset_topics)) if (!in_array($record['t_id'], $isset_topics))
{ {

+ 1
- 1
shoutbox.php View File

@ -59,7 +59,7 @@ else
$shoutbox_content = ''; $shoutbox_content = '';
$sql = "SELECT ".SHOUTBOX_TABLE.".*, ".USERS_TABLE.".* FROM ".SHOUTBOX_TABLE." LEFT JOIN ".USERS_TABLE." ON ".SHOUTBOX_TABLE.".u_id = ".USERS_TABLE.".u_id ORDER BY `mtime` $desc LIMIT ".$forum_config['shoutbox_max']; $sql = "SELECT ".SHOUTBOX_TABLE.".*, ".USERS_TABLE.".* FROM ".SHOUTBOX_TABLE." LEFT JOIN ".USERS_TABLE." ON ".SHOUTBOX_TABLE.".u_id = ".USERS_TABLE.".u_id ORDER BY `mtime` $desc LIMIT ".$forum_config['shoutbox_max'];
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain shoutbox information'); $query = DataBase::sql_query($sql,'CRITICAL','Could not obtain shoutbox information');
while($sb_msg = @mysql_fetch_array($query))
while($sb_msg = DataBase::fetch($query))
{ {
$allow_del = (RANK>0) ? '<a href="index.php?mode=shoutbox_delete&amp;id='.$sb_msg['m_id'].'" class="fsmall">X</a><span class="small">&nbsp;</span>' : ''; $allow_del = (RANK>0) ? '<a href="index.php?mode=shoutbox_delete&amp;id='.$sb_msg['m_id'].'" class="fsmall">X</a><span class="small">&nbsp;</span>' : '';
$shoutbox_content .= ' $shoutbox_content .= '

+ 1
- 1
topic.php View File

@ -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;"; $sql = "SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".*, ".USERS_TABLE.".u_id AS user_id,".SESSIONS_TABLE.".* FROM `".POSTS_TABLE."` LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".u_id = ".POSTS_TABLE.".u_id LEFT JOIN ".SESSIONS_TABLE." ON ".SESSIONS_TABLE.".u_id = ".POSTS_TABLE.".u_id WHERE t_id='$tid' ORDER BY tp_id $limit;";
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain post information.'); $query = DataBase::sql_query($sql,'CRITICAL','Could not obtain post information.');
while($item=mysql_fetch_array($query))
while($item=DataBase::fetch($query))
{ {
$ua = UserAgent($item['user_agent']); $ua = UserAgent($item['user_agent']);
$warn_pool = ($forum_config['allow_warns'] && $forum_config['warns_in_topic'] ) ? (isset($user_warnlevel[$item['u_id']])) ? $warn_pool = ($forum_config['allow_warns'] && $forum_config['warns_in_topic'] ) ? (isset($user_warnlevel[$item['u_id']])) ?

+ 4
- 4
user.php View File

@ -32,7 +32,7 @@ $uid = intval($_GET['id']);
//check online for user //check online for user
$sql = "SELECT `s_id`, `u_id`, `time` FROM ".SESSIONS_TABLE." WHERE `u_id`='$uid' AND time+1250>".time()." LIMIT 1"; $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.'); $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) if ($result['u_id']==$uid)
{ {
$active = 1; $active = 1;
@ -45,8 +45,8 @@ unset($sql, $query, $result);
$userwarn = 0; $userwarn = 0;
$sql = "SELECT `u_id`,`value` FROM `".WARNINGS_TABLE."` WHERE `u_id`='$uid'"; $sql = "SELECT `u_id`,`value` FROM `".WARNINGS_TABLE."` WHERE `u_id`='$uid'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user warns information'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain user warns information');
$result = mysql_num_rows($query);
while ($result = @mysql_fetch_array($query))
$result = DataBase::num_rows($query);
while ($result = DataBase::fetch($query))
{ {
if ($result['value']=='-') if ($result['value']=='-')
{ {
@ -61,7 +61,7 @@ $userwarn = ($userwarn>0) ? $userwarn*10 : $userwarn;
//add skin variables //add skin variables
$sql = "SELECT * FROM `".USERS_TABLE."` WHERE u_id='$uid'"; $sql = "SELECT * FROM `".USERS_TABLE."` WHERE u_id='$uid'";
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain user information'); $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']=='') if ($user_info['u_id']=='')
{ {
message_forum($lng['no_user'],'index.php'); message_forum($lng['no_user'],'index.php');

+ 2
- 2
users.php View File

@ -53,7 +53,7 @@ else
$limit = 'LIMIT 0, '.$limiter; $limit = 'LIMIT 0, '.$limiter;
$page=1; $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')); FROM ".USERS_TABLE,'GENERAL','Could not obtain count amout of users'));
$count = $count['u_id'] -1; $count = $count['u_id'] -1;
$count = ceil($count / $limiter); $count = ceil($count / $limiter);
@ -190,7 +190,7 @@ switch($_COOKIE['users_sort'])
} }
} }
$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain user information.'); $query = DataBase::sql_query($sql,'CRITICAL','Could not obtain user information.');
while($result = mysql_fetch_array($query))
while($result = DataBase::fetch($query))
{ {
$skin = array( $skin = array(
'id'=>$result['u_id'], 'id'=>$result['u_id'],

+ 3
- 3
warns.php View File

@ -121,7 +121,7 @@ switch(trim($_GET['mode']))
$uid = $_GET['id']; $uid = $_GET['id'];
$sql = "SELECT `u_id`, `nick` FROM `".USERS_TABLE."` WHERE `u_id`='$uid'"; $sql = "SELECT `u_id`, `nick` FROM `".USERS_TABLE."` WHERE `u_id`='$uid'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information');
$user = @mysql_fetch_array($query);
$user = DataBase::fetch($query);
if ($user['u_id']=='') if ($user['u_id']=='')
{ {
message_forum($lng['no_user'],'index.php'); message_forum($lng['no_user'],'index.php');
@ -136,9 +136,9 @@ switch(trim($_GET['mode']))
include('./skins/'.$default_skin.'/warns_view_body.tpl'); include('./skins/'.$default_skin.'/warns_view_body.tpl');
$sql = "SELECT * FROM `".WARNINGS_TABLE."` WHERE `u_id`='$uid'"; $sql = "SELECT * FROM `".WARNINGS_TABLE."` WHERE `u_id`='$uid'";
$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user warns information'); $query = DataBase::sql_query($sql,'GENERAL','Could not obtain user warns information');
$result = mysql_num_rows($query);
$result = DataBase::num_rows($query);
$warns_count = 0; $warns_count = 0;
while($item = mysql_fetch_array($query))
while($item = DataBase::fetch($query))
{ {
$skin = array( $skin = array(
'value'=>$item['value'], 'value'=>$item['value'],

Loading…
Cancel
Save