diff --git a/admin/admin_forums.php b/admin/admin_forums.php index 2887aff..d894824 100644 --- a/admin/admin_forums.php +++ b/admin/admin_forums.php @@ -35,7 +35,7 @@ function GenerateDefaultDisplay() //cache forums --don't modify!!! $cache_id=1; $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 = DataBase::fetch($query)) { $forum[$cache_id]['f_id'] = $result['f_id']; @@ -58,7 +58,7 @@ function GenerateDefaultDisplay() include('./template/forums_beam_body.tpl'); //add forums and categories $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 = DataBase::fetch($query)) { $skin = array( @@ -115,15 +115,15 @@ switch($_GET['mode']) { $cat_name = strip_tags($_POST['cat_name']); $sql = "SELECT `sort` FROM `".CATS_TABLE."` ORDER BY `sort` DESC LIMIT 1"; - $last = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain last category sort id')); + $last = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain last category sort id')); $sort = $last ['sort']; $sort = $sort+1; $sql = "SELECT `c_id` FROM `".CATS_TABLE."` ORDER BY `c_id` DESC LIMIT 1"; - $last = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain last category id')); + $last = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain last category id')); $last = $last['c_id']; $last = $last +1; $sql = "INSERT INTO `".CATS_TABLE."` VALUES ('$last','$cat_name','$sort')"; - DataBase::sql_query($sql,'GENERAL','Could not add category'); + DataBase::sql_query($sql,GENERAL,'Could not add category'); $msg='./template/blank.tpl'; admin_message_forum($lng['cat_saved'],'admin_forums.php'); } @@ -169,15 +169,15 @@ switch($_GET['mode']) $forum_lock = (isset($_POST['forum_locked'])) ? 1 : 0; $allow_moderate = (isset($_POST['allow_moderate'])) ? 1 : 0; $sql = "SELECT `sort`, `c_id` FROM `".FORUMS_TABLE."` WHERE `c_id`='$forum_cat' ORDER BY `sort` DESC LIMIT 1"; - $last = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain last forum sort id')); + $last = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain last forum sort id')); $sort = $last ['sort']; $sort = $sort+1; $sql = "SELECT `f_id` FROM `".FORUMS_TABLE."` ORDER BY `f_id` DESC LIMIT 1"; - $last = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain last forum id')); + $last = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain last forum id')); $last = $last['f_id']; $last = $last +1; - $sql = "INSERT INTO `".FORUMS_TABLE."` VALUES ('$last','$forum_lock','$allow_moderate', '$forum_name', '$forum_desc','$forum_cat','$sort')"; - DataBase::sql_query($sql,'GENERAL','Could not add forum'); + $sql = "INSERT INTO `".FORUMS_TABLE."` VALUES ('$last','$forum_lock','$allow_moderate', '$forum_name', '$forum_desc', '0', '','$forum_cat','$sort')"; + DataBase::sql_query($sql,GENERAL,'Could not add forum'); $msg='./../skins/'.$default_skin.'/blank.tpl'; admin_message_forum($lng['forum_saved'],'admin_forums.php'); } @@ -243,19 +243,19 @@ switch($_GET['mode']) { $i1 = $_GET['c']; $sql = "SELECT `sort`, `c_id` FROM ".CATS_TABLE." WHERE `c_id`='$i1'"; - $s1 = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain category information.')); + $s1 = DataBase::fetch(DataBase::sql_query($sql,CRITICAL,'Could not obtain category information.')); $s1 = $s1['sort']; $s2 = $s1 -1; if ($s1>1) { $sql = "SELECT `sort`, `c_id` FROM ".CATS_TABLE." WHERE `sort`='$s2'"; - $s2 = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain category information.')); + $s2 = DataBase::fetch(DataBase::sql_query($sql,CRITICAL,'Could not obtain category information.')); $i2 = $s2['c_id']; $s2 = $s2['sort']; $sql = "UPDATE ".CATS_TABLE." SET `sort`='$s2' WHERE `c_id`='$i1'"; - DataBase::sql_query($sql,'GENERAL','Could not update category position'); + DataBase::sql_query($sql,GENERAL,'Could not update category position'); $sql = "UPDATE ".CATS_TABLE." SET `sort`='$s1' WHERE `c_id`='$i2'"; - DataBase::sql_query($sql,'GENERAL','Could not update category position'); + DataBase::sql_query($sql,GENERAL,'Could not update category position'); } } break; @@ -266,20 +266,20 @@ switch($_GET['mode']) { $i1 = $_GET['f']; $sql = "SELECT `sort`, `c_id`, `f_id` FROM ".FORUMS_TABLE." WHERE `f_id`='$i1'"; - $s1 = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain forum information.')); + $s1 = DataBase::fetch(DataBase::sql_query($sql,CRITICAL,'Could not obtain forum information.')); $cid = $s1['c_id']; $s1 = $s1['sort']; $s2 = $s1 -1; if ($s1>1) { $sql = "SELECT `sort`, `c_id`, `f_id` FROM ".FORUMS_TABLE." WHERE `sort`='$s2' AND `c_id`='$cid'"; - $s2 = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not forum forum information.')); + $s2 = DataBase::fetch(DataBase::sql_query($sql,CRITICAL,'Could not forum forum information.')); $i2 = $s2['f_id']; $s2 = $s2['sort']; $sql = "UPDATE ".FORUMS_TABLE." SET `sort`='$s2' WHERE `f_id`='$i1'"; - DataBase::sql_query($sql,'GENERAL','Could not update forum position'); + DataBase::sql_query($sql,GENERAL,'Could not update forum position'); $sql = "UPDATE ".FORUMS_TABLE." SET `sort`='$s1' WHERE `f_id`='$i2'"; - DataBase::sql_query($sql,'GENERAL','Could not update forum position'); + DataBase::sql_query($sql,GENERAL,'Could not update forum position'); } } break; @@ -306,21 +306,21 @@ switch($_GET['mode']) $i1 = $_GET['c']; $i2 = $i1 +1; $sql = "SELECT `sort`, `c_id` FROM ".CATS_TABLE." WHERE `c_id`='$i1'"; - $s1 = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain category information.')); + $s1 = DataBase::fetch(DataBase::sql_query($sql,CRITICAL,'Could not obtain category information.')); $s1 = $s1['sort']; $s2 = $s1 +1; $sql = "SELECT `c_id` FROM ".CATS_TABLE; - $count = DataBase::num_rows(DataBase::sql_query($sql,'CRITICAL','Could not obtain category information.')); + $count = DataBase::num_rows(DataBase::sql_query($sql,CRITICAL,'Could not obtain category information.')); if ($s1<$count) { $sql = "SELECT `sort`, `c_id` FROM ".CATS_TABLE." WHERE `sort`='$s2'"; - $s2 = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain category information.')); + $s2 = DataBase::fetch(DataBase::sql_query($sql,CRITICAL,'Could not obtain category information.')); $i2 = $s2['c_id']; $s2 = $s2['sort']; $sql = "UPDATE ".CATS_TABLE." SET `sort`='$s2' WHERE `c_id`='$i1'"; - DataBase::sql_query($sql,'GENERAL','Could not update category position'); + DataBase::sql_query($sql,GENERAL,'Could not update category position'); $sql = "UPDATE ".CATS_TABLE." SET `sort`='$s1' WHERE `c_id`='$i2'"; - DataBase::sql_query($sql,'GENERAL','Could not update category position'); + DataBase::sql_query($sql,GENERAL,'Could not update category position'); } } break; @@ -332,22 +332,22 @@ switch($_GET['mode']) $i1 = $_GET['f']; $i2 = $i1 +1; $sql = "SELECT `sort`, `c_id`, `f_id` FROM ".FORUMS_TABLE." WHERE `f_id`='$i1'"; - $s1 = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain forum information.')); + $s1 = DataBase::fetch(DataBase::sql_query($sql,CRITICAL,'Could not obtain forum information.')); $cid = $s1['c_id']; $s1 = $s1['sort']; $s2 = $s1 +1; $sql = "SELECT `f_id` FROM ".FORUMS_TABLE." WHERE `c_id`='$cid'"; - $count = DataBase::num_rows(DataBase::sql_query($sql,'CRITICAL','Could not obtain forum information.')); + $count = DataBase::num_rows(DataBase::sql_query($sql,CRITICAL,'Could not obtain forum information.')); if ($s1<$count) { $sql = "SELECT `sort`, `f_id` FROM ".FORUMS_TABLE." WHERE `sort`='$s2'"; - $s2 = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain forum information.')); + $s2 = DataBase::fetch(DataBase::sql_query($sql,CRITICAL,'Could not obtain forum information.')); $i2 = $s2['f_id']; $s2 = $s2['sort']; $sql = "UPDATE ".FORUMS_TABLE." SET `sort`='$s2' WHERE `f_id`='$i1'"; - DataBase::sql_query($sql,'GENERAL','Could not update forum position'); + DataBase::sql_query($sql,GENERAL,'Could not update forum position'); $sql = "UPDATE ".FORUMS_TABLE." SET `sort`='$s1' WHERE `f_id`='$i2'"; - DataBase::sql_query($sql,'GENERAL','Could not update forum position'); + DataBase::sql_query($sql,GENERAL,'Could not update forum position'); } } break; @@ -368,32 +368,32 @@ switch($_GET['mode']) { $cid = intval($_GET['c']); $sql = "SELECT * FROM `".CATS_TABLE."` WHERE `c_id`='$cid'"; - $query = DataBase::sql_query($sql,'GENERAL','Could not obtain category information'); + $query = DataBase::sql_query($sql,GENERAL,'Could not obtain category information'); $result = DataBase::fetch($query); $sort = $result['sort']; $sql = "SELECT * FROM `".CATS_TABLE."` WHERE `sort`>'$sort'"; - $query = DataBase::sql_query($sql,'GENERAL','Could not obtain categories information'); + $query = DataBase::sql_query($sql,GENERAL,'Could not obtain categories information'); while($item = DataBase::fetch($query)) { $new_sort = $item['sort']-1; $cid2 = $item['c_id']; $sql2 = "UPDATE `".CATS_TABLE."` SET `sort`='$new_sort' WHERE `c_id`='$cid2'"; - DataBase::sql_query($sql,'GENERAL','Could not update category'); + DataBase::sql_query($sql,GENERAL,'Could not update category'); } $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 = DataBase::fetch($query)) { $fid = $item['f_id']; $sql="DELETE FROM `".POSTS_TABLE."` WHERE `f_id`='$fid'"; - DataBase::sql_query($sql, 'GENERAL','Could not delete post.'); + DataBase::sql_query($sql, GENERAL,'Could not delete post.'); $sql = "DELETE FROM `".TOPICS_TABLE."` WHERE `f_id`='$fid'"; - DataBase::sql_query($sql, 'GENERAL','Could not delete topic'); + DataBase::sql_query($sql, GENERAL,'Could not delete topic'); } $sql = "DELETE FROM `".FORUMS_TABLE."` WHERE `c_id`='$cid'"; - DataBase::sql_query($sql, 'GENERAL','Could not delete topic'); + DataBase::sql_query($sql, GENERAL,'Could not delete topic'); $sql = "DELETE FROM `".CATS_TABLE."` WHERE `c_id`='$cid'"; - DataBase::sql_query($sql,'GENERAL','Could not delete category.'); + DataBase::sql_query($sql,GENERAL,'Could not delete category.'); } } case 'forum': @@ -402,24 +402,24 @@ switch($_GET['mode']) { $fid = intval($_GET['f']); $sql = "SELECT * FROM `".FORUMS_TABLE."` WHERE `f_id`='$fid'"; - $query = DataBase::sql_query($sql,'GENERAL','Could not obtain forum information'); + $query = DataBase::sql_query($sql,GENERAL,'Could not obtain forum information'); $result = DataBase::fetch($query); $sort = $result['sort']; $sql = "SELECT * FROM `".FORUMS_TABLE."` WHERE `sort`>'$sort'"; - $query = DataBase::sql_query($sql,'GENERAL','Could not obtain forums information'); + $query = DataBase::sql_query($sql,GENERAL,'Could not obtain forums information'); while($item = DataBase::fetch($query)) { $new_sort = $item['sort']-1; $fid1 = $item['f_id']; $sql2 = "UPDATE `".FORUMS_TABLE."` SET `sort`='$new_sort' WHERE `f_id`='$fid1'"; - DataBase::sql_query($sql,'GENERAL','Could not update forum'); + DataBase::sql_query($sql,GENERAL,'Could not update forum'); } $sql="DELETE FROM `".POSTS_TABLE."` WHERE `f_id`='$fid'"; - DataBase::sql_query($sql, 'GENERAL','Could not delete post.'); + DataBase::sql_query($sql, GENERAL,'Could not delete post.'); $sql = "DELETE FROM `".TOPICS_TABLE."` WHERE `f_id`='$fid'"; - DataBase::sql_query($sql, 'GENERAL','Could not delete topic'); + DataBase::sql_query($sql, GENERAL,'Could not delete topic'); $sql = "DELETE FROM `".FORUMS_TABLE."` WHERE `f_id`='$fid'"; - DataBase::sql_query($sql, 'GENERAL','Could not delete forum'); + DataBase::sql_query($sql, GENERAL,'Could not delete forum'); } } } @@ -439,11 +439,11 @@ switch($_GET['mode']) { $cat_name = strip_tags($_POST['cat_name']); $sql = "SELECT `sort`, `c_id` FROM `".FORUMS_TABLE."` WHERE `c_id`='$cat_name' ORDER BY `sort` DESC LIMIT 1"; - $last = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain last forum sort id')); + $last = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain last forum sort id')); $sort = $last ['sort']; $sort = $sort+1; $sql = "UPDATE `".CATS_TABLE."` SET `name`='$cat_name', `sort`='$sort' WHERE `c_id`='$cid'"; - DataBase::sql_query($sql,'GENERAL','Could not update category'); + DataBase::sql_query($sql,GENERAL,'Could not update category'); $msg='./../skins/'.$default_skin.'/blank.tpl'; admin_message_forum($lng['cat_saved'],'admin_forums.php'); } @@ -455,7 +455,7 @@ switch($_GET['mode']) } else { - $tmp = DataBase::fetch(DataBase::sql_query("SELECT `name` FROM `".CATS_TABLE."` WHERE `c_id`='$cid'",'GENERAL','Could not obtain category information')); + $tmp = DataBase::fetch(DataBase::sql_query("SELECT `name` FROM `".CATS_TABLE."` WHERE `c_id`='$cid'",GENERAL,'Could not obtain category information')); $tmp = $tmp['name']; $_POST['cat_name'] = $tmp; if($tmp['name']=='') @@ -495,14 +495,14 @@ switch($_GET['mode']) $forum_desc = strip_tags($_POST['forum_desc']); $forum_cat = $_POST['forum_cat']; $sql = "SELECT * FROM `".FORUMS_TABLE."` WHERE `f_id`='$fid'"; - $query = DataBase::sql_query($sql,'GENERAL','Could not obtain forum information'); + $query = DataBase::sql_query($sql,GENERAL,'Could not obtain forum information'); $result = DataBase::fetch($query); $actual_cid = $result['c_id']; $sort = $result['sort']; if ($actual_cid != $forum_cat) { $sql = "SELECT * FROM `".FORUMS_TABLE."` WHERE `c_id`='$forum_cat' ORDER BY `sort` DESC LIMIT 1"; - $query = DataBase::sql_query($sql,'GENERAL','Could not obtain forums information'); + $query = DataBase::sql_query($sql,GENERAL,'Could not obtain forums information'); $result = DataBase::fetch($query); $sort = $result['sort']+1; } @@ -517,7 +517,7 @@ switch($_GET['mode']) `c_id`='$forum_cat', `sort`='$sort' WHERE `f_id`='$fid'"; - DataBase::sql_query($sql,'GENERAL','Could not update forum'); + DataBase::sql_query($sql,GENERAL,'Could not update forum'); $msg='./../skins/'.$default_skin.'/blank.tpl'; admin_message_forum($lng['forum_saved'],'admin_forums.php'); } @@ -535,7 +535,7 @@ switch($_GET['mode']) } else { - $tmp = DataBase::fetch(DataBase::sql_query("SELECT `name`, `desc` FROM `".FORUMS_TABLE."` WHERE `f_id`='$fid'",'GENERAL','Could not obtain forum information')); + $tmp = DataBase::fetch(DataBase::sql_query("SELECT `name`, `desc` FROM `".FORUMS_TABLE."` WHERE `f_id`='$fid'",GENERAL,'Could not obtain forum information')); $_POST['forum_name'] = $tmp['name']; $msg='./../skins/'.$default_skin.'/blank.tpl'; $_POST['forum_desc'] = $tmp['desc']; diff --git a/admin/admin_groups.php b/admin/admin_groups.php index 8c995e9..fb69724 100644 --- a/admin/admin_groups.php +++ b/admin/admin_groups.php @@ -41,7 +41,7 @@ function GenerateDefaultDisplay() Admin_Over::GenerateHeader(); include('./template/groups_beam_body.tpl'); $sql = "SELECT `g_id`, `name`, `desc` FROM `".GROUPS_TABLE."` ORDER BY `sort`"; - $query = DataBase::sql_query($sql, 'GENERAL', 'Could not obtain groups information.'); + $query = DataBase::sql_query($sql, GENERAL, 'Could not obtain groups information.'); while($item = DataBase::fetch($query)) { $skin = array( @@ -69,9 +69,9 @@ switch($_GET['mode']) $gid = $_GET['id']; Secure::group_exists($gid); $sql = "DELETE FROM ".GROUPS_TABLE." WHERE `g_id`='$gid'"; - DataBase::sql_query($sql,'GENERAL','Could not delete group.'); + DataBase::sql_query($sql,GENERAL,'Could not delete group.'); $sql = "DELETE FROM ".USERS_GROUP_TABLE." WHERE `g_id`='$gid'"; - DataBase::sql_query($sql,'GENERAL','Could users in group.'); + DataBase::sql_query($sql,GENERAL,'Could users in group.'); GenerateDefaultDisplay(); break; } @@ -88,15 +88,15 @@ switch($_GET['mode']) $group_desc = htmlspecialchars($_POST['group_desc']); $group_mod = User::UserIdByNick(htmlspecialchars($_POST['group_mod'])); $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 = $group_sort+1; $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 = $group_id+1; $sql = "INSERT INTO ".GROUPS_TABLE." VALUES ('$group_id', '$group_name', '$group_desc', '$group_mod', '$group_sort')"; - DataBase::sql_query($sql, 'GENERAL', 'Could not add group'); + DataBase::sql_query($sql, GENERAL, 'Could not add group'); unset($group_name, $group_desc, $group_mod, $group_id); admin_message_forum($lng['group_saved'],'admin_groups.php'); } @@ -148,7 +148,7 @@ switch($_GET['mode']) `desc` = '$group_desc', `m_id` = '$group_mod' WHERE `g_id` = '$group_id'"; - DataBase::sql_query($sql, 'GENERAL', 'Could not update group'); + DataBase::sql_query($sql, GENERAL, 'Could not update group'); unset($group_name, $group_desc, $group_mod, $group_id); admin_message_forum($lng['group_saved'],'admin_groups.php'); } @@ -161,7 +161,7 @@ switch($_GET['mode']) else { $sql = "SELECT * FROM `".GROUPS_TABLE."` WHERE `g_id`='$gid'"; - $g = DataBase::fetch(DataBase::sql_query($sql, 'GENERAL','Could not obtain group information.')); + $g = DataBase::fetch(DataBase::sql_query($sql, GENERAL,'Could not obtain group information.')); $_POST['group_name'] = $g['name']; $_POST['group_desc'] = $g['desc']; $_POST['group_mod'] = User::UserInformation($g['m_id'],'nick'); @@ -188,19 +188,19 @@ switch($_GET['mode']) { $i1 = intval($_GET['id']); $sql = "SELECT `sort`, `g_id` FROM ".GROUPS_TABLE." WHERE `g_id`='$i1'"; - $s1 = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain group information.')); + $s1 = DataBase::fetch(DataBase::sql_query($sql,CRITICAL,'Could not obtain group information.')); $s1 = $s1['sort']; $s2 = $s1 -1; if ($s1>1) { $sql = "SELECT `sort`, `g_id` FROM ".GROUPS_TABLE." WHERE `sort`='$s2'"; - $s2 = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain group information.')); + $s2 = DataBase::fetch(DataBase::sql_query($sql,CRITICAL,'Could not obtain group information.')); $i2 = $s2['g_id']; $s2 = $s2['sort']; $sql = "UPDATE ".GROUPS_TABLE." SET `sort`='$s2' WHERE `g_id`='$i1'"; - DataBase::sql_query($sql,'GENERAL','Could not update group position'); + DataBase::sql_query($sql,GENERAL,'Could not update group position'); $sql = "UPDATE ".GROUPS_TABLE." SET `sort`='$s1' WHERE `g_id`='$i2'"; - DataBase::sql_query($sql,'GENERAL','Could not update group position'); + DataBase::sql_query($sql,GENERAL,'Could not update group position'); } } GenerateDefaultDisplay(); @@ -213,21 +213,21 @@ switch($_GET['mode']) $i1 = intval($_GET['id']); $i2 = $i1 +1; $sql = "SELECT `sort`, `g_id` FROM ".GROUPS_TABLE." WHERE `g_id`='$i1'"; - $s1 = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain group information.')); + $s1 = DataBase::fetch(DataBase::sql_query($sql,CRITICAL,'Could not obtain group information.')); $s1 = $s1['sort']; $s2 = $s1 +1; $sql = "SELECT `g_id` FROM ".GROUPS_TABLE; - $count = DataBase::num_rows(DataBase::sql_query($sql,'CRITICAL','Could not obtain group information.')); + $count = DataBase::num_rows(DataBase::sql_query($sql,CRITICAL,'Could not obtain group information.')); if ($s1<$count) { $sql = "SELECT `sort`, `g_id` FROM ".GROUPS_TABLE." WHERE `sort`='$s2'"; - $s2 = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain group information.')); + $s2 = DataBase::fetch(DataBase::sql_query($sql,CRITICAL,'Could not obtain group information.')); $i2 = $s2['g_id']; $s2 = $s2['sort']; $sql = "UPDATE ".GROUPS_TABLE." SET `sort`='$s2' WHERE `g_id`='$i1'"; - DataBase::sql_query($sql,'GENERAL','Could not update group position'); + DataBase::sql_query($sql,GENERAL,'Could not update group position'); $sql = "UPDATE ".GROUPS_TABLE." SET `sort`='$s1' WHERE `g_id`='$i2'"; - DataBase::sql_query($sql,'GENERAL','Could not update group position'); + DataBase::sql_query($sql,GENERAL,'Could not update group position'); } } GenerateDefaultDisplay(); diff --git a/admin/admin_script.php b/admin/admin_script.php index 6e27bf2..7da8154 100644 --- a/admin/admin_script.php +++ b/admin/admin_script.php @@ -33,7 +33,7 @@ function AddSkins() { global $forum_config; $all=''; - $query = DataBase::sql_query("SELECT `name`, `s_id` FROM `".SKINS_TABLE."`",'GENERAL','Could not obtain skins information'); + $query = DataBase::sql_query("SELECT `name`, `s_id` FROM `".SKINS_TABLE."`",GENERAL,'Could not obtain skins information'); while($t = DataBase::fetch($query)) { @@ -294,7 +294,7 @@ if (isset($_POST['forum_path'])) for($i=0;$i<$count_o;$i++) { $sql = "UPDATE `".CONFIG_TABLE."` SET `value`='".$value[$i]."' WHERE `name`='".$name[$i]."'"; - DataBase::sql_query($sql, 'GENERAL', 'Could not update script config'); + DataBase::sql_query($sql, GENERAL, 'Could not update script config'); } //end... unset($name, $value, $count_o, $sql); diff --git a/admin/admin_users.php b/admin/admin_users.php index d6f3c2f..dbc6ece 100644 --- a/admin/admin_users.php +++ b/admin/admin_users.php @@ -44,27 +44,27 @@ switch($_GET['mode']) //delete from users table $sql = "DELETE FROM ".USERS_TABLE." WHERE `u_id`='$uid'"; - DataBase::sql_query($sql,'GENERAL','Could not delete user.'); + DataBase::sql_query($sql,GENERAL,'Could not delete user.'); //delete from PM SentBox table $sql = "DELETE FROM ".PM_SENTBOX_TABLE." WHERE `u_n_id`='$uid'"; - DataBase::sql_query($sql,'GENERAL','Could not delete user sentbox messages.'); + DataBase::sql_query($sql,GENERAL,'Could not delete user sentbox messages.'); //update PM InBox table -> change u_n_id to Anonymous $sql = "UPDATE ".PM_INBOX_TABLE." SET `u_n_id`='-1' WHERE `u_n_id`='$uid'"; - DataBase::sql_query($sql,'GENERAL','Could not update user inbox messages.'); + DataBase::sql_query($sql,GENERAL,'Could not update user inbox messages.'); //update user posts -> change u_id to Anonymous $sql = "UPDATE ".POSTS_TABLE." SET `u_id`='-1' WHERE `u_id`='$uid'"; - DataBase::sql_query($sql,'GENERAL','Could edit post.'); + DataBase::sql_query($sql,GENERAL,'Could edit post.'); //update shoutbox messages -> change u_id to Anonymous $sql = "UPDATE ".SHOUTBOX_TABLE." SET `u_id`='-1' WHERE `u_id`='$uid'"; - DataBase::sql_query($sql,'GENERAL','Could edit shoutbox messages.'); + DataBase::sql_query($sql,GENERAL,'Could edit shoutbox messages.'); //update user topics -> change u_id to Anonymous $sql = "UPDATE ".TOPICS_TABLE." SET `author`='-1' WHERE `author`='$uid'"; - DataBase::sql_query($sql,'GENERAL','Could edit post.'); + DataBase::sql_query($sql,GENERAL,'Could edit post.'); //back to admin users admin_message_forum($lng['user_deleted'],'admin_users.php'); @@ -196,7 +196,7 @@ switch($_GET['mode']) } } $sql = "SELECT * FROM ".USERS_TABLE." WHERE `u_id`='$uid'"; - $userinfo = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain user information')); + $userinfo = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain user information')); if ($userinfo['rank']=='') { admin_message_forum($lng['no_user'],'admin_users.php?mode=view'); @@ -297,7 +297,7 @@ switch($_GET['mode']) $page=1; } $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 = ceil($count /30); if(isset($_GET['page']) && ($_GET['page']>$count)) @@ -428,7 +428,7 @@ switch($_GET['mode']) break; } } - $query = DataBase::sql_query($sql,'CRITICAL','Could not obtain user information.'); + $query = DataBase::sql_query($sql,CRITICAL,'Could not obtain user information.'); while($result = DataBase::fetch($query)) { $skin = array( diff --git a/admin/banlist.php b/admin/banlist.php index 5af7d2b..7ab6712 100644 --- a/admin/banlist.php +++ b/admin/banlist.php @@ -67,7 +67,7 @@ switch($_GET['mode']) } $ban_motive = strip_tags($_POST['motive']); $sql = "INSERT INTO ".BANLIST_TABLE." VALUES ('', '$ban_uid', '$ban_ip', '$ban_motive')"; - DataBase::sql_query($sql,'GENERAL','Could not update add ban.'); + DataBase::sql_query($sql,GENERAL,'Could not update add ban.'); admin_message_forum($lng['ban_added'],'banlist.php?mode=view'); } else @@ -114,12 +114,12 @@ switch($_GET['mode']) message_forum($lng['no_ban_me'],'banlist.php?mode=view'); } $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')); $bid = $bid['b_id']; $bid = $bid +1; $sql = "INSERT INTO ".BANLIST_TABLE." VALUES ('$bid', '$ban_uid', '$ban_ip', '$ban_motive')"; - DataBase::sql_query($sql,'GENERAL','Could not update add ban.'); + DataBase::sql_query($sql,GENERAL,'Could not update add ban.'); admin_message_forum($lng['ban_added'],'banlist.php?mode=view'); } else @@ -168,12 +168,12 @@ switch($_GET['mode']) message_forum($lng['no_ban_me'],'banlist.php?mode=view'); } $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')); $bid = $bid['b_id']; $bid = $bid +1; $sql = "INSERT INTO ".BANLIST_TABLE." VALUES ('$bid', '$ban_uid', '$ban_ip', '$ban_motive')"; - DataBase::sql_query($sql,'GENERAL','Could not update add ban.'); + DataBase::sql_query($sql,GENERAL,'Could not update add ban.'); admin_message_forum($lng['ban_added'],'banlist.php?mode=view'); } else @@ -209,13 +209,13 @@ switch($_GET['mode']) $catalog = '../tmp/'; if(!move_uploaded_file($_FILES['file']['tmp_name'], $catalog.$_FILES['file']['name'])) { - message_die('GENERAL','Could not upload file.',''); + message_die(GENERAL,'Could not upload file.',''); } $open = fopen($catalog.$_FILES['file']['name'],'r'); $file = fread($open, filesize($catalog.$_FILES['file']['name'])); $item = @explode("\n",$file); $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')); $bid = $bid['b_id']; $bid = $bid +1; @@ -223,7 +223,7 @@ switch($_GET['mode']) { $ban_ip = $item[$i]; $sql = "INSERT INTO ".BANLIST_TABLE." VALUES ('$bid', '$ban_uid', '$ban_ip', '$ban_motive')"; - DataBase::sql_query($sql,'GENERAL','Could not update add ban.'); + DataBase::sql_query($sql,GENERAL,'Could not update add ban.'); $bid = $bid +1; } admin_message_forum($lng['ban_added'],'banlist.php?mode=view'); @@ -255,7 +255,7 @@ switch($_GET['mode']) { $bid = $_GET['id']; $sql = "DELETE FROM ".BANLIST_TABLE." WHERE `b_id`='$bid'"; - DataBase::sql_query($sql,'GENERAL','Could not delete banlist item.'); + DataBase::sql_query($sql,GENERAL,'Could not delete banlist item.'); admin_message_forum($lng['ban_deleted'],'banlist.php?mode=view'); break; } @@ -288,14 +288,14 @@ switch($_GET['mode']) `u_id`='$ban_uid', `motive`='$ban_motive' WHERE `b_id`='$bid'"; - DataBase::sql_query($sql,'GENERAL','Could not update ban.'); + DataBase::sql_query($sql,GENERAL,'Could not update ban.'); admin_message_forum($lng['ban_edited'],'banlist.php?mode=view'); } else { $bid = $_GET['id']; $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 = DataBase::fetch($query); $_POST['ip']=$result['IP']; $_POST['motive'] = $result['motive']; @@ -321,18 +321,18 @@ switch($_GET['mode']) case 'clear': { $sql = "TRUNCATE `".BANLIST_TABLE."`"; - DataBase::sql_query($sql, 'GENERAL','Could not empty banlist'); + DataBase::sql_query($sql, GENERAL,'Could not empty banlist'); admin_message_forum($lng['banlist_cleanout'],'banlist.php?mode=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 = DataBase::fetch($query)) { $user[$result['u_id']]['nick'] = $result['nick']; } $sql = "SELECT * FROM ".BANLIST_TABLE.""; - $query = DataBase::sql_query($sql,'CRITICAL','Could not obtain banlist items'); + $query = DataBase::sql_query($sql,CRITICAL,'Could not obtain banlist items'); $skin=array( 'L.banlist'=>$lng['admin_banlist'], 'L.select_mode'=>$lng['what_do_you_want'], diff --git a/admin/censorlist.php b/admin/censorlist.php index 128da68..4576255 100644 --- a/admin/censorlist.php +++ b/admin/censorlist.php @@ -45,19 +45,19 @@ switch($_GET['mode']) $catalog = '../tmp/'; if(!move_uploaded_file($_FILES['file']['tmp_name'], $catalog.$_FILES['file']['name'])) { - message_die('GENERAL','Could not upload file.',''); + message_die(GENERAL,'Could not upload file.',''); } $open = fopen($catalog.$_FILES['file']['name'],'r'); $file = fread($open, filesize($catalog.$_FILES['file']['name'])); $item = @explode(',',$file); $sql = "SELECT `w_id` FROM ".CENSORLIST_TABLE." ORDER BY `w_id` DESC"; - $last = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain last word id')); + $last = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain last word id')); $last = $last['w_id']; $last= $last +1; for($i=0;$i$lng['admin_censorlist'], 'L.view_all_words'=>$lng['view_all_words'] diff --git a/admin/check_script.php b/admin/check_script.php index 7ab980f..d619550 100644 --- a/admin/check_script.php +++ b/admin/check_script.php @@ -47,7 +47,7 @@ function check_size_md5($file) function mysqlversion() { $temp = ''; - $result = DataBase::fetch(DataBase::sql_query("SELECT VERSION() AS mysql_version",'GENERAL','Could not read mysql version.')); + $result = DataBase::fetch(DataBase::sql_query("SELECT VERSION() AS mysql_version",GENERAL,'Could not read mysql version.')); $result = $result['mysql_version']; for($i=0;$i<5;$i++) { @@ -62,7 +62,7 @@ function db_size() { $sql = "SHOW TABLE STATUS"; $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 = DataBase::fetch($query)) { $db_size += $result['Index_length']; diff --git a/admin/smilelist.php b/admin/smilelist.php index e536392..c8f2a74 100644 --- a/admin/smilelist.php +++ b/admin/smilelist.php @@ -48,14 +48,14 @@ switch($_GET['mode']) if (isset($_POST['word'],$_POST['url'])) { $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 = DataBase::fetch($query); $smile_id = $result['s_id']; $smile_id = $smile_id +1; $smile_word = strip_tags($_POST['word']); $smile_url = strip_tags($_POST['url']); $sql = "INSERT INTO ".SMILES_TABLE." VALUES('$smile_id','$smile_word','$smile_url')"; - DataBase::sql_query($sql,'GENERAL','Could not add smile.'); + DataBase::sql_query($sql,GENERAL,'Could not add smile.'); admin_message_forum($lng['smile_added'],'smilelist.php?mode=view'); } else @@ -87,13 +87,13 @@ switch($_GET['mode']) $catalog = '../tmp/'; if(!move_uploaded_file($_FILES['file']['tmp_name'], $catalog.$_FILES['file']['name'])) { - message_die('GENERAL','Could not upload file.',''); + message_die(GENERAL,'Could not upload file.',''); } $open = @fopen($catalog.$_FILES['file']['name'],'r'); $file = @fread($open, filesize($catalog.$_FILES['file']['name'])); $item = @explode("\n",$file); $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')); $sid = $sid['s_id']; $sid = $sid +1; @@ -103,7 +103,7 @@ switch($_GET['mode']) $smile_word = $subitem[0]; $smile_url = $subitem[1]; $sql = "INSERT INTO ".SMILES_TABLE." VALUES ('$sid', '$smile_word', '$smile_url')"; - DataBase::sql_query($sql,'GENERAL','Could not add smile.'); + DataBase::sql_query($sql,GENERAL,'Could not add smile.'); $sid = $bid +1; } admin_message_forum($lng['smiles_added'],'smilelist.php?mode=view'); @@ -133,7 +133,7 @@ switch($_GET['mode']) { $sid = $_GET['id']; $sql = "DELETE FROM ".SMILES_TABLE." WHERE `s_id`='$sid'"; - DataBase::sql_query($sql,'GENERAL','Could not delete smilelist item.'); + DataBase::sql_query($sql,GENERAL,'Could not delete smilelist item.'); admin_message_forum($lng['smile_deleted'],'smilelist.php?mode=view'); break; } @@ -149,14 +149,14 @@ switch($_GET['mode']) `smile`='$smile_word', `url`='$smile_url' WHERE `s_id`='$smile_id'"; - DataBase::sql_query($sql,'GENERAL','Could not update smile.'); + DataBase::sql_query($sql,GENERAL,'Could not update smile.'); admin_message_forum($lng['smile_edited'],'smilelist.php?mode=view'); } else { $sid = intval($_GET['id']); $sql = "SELECT * FROM ".SMILES_TABLE." WHERE `s_id`='$sid'"; - $query = DataBase::sql_query($sql,'CRITICAL','Could not obtain smilelist item information'); + $query = DataBase::sql_query($sql,CRITICAL,'Could not obtain smilelist item information'); $result = DataBase::fetch($query); if ($result['s_id']=='') { @@ -182,13 +182,13 @@ switch($_GET['mode']) case 'clear': { $sql = "TRUNCATE `".SMILES_TABLE."`"; - DataBase::sql_query($sql, 'GENERAL','Could not empty smilelist'); + DataBase::sql_query($sql, GENERAL,'Could not empty smilelist'); admin_message_forum($lng['smilelist_cleanout'],'smilelist.php?mode=view'); } case 'view': { $sql = "SELECT * FROM ".SMILES_TABLE.""; - $query = DataBase::sql_query($sql,'CRITICAL','Could not obtain smilelist items'); + $query = DataBase::sql_query($sql,CRITICAL,'Could not obtain smilelist items'); $skin=array( 'L.smilelist'=>$lng['admin_smilelist'], 'L.select_mode'=>$lng['what_do_you_want'], diff --git a/admin/styles.php b/admin/styles.php index d2523fe..12a843e 100644 --- a/admin/styles.php +++ b/admin/styles.php @@ -44,9 +44,9 @@ switch($_GET['mode']) if ($sid!=$forum_config['defaultskin']) { $sql = "DELETE FROM ".SKINS_TABLE." WHERE `s_id`='$sid'"; - DataBase::sql_query($sql,'GENERAL','Could not delete skin'); + DataBase::sql_query($sql,GENERAL,'Could not delete skin'); $sql = "UPDATE ".USERS_TABLE." SET `skin`='".$forum_config['defaultskin']."' WHERE `skin`='$sid'"; - DataBase::sql_query($sql,'GENERAL','Could not update user'); + DataBase::sql_query($sql,GENERAL,'Could not update user'); admin_message_forum($lng['skins_deleted'],'styles.php?mode=view'); } else @@ -64,7 +64,7 @@ switch($_GET['mode']) if (is_dir('./../skins/'.$_POST['skin'])) { $last = DataBase::new_id(SKINS_TABLE); - DataBase::sql_query("INSERT INTO ".SKINS_TABLE." VALUES ('$last','".strip_tags($_POST['skin'])."')",'GENERAL','Could not add skin'); + DataBase::sql_query("INSERT INTO ".SKINS_TABLE." VALUES ('$last','".strip_tags($_POST['skin'])."')",GENERAL,'Could not add skin'); $_POST['skin']=''; admin_message_forum($lng['skins_added'],'styles.php?mode=view'); } @@ -89,7 +89,7 @@ switch($_GET['mode']) Admin_Over::GenerateHeader(); include('./template/skins_beam_body.tpl'); $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 = DataBase::fetch($query)) { $skin=array( diff --git a/common.php b/common.php index dcf61e3..999721c 100644 --- a/common.php +++ b/common.php @@ -19,7 +19,7 @@ if (phpversion()<'5.0.7') } //set global preferences from DataBase $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=DataBase::fetch($query)) { if (($result['name']=='') or ($result['name']=='0')) @@ -53,7 +53,7 @@ if ($_SESSION['uid']>0) $ip = $_SERVER['REMOTE_ADDR']; $uid = $_SESSION['uid']; $sql = "SELECT `IP`, `u_id`, `motive` FROM ".BANLIST_TABLE." WHERE `IP`='$ip' OR `u_id`='$uid'"; - $result = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain ban information')); + $result = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain ban information')); $motive = $result['motive']; $db_ip = $result['IP']; $db_uid = $result['u_id']; @@ -76,7 +76,7 @@ else { $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 = DataBase::fetch($query); define('RANK', $userdata['rank']); diff --git a/config.php b/config.php index b9668fd..0238d4b 100644 --- a/config.php +++ b/config.php @@ -7,12 +7,12 @@ if ( !defined('IN_uF') ) { die('Hacking attempt'); } -@ini_set('display_errors', '1'); +ini_set('display_errors', '1'); define('DB_HOST','localhost'); define('DB_USER','root'); define('DB_PASS',''); define('DB_NAME','uf'); define('DB_PREFIX','uf_'); -define('VERSION','9.5.1'); +define('VERSION','9.5.3'); define('UF_INSTALLED',true); ?> diff --git a/forum.php b/forum.php index 5dee762..8ddbe70 100644 --- a/forum.php +++ b/forum.php @@ -52,18 +52,19 @@ $skin = array_push_associative($skin,GenerateHeader($lng['showforum'].': '.$foru //do it! include('./skins/'.$default_skin.'/overall_header.tpl'); include('./skins/'.$default_skin.'/forum_body.tpl'); -$sql = "SELECT ".TOPICS_TABLE.".*, ".USERS_TABLE.".* FROM ".TOPICS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".TOPICS_TABLE.".author = ".USERS_TABLE.".u_id WHERE f_id='$fid' ORDER BY `sticky` DESC, `lastpost_time` DESC $limit;"; -$query = DataBase::sql_query($sql,'GENERAL','Could not obtain topics information'); +$sql = "SELECT ".TOPICS_TABLE.".*, ".USERS_TABLE.".*, ".TOPICS_TABLE.".posts AS `postcount`, ".TOPICS_TABLE.".lastpost AS `topic_lastpost` FROM ".TOPICS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".TOPICS_TABLE.".author = ".USERS_TABLE.".u_id WHERE f_id='$fid' ORDER BY `sticky` DESC, `lastpost_time` DESC $limit;"; +$query = DataBase::sql_query($sql,GENERAL,'Could not obtain topics information'); $value = DataBase::num_rows($query); if ($value>0) { while($record = DataBase::fetch($query)) { + $last_post = explode(':', $record['topic_lastpost']); $skin = array( 't_id'=>$record['t_id'], 'fname'=>($record['sticky']=='1') ? ''.$lng['sticky'].''.$record['name'] : $record['name'], 'author'=>Topic::TopicAuthor($record['author']), - 'tposts'=>$count_topic[$record['t_id']], + 'tposts'=>$record['postcount'], 'new_post'=>Topic::LastPostImg(), 'lastpost'=>Topic::LastPostInTopic($record['t_id']) ); diff --git a/groups.php b/groups.php index 24bc67f..2bef748 100644 --- a/groups.php +++ b/groups.php @@ -69,7 +69,7 @@ if(isset($_GET['mode'])) $_POST['delnick']=''; } $sql = "SELECT `g_id`, `name`, `desc`, `m_id` FROM `".GROUPS_TABLE."` WHERE `g_id`='$gid'"; - $group = DataBase::fetch(DataBase::sql_query($sql, 'GENERAL', 'Could not obtain groups information.')); + $group = DataBase::fetch(DataBase::sql_query($sql, GENERAL, 'Could not obtain groups information.')); if ($group['g_id']=='') { message_forum($lng['no_group'], 'index.php'); @@ -89,7 +89,7 @@ if(isset($_GET['mode'])) ); include('./skins/'.$default_skin.'/group_view_head_body.tpl'); $sql = "SELECT ".USERS_GROUP_TABLE.".*, ".USERS_TABLE.".* FROM `".USERS_GROUP_TABLE."` LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".u_id =".USERS_GROUP_TABLE.".u_id WHERE `g_id`='$gid'"; - $query = DataBase::sql_query($sql, 'GENERAL', 'Could not obtain users in groups information.'); + $query = DataBase::sql_query($sql, GENERAL, 'Could not obtain users in groups information.'); $amout = DataBase::num_rows($query); if ($amout>0) { @@ -142,7 +142,7 @@ else $skin = GenerateHeader($lng['lgroups'], '> '.$lng['lgroups']); include('./skins/'.$default_skin.'/overall_header.tpl'); $sql = "SELECT `g_id`, `name`, `desc` FROM `".GROUPS_TABLE."` ORDER BY `sort`"; - $query = DataBase::sql_query($sql, 'GENERAL', 'Could not obtain groups information.'); + $query = DataBase::sql_query($sql, GENERAL, 'Could not obtain groups information.'); if (DataBase::num_rows($query)>0) { while($item = DataBase::fetch($query)) diff --git a/includes/admin/class_forum.php b/includes/admin/class_forum.php index 478d791..128811d 100644 --- a/includes/admin/class_forum.php +++ b/includes/admin/class_forum.php @@ -18,7 +18,7 @@ class Admin_Forum global $forum_config; $cat = Forum::ForumInformation($fid,'c_id'); $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 = DataBase::fetch($query)) { diff --git a/includes/admin/class_main.php b/includes/admin/class_main.php index 4bcc81b..6411686 100644 --- a/includes/admin/class_main.php +++ b/includes/admin/class_main.php @@ -37,7 +37,7 @@ class Admin_Over global $forum_config; global $default_skin; $all=''; - $query = DataBase::sql_query("SELECT `name`, `s_id` FROM `".SKINS_TABLE."`",'GENERAL','Could not obtain skins information'); + $query = DataBase::sql_query("SELECT `name`, `s_id` FROM `".SKINS_TABLE."`",GENERAL,'Could not obtain skins information'); while($t = DataBase::fetch($query)) { @@ -104,14 +104,14 @@ class Admin_Over { $result = User::UserInformation($_SESSION['uid'],'skin'); $sql = "SELECT * FROM `".SKINS_TABLE."` WHERE `s_id`='$result'"; - $result = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain skin information.')); + $result = DataBase::fetch(DataBase::sql_query($sql,CRITICAL,'Could not obtain skin information.')); return $result['name']; } else { $result = $forum_config['defaultskin']; $sql = "SELECT * FROM `".SKINS_TABLE."` WHERE `s_id`='$result'"; - $result = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain skin information.')); + $result = DataBase::fetch(DataBase::sql_query($sql,CRITICAL,'Could not obtain skin information.')); return $result['name']; } } @@ -130,14 +130,14 @@ class Admin_Over function TotalTopics() { $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 = DataBase::num_rows($query); return($result); } function TotalPosts() { $sql = "SELECT `p_id` FROM ".POSTS_TABLE.";"; - $query = DataBase::sql_query($sql,'GENERAL','Could not obtain total posts information'); + $query = DataBase::sql_query($sql,GENERAL,'Could not obtain total posts information'); $result = DataBase::num_rows($query); return($result); } diff --git a/includes/cache/cache_forums.php b/includes/cache/cache_forums.php index ee23c29..71270dc 100644 --- a/includes/cache/cache_forums.php +++ b/includes/cache/cache_forums.php @@ -14,7 +14,7 @@ if(!defined('IN_uF')) //cache forums and posts - version v1.0 Alpha 2--------------------------------- $default_skin = ViewSkinName(); $sql = "SELECT `name`,`lock` FROM ".FORUMS_TABLE." WHERE `f_id`='$fid' LIMIT 1"; -$result = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain forum information')); +$result = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain forum information')); if ($result['name']=='') { message_forum($lng['no_forum'],'index.php'); @@ -23,14 +23,14 @@ $forum = array( 'name'=>$result['name'], 'lock'=>$result['lock'] ); -$sql = "SELECT COUNT(*) as `p_id`, `t_id` FROM ".POSTS_TABLE." GROUP BY `t_id`"; -$query = DataBase::sql_query($sql,'GENERAL', 'Could not obtain amout of posts in forum'); +/*$sql = "SELECT COUNT(*) as `p_id`, `t_id` FROM ".POSTS_TABLE." GROUP BY `t_id`"; +$query = DataBase::sql_query($sql,GENERAL, 'Could not obtain amout of posts in forum'); while($result = DataBase::fetch($query)) { $count_topic[$result['t_id']]=$result['p_id']; -} +}*/ /*$sql = "SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".* FROM ".POSTS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".u_id = ".POSTS_TABLE.".u_id WHERE `f_id`='$fid' ORDER BY `ptime`"; -$query = DataBase::sql_query($sql,'GENERAL', 'Could not obtain amout of posts in forum'); +$query = DataBase::sql_query($sql,GENERAL, 'Could not obtain amout of posts in forum'); while($result = DataBase::fetch($query)) { $lastpost[$result['t_id']]['tp_id']=$result['tp_id']; @@ -66,7 +66,7 @@ else $page=1; } $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 = ceil($count / $limiter); if ($count==0) diff --git a/includes/cache/cache_index.php b/includes/cache/cache_index.php index de6a887..762b327 100644 --- a/includes/cache/cache_index.php +++ b/includes/cache/cache_index.php @@ -18,7 +18,7 @@ if(!defined('IN_uF')) //cache forums --don't modify!!! $cache_id=1; $sql = "SELECT ".FORUMS_TABLE.".*, COUNT(".POSTS_TABLE.".p_id) as amout, ".POSTS_TABLE.".f_id AS count FROM ".FORUMS_TABLE." LEFT JOIN ".POSTS_TABLE." ON ".FORUMS_TABLE.".f_id= ".POSTS_TABLE.".f_id GROUP BY `f_id` ORDER BY `c_id`, `sort`"; -$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain forum information.'); +$query = DataBase::sql_query($sql,CRITICAL,'Could not obtain forum information.'); while($result = DataBase::fetch($query)) { $forum[$cache_id]['f_id'] = $result['f_id']; @@ -31,7 +31,7 @@ while($result = DataBase::fetch($query)) $cache_id+=1; } $sql = "SELECT `u_id`,`nick`, `regdate` AS count FROM ".USERS_TABLE." ORDER BY `regdate` DESC"; -$query = DataBase::sql_query($sql,'GENERAL','Could not obtain amout of count users information'); +$query = DataBase::sql_query($sql,GENERAL,'Could not obtain amout of count users information'); $lastuser = DataBase::fetch($query); $count_users = DataBase::num_rows($query) -1; ?> diff --git a/includes/cache/cache_topic.php b/includes/cache/cache_topic.php index 4f1f66e..5d5aa5f 100644 --- a/includes/cache/cache_topic.php +++ b/includes/cache/cache_topic.php @@ -13,7 +13,7 @@ if(!defined('IN_uF')) } //||topic.php script cache ------------------------------------------------------------------------------ $sql = "SELECT ".TOPICS_TABLE.".*, ".TOPICS_TABLE.".name AS topic_name, ".TOPICS_TABLE.".lock AS topic_lock, ".FORUMS_TABLE.".* FROM ".TOPICS_TABLE." LEFT JOIN ".FORUMS_TABLE." ON ".TOPICS_TABLE.".f_id = ".FORUMS_TABLE.".f_id WHERE `t_id`='$tid' LIMIT 1"; -$result = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain forum information')); +$result = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain forum information')); if ($result['t_id']=='') { message_forum($lng['no_topic'], 'index.php'); @@ -29,7 +29,7 @@ $forum['moderate']=$result['moderate']; $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 = DataBase::num_rows($query); while ($result = DataBase::fetch($query)) { @@ -49,7 +49,7 @@ while ($result = DataBase::fetch($query)) //check online for user $sql = "SELECT `s_id`, `u_id`, `time` FROM ".SESSIONS_TABLE." WHERE time+1250>".time(); -$query = DataBase::sql_query($sql, 'GENERAL', 'Could not read user active.'); +$query = DataBase::sql_query($sql, GENERAL, 'Could not read user active.'); while($result = DataBase::fetch($query)) { $user[$result['u_id']]['online']='1'; @@ -82,7 +82,7 @@ else $page=1; } $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 = ceil($count / $limiter); if(isset($_GET['page']) && ($_GET['page']>$count)) diff --git a/includes/classes/class_forum.php b/includes/classes/class_forum.php index c0f3aec..623941f 100644 --- a/includes/classes/class_forum.php +++ b/includes/classes/class_forum.php @@ -18,7 +18,7 @@ class Forum global $forum_config; $forum = Topic::TopicInformation($tid,'f_id'); $all=''; - $query = DataBase::sql_query("SELECT `name`, `f_id` FROM `".FORUMS_TABLE."` ORDER BY `f_id`",'GENERAL','Could not obtain forum information'); + $query = DataBase::sql_query("SELECT `name`, `f_id` FROM `".FORUMS_TABLE."` ORDER BY `f_id`",GENERAL,'Could not obtain forum information'); while($t = DataBase::fetch($query)) { @@ -38,7 +38,7 @@ class Forum function PostsInForum($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 = DataBase::fetch($query); return $result['p_id']; } @@ -132,7 +132,7 @@ class Forum function ForumInformation($fid, $inf) { $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 = DataBase::fetch($query); $result = $result[$inf]; return $result; diff --git a/includes/classes/class_mod.php b/includes/classes/class_mod.php index d4fafea..5f6ed12 100644 --- a/includes/classes/class_mod.php +++ b/includes/classes/class_mod.php @@ -16,9 +16,9 @@ class Mod function MoveTopic($tid, $fid) { $sql = "UPDATE `".TOPICS_TABLE."` SET `f_id`='$fid' WHERE `t_id`='$tid'"; - DataBase::sql_query($sql,'GENERAL','Could not update topic'); + DataBase::sql_query($sql,GENERAL,'Could not update topic'); $sql = "UPDATE `".POSTS_TABLE."` SET `f_id`='$fid' WHERE `t_id`='$tid'"; - DataBase::sql_query($sql,'GENERAL','Could not update post'); + DataBase::sql_query($sql,GENERAL,'Could not update post'); } function TopicLocked($tid) @@ -39,37 +39,37 @@ class Mod function DeleteTopic($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 = DataBase::fetch($query)) { $uid = Topic::PostInformation($item['p_id'],'u_id'); $posts = User::UserInformation($uid,'posts'); $posts = $posts -1; $sql = "UPDATE `".USERS_TABLE."` SET `posts`='$posts' WHERE `u_id`='$uid'"; - DataBase::sql_query($sql,'GENERAL','Could not update user amout of posts'); + DataBase::sql_query($sql,GENERAL,'Could not update user amout of posts'); } $sql = "DELETE FROM ".POSTS_TABLE." WHERE t_id='$topicid';"; - DataBase::sql_query($sql,'GENERAL','Could not delete topic posts.'); + DataBase::sql_query($sql,GENERAL,'Could not delete topic posts.'); $sql = "DELETE FROM ".TOPICS_TABLE." WHERE t_id='$topicid';"; - DataBase::sql_query($sql,'GENERAL','Could not delete topic posts.'); + DataBase::sql_query($sql,GENERAL,'Could not delete topic posts.'); } function LockTopic($topicid) { $sql = "UPDATE `".TOPICS_TABLE."` SET `lock` = '1' WHERE `t_id` =$topicid;"; - DataBase::sql_query($sql,'GENERAL','Could not lock topic.'); + DataBase::sql_query($sql,GENERAL,'Could not lock topic.'); } function StickTopic($topicid, $mode) { $sql = "UPDATE `".TOPICS_TABLE."` SET `sticky` = '$mode' WHERE `t_id` =$topicid;"; - DataBase::sql_query($sql,'GENERAL','Could not stick topic.'); + DataBase::sql_query($sql,GENERAL,'Could not stick topic.'); } function UnlockTopic($topicid) { $sql = "UPDATE `".TOPICS_TABLE."` SET `lock` = '0' WHERE `t_id` =$topicid;"; - DataBase::sql_query($sql,'GENERAL','Could not unlock topic.'); + DataBase::sql_query($sql,GENERAL,'Could not unlock topic.'); } function DeletePost($postid) @@ -79,25 +79,25 @@ class Mod $posts = User::UserInformation($uid,'posts'); $posts = $posts -1; $sql = "UPDATE `".USERS_TABLE."` SET `posts`='$posts' WHERE `u_id`='$uid'"; - DataBase::sql_query($sql,'GENERAL','Could not update user amout of posts'); + DataBase::sql_query($sql,GENERAL,'Could not update user amout of posts'); $sql2 = "DELETE FROM ".POSTS_TABLE." WHERE p_id='$postid';"; - 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';"; - $query = DataBase::sql_query($sql,'GENERAL','Could not obtain post information.'); + $query = DataBase::sql_query($sql,GENERAL,'Could not obtain post information.'); while($item=DataBase::fetch($query)) { $number = $item['tp_id']; $number = $number-1; $number2 = $item['p_id']; $sql3 = "UPDATE `".POSTS_TABLE."` SET `tp_id` = '$number' WHERE `p_id` =$number2;"; - DataBase::sql_query($sql3,'GENERAL','Could not update post.'); + DataBase::sql_query($sql3,GENERAL,'Could not update post.'); } } function AcceptPost($postid) { $sql = "UPDATE `".POSTS_TABLE."` SET `moderated`='0' WHERE `p_id`='$postid'"; - DataBase::sql_query($sql, 'GENERAL', 'Could not accept post'); + DataBase::sql_query($sql, GENERAL, 'Could not accept post'); } } ?> diff --git a/includes/classes/class_pms.php b/includes/classes/class_pms.php index 0a03f27..b79b7f8 100644 --- a/includes/classes/class_pms.php +++ b/includes/classes/class_pms.php @@ -50,12 +50,12 @@ class Pms function DeleteMsgUser($mid) { $sql = "DELETE FROM `".PM_INBOX_TABLE."` WHERE `m_id`='$mid'"; - DataBase::sql_query($sql,'GENERAL','Could not delete message in inbox'); + DataBase::sql_query($sql,GENERAL,'Could not delete message in inbox'); } function DeleteMsgAuthor($mid) { $sql = "DELETE FROM `".PM_SENTBOX_TABLE."` WHERE `m_id`='$mid'"; - DataBase::sql_query($sql,'GENERAL','Could not delete message in sentbox'); + DataBase::sql_query($sql,GENERAL,'Could not delete message in sentbox'); } } @@ -66,14 +66,14 @@ class NewMessage $last = DataBase::new_id(PM_INBOX_TABLE); $time = time(); $sql = "INSERT INTO `".PM_INBOX_TABLE."` VALUES ('$last', '$uid', '$name', '$text', '$time', '$unid','0')"; - DataBase::sql_query($sql,'GENERAL','Could not add new message at inbox'); + DataBase::sql_query($sql,GENERAL,'Could not add new message at inbox'); } function AddToSentbox($text, $name, $unid, $uid) { $last=DataBase::new_id(PM_SENTBOX_TABLE); $time = time(); $sql = "INSERT INTO `".PM_SENTBOX_TABLE."` VALUES ('$last', '$uid', '$name', '$text', '$time', '$unid')"; - DataBase::sql_query($sql,'GENERAL','Could not add new message at inbox'); + DataBase::sql_query($sql,GENERAL,'Could not add new message at inbox'); } } ?> diff --git a/includes/classes/class_posting.php b/includes/classes/class_posting.php index 0bc1a3e..7894be3 100644 --- a/includes/classes/class_posting.php +++ b/includes/classes/class_posting.php @@ -19,7 +19,7 @@ class Post $last = DataBase::new_id(POSTS_TABLE); #read last post in topic $sql = "SELECT * FROM ".POSTS_TABLE." WHERE t_id='$tid' ORDER BY tp_id DESC LIMIT 1;"; - $query = DataBase::sql_query($sql,'GENERAL','Could not last post information.'); + $query = DataBase::sql_query($sql,GENERAL,'Could not last post information.'); $result = DataBase::fetch($query); $forum = $result['f_id'];//forum id $moderate = Forum::ForumInformation($forum,'moderate'); @@ -29,20 +29,20 @@ class Post $time = time(); #add new post $sql = "INSERT INTO `".POSTS_TABLE."` VALUES ('$last','$tid', '$uid', '$post', '".$_SERVER['HTTP_USER_AGENT']."', '$time', '$tpid', '$forum','$moderate','".$_SERVER['REMOTE_ADDR']."')"; - $query = DataBase::sql_query($sql,'GENERAL','Could not add new post.'); + $query = DataBase::sql_query($sql,GENERAL,'Could not add new post.'); $result=User::UserInformation($uid,'posts'); $result = $result+1; - $sql="UPDATE ".TOPICS_TABLE." SET lastpost_time='$time' WHERE t_id='$tid' "; - $query = DataBase::sql_query($sql,'GENERAL','Could not update user information.'); + TriggerStats($forum, 1); + TriggerStats($tid, 2); $sql="UPDATE ".USERS_TABLE." SET posts='$result' WHERE u_id='$uid' "; - $query = DataBase::sql_query($sql,'GENERAL','Could not update user information.'); + $query = DataBase::sql_query($sql,GENERAL,'Could not update user information.'); return $tpid; } function EditPost($postid, $text) { $sql = "UPDATE `".POSTS_TABLE."` SET text='$text' WHERE `p_id`='$postid';"; - $query = DataBase::sql_query($sql,'GENERAL','Could not edit post.'); + $query = DataBase::sql_query($sql,GENERAL,'Could not edit post.'); } function NewTopic($posttext, $ntopic, $forum, $uid, $sticky) @@ -51,21 +51,25 @@ class Post $moderate = Forum::ForumInformation($forum,'moderate'); $time = time(); $lastt=DataBase::new_id(TOPICS_TABLE); - $sql = "INSERT INTO ".TOPICS_TABLE." VALUES ('$lastt', '$forum', '0', '$sticky', '$ntopic', '$uid','$time')"; - $query = DataBase::sql_query($sql,'GENERAL','Could not add new topic'); + $sql = "INSERT INTO ".TOPICS_TABLE." VALUES ('$lastt', '$forum', '0', '$sticky', '$ntopic', '$uid','$time', '', '')"; + $query = DataBase::sql_query($sql,GENERAL,'Could not add new topic'); //add post //select last post $last = DataBase::new_id(POSTS_TABLE); //add post $sql = "INSERT INTO ".POSTS_TABLE." VALUES ('$last','$lastt', '$uid', '$posttext','".$_SERVER['HTTP_USER_AGENT']."', '$time', '1', '$forum', '$moderate','".$_SERVER['REMOTE_ADDR']."');"; - $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';"; - $query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information.'); + $query = DataBase::sql_query($sql,GENERAL,'Could not obtain user information.'); $result = DataBase::fetch($query); $result = $result['posts']; $result = $result+1; + + TriggerStats($forum, 1); + TriggerStats($lastt, 2); + $sql = "UPDATE ".USERS_TABLE." SET posts='$result' WHERE u_id='$uid' "; - $query = DataBase::sql_query($sql,'GENERAL','Could not update user information.'); + $query = DataBase::sql_query($sql,GENERAL,'Could not update user information.'); return $lastt; } @@ -74,7 +78,7 @@ class Post $text =''; $result=''; $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; while($smile = DataBase::fetch($query)) { @@ -98,7 +102,7 @@ class Post function SmilesReplace($text) { $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; while($result = DataBase::fetch($query)) { diff --git a/includes/classes/class_topic.php b/includes/classes/class_topic.php index 99b07be..5d6b0bd 100644 --- a/includes/classes/class_topic.php +++ b/includes/classes/class_topic.php @@ -16,13 +16,15 @@ class Topic function LastPostInTopic($topic) { global $lng; - global $lastpost; + global $last_post; global $forum_config; global $userdata; - $id = $lastpost[$topic]['tp_id']; - $userid = $lastpost[$topic]['u_id']; - $un = $lastpost[$topic]['user_nick']; - $rank = $lastpost[$topic]['user_rank']; + + $id = $last_post[0]; + $userid = $last_post[1]; + $un = $last_post[4]; + $rank = $last_post[3]; + switch($rank) { case '0': @@ -58,18 +60,18 @@ class Topic { $page=''; } - return '

