aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/ucp
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-03-22 17:30:20 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-03-22 17:30:20 +0000
commit1e2ed1bc9f8128d4d252c6761b50216d0b01998e (patch)
treea0f77cfde33df5debf9cc45a1444a8df5135f0fb /phpBB/includes/ucp
parent02239880a55f38828b1f4151fc2d2a658312b98e (diff)
downloadforums-1e2ed1bc9f8128d4d252c6761b50216d0b01998e.tar
forums-1e2ed1bc9f8128d4d252c6761b50216d0b01998e.tar.gz
forums-1e2ed1bc9f8128d4d252c6761b50216d0b01998e.tar.bz2
forums-1e2ed1bc9f8128d4d252c6761b50216d0b01998e.tar.xz
forums-1e2ed1bc9f8128d4d252c6761b50216d0b01998e.zip
adjusting sql_freeresult a bit as well as our error handler (it now prints out if it is because of DEBUG_EXTRA being defined - which is not enabled within the betas/rc's and stable releases).
git-svn-id: file:///svn/phpbb/trunk@5699 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/ucp')
-rw-r--r--phpBB/includes/ucp/ucp_attachments.php4
-rw-r--r--phpBB/includes/ucp/ucp_groups.php3
-rw-r--r--phpBB/includes/ucp/ucp_main.php9
-rw-r--r--phpBB/includes/ucp/ucp_pm.php4
-rw-r--r--phpBB/includes/ucp/ucp_pm_options.php21
5 files changed, 22 insertions, 19 deletions
diff --git a/phpBB/includes/ucp/ucp_attachments.php b/phpBB/includes/ucp/ucp_attachments.php
index d06eb08709..3c3b9c24ad 100644
--- a/phpBB/includes/ucp/ucp_attachments.php
+++ b/phpBB/includes/ucp/ucp_attachments.php
@@ -77,11 +77,11 @@ class ucp_attachments
$order_by = $sort_key_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC');
- $sql = 'SELECT COUNT(*) as num_attachments
+ $sql = 'SELECT COUNT(attach_id) as num_attachments
FROM ' . ATTACHMENTS_TABLE . '
WHERE poster_id = ' . $user->data['user_id'];
$result = $db->sql_query_limit($sql, 1);
- $num_attachments = $db->sql_fetchfield('num_attachments', 0, $result);
+ $num_attachments = $db->sql_fetchfield('num_attachments');
$db->sql_freeresult($result);
$sql = 'SELECT a.*, t.topic_title, p.message_subject as message_title
diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php
index 784fb9efe9..43e4ee1603 100644
--- a/phpBB/includes/ucp/ucp_groups.php
+++ b/phpBB/includes/ucp/ucp_groups.php
@@ -625,8 +625,7 @@ class ucp_groups
WHERE group_id = $group_id
AND group_leader <> 1";
$result = $db->sql_query($sql);
-
- $total_members = (int) $db->sql_fetchfield('total_members', 0, $result);
+ $total_members = (int) $db->sql_fetchfield('total_members');
$db->sql_freeresult($result);
$start = request_var('start', 0);
diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php
index 898103043c..f992d22a15 100644
--- a/phpBB/includes/ucp/ucp_main.php
+++ b/phpBB/includes/ucp/ucp_main.php
@@ -67,7 +67,7 @@ class ucp_main
$sql .= ' AND forum_id NOT IN ( ' . implode(', ', $forum_ary) . ')';
}
$result = $db->sql_query_limit($sql, 1);
- $g_forum_id = (int) $db->sql_fetchfield('forum_id', 0, $result);
+ $g_forum_id = (int) $db->sql_fetchfield('forum_id');
$db->sql_freeresult($result);
$sql = "SELECT t.* $sql_select
@@ -303,7 +303,7 @@ class ucp_main
FROM ' . TOPICS_WATCH_TABLE . '
WHERE user_id = ' . $user->data['user_id'];
$result = $db->sql_query($sql);
- $topics_count = (int) $db->sql_fetchfield('topics_count', 0, $result);
+ $topics_count = (int) $db->sql_fetchfield('topics_count');
$db->sql_freeresult($result);
if ($topics_count)
@@ -451,10 +451,11 @@ class ucp_main
$move_up = request_var('move_up', 0);
$move_down = request_var('move_down', 0);
- $sql = 'SELECT MAX(order_id) as max_order_id FROM ' . BOOKMARKS_TABLE . '
+ $sql = 'SELECT MAX(order_id) as max_order_id
+ FROM ' . BOOKMARKS_TABLE . '
WHERE user_id = ' . $user->data['user_id'];
$result = $db->sql_query($sql);
- $max_order_id = $db->sql_fetchfield('max_order_id', 0, $result);
+ $max_order_id = (int) $db->sql_fetchfield('max_order_id');
$db->sql_freeresult($result);
if ($move_up || $move_down)
diff --git a/phpBB/includes/ucp/ucp_pm.php b/phpBB/includes/ucp/ucp_pm.php
index 7e2fb0a901..530b3493d8 100644
--- a/phpBB/includes/ucp/ucp_pm.php
+++ b/phpBB/includes/ucp/ucp_pm.php
@@ -125,7 +125,7 @@ class ucp_pm
FROM ' . GROUPS_TABLE . '
WHERE group_id = ' . $user->data['group_id'];
$result = $db->sql_query($sql);
- $message_limit = (int) $db->sql_fetchfield('group_message_limit', 0, $result);
+ $message_limit = (int) $db->sql_fetchfield('group_message_limit');
$db->sql_freeresult($result);
$user->data['message_limit'] = (!$message_limit) ? $config['pm_max_msgs'] : $message_limit;
@@ -162,7 +162,7 @@ class ucp_pm
FROM ' . GROUPS_TABLE . '
WHERE group_id = ' . $user->data['group_id'];
$result = $db->sql_query($sql);
- $message_limit = (int) $db->sql_fetchfield('group_message_limit', 0, $result);
+ $message_limit = (int) $db->sql_fetchfield('group_message_limit');
$db->sql_freeresult($result);
$user->data['message_limit'] = (!$message_limit) ? $config['pm_max_msgs'] : $message_limit;
diff --git a/phpBB/includes/ucp/ucp_pm_options.php b/phpBB/includes/ucp/ucp_pm_options.php
index 40f8baba7a..b3f6b02bbe 100644
--- a/phpBB/includes/ucp/ucp_pm_options.php
+++ b/phpBB/includes/ucp/ucp_pm_options.php
@@ -76,12 +76,13 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit
FROM ' . PRIVMSGS_FOLDER_TABLE . '
WHERE user_id = ' . $user->data['user_id'];
$result = $db->sql_query($sql);
-
- if ($db->sql_fetchfield('num_folder', 0, $result) >= $config['pm_max_boxes'])
+ $num_folder = (int) $db->sql_fetchfield('num_folder');
+ $db->sql_freeresult($result);
+
+ if ($num_folder >= $config['pm_max_boxes'])
{
trigger_error('MAX_FOLDER_REACHED');
}
- $db->sql_freeresult($result);
$sql = 'INSERT INTO ' . PRIVMSGS_FOLDER_TABLE . ' ' . $db->sql_build_array('INSERT', array(
'user_id' => (int) $user->data['user_id'], 'folder_name' => $folder_name));
@@ -344,7 +345,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit
WHERE user_id = ' . $user->data['user_id'] . '
AND folder_id = ' . PRIVMSGS_INBOX;
$result = $db->sql_query($sql);
- $num_messages = $db->sql_fetchfield('num_messages', 0, $result);
+ $num_messages = (int) $db->sql_fetchfield('num_messages');
$db->sql_freeresult($result);
$folder[PRIVMSGS_INBOX] = array(
@@ -641,12 +642,13 @@ function define_cond_option($hardcoded, $cond_option, $rule_option, $global_rule
FROM ' . USERS_TABLE . "
WHERE username = '" . $db->sql_escape($rule_string) . "'";
$result = $db->sql_query($sql);
+ $rule_user_id = (int) $db->sql_fetchfield('user_id');
+ $db->sql_freeresult($result);
- if (!($rule_user_id = $db->sql_fetchfield('user_id', 0, $result)))
+ if (!$rule_user_id)
{
$rule_string = '';
}
- $db->sql_freeresult($result);
}
else if (!$rule_string && $rule_user_id)
{
@@ -654,12 +656,13 @@ function define_cond_option($hardcoded, $cond_option, $rule_option, $global_rule
FROM ' . USERS_TABLE . "
WHERE user_id = $rule_user_id";
$result = $db->sql_query($sql);
-
- if (!($rule_string = $db->sql_fetchfield('username', 0, $result)))
+ $rule_string = $db->sql_fetchfield('username');
+ $db->sql_freeresult($result);
+
+ if (!$rule_string)
{
$rule_user_id = 0;
}
- $db->sql_freeresult($result);
}
$template->assign_vars(array(