'.GenerateTime($lastpost[$topic]['time']).'
Post #'.$id.': '.$user_color_name.'

'; + return '

'.GenerateTime($last_post[2]).'
Post #'.$id.': '.$user_color_name.'

'; } function LastPostImg() { - global $lastpost; + global $last_post; global $record; global $default_skin; $time = time()-129600; if ($_SESSION['uid']>0) { - if ($lastpost[$record['t_id']]['time']>$time) + if ($last_post[2]>$time) { return 'folder_new_posts'; } @@ -115,7 +117,7 @@ class Topic function TopicInformation($tid, $mode) { $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 = DataBase::fetch($query); $result = $result[$mode]; return $result; @@ -124,7 +126,7 @@ class Topic function PostInformation($pid, $mode) { $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 = DataBase::fetch($query); $result = $result[$mode]; return $result; diff --git a/includes/classes/class_user.php b/includes/classes/class_user.php index f541403..35661cc 100644 --- a/includes/classes/class_user.php +++ b/includes/classes/class_user.php @@ -24,7 +24,7 @@ class User function UserInformation($uid, $inf) { $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 = DataBase::fetch($query); $result = $result[$inf]; return $result; @@ -33,7 +33,7 @@ class User function UserIdByNick($nick) { $sql = "SELECT * FROM `".USERS_TABLE."` WHERE `nick`='$nick';"; - $result = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain user information.')); + $result = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain user information.')); $result = $result['u_id']; /*if ($result=='') { @@ -46,13 +46,13 @@ class User { $last= DataBase::new_id(USERS_GROUP_TABLE); $sql = "INSERT INTO `".USERS_GROUP_TABLE."` VALUES ('$last','$uid', '$gid')"; - DataBase::sql_query($sql,'GENERAL','Could not add user to group.'); + DataBase::sql_query($sql,GENERAL,'Could not add user to group.'); } function DeleteFromGroup($uid, $gid) { $sql = "DELETE FROM `".USERS_GROUP_TABLE."` WHERE `u_id`='$uid' AND `g_id`='$gid'"; - DataBase::sql_query($sql,'GENERAL','Could not delete user for group.'); + DataBase::sql_query($sql,GENERAL,'Could not delete user for group.'); } function LogedAs($sid, $uid) @@ -119,7 +119,7 @@ class User if ($uid>0) { $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 = DataBase::fetch($query); $rank = $result['rank']; if (($rank=='1') or ($rank=='2')) @@ -156,7 +156,7 @@ class User `view_shoutbox` = '$allow_shoutbox', `limit_users` = '$limit_users' WHERE `u_id` ='$uid' LIMIT 1 ;"; - DataBase::sql_query($sql,'CRITICAL','Could not update user information'); + DataBase::sql_query($sql,CRITICAL,'Could not update user information'); } function UpdateAdminPools($uid, $posts, $rank, $active, $nick) @@ -167,7 +167,7 @@ class User `active` = '$active', `nick` = '$nick' WHERE `u_id` ='$uid' LIMIT 1 ;"; - DataBase::sql_query($sql,'CRITICAL','Could not update user information'); + DataBase::sql_query($sql,CRITICAL,'Could not update user information'); } function UpdatePassword($uid, $pass) @@ -175,7 +175,7 @@ class User $sql ="UPDATE `".USERS_TABLE."` SET `pass` = '$pass' WHERE `u_id` ='$uid' LIMIT 1 ;"; - DataBase::sql_query($sql,'CRITICAL','Could not update user information'); + DataBase::sql_query($sql,CRITICAL,'Could not update user information'); } function CreateProfile($nick, $pass, $email, $gg, $allow_gg, $allow_email, $allow_qr, $sig, $av, $interests) @@ -185,7 +185,7 @@ class User $time = time(); $sql = "INSERT INTO ".USERS_TABLE." VALUES ('$last', '$nick', '$pass', '$email', '0', '$time', '0', '$gg', '$allow_gg', '$allow_email', '$allow_qr', '".$forum_config['view_shoutbox']."', '".$forum_config['defaultskin']."', '".$forum_config['defaultlang']."','".$forum_config['limit_tpid']."', '".$forum_config['limit_ftid']."', '".$forum_config['limit_users']."', '$sig', '$av', '1','0','$interests');"; - DataBase::sql_query($sql,'CRITICAL','Could not create new user'); + DataBase::sql_query($sql,CRITICAL,'Could not create new user'); } function UserMsgs() @@ -194,7 +194,7 @@ class User if($uid>0) { $sql = "SELECT count(*) as `m_id` FROM ".PM_INBOX_TABLE." WHERE `u_id`='$uid' AND `read`='0'"; - $result = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain amounts PM of User.')); + $result = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain amounts PM of User.')); $result = $result['m_id']; if ($result>0) { @@ -210,14 +210,14 @@ class User function UserAddWarn($uid, $value, $motive) { $sql = "INSERT INTO `".WARNINGS_TABLE."` ( `w_id` , `u_id` , `value` , `motive` ) VALUES('','$uid','$value','$motive');"; - DataBase::sql_query($sql,'GENERAL','Could not add new warn.'); + DataBase::sql_query($sql,GENERAL,'Could not add new warn.'); if (User::UserLevelWarns($uid)==100) { $ban_ip = '0.0.0.0'; $ban_uid = $uid; $ban_motive = $lng['warns_ban']; $sql = "INSERT INTO ".BANLIST_TABLE." VALUES ('', '$ban_uid', '$ban_ip', '$ban_motive')"; - DataBase::sql_query($sql,'GENERAL','Could not update add ban.'); + DataBase::sql_query($sql,GENERAL,'Could not update add ban.'); } } } diff --git a/includes/classes/secure.php b/includes/classes/secure.php index d26759d..3f3dbd0 100644 --- a/includes/classes/secure.php +++ b/includes/classes/secure.php @@ -17,7 +17,7 @@ class Secure { global $lng; $sql = "SELECT * FROM ".FORUMS_TABLE." WHERE f_id='$fid'"; - $query = DataBase::sql_query($sql,'GENERAL','Could not obtain forum information.'); + $query = DataBase::sql_query($sql,GENERAL,'Could not obtain forum information.'); $result = DataBase::fetch($query); $result = $result['f_id']; if ($result=='') @@ -31,7 +31,7 @@ class Secure if ($forum_config['use_censorlist']) { $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 = DataBase::fetch($query)) { $text = str_replace($word['word'],'[censored]', $text); @@ -68,7 +68,7 @@ class Secure { global $lng; $sql = "SELECT * FROM ".PM_INBOX_TABLE." WHERE m_id='$mid'"; - $query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information.'); + $query = DataBase::sql_query($sql,GENERAL,'Could not obtain user information.'); $result = DataBase::fetch($query); $result = $result['m_id']; if ($result=='') @@ -80,7 +80,7 @@ class Secure { global $lng; $sql = "SELECT * FROM ".PM_SENTBOX_TABLE." WHERE m_id='$mid'"; - $query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information.'); + $query = DataBase::sql_query($sql,GENERAL,'Could not obtain user information.'); $result = DataBase::fetch($query); $result = $result['u_n_id']; if ($result!=$_SESSION['uid']) @@ -92,7 +92,7 @@ class Secure { global $lng; $sql = "SELECT * FROM ".PM_INBOX_TABLE." WHERE m_id='$mid'"; - $result = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain user information.')); + $result = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain user information.')); $result = $result['u_id']; if ($result!=$_SESSION['uid']) { @@ -103,7 +103,7 @@ class Secure { global $lng; $sql = "SELECT * FROM ".PM_SENTBOX_TABLE." WHERE m_id='$mid'"; - $result = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain user information.')); + $result = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain user information.')); $result = $result['m_id']; if ($result=='') { @@ -114,7 +114,7 @@ class Secure { global $lng; $sql = "SELECT * FROM `".TOPICS_TABLE."` WHERE `t_id`='$tid'"; - $query = DataBase::sql_query($sql,'GENERAL','Could not obtain topic information.'); + $query = DataBase::sql_query($sql,GENERAL,'Could not obtain topic information.'); $result = DataBase::fetch($query); $result = $result['t_id']; if ($result=='') @@ -126,7 +126,7 @@ class Secure { global $lng; $sql = "SELECT * FROM ".POSTS_TABLE." WHERE p_id='$pid'"; - $query = DataBase::sql_query($sql,'GENERAL','Could not obtain topic information.'); + $query = DataBase::sql_query($sql,GENERAL,'Could not obtain topic information.'); $result = DataBase::fetch($query); $result = $result['p_id']; if ($result=='') @@ -138,7 +138,7 @@ class Secure { global $lng; $sql = "SELECT * FROM ".USERS_TABLE." WHERE u_id='$uid'"; - $result = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain user information.')); + $result = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain user information.')); $result = $result['u_id']; if (($result=='') or ($result=='-1')) { @@ -149,7 +149,7 @@ class Secure { global $lng; $sql = "SELECT `g_id` FROM `".GROUPS_TABLE."` WHERE g_id='$gid'"; - $result = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain group information.')); + $result = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain group information.')); $result = $result['g_id']; if ($result=='') { @@ -170,10 +170,10 @@ class Secure { global $lng; $sql = "SELECT `f_id`,`lock` FROM `".TOPICS_TABLE."` WHERE `t_id`='$tid'"; - $result = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain topic information')); + $result = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain topic information')); $fid = $result['f_id']; $sql2 = "SELECT `lock` FROM `".FORUMS_TABLE."` WHERE `f_id`='$fid'"; - $result2 = DataBase::fetch(DataBase::sql_query($sql2,'GENERAL','Could not obtain forum information')); + $result2 = DataBase::fetch(DataBase::sql_query($sql2,GENERAL,'Could not obtain forum information')); if (($result['lock']=='1') or ($result2['lock']=='1')) { message_forum($lng['no_posting_topic_locked'],'topic.php?t='.$tid); @@ -183,7 +183,7 @@ class Secure { global $lng; $sql = "SELECT `lock` FROM `".FORUMS_TABLE."` WHERE `f_id`='$fid'"; - $result = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain forum information')); + $result = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain forum information')); if ($result['lock']=='1') { message_forum($lng['no_posting_forum_locked'],'forum.php?f='.$fid); diff --git a/includes/constants.php b/includes/constants.php index 9302402..4150ce1 100644 --- a/includes/constants.php +++ b/includes/constants.php @@ -44,25 +44,6 @@ define('FOOTER_TEXT','Powered by µForum $value) - { - $arr[$key] = $value; - $ret++; - } - } - else - { - $arr[$arg] = ""; - } - } - return $arr; -} +define('CRITICAL', 'Critical Error'); +define('GENERAL', 'General Error'); ?> diff --git a/includes/db.php b/includes/db.php index 01bd14e..87c614e 100644 --- a/includes/db.php +++ b/includes/db.php @@ -23,16 +23,16 @@ class DataBase $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); + 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); + 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); + message_die(CRITICAL,' Could not select database.', $db->error); } } @@ -59,12 +59,20 @@ class DataBase function fetch($query) { - return $query->fetch_array(); + return $query->fetch_assoc(); } function num_rows($query) { - return $query->num_rows; + // return $query->num_rows; + if ($query===true || $query===false) + { + return 0; + } + else + { + return mysqli_num_rows($query); + } } function new_id($table) @@ -91,7 +99,7 @@ class DataBase case WARNINGS_TABLE: { $id = 'w_id'; break; } } $sql = "SELECT `$id` FROM $table ORDER BY `$id` DESC LIMIT 1"; - $return_id = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Error with obtain last id.
File: db.php, Line: '.__LINE__)); + $return_id = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Error with obtain last id.
File: db.php, Line: '.__LINE__)); $return_id = $return_id[$id]; $return_id = $return_id+1; return $return_id; diff --git a/includes/emailer.php b/includes/emailer.php index e3b5e36..27bf3ab 100644 --- a/includes/emailer.php +++ b/includes/emailer.php @@ -38,7 +38,7 @@ function SendEmail($email, $title, $content) #send email - do it! if ( !mail($email, $title, $email_content, $email_headers )) { - message_die('GENERAL','Could not send email from: '.$email.'. sorry :(',''); + message_die(GENERAL,'Could not send email from: '.$email.'. sorry :(',''); } } @@ -78,7 +78,7 @@ function SendForgotPassEmail($newpass) function SendMassEmail($title,$content) { $sql = "SELECT `email`,`u_id` FROM ".USERS_TABLE." WHERE `u_id`>0"; - $query = DataBase::sql_query($sql,'CRITICAL','Could not read users table'); + $query = DataBase::sql_query($sql,CRITICAL,'Could not read users table'); while($item = DataBase::fetch($query)) { SendEmail($item['email'], $title, $content); diff --git a/includes/errors.php b/includes/errors.php index 2b4a679..cc4d561 100644 --- a/includes/errors.php +++ b/includes/errors.php @@ -19,8 +19,8 @@ function message_die($type, $msm, $sql) diff --git a/includes/misc_functions.php b/includes/misc_functions.php index 8f13df4..75a43bd 100644 --- a/includes/misc_functions.php +++ b/includes/misc_functions.php @@ -19,7 +19,7 @@ function SetCounter() { setcookie('forum_visited','1'); $visit_count = $forum_config['forum_counter'] +1; - DataBase::sql_query("UPDATE `".CONFIG_TABLE."` SET `value`='$visit_count' WHERE `name`='forum_counter'",'GENERAL','Could not update forum counter'); + DataBase::sql_query("UPDATE `".CONFIG_TABLE."` SET `value`='$visit_count' WHERE `name`='forum_counter'",GENERAL,'Could not update forum counter'); } else { @@ -201,7 +201,7 @@ function AddSkins() global $forum_config; global $default_skin; $all=''; - $query = DataBase::sql_query("SELECT `name`, `s_id` FROM `".SKINS_TABLE."`",'GENERAL','Could not obtain skins information'); + $query = DataBase::sql_query("SELECT `name`, `s_id` FROM `".SKINS_TABLE."`",GENERAL,'Could not obtain skins information'); while($t = DataBase::fetch($query)) { @@ -277,7 +277,7 @@ function IfModGroup($guid) function TotalPosts() { $sql = "SELECT count(*) as `p_id` FROM ".POSTS_TABLE.""; - $query = DataBase::sql_query($sql,'GENERAL','Could not obtain total posts information'); + $query = DataBase::sql_query($sql,GENERAL,'Could not obtain total posts information'); $result = DataBase::fetch($query); $result = $result['p_id']; @@ -338,13 +338,15 @@ function ViewSkinName() $result = $forum_config['defaultskin']; } $sql = "SELECT * FROM `".SKINS_TABLE."` WHERE `s_id`='$result'"; - $result = DataBase::fetch(DataBase::sql_query($sql,'CRITICAL','Could not obtain skin information.')); + $result = DataBase::fetch(DataBase::sql_query($sql,CRITICAL,'Could not obtain skin information.')); return $result['name']; } function GenerateLastPost($id, $type) { + $last_post = ''; + switch ($type) { /** field lastpost in forum format @@ -352,8 +354,8 @@ function GenerateLastPost($id, $type) */ case 1: //for forum { - $sql = "SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".* FROM ".POSTS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".POSTS_TABLE.".u_id = ".USERS_TABLE.".u_id WHERE `f_id`='$id' ORDER BY `ptime` LIMIT 1"; - $query = DataBase::sql_query($sql,'GENERAL','Could not obtain last post in forum', true); + $sql = "SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".* FROM ".POSTS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".POSTS_TABLE.".u_id = ".USERS_TABLE.".u_id WHERE `f_id`='$id' ORDER BY `ptime` DESC LIMIT 1"; + $query = DataBase::sql_query($sql,GENERAL,'Could not obtain last post in forum', true); $post_count = DataBase::num_rows($query); $result = DataBase::fetch($query); @@ -372,7 +374,7 @@ function GenerateLastPost($id, $type) $sql = "UPDATE ".FORUMS_TABLE." SET `lastpost`='$last_post' WHERE `f_id`='$id'"; - DataBase::sql_query($sql,'GENERAL','Could not update lastpost in forum'); + DataBase::sql_query($sql,GENERAL,'Could not update lastpost in forum'); break; } @@ -381,8 +383,8 @@ function GenerateLastPost($id, $type) */ 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'); + $sql = "SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".* FROM ".POSTS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".u_id = ".POSTS_TABLE.".u_id WHERE `t_id`='$id' ORDER BY `ptime` DESC LIMIT 1"; + $query = DataBase::sql_query($sql,GENERAL, 'Could not obtain amout of posts in topic'); $result = DataBase::fetch($query); $last_post .= $result['tp_id']; @@ -396,60 +398,93 @@ function GenerateLastPost($id, $type) $last_post .= $result['nick']; $sql = "UPDATE ".TOPICS_TABLE." SET + `lastpost_time`='".$result['ptime']."', `lastpost`='$last_post' WHERE `t_id`='$id'"; - DataBase::sql_query($sql,'GENERAL','Could not update lastpost in topic'); + DataBase::sql_query($sql,GENERAL,'Could not update lastpost in topic'); break; } } } 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); + $sql = "SELECT COUNT(p_id) AS cnt, `f_id` FROM ".POSTS_TABLE." WHERE `f_id`='$id'"; + $query = DataBase::sql_query($sql,GENERAL,'Could not obtain posts in forum', true); $post_count = DataBase::num_rows($query); $result = DataBase::fetch($query); - $posts = $result['count']; + $posts = $result['cnt']; $sql = "UPDATE ".FORUMS_TABLE." SET - `posts`='$last_post' + `posts`='$posts' WHERE `f_id`='$id'"; - DataBase::sql_query($sql,'GENERAL','Could not update lastpost in forum'); + DataBase::sql_query($sql,GENERAL,'Could not update lastpost in forum'); break; } - /** 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'); + $sql = "SELECT COUNT(p_id) AS cnt, t_id FROM ".POSTS_TABLE." WHERE `t_id`='$id'"; + $query = DataBase::sql_query($sql,GENERAL, 'Could not obtain posts count in topic'); $result = DataBase::fetch($query); - $last_post .= $result['tp_id']; - $last_post .= ':'; - $last_post .= $result['u_id']; - $last_post .= ':'; - $last_post .= $result['ptime']; - $last_post .= ':'; - $last_post .= $result['rank']; - $last_post .= ':'; - $last_post .= $result['nick']; + $posts = $result['cnt']; $sql = "UPDATE ".TOPICS_TABLE." SET - `lastpost`='$last_post' + `posts`='$posts' WHERE `t_id`='$id'"; - DataBase::sql_query($sql,'GENERAL','Could not update lastpost in topic'); + DataBase::sql_query($sql,GENERAL,'Could not update post count in topic'); break; } } } + +function UpdateConfigPosts() +{ + $sql = "SELECT count(`p_id`) AS `count` FROM ".POSTS_TABLE; + $query = DataBase::sql_query($sql, GENERAL, 'Could not obtain posts count.'); + $result = DataBase::fetch($query); + $cnt = $result['count']; + + unset ($sql, $query, $result); + + $sql = "UPDATE ".CONFIG_TABLE." SET + `value`='$cnt' + WHERE `name`='posts'"; + DataBase::sql_query($sql, GENERAL, 'Could not update posts count in config table'); +} +function TriggerStats($id, $type) +{ + GeneratePosts($id, $type); + GenerateLastPost($id, $type); + UpdateConfigPosts(); +} + +function array_push_associative(&$arr) +{ + $ret = ''; + $args = func_get_args(); + foreach ($args as $arg) + { + if (is_array($arg)) + { + foreach ($arg as $key => $value) + { + $arr[$key] = $value; + $ret++; + } + } + else + { + $arr[$arg] = ""; + } + } + return $arr; +} ?> diff --git a/includes/pms/pms_folder.php b/includes/pms/pms_folder.php index 07da0e7..2526ca3 100644 --- a/includes/pms/pms_folder.php +++ b/includes/pms/pms_folder.php @@ -4,7 +4,7 @@ //private messsages cache - v1.0 Alpha 2 // $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']= DataBase::num_rows($query); while($result = DataBase::fetch($query)) @@ -52,7 +52,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 = DataBase::num_rows($query); if ($count==0) diff --git a/includes/pms/pms_view.php b/includes/pms/pms_view.php index 8eeadeb..a5ca2a3 100644 --- a/includes/pms/pms_view.php +++ b/includes/pms/pms_view.php @@ -2,7 +2,7 @@ //smiles cache $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; while($result = DataBase::fetch($query)) { @@ -33,7 +33,7 @@ switch($_GET['submode']) break; } } -$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain messages information'); +$query = DataBase::sql_query($sql,CRITICAL,'Could not obtain messages information'); $result = DataBase::fetch($query); //if message exist.... if ($result['m_id']=='') @@ -63,12 +63,12 @@ switch($_GET['submode']) } if ($_GET['submode']=='user') { - DataBase::sql_query("UPDATE ".PM_INBOX_TABLE." SET `read`='1' WHERE `m_id`='$mid'", 'GENERAL', 'Could not update message.'); + DataBase::sql_query("UPDATE ".PM_INBOX_TABLE." SET `read`='1' WHERE `m_id`='$mid'", GENERAL, 'Could not update message.'); } $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 = DataBase::fetch($query); $folder = ($_GET['submode']=='author') ? ''.$lng['sentbox'].'' : ''.$lng['inbox'].''; diff --git a/includes/pms/pms_write.php b/includes/pms/pms_write.php index 4db6e39..617d6fa 100644 --- a/includes/pms/pms_write.php +++ b/includes/pms/pms_write.php @@ -8,7 +8,7 @@ if ((isset($_POST['textedit'])) and (isset($_POST['nmsg'])) and (isset($_POST['u { $nick = strip_tags($_POST['username']); $sql = "SELECT * FROM `".USERS_TABLE."` WHERE `nick`='$nick'"; - $result = DataBase::fetch(DataBase::sql_query($sql, 'CRITICAL','Could not obtain user information.')); + $result = DataBase::fetch(DataBase::sql_query($sql, CRITICAL,'Could not obtain user information.')); if ($result['u_id']!='') { $_POST['textedit'] = Secure::TagsReplace($_POST['textedit']); diff --git a/includes/sessions.php b/includes/sessions.php index e3e1c62..a884292 100644 --- a/includes/sessions.php +++ b/includes/sessions.php @@ -58,7 +58,7 @@ function SessRegister() SessDelete($uid); $time = time(); $sql = "INSERT INTO ".SESSIONS_TABLE." VALUES ('', '".$_COOKIE[SESS_NAME]."','$uid','$time')"; - $query = DataBase::sql_query($sql,'GENERAL','Could not add new session.',true); + $query = DataBase::sql_query($sql,GENERAL,'Could not add new session.',true); if (DataBase::num_rows($query)>0) { $result = DataBase::fetch(); @@ -75,7 +75,7 @@ function SessDeleteOld() { $time = time(); $sql = "DELETE FROM ".SESSIONS_TABLE." WHERE time+129600<$time;"; - DataBase::sql_query($sql, 'GENERAL','Could not delete session',true); + DataBase::sql_query($sql, GENERAL,'Could not delete session',true); } function SessDelInvalid() @@ -83,7 +83,7 @@ function SessDelInvalid() if ($_SESSION['uid']>0) { $sql = "SELECT `session_id`, `u_id` FROM ".SESSIONS_TABLE." WHERE `u_id`='".$_SESSION['uid']."'"; - $query = DataBase::sql_query($sql,'GENERAL','Could not obtain session information',true); + $query = DataBase::sql_query($sql,GENERAL,'Could not obtain session information',true); $result = DataBase::fetch($query); $result = $result['session_id']; if ($_COOKIE[SESS_NAME]!=$result) @@ -98,7 +98,7 @@ function SessDelete($uid) { $time = time(); $sql = "DELETE FROM ".SESSIONS_TABLE." WHERE u_id='$uid'"; - $query = DataBase::sql_query($sql, 'GENERAL','Could not delete session',true); + $query = DataBase::sql_query($sql, GENERAL,'Could not delete session',true); if (DataBase::num_rows($query)>0) { $result = DataBase::fetch($query); @@ -115,7 +115,7 @@ function SessView() $name = ''; $time = time(); $sql = "SELECT ".SESSIONS_TABLE.".*, ".USERS_TABLE.".*, ".SESSIONS_TABLE.".u_id AS u_id FROM ".SESSIONS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".SESSIONS_TABLE.".u_id = ".USERS_TABLE.".u_id WHERE time+1250>$time;"; - $query = DataBase::sql_query($sql, 'GENERAL','Could not obtain sessions information.'); + $query = DataBase::sql_query($sql, GENERAL,'Could not obtain sessions information.'); if (DataBase::num_rows($query)>0) { while($result = DataBase::fetch($query)) diff --git a/index.php b/index.php index 22809b5..1f8c809 100644 --- a/index.php +++ b/index.php @@ -54,7 +54,7 @@ include('./skins/'.$default_skin.'/index_body.tpl'); // $isset_forum = array(); $sql = "SELECT * FROM `".CATS_TABLE."` ORDER BY `sort`"; -$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain categories information.'); +$query = DataBase::sql_query($sql,CRITICAL,'Could not obtain categories information.'); while($result = DataBase::fetch($query)) { $skin = array( @@ -93,7 +93,7 @@ $skin =array( 'last_user' => $lng['last_user'] . ': ' . User::LastUser() . '', 'stat' => $lng['statistics'], 'showlastposts'=>$lng['showlastposts'], -'total_posts'=> str_replace('%x%', $post_count ,$lng['total_posts']), +'total_posts'=> str_replace('%x%', $forum_config['posts'] ,$lng['total_posts']), 'lforum_counter'=> str_replace('%x%',$visit_count, $lng['forum_counter']), 'logged_users' => str_replace('%x%', $sess[1] , $lng['logged_users']), 'group_users' => $lng['users_groups'], diff --git a/install/config.php b/install1/config.php similarity index 100% rename from install/config.php rename to install1/config.php diff --git a/install/functions_add.php b/install1/functions_add.php similarity index 93% rename from install/functions_add.php rename to install1/functions_add.php index e910114..bf98bad 100644 --- a/install/functions_add.php +++ b/install1/functions_add.php @@ -2,7 +2,7 @@ /** * @package uForum * @file install/functions_add.php -* @version $Id$3:26 +* @version $Id$ * @copyright 2009(c) PioDer * @link http://pioder.gim2przemysl.int.pl// * @license GNU GPL v3 diff --git a/install/index.php b/install1/index.php similarity index 90% rename from install/index.php rename to install1/index.php index a769680..2150833 100644 --- a/install/index.php +++ b/install1/index.php @@ -190,10 +190,10 @@ switch($_GET['page']) $config_file = str_replace('%pass%',strip_tags($_POST['mysql_pass']),$config_file); $config_file = str_replace('%dbname%',strip_tags($_POST['database']),$config_file); $config_file = str_replace('%dbprefix%',strip_tags($_POST['mysql_prefix']),$config_file); - $connect = @mysql_connect($_POST['mysql_host'],$_POST['mysql_user'],$_POST['mysql_pass']) or message_die('GENERAL','Could not connect to database server. Error with installation!',@mysql_error()); - @fwrite(@fopen('../config.php','w'),$config_file) or message_die('GENERAL','Could not write config file. Error with installation!',''); + $connect = @mysql_connect($_POST['mysql_host'],$_POST['mysql_user'],$_POST['mysql_pass']) or message_die(GENERAL,'Could not connect to database server. Error with installation!',@mysql_error()); + @fwrite(@fopen('../config.php','w'),$config_file) or message_die(GENERAL,'Could not write config file. Error with installation!',''); @mysql_query("SET NAMES 'utf8'",$connect); - @mysql_select_db($_POST['database'],$connect) or message_die('GENERAL','Could not connect to database. Error with installation!',@mysql_error()); + @mysql_select_db($_POST['database'],$connect) or message_die(GENERAL,'Could not connect to database. Error with installation!',@mysql_error()); include('./../includes/sql_parse.php'); $sql = @fread(@fopen('uf_tables.sql','r'),@filesize('uf_tables.sql')); $sql = preg_replace('/uf_/', $_POST['mysql_prefix'], $sql); @@ -203,9 +203,9 @@ switch($_GET['page']) { DataBase::sql_query($sql[$i],'ERROR','Error of SQL Query: '.$sql[$i].' Error with install script!'); } - DataBase::sql_query("UPDATE `".$_POST['mysql_prefix']."config` SET `value`='".time()."' WHERE `name`='date_install'",'GENERAL','Could not update date install information'); + DataBase::sql_query("UPDATE `".$_POST['mysql_prefix']."config` SET `value`='".time()."' WHERE `name`='date_install'",GENERAL,'Could not update date install information'); $patch = substr('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'],0 ,-strlen('install/index.php?page=step4')); - DataBase::sql_query("UPDATE `".$_POST['mysql_prefix']."config` SET `value`='".$patch."' WHERE `name`='forumpatch'",'GENERAL','Could not update date install information'); + DataBase::sql_query("UPDATE `".$_POST['mysql_prefix']."config` SET `value`='".$patch."' WHERE `name`='forumpatch'",GENERAL,'Could not update date install information'); header('Location: index.php?page=step5'); @@ -250,11 +250,11 @@ switch($_GET['page']) `regdate`='".time()."', `lastvisit`='".time()."' WHERE `u_id`='1';"; - DataBase::sql_query($sql,'CRITICAL','Could not update user. Error with install script!'); + DataBase::sql_query($sql,CRITICAL,'Could not update user. Error with install script!'); $sql = "UPDATE `".POSTS_TABLE."` SET `ptime`='".time()."' WHERE `p_id`='1'"; - DataBase::sql_query($sql,'CRITICAL','Could not update post. Error with install script!'); + DataBase::sql_query($sql,CRITICAL,'Could not update post. Error with install script!'); $sql = "UPDATE `".TOPICS_TABLE."` SET `lastpost_time`='".time()."' WHERE `t_id`='1'"; - DataBase::sql_query($sql,'CRITICAL','Could not update topic. Error with install script!'); + DataBase::sql_query($sql,CRITICAL,'Could not update topic. Error with install script!'); header('Location: index.php?page=step7'); } else @@ -290,7 +290,7 @@ switch($_GET['page']) $open = @fopen('../config.php','a+'); $config_file = @fread($open,@filesize('../config.php')); $config_file = str_replace('false','true',$config_file); - @fwrite(@fopen('../config.php','w'),$config_file) or message_die('GENERAL','Could not write config file. Error with installation!',''); + @fwrite(@fopen('../config.php','w'),$config_file) or message_die(GENERAL,'Could not write config file. Error with installation!',''); echo $header.'
- DSF v'.VERSION.' - '; - $msg .= ($type='CRITICAL') ? 'CRITICAL ERROR' : 'GENERAL ERROR' ; + µForum v'.VERSION.' - '; + $msg .= $type; $msg .= '
'.$lng['info_2'].'
'; break; } diff --git a/install/licence.html b/install1/licence.html similarity index 100% rename from install/licence.html rename to install1/licence.html diff --git a/install/tpls/index.html b/install1/tpls/index.html similarity index 100% rename from install/tpls/index.html rename to install1/tpls/index.html diff --git a/install/tpls/install_check_script.tpl b/install1/tpls/install_check_script.tpl similarity index 100% rename from install/tpls/install_check_script.tpl rename to install1/tpls/install_check_script.tpl diff --git a/install/tpls/install_step4.tpl b/install1/tpls/install_step4.tpl similarity index 100% rename from install/tpls/install_step4.tpl rename to install1/tpls/install_step4.tpl diff --git a/install/tpls/install_step6.tpl b/install1/tpls/install_step6.tpl similarity index 100% rename from install/tpls/install_step6.tpl rename to install1/tpls/install_step6.tpl diff --git a/install/tpls/install_step8.tpl b/install1/tpls/install_step8.tpl similarity index 100% rename from install/tpls/install_step8.tpl rename to install1/tpls/install_step8.tpl diff --git a/install/tpls/invalidfile_body.tpl b/install1/tpls/invalidfile_body.tpl similarity index 100% rename from install/tpls/invalidfile_body.tpl rename to install1/tpls/invalidfile_body.tpl diff --git a/install/uf_tables.sql b/install1/uf_tables.sql similarity index 100% rename from install/uf_tables.sql rename to install1/uf_tables.sql diff --git a/lngs/Polish/main.php b/lngs/Polish/main.php index d29bde1..17b4bef 100644 --- a/lngs/Polish/main.php +++ b/lngs/Polish/main.php @@ -142,6 +142,7 @@ $lng['sticky']='Przyklejony: '; $lng['visible_of_post']='Kliknij tutaj, aby zatwierdzić post'; $lng['post_moderated']='Ten post nie zostaÅ‚ jeszcze zatwierdzony u moderatora'; $lng['moderated_post_text']='Treść nie zatwierdzonego postu'; +$lng['post'] = 'Post'; // //on private messages.....-------------------------------------------- // diff --git a/login.php b/login.php index 94c2e8d..28f1996 100644 --- a/login.php +++ b/login.php @@ -65,7 +65,7 @@ if (isset($_GET['mode'])) $user = strip_tags(addslashes($_POST['user'])); $pass = md5(strip_tags($_POST['pass'])); $sql = "SELECT `u_id`, `nick`, `pass` FROM `".USERS_TABLE."` WHERE nick='$user'"; - $query = DataBase::sql_query($sql,'GENERAL','Could not obtain user inforamtion'); + $query = DataBase::sql_query($sql,GENERAL,'Could not obtain user inforamtion'); $result = DataBase::fetch($query); $nick = $result['nick']; if ($result['nick']==$user) @@ -76,7 +76,7 @@ if (isset($_GET['mode'])) { $user_id = $result['u_id']; $sql = "DELETE FROM `".SESSIONS_TABLE."` WHERE `u_id`='$user_id'"; - DataBase::sql_query($sql,'GENERAL','Could not delete session.'); + DataBase::sql_query($sql,GENERAL,'Could not delete session.'); if (User::UserInformation($user_id,'active')==0) { SessDelete($_SESSION['uid']); @@ -88,10 +88,10 @@ if (isset($_GET['mode'])) $_SESSION['sessionid']=$ssid; //session register $sql = "INSERT INTO `".SESSIONS_TABLE."` VALUES ('', '".$_COOKIE[SESS_NAME]."','$user_id','".time()."')";//query - DataBase::sql_query($sql,'GENERAL','Could not add new session.');//run query + DataBase::sql_query($sql,GENERAL,'Could not add new session.');//run query //next... $sql = "UPDATE `".USERS_TABLE."` SET lastvisit='".time()."' WHERE u_id='$user_id'";//update lastvisit for user - DataBase::sql_query($sql,'GENERAL','Could not update user lastvisit');//run query + DataBase::sql_query($sql,GENERAL,'Could not update user lastvisit');//run query $msg = $lng['youareloggedas'].': '.$nick.'';// messaage "login as.." $skin['pa_link']=''; $stop = TimeGeneration();//generate generation's time diff --git a/moderate.php b/moderate.php index e127bec..235a9f5 100644 --- a/moderate.php +++ b/moderate.php @@ -48,6 +48,7 @@ switch(trim($_GET['action'])) Secure::topic_exists($tid); $fid = Topic::TopicInformation($tid,'f_id'); Mod::DeleteTopic($tid); + TriggerStats($fid, 1); $stop = TimeGeneration(); message_forum($lng['tdeleted'], 'forum.php?f='.$fid); break; @@ -79,6 +80,7 @@ switch(trim($_GET['action'])) if ($tpid >1) { Mod::DeletePost($pid); + TriggerStats($tid, 2); } $stop = TimeGeneration(); message_forum($lng['pdeleted'],'topic.php?t='.$tid); @@ -109,7 +111,10 @@ switch(trim($_GET['action'])) if (isset($_POST['forum_id'])) { $fid = $_POST['forum_id']; + $f_id = Topic::TopicInformation($tid, 'f_id'); Mod::MoveTopic($tid,$fid); + TriggerStats($fid, 1); + TriggerStats($f_id, 1); message_forum($lng['topic_moved'],'topic.php?t='.$tid); } else diff --git a/posting.php b/posting.php index 1118850..a92ada6 100644 --- a/posting.php +++ b/posting.php @@ -298,7 +298,7 @@ switch(trim($_GET['mode'])) $_POST['textedit']=''; } $sql = "SELECT `lock`, `name`, `f_id` FROM ".FORUMS_TABLE." WHERE `f_id`='".intval($_GET['f'])."'"; - $forum = DataBase::fetch(DataBase::sql_query($sql, 'GENERAL', 'Could not obtain forum information')); + $forum = DataBase::fetch(DataBase::sql_query($sql, GENERAL, 'Could not obtain forum information')); if($forum['name']=='') { message_forum($lng['no_forum'], 'index.php'); diff --git a/register.php b/register.php index ac3699b..882c282 100644 --- a/register.php +++ b/register.php @@ -52,7 +52,7 @@ if ( ereg ("^.+@.+\..+$", $_POST['email'])) if ($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 = DataBase::fetch($query); $result = $result['nick']; if ($result!=$nick) diff --git a/search.php b/search.php index 7a34a53..0a24fac 100644 --- a/search.php +++ b/search.php @@ -30,7 +30,7 @@ SessDelInvalid(); SessRegister(); SessDeleteOld(); $sql = "SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".* FROM ".POSTS_TABLE." LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".u_id = ".POSTS_TABLE.".u_id ORDER BY `ptime`"; -$query = DataBase::sql_query($sql,'GENERAL', 'Could not obtain amout of posts in forum'); +$query = DataBase::sql_query($sql,GENERAL, 'Could not obtain amout of posts in forum'); while($result = DataBase::fetch($query)) { $lastpost[$result['t_id']]['tp_id']=$result['tp_id']; @@ -40,7 +40,7 @@ while($result = DataBase::fetch($query)) $lastpost[$result['t_id']]['user_rank']=$result['rank']; } $sql = "SELECT COUNT(*) as `p_id`, `t_id` FROM ".POSTS_TABLE." GROUP BY `t_id`"; -$query = DataBase::sql_query($sql,'GENERAL', 'Could not obtain amout of posts in forum'); +$query = DataBase::sql_query($sql,GENERAL, 'Could not obtain amout of posts in forum'); while($result = DataBase::fetch($query)) { $count_topic[$result['t_id']]=$result['p_id']; @@ -105,7 +105,7 @@ if ((isset($_POST['keywords'])) || ($_GET['content']=='lastposts') || ($_GET['co if (isset($_GET['u'])) { $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 = ceil($count / $limiter); if ($count==0) @@ -139,7 +139,7 @@ if ((isset($_POST['keywords'])) || ($_GET['content']=='lastposts') || ($_GET['co $like_where .=' OR `text` LIKE \'%'.$keyword[$i].'%\''; } $sql = "SELECT COUNT(".TOPICS_TABLE.".t_id) as `count`, ".POSTS_TABLE.".* FROM ".TOPICS_TABLE." LEFT JOIN ".POSTS_TABLE." ON ".POSTS_TABLE.".t_id = ".TOPICS_TABLE.".t_id WHERE $like_where GROUP BY `t_id`"; - $count = DataBase::fetch(DataBase::sql_query($sql,'GENERAL','Could not obtain count amout of topics')); + $count = DataBase::fetch(DataBase::sql_query($sql,GENERAL,'Could not obtain count amout of topics')); $count = $count['count']; $count = ceil($count / $limiter); if ($count==0) @@ -178,7 +178,7 @@ if ((isset($_POST['keywords'])) || ($_GET['content']=='lastposts') || ($_GET['co $skin = array_push_associative($skin,GenerateHeader($window_title,$navigator_title)); include('./skins/'.$default_skin.'/overall_header.tpl'); include('./skins/'.$default_skin.'/forum_body.tpl'); - $query = DataBase::sql_query($sql,'GENERAL', 'Could not obtain topics information'); + $query = DataBase::sql_query($sql,GENERAL, 'Could not obtain topics information'); $value = DataBase::num_rows($query); if ($value>0) { diff --git a/shoutbox.php b/shoutbox.php index 8bc423e..aaf371f 100644 --- a/shoutbox.php +++ b/shoutbox.php @@ -25,9 +25,9 @@ if (isset($_GET['mode'])) if ((strlen($content)>3) and (strlen($content)<300)) { $sql = "DELETE FROM ".SHOUTBOX_TABLE." WHERE `mtime`<'".(time()-$forum_config['shoutbox_max_time'])."'"; - DataBase::sql_query($sql,'GENERAL','Could not delete old messages'); + DataBase::sql_query($sql,GENERAL,'Could not delete old messages'); $sql = "INSERT INTO ".SHOUTBOX_TABLE." VALUES('','".$_SESSION['uid']."','".$content."','".time()."')"; - DataBase::sql_query($sql,'GENERAL','Could not add shoutbox message'); + DataBase::sql_query($sql,GENERAL,'Could not add shoutbox message'); } } echo ''; @@ -37,7 +37,7 @@ if (isset($_GET['mode'])) { if (isset($_GET['id']) && (RANK>0)) { - DataBase::sql_query("DELETE FROM ".SHOUTBOX_TABLE." WHERE `m_id`='".intval($_GET['id'])."'",'GENERAL','Could not delete shoutbox message'); + DataBase::sql_query("DELETE FROM ".SHOUTBOX_TABLE." WHERE `m_id`='".intval($_GET['id'])."'",GENERAL,'Could not delete shoutbox message'); } break; } @@ -58,7 +58,7 @@ else } $shoutbox_content = ''; $sql = "SELECT ".SHOUTBOX_TABLE.".*, ".USERS_TABLE.".* FROM ".SHOUTBOX_TABLE." LEFT JOIN ".USERS_TABLE." ON ".SHOUTBOX_TABLE.".u_id = ".USERS_TABLE.".u_id ORDER BY `mtime` $desc LIMIT ".$forum_config['shoutbox_max']; -$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain shoutbox information'); +$query = DataBase::sql_query($sql,CRITICAL,'Could not obtain shoutbox information'); while($sb_msg = DataBase::fetch($query)) { $allow_del = (RANK>0) ? 'X ' : ''; diff --git a/skins/subPurple/forum_body.tpl b/skins/subPurple/forum_body.tpl index fadcce1..c11cb4b 100644 --- a/skins/subPurple/forum_body.tpl +++ b/skins/subPurple/forum_body.tpl @@ -6,11 +6,11 @@ - - - + + +
- \ No newline at end of file +
diff --git a/skins/subPurple/images/Thumbs.db b/skins/subPurple/images/Thumbs.db index 8fb3294..893fff9 100644 Binary files a/skins/subPurple/images/Thumbs.db and b/skins/subPurple/images/Thumbs.db differ diff --git a/skins/subPurple/images/delete.gif b/skins/subPurple/images/delete.gif index 28a3f01..3ffd86a 100644 Binary files a/skins/subPurple/images/delete.gif and b/skins/subPurple/images/delete.gif differ diff --git a/skins/subPurple/images/lng_Polish/Thumbs.db b/skins/subPurple/images/lng_Polish/Thumbs.db index 7690644..3428cdb 100644 Binary files a/skins/subPurple/images/lng_Polish/Thumbs.db and b/skins/subPurple/images/lng_Polish/Thumbs.db differ diff --git a/skins/subPurple/images/lock.gif b/skins/subPurple/images/lock.gif index 415e68e..6bd5ef0 100644 Binary files a/skins/subPurple/images/lock.gif and b/skins/subPurple/images/lock.gif differ diff --git a/skins/subPurple/images/move.gif b/skins/subPurple/images/move.gif index 65c6943..9fffc7d 100644 Binary files a/skins/subPurple/images/move.gif and b/skins/subPurple/images/move.gif differ diff --git a/skins/subPurple/images/stick.gif b/skins/subPurple/images/stick.gif index 0b1f0d1..a1073bb 100644 Binary files a/skins/subPurple/images/stick.gif and b/skins/subPurple/images/stick.gif differ diff --git a/skins/subPurple/images/unlock.gif b/skins/subPurple/images/unlock.gif index b8d436a..54ff515 100644 Binary files a/skins/subPurple/images/unlock.gif and b/skins/subPurple/images/unlock.gif differ diff --git a/skins/subPurple/images/unstick.gif b/skins/subPurple/images/unstick.gif index 90a638b..e78a19d 100644 Binary files a/skins/subPurple/images/unstick.gif and b/skins/subPurple/images/unstick.gif differ diff --git a/skins/subPurple/images/wyzz/Thumbs.db b/skins/subPurple/images/wyzz/Thumbs.db index b7dc9ba..de2f00f 100644 Binary files a/skins/subPurple/images/wyzz/Thumbs.db and b/skins/subPurple/images/wyzz/Thumbs.db differ diff --git a/skins/subPurple/post_add_body.tpl b/skins/subPurple/post_add_body.tpl deleted file mode 100644 index c3cb01d..0000000 --- a/skins/subPurple/post_add_body.tpl +++ /dev/null @@ -1,61 +0,0 @@ - - -
- - - - - - - -
Post
- - - - - - - - -0) { if(RANK>0) {?> - - - - - - - - - - - -
-
-


-
-

-
- Post - #
- :
- : online -
- quote
- - - pw
- <?= $skin['ua_system_desc']; ?> <?= $skin['ua_browser_desc']; ?> -
-
- - -
- -
-
- -
: : : :
- 
- diff --git a/skins/subPurple/topic_mod_body.tpl b/skins/subPurple/topic_mod_body.tpl index 6d2516a..54687ab 100644 --- a/skins/subPurple/topic_mod_body.tpl +++ b/skins/subPurple/topic_mod_body.tpl @@ -3,9 +3,9 @@ - delete + delete - move + move diff --git a/skins/subPurple/topic_post_body.tpl b/skins/subPurple/topic_post_body.tpl index bd2dd03..0b36895 100644 --- a/skins/subPurple/topic_post_body.tpl +++ b/skins/subPurple/topic_post_body.tpl @@ -1,10 +1,9 @@ - - + @@ -26,11 +25,11 @@ diff --git a/topic.php b/topic.php index ac5b9f8..beed321 100644 --- a/topic.php +++ b/topic.php @@ -54,7 +54,7 @@ include('./skins/'.$default_skin.'/overall_header.tpl'); include('./skins/'.$default_skin.'/topic_body.tpl'); $sql = "SELECT ".POSTS_TABLE.".*, ".USERS_TABLE.".*, ".USERS_TABLE.".u_id AS user_id,".SESSIONS_TABLE.".* FROM `".POSTS_TABLE."` LEFT JOIN ".USERS_TABLE." ON ".USERS_TABLE.".u_id = ".POSTS_TABLE.".u_id LEFT JOIN ".SESSIONS_TABLE." ON ".SESSIONS_TABLE.".u_id = ".POSTS_TABLE.".u_id WHERE t_id='$tid' ORDER BY tp_id $limit;"; -$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain post information.'); +$query = DataBase::sql_query($sql,CRITICAL,'Could not obtain post information.'); while($item=DataBase::fetch($query)) { $ua = UserAgent($item['user_agent']); @@ -113,6 +113,7 @@ while($item=DataBase::fetch($query)) 'ua_browser_desc'=>$lng['browser'].' '.$ua[3], 'lno'=>$lng['no.'], 'lpinfo'=>$lng['postinfo'], + 'lpost'=>$lng['post'], 'C.delete_post'=>$lng['c_delete_post'] ); //do it! diff --git a/user.php b/user.php index 36d717c..b6fca7e 100644 --- a/user.php +++ b/user.php @@ -31,7 +31,7 @@ SessDeleteOld(); $uid = intval($_GET['id']); //check online for user $sql = "SELECT `s_id`, `u_id`, `time` FROM ".SESSIONS_TABLE." WHERE `u_id`='$uid' AND time+1250>".time()." LIMIT 1"; -$query = DataBase::sql_query($sql, 'GENERAL', 'Could not read user active.'); +$query = DataBase::sql_query($sql, GENERAL, 'Could not read user active.'); $result = DataBase::fetch($query); if ($result['u_id']==$uid) { @@ -44,7 +44,7 @@ else unset($sql, $query, $result); $userwarn = 0; $sql = "SELECT `u_id`,`value` FROM `".WARNINGS_TABLE."` WHERE `u_id`='$uid'"; -$query = DataBase::sql_query($sql,'GENERAL','Could not obtain user warns information'); +$query = DataBase::sql_query($sql,GENERAL,'Could not obtain user warns information'); $result = DataBase::num_rows($query); while ($result = DataBase::fetch($query)) { @@ -60,7 +60,7 @@ while ($result = DataBase::fetch($query)) $userwarn = ($userwarn>0) ? $userwarn*10 : $userwarn; //add skin variables $sql = "SELECT * FROM `".USERS_TABLE."` WHERE u_id='$uid'"; -$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain user information'); +$query = DataBase::sql_query($sql,CRITICAL,'Could not obtain user information'); $user_info = DataBase::fetch($query); if ($user_info['u_id']=='') { diff --git a/users.php b/users.php index c1b4adf..ddad51c 100644 --- a/users.php +++ b/users.php @@ -54,7 +54,7 @@ else $page=1; } $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 = ceil($count / $limiter); if(isset($_GET['page']) && ($_GET['page']>$count)) @@ -189,7 +189,7 @@ switch($_COOKIE['users_sort']) break; } } -$query = DataBase::sql_query($sql,'CRITICAL','Could not obtain user information.'); +$query = DataBase::sql_query($sql,CRITICAL,'Could not obtain user information.'); while($result = DataBase::fetch($query)) { $skin = array( diff --git a/warns.php b/warns.php index ccfcf4b..cceacd9 100644 --- a/warns.php +++ b/warns.php @@ -120,7 +120,7 @@ switch(trim($_GET['mode'])) { $uid = $_GET['id']; $sql = "SELECT `u_id`, `nick` FROM `".USERS_TABLE."` WHERE `u_id`='$uid'"; - $query = DataBase::sql_query($sql,'GENERAL','Could not obtain user information'); + $query = DataBase::sql_query($sql,GENERAL,'Could not obtain user information'); $user = DataBase::fetch($query); if ($user['u_id']=='') { @@ -135,7 +135,7 @@ switch(trim($_GET['mode'])) include('./skins/'.$default_skin.'/overall_header.tpl'); include('./skins/'.$default_skin.'/warns_view_body.tpl'); $sql = "SELECT * FROM `".WARNINGS_TABLE."` WHERE `u_id`='$uid'"; - $query = DataBase::sql_query($sql,'GENERAL','Could not obtain user warns information'); + $query = DataBase::sql_query($sql,GENERAL,'Could not obtain user warns information'); $result = DataBase::num_rows($query); $warns_count = 0; while($item = DataBase::fetch($query))
Post
- quote
- pw
<?= $skin['ua_system_desc']; ?> <?= $skin['ua_browser_desc']; ?>