diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2009-02-22 18:06:05 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2009-02-22 18:06:05 +0000 |
commit | 84f795e9fbd172924280593d575bf4587c9b40e5 (patch) | |
tree | 45ac9db0e053f78f8c240370ad5dc5f8f34cb730 /phpBB/modules | |
parent | 95b69cfa7f66e721cea3f8a5d62ad1cb2b822cfc (diff) | |
download | forums-84f795e9fbd172924280593d575bf4587c9b40e5.tar forums-84f795e9fbd172924280593d575bf4587c9b40e5.tar.gz forums-84f795e9fbd172924280593d575bf4587c9b40e5.tar.bz2 forums-84f795e9fbd172924280593d575bf4587c9b40e5.tar.xz forums-84f795e9fbd172924280593d575bf4587c9b40e5.zip |
$db-> to phpbb::$db->
git-svn-id: file:///svn/phpbb/trunk@9336 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/modules')
52 files changed, 1796 insertions, 1796 deletions
diff --git a/phpBB/modules/acp/acp_attachments.php b/phpBB/modules/acp/acp_attachments.php index 6596b396e3..738e90e6c7 100644 --- a/phpBB/modules/acp/acp_attachments.php +++ b/phpBB/modules/acp/acp_attachments.php @@ -82,14 +82,14 @@ class acp_attachments FROM ' . EXTENSION_GROUPS_TABLE . ' WHERE cat_id > 0 ORDER BY cat_id'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $s_assigned_groups = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $s_assigned_groups[$row['cat_id']][] = $row['group_name']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $l_legend_cat_images = phpbb::$user->lang['SETTINGS_CAT_IMAGES'] . ' [' . phpbb::$user->lang['ASSIGNED_GROUP'] . ': ' . ((!empty($s_assigned_groups[ATTACHMENT_CATEGORY_IMAGE])) ? implode(', ', $s_assigned_groups[ATTACHMENT_CATEGORY_IMAGE]) : phpbb::$user->lang['NO_EXT_GROUP']) . ']'; @@ -214,12 +214,12 @@ class acp_attachments $sql = 'SELECT * FROM ' . SITELIST_TABLE; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $defined_ips = ''; $ips = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $value = ($row['site_ip']) ? $row['site_ip'] : $row['site_hostname']; if ($value) @@ -228,7 +228,7 @@ class acp_attachments $ips[$row['site_id']] = $value; } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $template->assign_vars(array( 'S_SECURE_DOWNLOADS' => $this->new_config['secure_downloads'], @@ -314,21 +314,21 @@ class acp_attachments $sql = 'SELECT * FROM ' . EXTENSIONS_TABLE . ' ORDER BY extension_id'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if ($row['group_id'] != $extensions[$row['extension_id']]['group_id']) { $sql = 'UPDATE ' . EXTENSIONS_TABLE . ' SET group_id = ' . (int) $extensions[$row['extension_id']]['group_id'] . ' WHERE extension_id = ' . $row['extension_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); add_log('admin', 'LOG_ATTACH_EXT_UPDATE', $row['extension']); } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Delete Extension? $extension_id_list = request_var('extension_id_list', array(0)); @@ -337,20 +337,20 @@ class acp_attachments { $sql = 'SELECT extension FROM ' . EXTENSIONS_TABLE . ' - WHERE ' . $db->sql_in_set('extension_id', $extension_id_list); - $result = $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('extension_id', $extension_id_list); + $result = phpbb::$db->sql_query($sql); $extension_list = ''; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $extension_list .= ($extension_list == '') ? $row['extension'] : ', ' . $row['extension']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql = 'DELETE FROM ' . EXTENSIONS_TABLE . ' - WHERE ' . $db->sql_in_set('extension_id', $extension_id_list); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('extension_id', $extension_id_list); + phpbb::$db->sql_query($sql); add_log('admin', 'LOG_ATTACH_EXT_DEL', $extension_list); } @@ -367,14 +367,14 @@ class acp_attachments { $sql = 'SELECT extension_id FROM ' . EXTENSIONS_TABLE . " - WHERE extension = '" . $db->sql_escape($add_extension) . "'"; - $result = $db->sql_query($sql); + WHERE extension = '" . phpbb::$db->sql_escape($add_extension) . "'"; + $result = phpbb::$db->sql_query($sql); - if ($row = $db->sql_fetchrow($result)) + if ($row = phpbb::$db->sql_fetchrow($result)) { $error[] = sprintf(phpbb::$user->lang['EXTENSION_EXIST'], $add_extension); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (!sizeof($error)) { @@ -383,7 +383,7 @@ class acp_attachments 'extension' => $add_extension ); - $db->sql_query('INSERT INTO ' . EXTENSIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + phpbb::$db->sql_query('INSERT INTO ' . EXTENSIONS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary)); add_log('admin', 'LOG_ATTACH_EXT_ADD', $add_extension); } } @@ -406,9 +406,9 @@ class acp_attachments $sql = 'SELECT * FROM ' . EXTENSIONS_TABLE . ' ORDER BY group_id, extension'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - if ($row = $db->sql_fetchrow($result)) + if ($row = phpbb::$db->sql_fetchrow($result)) { $old_group_id = $row['group_id']; do @@ -429,9 +429,9 @@ class acp_attachments 'GROUP_OPTIONS' => $this->group_select('group_select[]', $row['group_id'])) ); } - while ($row = $db->sql_fetchrow($result)); + while ($row = phpbb::$db->sql_fetchrow($result)); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); break; @@ -459,9 +459,9 @@ class acp_attachments $sql = 'SELECT * FROM ' . EXTENSION_GROUPS_TABLE . " WHERE group_id = $group_id"; - $result = $db->sql_query($sql); - $ext_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $ext_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$ext_row) { @@ -486,13 +486,13 @@ class acp_attachments { $sql = 'SELECT group_name FROM ' . EXTENSION_GROUPS_TABLE; - $result = $db->sql_query($sql); - $ext_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $ext_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); $clean_group_name = utf8_clean_string($new_group_name); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if (utf8_clean_string($row['group_name']) === $clean_group_name) { @@ -500,7 +500,7 @@ class acp_attachments break; } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } if (!sizeof($error)) @@ -542,14 +542,14 @@ class acp_attachments // @TODO: rewrite with the new param db functions $sql = ($action == 'add') ? 'INSERT INTO ' . EXTENSION_GROUPS_TABLE . ' ' : 'UPDATE ' . EXTENSION_GROUPS_TABLE . ' SET '; - $sql .= $db->sql_build_array((($action == 'add') ? 'INSERT' : 'UPDATE'), $group_ary); + $sql .= phpbb::$db->sql_build_array((($action == 'add') ? 'INSERT' : 'UPDATE'), $group_ary); $sql .= ($action == 'edit') ? " WHERE group_id = $group_id" : ''; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); if ($action == 'add') { - $group_id = $db->sql_nextid(); + $group_id = phpbb::$db->sql_nextid(); } add_log('admin', 'LOG_ATTACH_EXTGROUP_' . strtoupper($action), $group_name); @@ -562,15 +562,15 @@ class acp_attachments $sql = 'UPDATE ' . EXTENSIONS_TABLE . " SET group_id = 0 WHERE group_id = $group_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } if (sizeof($extension_list)) { $sql = 'UPDATE ' . EXTENSIONS_TABLE . " SET group_id = $group_id - WHERE " . $db->sql_in_set('extension_id', $extension_list); - $db->sql_query($sql); + WHERE " . phpbb::$db->sql_in_set('extension_id', $extension_list); + phpbb::$db->sql_query($sql); } phpbb::$acm->destroy('extensions'); @@ -602,20 +602,20 @@ class acp_attachments $sql = 'SELECT group_name FROM ' . EXTENSION_GROUPS_TABLE . " WHERE group_id = $group_id"; - $result = $db->sql_query($sql); - $group_name = (string) $db->sql_fetchfield('group_name'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $group_name = (string) phpbb::$db->sql_fetchfield('group_name'); + phpbb::$db->sql_freeresult($result); $sql = 'DELETE FROM ' . EXTENSION_GROUPS_TABLE . " WHERE group_id = $group_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // Set corresponding Extensions to a pending Group $sql = 'UPDATE ' . EXTENSIONS_TABLE . " SET group_id = 0 WHERE group_id = $group_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); add_log('admin', 'LOG_ATTACH_EXTGROUP_DEL', $group_name); @@ -645,9 +645,9 @@ class acp_attachments $sql = 'SELECT * FROM ' . EXTENSION_GROUPS_TABLE . " WHERE group_id = $group_id"; - $result = $db->sql_query($sql); - $ext_group_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $ext_group_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); $forum_ids = (!$ext_group_row['allowed_forums']) ? array() : unserialize(trim($ext_group_row['allowed_forums'])); @@ -676,9 +676,9 @@ class acp_attachments WHERE group_id = $group_id OR group_id = 0 ORDER BY extension"; - $result = $db->sql_query($sql); - $extensions = $db->sql_fetchrowset($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $extensions = phpbb::$db->sql_fetchrowset($result); + phpbb::$db->sql_freeresult($result); if ($ext_group_row['max_filesize'] == 0) { @@ -771,13 +771,13 @@ class acp_attachments $sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id FROM ' . FORUMS_TABLE . ' ORDER BY left_id ASC'; - $result = $db->sql_query($sql, 600); + $result = phpbb::$db->sql_query($sql, 600); $right = $cat_right = $padding_inc = 0; $padding = $forum_list = $holding = ''; $padding_store = array('0' => ''); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if ($row['forum_type'] == FORUM_CAT && ($row['left_id'] + 1 == $row['right_id'])) { @@ -830,7 +830,7 @@ class acp_attachments $s_forum_id_options .= $holding; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); unset($padding_store); $template->assign_vars(array( @@ -843,10 +843,10 @@ class acp_attachments $sql = 'SELECT * FROM ' . EXTENSION_GROUPS_TABLE . ' ORDER BY allow_group DESC, allow_in_pm DESC, group_name'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $old_allow_group = $old_allow_pm = 1; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $s_add_spacer = ($old_allow_group != $row['allow_group'] || $old_allow_pm != $row['allow_in_pm']) ? true : false; @@ -866,7 +866,7 @@ class acp_attachments $old_allow_group = $row['allow_group']; $old_allow_pm = $row['allow_in_pm']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); break; @@ -882,12 +882,12 @@ class acp_attachments { $sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . ' - WHERE ' . $db->sql_in_set('attach_id', $delete_files) . ' + WHERE ' . phpbb::$db->sql_in_set('attach_id', $delete_files) . ' AND is_orphan = 1'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $delete_files = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { phpbb_unlink($row['physical_filename'], 'file'); @@ -898,14 +898,14 @@ class acp_attachments $delete_files[$row['attach_id']] = $row['real_filename']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } if (sizeof($delete_files)) { $sql = 'DELETE FROM ' . ATTACHMENTS_TABLE . ' - WHERE ' . $db->sql_in_set('attach_id', array_keys($delete_files)); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('attach_id', array_keys($delete_files)); + phpbb::$db->sql_query($sql); add_log('admin', 'LOG_ATTACH_ORPHAN_DEL', implode(', ', $delete_files)); $notify[] = sprintf(phpbb::$user->lang['LOG_ATTACH_ORPHAN_DEL'], implode(', ', $delete_files)); @@ -927,36 +927,36 @@ class acp_attachments $sql = 'SELECT forum_id, forum_name FROM ' . FORUMS_TABLE; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $forum_names = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $forum_names[$row['forum_id']] = $row['forum_name']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql = 'SELECT forum_id, topic_id, post_id, poster_id FROM ' . POSTS_TABLE . ' - WHERE ' . $db->sql_in_set('post_id', $upload_list); - $result = $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('post_id', $upload_list); + $result = phpbb::$db->sql_query($sql); $post_info = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $post_info[$row['post_id']] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Select those attachments we want to change... $sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . ' - WHERE ' . $db->sql_in_set('attach_id', array_keys($upload_list)) . ' + WHERE ' . phpbb::$db->sql_in_set('attach_id', array_keys($upload_list)) . ' AND is_orphan = 1'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $files_added = $space_taken = 0; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $post_row = $post_info[$upload_list[$row['attach_id']]]; @@ -981,26 +981,26 @@ class acp_attachments ); $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . ' WHERE attach_id = ' . $row['attach_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $sql = 'UPDATE ' . POSTS_TABLE . ' SET post_attachment = 1 WHERE post_id = ' . $post_row['post_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $sql = 'UPDATE ' . TOPICS_TABLE . ' SET topic_attachment = 1 WHERE topic_id = ' . $post_row['topic_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $space_taken += $row['filesize']; $files_added++; add_log('admin', 'LOG_ATTACH_FILEUPLOAD', $post_row['post_id'], $row['real_filename']); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if ($files_added) { @@ -1020,9 +1020,9 @@ class acp_attachments WHERE is_orphan = 1 AND filetime < ' . (time() - 3*60*60) . ' ORDER BY filetime DESC'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $template->assign_block_vars('orphan', array( 'FILESIZE' => get_formatted_filesize($row['filesize']), @@ -1034,7 +1034,7 @@ class acp_attachments 'U_FILE' => append_sid('download/file', 'mode=view&id=' . $row['attach_id'])) ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); break; } @@ -1075,11 +1075,11 @@ class acp_attachments $sql = 'SELECT cat_id FROM ' . EXTENSION_GROUPS_TABLE . ' WHERE group_id = ' . (int) $group_id; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - $cat_type = (!($row = $db->sql_fetchrow($result))) ? ATTACHMENT_CATEGORY_NONE : $row['cat_id']; + $cat_type = (!($row = phpbb::$db->sql_fetchrow($result))) ? ATTACHMENT_CATEGORY_NONE : $row['cat_id']; - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } else { @@ -1109,14 +1109,14 @@ class acp_attachments $sql = 'SELECT group_id, group_name FROM ' . EXTENSION_GROUPS_TABLE . ' ORDER BY group_name'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $group_name = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $group_name[] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $row['group_id'] = 0; $row['group_name'] = phpbb::$user->lang['NOT_ASSIGNED']; @@ -1309,9 +1309,9 @@ class acp_attachments $sql = 'SELECT site_ip, site_hostname FROM ' . SITELIST_TABLE . " WHERE ip_exclude = $ip_exclude"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - if ($row = $db->sql_fetchrow($result)) + if ($row = phpbb::$db->sql_fetchrow($result)) { $iplist_tmp = array(); $hostlist_tmp = array(); @@ -1337,14 +1337,14 @@ class acp_attachments } // break; } - while ($row = $db->sql_fetchrow($result)); + while ($row = phpbb::$db->sql_fetchrow($result)); $iplist = array_unique(array_diff($iplist, $iplist_tmp)); $hostlist = array_unique(array_diff($hostlist, $hostlist_tmp)); unset($iplist_tmp); unset($hostlist_tmp); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($iplist)) { @@ -1352,7 +1352,7 @@ class acp_attachments { $sql = 'INSERT INTO ' . SITELIST_TABLE . " (site_ip, ip_exclude) VALUES ($ip_entry, $ip_exclude)"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } } @@ -1362,7 +1362,7 @@ class acp_attachments { $sql = 'INSERT INTO ' . SITELIST_TABLE . " (site_hostname, ip_exclude) VALUES ($host_entry, $ip_exclude)"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } } @@ -1386,18 +1386,18 @@ class acp_attachments // Grab details of ips for logging information later $sql = 'SELECT site_ip, site_hostname FROM ' . SITELIST_TABLE . ' - WHERE ' . $db->sql_in_set('site_id', $unip_sql); - $result = $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('site_id', $unip_sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $l_unip_list .= (($l_unip_list != '') ? ', ' : '') . (($row['site_ip']) ? $row['site_ip'] : $row['site_hostname']); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql = 'DELETE FROM ' . SITELIST_TABLE . ' - WHERE ' . $db->sql_in_set('site_id', $unip_sql); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('site_id', $unip_sql); + phpbb::$db->sql_query($sql); add_log('admin', 'LOG_DOWNLOAD_REMOVE_IP', $l_unip_list); } diff --git a/phpBB/modules/acp/acp_ban.php b/phpBB/modules/acp/acp_ban.php index 8946da6ee5..85a03439fa 100644 --- a/phpBB/modules/acp/acp_ban.php +++ b/phpBB/modules/acp/acp_ban.php @@ -166,12 +166,12 @@ class acp_ban AND ban_email <> ''"; break; } - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $banned_options = ''; $ban_length = $ban_reasons = $ban_give_reasons = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $banned_options .= '<option' . (($row['ban_exclude']) ? ' class="sep"' : '') . ' value="' . $row['ban_id'] . '">' . $row[$field] . '</option>'; @@ -181,7 +181,7 @@ class acp_ban $ban_reasons[$row['ban_id']] = $row['ban_reason']; $ban_give_reasons[$row['ban_id']] = $row['ban_give_reason']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($ban_length)) { diff --git a/phpBB/modules/acp/acp_bbcodes.php b/phpBB/modules/acp/acp_bbcodes.php index 27afddae23..fdbefb9c55 100644 --- a/phpBB/modules/acp/acp_bbcodes.php +++ b/phpBB/modules/acp/acp_bbcodes.php @@ -49,9 +49,9 @@ class acp_bbcodes $sql = 'SELECT bbcode_match, bbcode_tpl, display_on_posting, bbcode_helpline FROM ' . BBCODES_TABLE . ' WHERE bbcode_id = ' . $bbcode_id; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$row) { @@ -68,9 +68,9 @@ class acp_bbcodes $sql = 'SELECT bbcode_id, bbcode_tag FROM ' . BBCODES_TABLE . ' WHERE bbcode_id = ' . $bbcode_id; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$row) { @@ -130,10 +130,10 @@ class acp_bbcodes { $sql = 'SELECT 1 as test FROM ' . BBCODES_TABLE . " - WHERE LOWER(bbcode_tag) = '" . $db->sql_escape(strtolower($data['bbcode_tag'])) . "'"; - $result = $db->sql_query($sql); - $info = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + WHERE LOWER(bbcode_tag) = '" . phpbb::$db->sql_escape(strtolower($data['bbcode_tag'])) . "'"; + $result = phpbb::$db->sql_query($sql); + $info = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); // Grab the end, interrogate the last closing tag if ($info['test'] === '1' || in_array(strtolower($data['bbcode_tag']), $hard_coded) || (preg_match('#\[/([^[]*)]$#', $bbcode_match, $regs) && in_array(strtolower($regs[1]), $hard_coded))) @@ -188,9 +188,9 @@ class acp_bbcodes { $sql = 'SELECT MAX(bbcode_id) as max_bbcode_id FROM ' . BBCODES_TABLE; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if ($row) { @@ -214,7 +214,7 @@ class acp_bbcodes $sql_ary['bbcode_id'] = (int) $bbcode_id; - $db->sql_query('INSERT INTO ' . BBCODES_TABLE . $db->sql_build_array('INSERT', $sql_ary)); + phpbb::$db->sql_query('INSERT INTO ' . BBCODES_TABLE . phpbb::$db->sql_build_array('INSERT', $sql_ary)); phpbb::$acm->destroy_sql(BBCODES_TABLE); $lang = 'BBCODE_ADDED'; @@ -223,9 +223,9 @@ class acp_bbcodes else { $sql = 'UPDATE ' . BBCODES_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . ' WHERE bbcode_id = ' . $bbcode_id; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); phpbb::$acm->destroy_sql(BBCODES_TABLE); $lang = 'BBCODE_EDITED'; @@ -243,15 +243,15 @@ class acp_bbcodes $sql = 'SELECT bbcode_tag FROM ' . BBCODES_TABLE . " WHERE bbcode_id = $bbcode_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if ($row) { if (confirm_box(true)) { - $db->sql_query('DELETE FROM ' . BBCODES_TABLE . " WHERE bbcode_id = $bbcode_id"); + phpbb::$db->sql_query('DELETE FROM ' . BBCODES_TABLE . " WHERE bbcode_id = $bbcode_id"); phpbb::$acm->destroy_sql(BBCODES_TABLE); add_log('admin', 'LOG_BBCODE_DELETE', $row['bbcode_tag']); } @@ -276,9 +276,9 @@ class acp_bbcodes $sql = 'SELECT * FROM ' . BBCODES_TABLE . ' ORDER BY bbcode_tag'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $template->assign_block_vars('bbcodes', array( 'BBCODE_TAG' => $row['bbcode_tag'], @@ -286,7 +286,7 @@ class acp_bbcodes 'U_DELETE' => $this->u_action . '&action=delete&bbcode=' . $row['bbcode_id']) ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } /* diff --git a/phpBB/modules/acp/acp_bots.php b/phpBB/modules/acp/acp_bots.php index fd18d105e9..bb94abb480 100644 --- a/phpBB/modules/acp/acp_bots.php +++ b/phpBB/modules/acp/acp_bots.php @@ -59,7 +59,7 @@ class acp_bots $sql = 'UPDATE ' . BOTS_TABLE . " SET bot_active = 1 WHERE bot_id $sql_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } phpbb::$acm->destroy('bots'); @@ -73,7 +73,7 @@ class acp_bots $sql = 'UPDATE ' . BOTS_TABLE . " SET bot_active = 0 WHERE bot_id $sql_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } phpbb::$acm->destroy('bots'); @@ -90,21 +90,21 @@ class acp_bots $sql = 'SELECT bot_name, user_id FROM ' . BOTS_TABLE . " WHERE bot_id $sql_id"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $user_id_ary = $bot_name_ary = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $user_id_ary[] = (int) $row['user_id']; $bot_name_ary[] = $row['bot_name']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); - $db->sql_transaction('begin'); + phpbb::$db->sql_transaction('begin'); $sql = 'DELETE FROM ' . BOTS_TABLE . " WHERE bot_id $sql_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); if (sizeof($user_id_ary)) { @@ -112,12 +112,12 @@ class acp_bots foreach ($_tables as $table) { $sql = "DELETE FROM $table - WHERE " . $db->sql_in_set('user_id', $user_id_ary); - $db->sql_query($sql); + WHERE " . phpbb::$db->sql_in_set('user_id', $user_id_ary); + phpbb::$db->sql_query($sql); } } - $db->sql_transaction('commit'); + phpbb::$db->sql_transaction('commit'); phpbb::$acm->destroy('bots'); @@ -182,9 +182,9 @@ class acp_bots FROM ' . BOTS_TABLE . ' b, ' . USERS_TABLE . " u WHERE b.bot_id = $bot_id AND u.user_id = b.user_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$bot_row) { @@ -209,9 +209,9 @@ class acp_bots FROM ' . GROUPS_TABLE . " WHERE group_name_clean = 'bots' AND group_type = " . GROUP_SPECIAL; - $result = $db->sql_query($sql); - $group_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $group_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$group_row) { @@ -232,14 +232,14 @@ class acp_bots 'user_allow_massemail' => 0, )); - $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array( + $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', array( 'user_id' => (int) $user_id, 'bot_name' => (string) $bot_row['bot_name'], 'bot_active' => (int) $bot_row['bot_active'], 'bot_agent' => (string) $bot_row['bot_agent'], 'bot_ip' => (string) $bot_row['bot_ip']) ); - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $log = 'ADDED'; } @@ -248,9 +248,9 @@ class acp_bots $sql = 'SELECT user_id, bot_name FROM ' . BOTS_TABLE . " WHERE bot_id = $bot_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$row) { @@ -268,16 +268,16 @@ class acp_bots $sql_ary['username_clean'] = (string) utf8_clean_string($bot_row['bot_name']); } - $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE user_id = {$row['user_id']}"; - $db->sql_query($sql); + $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . " WHERE user_id = {$row['user_id']}"; + phpbb::$db->sql_query($sql); - $sql = 'UPDATE ' . BOTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( + $sql = 'UPDATE ' . BOTS_TABLE . ' SET ' . phpbb::$db->sql_build_array('UPDATE', array( 'bot_name' => (string) $bot_row['bot_name'], 'bot_active' => (int) $bot_row['bot_active'], 'bot_agent' => (string) $bot_row['bot_agent'], 'bot_ip' => (string) $bot_row['bot_ip']) ) . " WHERE bot_id = $bot_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // Updated username? if ($bot_row['bot_name'] !== $row['bot_name']) @@ -301,9 +301,9 @@ class acp_bots FROM ' . BOTS_TABLE . ' b, ' . USERS_TABLE . " u WHERE b.bot_id = $bot_id AND u.user_id = b.user_id"; - $result = $db->sql_query($sql); - $bot_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $bot_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$bot_row) { @@ -367,9 +367,9 @@ class acp_bots FROM ' . BOTS_TABLE . ' b, ' . USERS_TABLE . ' u WHERE u.user_id = b.user_id ORDER BY u.user_lastvisit DESC, b.bot_name ASC'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $active_lang = (!$row['bot_active']) ? 'BOT_ACTIVATE' : 'BOT_DEACTIVATE'; $active_value = (!$row['bot_active']) ? 'activate' : 'deactivate'; @@ -385,7 +385,7 @@ class acp_bots 'U_DELETE' => $this->u_action . "&id={$row['bot_id']}&action=delete") ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } /** @@ -401,10 +401,10 @@ class acp_bots // Admins might want to use names otherwise forbidden, thus we only check for duplicates. $sql = 'SELECT username FROM ' . USERS_TABLE . " - WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($newname)) . "'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + WHERE username_clean = '" . phpbb::$db->sql_escape(utf8_clean_string($newname)) . "'"; + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); return ($row) ? false : true; } diff --git a/phpBB/modules/acp/acp_database.php b/phpBB/modules/acp/acp_database.php index 80672f6033..a51b2d529d 100644 --- a/phpBB/modules/acp/acp_database.php +++ b/phpBB/modules/acp/acp_database.php @@ -83,7 +83,7 @@ class acp_database $time = time(); $filename = 'backup_' . $time . '_' . unique_id(); - switch ($db->dbms_type) + switch (phpbb::$db->dbms_type) { case 'mysql': $extractor = new mysql_extractor($download, $store, $format, $filename, $time); @@ -126,7 +126,7 @@ class acp_database else { // We might wanna empty out all that junk :D - switch ($db->dbms_type) + switch (phpbb::$db->dbms_type) { case 'sqlite': case 'firebird': @@ -314,14 +314,14 @@ class acp_database break; } - switch ($db->dbms_type) + switch (phpbb::$db->dbms_type) { case 'mysql': case 'sqlite': case 'db2': while (($sql = $fgetd($fp, ";\n", $read, $seek, $eof)) !== false) { - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } break; @@ -335,7 +335,7 @@ class acp_database $delim = $query[9] . "\n"; continue; } - $db->sql_query($query); + phpbb::$db->sql_query($query); } break; @@ -351,16 +351,16 @@ class acp_database $sql = "SELECT domain_name FROM information_schema.domains WHERE domain_name = '$domain';"; - $result = $db->sql_query($sql); - if (!$db->sql_fetchrow($result)) + $result = phpbb::$db->sql_query($sql); + if (!phpbb::$db->sql_fetchrow($result)) { - $db->sql_query($query); + phpbb::$db->sql_query($query); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } else { - $db->sql_query($query); + phpbb::$db->sql_query($query); } if (substr($query, 0, 4) == 'COPY') @@ -371,10 +371,10 @@ class acp_database { trigger_error(phpbb::$user->lang['RESTORE_FAILURE'] . adm_back_link($this->u_action), E_USER_WARNING); } - pg_put_line($db->db_connect_id, $sub . "\n"); + pg_put_line(phpbb::$db->db_connect_id, $sub . "\n"); } - pg_put_line($db->db_connect_id, "\\.\n"); - pg_end_copy($db->db_connect_id); + pg_put_line(phpbb::$db->db_connect_id, "\\.\n"); + pg_end_copy(phpbb::$db->db_connect_id); } } break; @@ -382,14 +382,14 @@ class acp_database case 'oracle': while (($sql = $fgetd($fp, "/\n", $read, $seek, $eof)) !== false) { - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } break; case 'mssql': while (($sql = $fgetd($fp, "GO\n", $read, $seek, $eof)) !== false) { - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } break; } @@ -611,19 +611,19 @@ class mysql_extractor extends base_extractor function write_table($table_name) { $sql = 'SHOW CREATE TABLE ' . $table_name; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); $sql_data = '# Table: ' . $table_name . "\n"; $sql_data .= "DROP TABLE IF EXISTS $table_name;\n"; $this->flush($sql_data . $row['Create Table'] . ";\n\n"); - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } function write_data($table_name) { - if ($db->sql_layer === 'mysqli') + if (phpbb::$db->sql_layer === 'mysqli') { $this->write_data_mysqli($table_name); } @@ -637,7 +637,7 @@ class mysql_extractor extends base_extractor { $sql = "SELECT * FROM $table_name"; - $result = mysqli_query($db->db_connect_id, $sql, MYSQLI_USE_RESULT); + $result = mysqli_query(phpbb::$db->db_connect_id, $sql, MYSQLI_USE_RESULT); if ($result != false) { $fields_cnt = mysqli_num_fields($result); @@ -715,7 +715,7 @@ class mysql_extractor extends base_extractor { $sql = "SELECT * FROM $table_name"; - $result = mysql_unbuffered_query($sql, $db->db_connect_id); + $result = mysql_unbuffered_query($sql, phpbb::$db->db_connect_id); if ($result != false) { @@ -819,23 +819,23 @@ class sqlite_extractor extends base_extractor $sql = "SELECT sql FROM sqlite_master WHERE type = 'table' - AND name = '" . $db->sql_escape($table_name) . "' + AND name = '" . phpbb::$db->sql_escape($table_name) . "' ORDER BY type DESC, name;"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); // Create Table $sql_data .= $row['sql'] . ";\n"; - $result = $db->sql_query("PRAGMA index_list('" . $db->sql_escape($table_name) . "');"); + $result = phpbb::$db->sql_query("PRAGMA index_list('" . phpbb::$db->sql_escape($table_name) . "');"); $ar = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $ar[] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); foreach ($ar as $value) { @@ -844,14 +844,14 @@ class sqlite_extractor extends base_extractor continue; } - $result = $db->sql_query("PRAGMA index_info('" . $db->sql_escape($value['name']) . "');"); + $result = phpbb::$db->sql_query("PRAGMA index_info('" . phpbb::$db->sql_escape($value['name']) . "');"); $fields = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $fields[] = $row['name']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql_data .= 'CREATE ' . ($value['unique'] ? 'UNIQUE ' : '') . 'INDEX ' . $value['name'] . ' on ' . $table_name . ' (' . implode(', ', $fields) . ");\n"; } @@ -870,7 +870,7 @@ class sqlite_extractor extends base_extractor if ($proper) { - $col_types = sqlite_fetch_column_types($db->db_connect_id, $table_name); + $col_types = sqlite_fetch_column_types(phpbb::$db->db_connect_id, $table_name); } else { @@ -878,7 +878,7 @@ class sqlite_extractor extends base_extractor FROM sqlite_master WHERE type = 'table' AND name = '" . $table_name . "'"; - $table_data = sqlite_single_query($db->db_connect_id, $sql); + $table_data = sqlite_single_query(phpbb::$db->db_connect_id, $sql); $table_data = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', '', $table_data); $table_data = trim($table_data); @@ -901,7 +901,7 @@ class sqlite_extractor extends base_extractor $sql = "SELECT * FROM $table_name"; - $result = sqlite_unbuffered_query($db->db_connect_id, $sql); + $result = sqlite_unbuffered_query(phpbb::$db->db_connect_id, $sql); $rows = sqlite_fetch_all($result, SQLITE_ASSOC); $sql_insert = 'INSERT INTO ' . $table_name . ' (' . implode(', ', array_keys($col_types)) . ') VALUES ('; foreach ($rows as $row) @@ -956,8 +956,8 @@ class postgres_extractor extends base_extractor FROM INFORMATION_SCHEMA.domains a, INFORMATION_SCHEMA.column_domain_usage b WHERE a.domain_name = b.domain_name AND b.table_name = '{$table_name}'"; - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + $result = phpbb::$db->sql_query($sql); + while ($row = phpbb::$db->sql_fetchrow($result)) { if (empty($domains_created[$row['domain_name']])) { @@ -984,35 +984,35 @@ class postgres_extractor extends base_extractor FROM pg_class WHERE relkind = 'S' AND relname = '{$table_name}_seq'"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); // We don't even care about storing the results. We already know the answer if we get rows back. - if ($db->sql_fetchrow($result)) + if (phpbb::$db->sql_fetchrow($result)) { $sql_data .= "DROP SEQUENCE {$table_name}_seq;\n"; $sql_data .= "CREATE SEQUENCE {$table_name}_seq;\n"; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $field_query = "SELECT a.attnum, a.attname as field, t.typname as type, a.attlen as length, a.atttypmod as lengthvar, a.attnotnull as notnull FROM pg_class c, pg_attribute a, pg_type t - WHERE c.relname = '" . $db->sql_escape($table_name) . "' + WHERE c.relname = '" . phpbb::$db->sql_escape($table_name) . "' AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid ORDER BY a.attnum"; - $result = $db->sql_query($field_query); + $result = phpbb::$db->sql_query($field_query); $sql_data .= "CREATE TABLE $table_name(\n"; $lines = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { // Get the data from the table $sql_get_default = "SELECT pg_get_expr(d.adbin, d.adrelid) as rowdefault FROM pg_attrdef d, pg_class c - WHERE (c.relname = '" . $db->sql_escape($table_name) . "') + WHERE (c.relname = '" . phpbb::$db->sql_escape($table_name) . "') AND (c.oid = d.adrelid) AND d.adnum = " . $row['attnum']; - $def_res = $db->sql_query($sql_get_default); + $def_res = phpbb::$db->sql_query($sql_get_default); if (!$def_res) { @@ -1020,9 +1020,9 @@ class postgres_extractor extends base_extractor } else { - $row['rowdefault'] = $db->sql_fetchfield('rowdefault', $def_res); + $row['rowdefault'] = phpbb::$db->sql_fetchfield('rowdefault', $def_res); } - $db->sql_freeresult($def_res); + phpbb::$db->sql_freeresult($def_res); if ($row['type'] == 'bpchar') { @@ -1059,7 +1059,7 @@ class postgres_extractor extends base_extractor $lines[] = $line; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Get the listing of primary keys. @@ -1069,17 +1069,17 @@ class postgres_extractor extends base_extractor AND (ic.oid = i.indexrelid) AND (ia.attrelid = i.indexrelid) AND (ta.attrelid = bc.oid) - AND (bc.relname = '" . $db->sql_escape($table_name) . "') + AND (bc.relname = '" . phpbb::$db->sql_escape($table_name) . "') AND (ta.attrelid = i.indrelid) AND (ta.attnum = i.indkey[ia.attnum-1]) ORDER BY index_name, tab_name, column_name"; - $result = $db->sql_query($sql_pri_keys); + $result = phpbb::$db->sql_query($sql_pri_keys); $index_create = $index_rows = $primary_key = array(); // We do this in two steps. It makes placing the comma easier - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if ($row['primary_key'] == 't') { @@ -1095,7 +1095,7 @@ class postgres_extractor extends base_extractor $index_rows[$row['index_name']]['column_names'][] = $row['column_name']; } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (!empty($index_rows)) { @@ -1114,7 +1114,7 @@ class postgres_extractor extends base_extractor $sql_checks = "SELECT conname as index_name, consrc FROM pg_constraint, pg_class bc WHERE conrelid = bc.oid - AND bc.relname = '" . $db->sql_escape($table_name) . "' + AND bc.relname = '" . phpbb::$db->sql_escape($table_name) . "' AND NOT EXISTS ( SELECT * FROM pg_constraint as c, pg_inherits as i @@ -1123,17 +1123,17 @@ class postgres_extractor extends base_extractor AND c.consrc = pg_constraint.consrc AND c.conrelid = i.inhparent )"; - $result = $db->sql_query($sql_checks); + $result = phpbb::$db->sql_query($sql_checks); // Add the constraints to the sql file. - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if (!is_null($row['consrc'])) { $lines[] = ' CONSTRAINT ' . $row['index_name'] . ' CHECK ' . $row['consrc']; } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql_data .= implode(", \n", $lines); $sql_data .= "\n);\n"; @@ -1150,7 +1150,7 @@ class postgres_extractor extends base_extractor // Grab all of the data from current table. $sql = "SELECT * FROM $table_name"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $i_num_fields = pg_num_fields($result); $seq = ''; @@ -1166,8 +1166,8 @@ class postgres_extractor extends base_extractor WHERE (c.relname = '{$table_name}') AND (c.oid = d.adrelid) AND d.adnum = " . strval($i + 1); - $result2 = $db->sql_query($sql); - if ($row = $db->sql_fetchrow($result2)) + $result2 = phpbb::$db->sql_query($sql); + if ($row = phpbb::$db->sql_fetchrow($result2)) { // Determine if we must reset the sequences if (strpos($row['rowdefault'], "nextval('") === 0) @@ -1178,7 +1178,7 @@ class postgres_extractor extends base_extractor } $this->flush("COPY $table_name (" . implode(', ', $ary_name) . ') FROM stdin;' . "\n"); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $schema_vals = array(); @@ -1209,7 +1209,7 @@ class postgres_extractor extends base_extractor // into a valid sql statement to recreate that field in the data. $this->flush(implode("\t", $schema_vals) . "\n"); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $this->flush("\\.\n"); // Write out the sequence statements @@ -1260,9 +1260,9 @@ class mssql_extractor extends base_extractor $sql = "SELECT COLUMN_NAME, COLUMN_DEFAULT, IS_NULLABLE, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, COLUMNPROPERTY(object_id(TABLE_NAME), COLUMN_NAME, 'IsIdentity') as IS_IDENTITY FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '$table_name'"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $line = "\t[{$row['COLUMN_NAME']}] [{$row['DATA_TYPE']}]"; @@ -1297,7 +1297,7 @@ class mssql_extractor extends base_extractor $rows[] = $line; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql_data .= implode(",\n", $rows); $sql_data .= "\n) ON [PRIMARY]"; @@ -1313,8 +1313,8 @@ class mssql_extractor extends base_extractor $sql = "SELECT CONSTRAINT_NAME, COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME = '$table_name'"; - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + $result = phpbb::$db->sql_query($sql); + while ($row = phpbb::$db->sql_fetchrow($result)) { if (!sizeof($rows)) { @@ -1328,19 +1328,19 @@ class mssql_extractor extends base_extractor $sql_data .= implode(",\n", $rows); $sql_data .= "\n\t) ON [PRIMARY] \nGO\n"; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $index = array(); $sql = "EXEC sp_statistics '$table_name'"; - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + $result = phpbb::$db->sql_query($sql); + while ($row = phpbb::$db->sql_fetchrow($result)) { if ($row['TYPE'] == 3) { $index[$row['INDEX_NAME']][] = '[' . $row['COLUMN_NAME'] . ']'; } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); foreach ($index as $index_name => $column_name) { @@ -1356,11 +1356,11 @@ class mssql_extractor extends base_extractor function write_data($table_name) { - if ($db->sql_layer === 'mssql') + if (phpbb::$db->sql_layer === 'mssql') { $this->write_data_mssql($table_name); } - else if ($db->sql_layer === 'mssql_odbc') + else if (phpbb::$db->sql_layer === 'mssql_odbc') { $this->write_data_odbc($table_name); } @@ -1380,7 +1380,7 @@ class mssql_extractor extends base_extractor // Grab all of the data from current table. $sql = "SELECT * FROM $table_name"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $retrieved_data = mssql_num_rows($result); @@ -1397,17 +1397,17 @@ class mssql_extractor extends base_extractor $sql = "SELECT 1 as has_identity FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMNPROPERTY(object_id('$table_name'), COLUMN_NAME, 'IsIdentity') = 1"; - $result2 = $db->sql_query($sql); - $row2 = $db->sql_fetchrow($result2); + $result2 = phpbb::$db->sql_query($sql); + $row2 = phpbb::$db->sql_fetchrow($result2); if (!empty($row2['has_identity'])) { $sql_data .= "\nSET IDENTITY_INSERT $table_name ON\nGO\n"; $ident_set = true; } - $db->sql_freeresult($result2); + phpbb::$db->sql_freeresult($result2); } - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $schema_vals = $schema_fields = array(); @@ -1455,7 +1455,7 @@ class mssql_extractor extends base_extractor $this->flush($sql_data); $sql_data = ''; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if ($retrieved_data && $ident_set) { @@ -1473,7 +1473,7 @@ class mssql_extractor extends base_extractor // Grab all of the data from current table. $sql = "SELECT * FROM $table_name"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $retrieved_data = odbc_num_rows($result); @@ -1482,14 +1482,14 @@ class mssql_extractor extends base_extractor $sql = "SELECT 1 as has_identity FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMNPROPERTY(object_id('$table_name'), COLUMN_NAME, 'IsIdentity') = 1"; - $result2 = $db->sql_query($sql); - $row2 = $db->sql_fetchrow($result2); + $result2 = phpbb::$db->sql_query($sql); + $row2 = phpbb::$db->sql_fetchrow($result2); if (!empty($row2['has_identity'])) { $sql_data .= "\nSET IDENTITY_INSERT $table_name ON\nGO\n"; $ident_set = true; } - $db->sql_freeresult($result2); + phpbb::$db->sql_freeresult($result2); } $i_num_fields = odbc_num_fields($result); @@ -1500,7 +1500,7 @@ class mssql_extractor extends base_extractor $ary_name[$i] = odbc_field_name($result, $i + 1); } - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $schema_vals = $schema_fields = array(); @@ -1550,7 +1550,7 @@ class mssql_extractor extends base_extractor $sql_data = ''; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if ($retrieved_data && $ident_set) { @@ -1586,9 +1586,9 @@ class db2_extractor extends base_extractor $sql = "SELECT colname, typename, length, default, identity, nulls FROM syscat.columns WHERE tabname = '$table_name'"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $line = "\t{$row['colname']} {$row['typename']}"; @@ -1618,19 +1618,19 @@ class db2_extractor extends base_extractor $rows[] = $line; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // switch to db2_columns()? $sql = "SELECT colname FROM SYSCAT.KEYCOLUSE WHERE tabname = '$table_name'"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $prim_cols = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $prim_cols[] = $row['colname']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($prim_cols)) { $rows[] = "\tPRIMARY KEY (" . implode($prim_cols) . ')'; @@ -1644,15 +1644,15 @@ class db2_extractor extends base_extractor FROM SYSCAT.INDEXES WHERE TABNAME = '$table_name' AND UNIQUERULE <> 'P'"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $index = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $inds = explode('+', $row['colnames']); unset($inds[0]); $sql_data .= 'CREATE INDEX ' . $row['indname'] . ' ON ' . $table_name . ' (' . implode(', ', $inds) . ") PCTFREE 10 MINPCTUSED 10 ALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC COLLECT SAMPLED DETAILED STATISTICS;\n"; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $this->flush($sql_data); } @@ -1660,24 +1660,24 @@ class db2_extractor extends base_extractor function write_data($table_name) { $ary_type = $ary_name = array(); - $result = db2_columns($db->db_connect_id, '', '%', $table_name); + $result = db2_columns(phpbb::$db->db_connect_id, '', '%', $table_name); $i = 0; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $ary_type[$i] = $row['type_name']; $ary_name[$i++] = strtolower($row['column_name']); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Grab all of the data from current table. $sql = "SELECT * FROM $table_name"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $sql_data = ''; $i_num_fields = $i; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $schema_vals = $schema_fields = array(); @@ -1724,7 +1724,7 @@ class db2_extractor extends base_extractor $this->flush($sql_data); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } } @@ -1743,10 +1743,10 @@ class oracle_extractor extends base_extractor $sql = "SELECT COLUMN_NAME, DATA_TYPE, DATA_PRECISION, DATA_LENGTH, NULLABLE, DATA_DEFAULT FROM ALL_TAB_COLS WHERE table_name = '{$table_name}'"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $rows = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $line = ' "' . $row['column_name'] . '" ' . $row['data_type']; @@ -1773,33 +1773,33 @@ class oracle_extractor extends base_extractor } $rows[] = $line; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql = "SELECT A.CONSTRAINT_NAME, A.COLUMN_NAME FROM USER_CONS_COLUMNS A, USER_CONSTRAINTS B WHERE A.CONSTRAINT_NAME = B.CONSTRAINT_NAME AND B.CONSTRAINT_TYPE = 'P' AND A.TABLE_NAME = '{$table_name}'"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $rows[] = " CONSTRAINT {$row['constraint_name']} PRIMARY KEY ({$row['column_name']})"; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql = "SELECT A.CONSTRAINT_NAME, A.COLUMN_NAME FROM USER_CONS_COLUMNS A, USER_CONSTRAINTS B WHERE A.CONSTRAINT_NAME = B.CONSTRAINT_NAME AND B.CONSTRAINT_TYPE = 'U' AND A.TABLE_NAME = '{$table_name}'"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $rows[] = " CONSTRAINT {$row['constraint_name']} UNIQUE ({$row['column_name']})"; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql_data .= implode(",\n", $rows); $sql_data .= "\n)\n\\"; @@ -1809,33 +1809,33 @@ class oracle_extractor extends base_extractor WHERE A.REFERENCED_TYPE = 'SEQUENCE' AND A.NAME = B.TRIGGER_NAME AND B.TABLE_NAME = '{$table_name}'"; - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + $result = phpbb::$db->sql_query($sql); + while ($row = phpbb::$db->sql_fetchrow($result)) { $sql_data .= "\nCREATE SEQUENCE {$row['referenced_name']}\\\n"; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql = "SELECT DESCRIPTION, WHEN_CLAUSE, TRIGGER_BODY FROM USER_TRIGGERS WHERE TABLE_NAME = '{$table_name}'"; - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + $result = phpbb::$db->sql_query($sql); + while ($row = phpbb::$db->sql_fetchrow($result)) { $sql_data .= "\nCREATE OR REPLACE TRIGGER {$row['description']}WHEN ({$row['when_clause']})\n{$row['trigger_body']}\\"; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql = "SELECT A.INDEX_NAME, B.COLUMN_NAME FROM USER_INDEXES A, USER_IND_COLUMNS B WHERE A.UNIQUENESS = 'NONUNIQUE' AND A.INDEX_NAME = B.INDEX_NAME AND B.TABLE_NAME = '{$table_name}'"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $index = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $index[$row['index_name']][] = $row['column_name']; } @@ -1844,7 +1844,7 @@ class oracle_extractor extends base_extractor { $sql_data .= "\nCREATE INDEX $index_name ON $table_name(" . implode(', ', $column_names) . ")\n\\"; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $this->flush($sql_data); } @@ -1855,7 +1855,7 @@ class oracle_extractor extends base_extractor // Grab all of the data from current table. $sql = "SELECT * FROM $table_name"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $i_num_fields = ocinumcols($result); @@ -1867,7 +1867,7 @@ class oracle_extractor extends base_extractor $sql_data = ''; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $schema_vals = $schema_fields = array(); @@ -1914,7 +1914,7 @@ class oracle_extractor extends base_extractor $this->flush($sql_data); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } function write_start($prefix) @@ -1950,7 +1950,7 @@ class firebird_extractor extends base_extractor // Grab all of the data from current table. $sql = "SELECT * FROM $table_name"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $i_num_fields = ibase_num_fields($result); @@ -1961,7 +1961,7 @@ class firebird_extractor extends base_extractor $ary_name[$i] = $info['name']; } - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $schema_vals = $schema_fields = array(); @@ -2008,7 +2008,7 @@ class firebird_extractor extends base_extractor $this->flush($sql_data); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } function write_table($table_name) @@ -2027,10 +2027,10 @@ class firebird_extractor extends base_extractor WHERE F.RDB$SYSTEM_FLAG = 0 AND R.RDB$RELATION_NAME = \''. $table_name . '\' ORDER BY R.RDB$FIELD_POSITION'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $rows = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $line = "\t" . '"' . $row['fname'] . '" ' . $data_types[$row['ftype']]; @@ -2055,7 +2055,7 @@ class firebird_extractor extends base_extractor } $rows[] = $line; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql_data .= implode(",\n", $rows); $sql_data .= "\n);\n"; @@ -2067,9 +2067,9 @@ class firebird_extractor extends base_extractor AND (IDX.RDB$INDEX_NAME = RC.RDB$INDEX_NAME) AND (RC.RDB$RELATION_NAME = \''. $table_name . '\') ORDER BY I.RDB$FIELD_POSITION'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $keys[] = $row['name']; } @@ -2079,7 +2079,7 @@ class firebird_extractor extends base_extractor $sql_data .= "\nALTER TABLE $table_name ADD PRIMARY KEY (" . implode(', ', $keys) . ');'; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql = 'SELECT I.RDB$INDEX_NAME as INAME, I.RDB$UNIQUE_FLAG as UFLAG, S.RDB$FIELD_NAME as FNAME FROM RDB$INDICES I JOIN RDB$INDEX_SEGMENTS S ON S.RDB$INDEX_NAME=I.RDB$INDEX_NAME @@ -2088,10 +2088,10 @@ class firebird_extractor extends base_extractor AND I.RDB$RELATION_NAME = \''. $table_name . '\' AND I.RDB$INDEX_NAME NOT STARTING WITH \'RDB$\' ORDER BY S.RDB$FIELD_POSITION'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $index = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $index[$row['iname']]['unique'] = !empty($row['uflag']); $index[$row['iname']]['values'][] = $row['fname']; @@ -2108,7 +2108,7 @@ class firebird_extractor extends base_extractor } $sql_data .= "\n"; - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql = 'SELECT D1.RDB$DEPENDENT_NAME as DNAME, D1.RDB$FIELD_NAME as FNAME, D1.RDB$DEPENDENT_TYPE, R1.RDB$RELATION_NAME FROM RDB$DEPENDENCIES D1 @@ -2122,8 +2122,8 @@ class firebird_extractor extends base_extractor AND (D2.RDB$DEPENDENT_NAME = F2.RDB$FIELD_SOURCE) AND (D2.RDB$DEPENDED_ON_NAME = \'' . $table_name . '\') ORDER BY 1, 2'; - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + $result = phpbb::$db->sql_query($sql); + while ($row = phpbb::$db->sql_fetchrow($result)) { $sql = 'SELECT T1.RDB$DEPENDED_ON_NAME as GEN, T1.RDB$FIELD_NAME, T1.RDB$DEPENDED_ON_TYPE FROM RDB$DEPENDENCIES T1 @@ -2135,9 +2135,9 @@ class firebird_extractor extends base_extractor AND (D.RDB$DEPENDENT_NAME = F.RDB$FIELD_SOURCE) AND (F.RDB$RELATION_NAME = \'' . $row['dname'] . '\') ORDER BY 1,2'; - $result2 = $db->sql_query($sql); - $row2 = $db->sql_fetchrow($result2); - $db->sql_freeresult($result2); + $result2 = phpbb::$db->sql_query($sql); + $row2 = phpbb::$db->sql_fetchrow($result2); + phpbb::$db->sql_freeresult($result2); $gen_name = $row2['gen']; $sql_data .= "\nDROP GENERATOR " . $gen_name . ";"; @@ -2153,7 +2153,7 @@ class firebird_extractor extends base_extractor $this->flush($sql_data); - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } } diff --git a/phpBB/modules/acp/acp_disallow.php b/phpBB/modules/acp/acp_disallow.php index 37317c7d2c..dcf137cfb3 100644 --- a/phpBB/modules/acp/acp_disallow.php +++ b/phpBB/modules/acp/acp_disallow.php @@ -53,8 +53,8 @@ class acp_disallow trigger_error(phpbb::$user->lang['NO_USERNAME_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING); } - $sql = 'INSERT INTO ' . DISALLOW_TABLE . ' ' . $db->sql_build_array('INSERT', array('disallow_username' => $disallowed_user)); - $db->sql_query($sql); + $sql = 'INSERT INTO ' . DISALLOW_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', array('disallow_username' => $disallowed_user)); + phpbb::$db->sql_query($sql); phpbb::$acm->destroy('disallowed_usernames'); @@ -74,7 +74,7 @@ class acp_disallow $sql = 'DELETE FROM ' . DISALLOW_TABLE . ' WHERE disallow_id = ' . $disallowed_id; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); phpbb::$acm->destroy('disallowed_usernames'); @@ -86,14 +86,14 @@ class acp_disallow // Grab the current list of disallowed usernames... $sql = 'SELECT * FROM ' . DISALLOW_TABLE; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $disallow_select = ''; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $disallow_select .= '<option value="' . $row['disallow_id'] . '">' . str_replace('%', '*', $row['disallow_username']) . '</option>'; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $template->assign_vars(array( 'U_ACTION' => $this->u_action, diff --git a/phpBB/modules/acp/acp_email.php b/phpBB/modules/acp/acp_email.php index ac21b068c0..b86765b897 100644 --- a/phpBB/modules/acp/acp_email.php +++ b/phpBB/modules/acp/acp_email.php @@ -71,7 +71,7 @@ class acp_email // If giving usernames the admin is able to email inactive users too... $sql = 'SELECT username, user_email, user_jabber, user_notify_type, user_lang FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('username_clean', array_map('utf8_clean_string', explode("\n", $usernames))) . ' + WHERE ' . phpbb::$db->sql_in_set('username_clean', array_map('utf8_clean_string', explode("\n", $usernames))) . ' AND user_allow_massemail = 1 ORDER BY user_lang, user_notify_type'; // , SUBSTRING(user_email FROM INSTR(user_email, '@')) } @@ -97,12 +97,12 @@ class acp_email ORDER BY user_lang, user_notify_type'; } } - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); if (!$row) { - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); trigger_error(phpbb::$user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -141,8 +141,8 @@ class acp_email $i++; } } - while ($row = $db->sql_fetchrow($result)); - $db->sql_freeresult($result); + while ($row = phpbb::$db->sql_fetchrow($result)); + phpbb::$db->sql_freeresult($result); // Send the messages include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); @@ -225,14 +225,14 @@ class acp_email $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name_clean IN ('bots', 'guests')"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $exclude = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $exclude[] = $row['group_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $select_list = '<option value="0"' . ((!$group_id) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['ALL_USERS'] . '</option>'; $select_list .= group_select_options($group_id, $exclude); diff --git a/phpBB/modules/acp/acp_forums.php b/phpBB/modules/acp/acp_forums.php index 5117d5bbd1..3b2c7020ff 100644 --- a/phpBB/modules/acp/acp_forums.php +++ b/phpBB/modules/acp/acp_forums.php @@ -188,11 +188,11 @@ class acp_forums { $sql = 'DELETE FROM ' . ACL_USERS_TABLE . ' WHERE forum_id = ' . (int) $forum_data['forum_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . ' WHERE forum_id = ' . (int) $forum_data['forum_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } // From the mysql documentation: @@ -203,10 +203,10 @@ class acp_forums $sql = 'SELECT user_id, auth_option_id, auth_role_id, auth_setting FROM ' . ACL_USERS_TABLE . ' WHERE forum_id = ' . $forum_perm_from; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $users_sql_ary = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $users_sql_ary[] = array( 'user_id' => (int) $row['user_id'], @@ -216,16 +216,16 @@ class acp_forums 'auth_setting' => (int) $row['auth_setting'] ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Copy permisisons from/to the acl groups table (only forum_id gets changed) $sql = 'SELECT group_id, auth_option_id, auth_role_id, auth_setting FROM ' . ACL_GROUPS_TABLE . ' WHERE forum_id = ' . $forum_perm_from; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $groups_sql_ary = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $groups_sql_ary[] = array( 'group_id' => (int) $row['group_id'], @@ -235,11 +235,11 @@ class acp_forums 'auth_setting' => (int) $row['auth_setting'] ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Now insert the data - $db->sql_multi_insert(ACL_USERS_TABLE, $users_sql_ary); - $db->sql_multi_insert(ACL_GROUPS_TABLE, $groups_sql_ary); + phpbb::$db->sql_multi_insert(ACL_USERS_TABLE, $users_sql_ary); + phpbb::$db->sql_multi_insert(ACL_GROUPS_TABLE, $groups_sql_ary); cache_moderators(); } @@ -282,9 +282,9 @@ class acp_forums $sql = 'SELECT * FROM ' . FORUMS_TABLE . " WHERE forum_id = $forum_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$row) { @@ -312,9 +312,9 @@ class acp_forums $sql = 'SELECT forum_name, forum_topics_real FROM ' . FORUMS_TABLE . " WHERE forum_id = $forum_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$row) { @@ -326,9 +326,9 @@ class acp_forums $sql = 'SELECT MIN(topic_id) as min_topic_id, MAX(topic_id) as max_topic_id FROM ' . TOPICS_TABLE . ' WHERE forum_id = ' . $forum_id; - $result = $db->sql_query($sql); - $row2 = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row2 = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); // Typecast to int if there is no data available $row2['min_topic_id'] = (int) $row2['min_topic_id']; @@ -350,9 +350,9 @@ class acp_forums FROM ' . TOPICS_TABLE . ' WHERE forum_id = ' . $forum_id . ' AND topic_id BETWEEN ' . $start . ' AND ' . $end; - $result = $db->sql_query($sql); - $topics_done = request_var('topics_done', 0) + (int) $db->sql_fetchfield('num_topics'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $topics_done = request_var('topics_done', 0) + (int) phpbb::$db->sql_fetchfield('num_topics'); + phpbb::$db->sql_freeresult($result); $start += $batch_size; @@ -390,9 +390,9 @@ class acp_forums $sql = 'SELECT forum_name, forum_type FROM ' . FORUMS_TABLE . " WHERE forum_id = $forum_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$row) { @@ -557,15 +557,15 @@ class acp_forums FROM ' . FORUMS_TABLE . ' WHERE forum_type = ' . FORUM_POST . " AND forum_id <> $forum_id"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - if ($db->sql_fetchrow($result)) + if (phpbb::$db->sql_fetchrow($result)) { $template->assign_vars(array( 'S_MOVE_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $forum_id, false, true, false)) ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Subforum move options if ($action == 'edit' && $forum_data['forum_type'] == FORUM_CAT) @@ -584,15 +584,15 @@ class acp_forums FROM ' . FORUMS_TABLE . ' WHERE forum_type = ' . FORUM_POST . " AND forum_id <> $forum_id"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - if ($db->sql_fetchrow($result)) + if (phpbb::$db->sql_fetchrow($result)) { $template->assign_vars(array( 'S_MOVE_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $subforums_id)) // , false, true, false??? ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $template->assign_vars(array( 'S_HAS_SUBFORUMS' => ($forum_data['right_id'] - $forum_data['left_id'] > 1) ? true : false, @@ -711,15 +711,15 @@ class acp_forums FROM ' . FORUMS_TABLE . ' WHERE forum_type = ' . FORUM_POST . " AND forum_id <> $forum_id"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - if ($db->sql_fetchrow($result)) + if (phpbb::$db->sql_fetchrow($result)) { $template->assign_vars(array( 'S_MOVE_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $subforums_id, false, true)) // , false, true, false??? ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $parent_id = ($this->parent_id == $forum_id) ? 0 : $this->parent_id; @@ -776,9 +776,9 @@ class acp_forums FROM ' . FORUMS_TABLE . " WHERE parent_id = $this->parent_id ORDER BY left_id"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - if ($row = $db->sql_fetchrow($result)) + if ($row = phpbb::$db->sql_fetchrow($result)) { do { @@ -828,7 +828,7 @@ class acp_forums 'U_SYNC' => $url . '&action=sync') ); } - while ($row = $db->sql_fetchrow($result)); + while ($row = phpbb::$db->sql_fetchrow($result)); } else if ($this->parent_id) { @@ -844,7 +844,7 @@ class acp_forums 'U_SYNC' => $url . '&action=sync') ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $template->assign_vars(array( 'ERROR_MSG' => (sizeof($errors)) ? implode('<br />', $errors) : '', @@ -866,9 +866,9 @@ class acp_forums $sql = 'SELECT * FROM ' . FORUMS_TABLE . " WHERE forum_id = $forum_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$row) { @@ -980,9 +980,9 @@ class acp_forums $sql = 'SELECT left_id, right_id, forum_type FROM ' . FORUMS_TABLE . ' WHERE forum_id = ' . $forum_data_sql['parent_id']; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$row) { @@ -998,12 +998,12 @@ class acp_forums $sql = 'UPDATE ' . FORUMS_TABLE . ' SET left_id = left_id + 2, right_id = right_id + 2 WHERE left_id > ' . $row['right_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $sql = 'UPDATE ' . FORUMS_TABLE . ' SET right_id = right_id + 2 WHERE ' . $row['left_id'] . ' BETWEEN left_id AND right_id'; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $forum_data_sql['left_id'] = $row['right_id']; $forum_data_sql['right_id'] = $row['right_id'] + 1; @@ -1012,18 +1012,18 @@ class acp_forums { $sql = 'SELECT MAX(right_id) AS right_id FROM ' . FORUMS_TABLE; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); $forum_data_sql['left_id'] = $row['right_id'] + 1; $forum_data_sql['right_id'] = $row['right_id'] + 2; } - $sql = 'INSERT INTO ' . FORUMS_TABLE . ' ' . $db->sql_build_array('INSERT', $forum_data_sql); - $db->sql_query($sql); + $sql = 'INSERT INTO ' . FORUMS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $forum_data_sql); + phpbb::$db->sql_query($sql); - $forum_data['forum_id'] = $db->sql_nextid(); + $forum_data['forum_id'] = phpbb::$db->sql_nextid(); add_log('admin', 'LOG_FORUM_ADD', $forum_data['forum_name']); } @@ -1099,23 +1099,23 @@ class acp_forums if (sizeof($forum_ids)) { $sql = 'DELETE FROM ' . FORUMS_TABLE . ' - WHERE ' . $db->sql_in_set('forum_id', $forum_ids); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('forum_id', $forum_ids); + phpbb::$db->sql_query($sql); $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . ' - WHERE ' . $db->sql_in_set('forum_id', $forum_ids); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('forum_id', $forum_ids); + phpbb::$db->sql_query($sql); $sql = 'DELETE FROM ' . ACL_USERS_TABLE . ' - WHERE ' . $db->sql_in_set('forum_id', $forum_ids); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('forum_id', $forum_ids); + phpbb::$db->sql_query($sql); // Delete forum ids from extension groups table $sql = 'SELECT group_id, allowed_forums FROM ' . EXTENSION_GROUPS_TABLE; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($_row = $db->sql_fetchrow($result)) + while ($_row = phpbb::$db->sql_fetchrow($result)) { if (!$_row['allowed_forums']) { @@ -1128,9 +1128,9 @@ class acp_forums $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . " SET allowed_forums = '" . ((sizeof($allowed_forums)) ? serialize($allowed_forums) : '') . "' WHERE group_id = {$_row['group_id']}"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); phpbb::$acm->destroy('extensions'); } @@ -1145,9 +1145,9 @@ class acp_forums $sql = 'SELECT forum_name FROM ' . FORUMS_TABLE . ' WHERE forum_id = ' . $subforums_to_id; - $result = $db->sql_query($sql); - $_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$_row) { @@ -1159,25 +1159,25 @@ class acp_forums $sql = 'SELECT forum_id FROM ' . FORUMS_TABLE . " WHERE parent_id = {$row['forum_id']}"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($_row = $db->sql_fetchrow($result)) + while ($_row = phpbb::$db->sql_fetchrow($result)) { $this->move_forum($_row['forum_id'], $subforums_to_id); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql = 'UPDATE ' . FORUMS_TABLE . " SET parent_id = $subforums_to_id WHERE parent_id = {$row['forum_id']}"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } // Adjust the left/right id $sql = 'UPDATE ' . FORUMS_TABLE . ' SET right_id = left_id + 1 WHERE forum_id = ' . $row['forum_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } } else if ($row['forum_type'] == FORUM_CAT && $forum_data_sql['forum_type'] == FORUM_POST) @@ -1223,7 +1223,7 @@ class acp_forums // the forum name has changed, clear the parents list of all forums (for safety) $sql = 'UPDATE ' . FORUMS_TABLE . " SET forum_parents = ''"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } // Setting the forum id to the forum id is not really received well by some dbs. ;) @@ -1231,9 +1231,9 @@ class acp_forums unset($forum_data_sql['forum_id']); $sql = 'UPDATE ' . FORUMS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $forum_data_sql) . ' + SET ' . phpbb::$db->sql_build_array('UPDATE', $forum_data_sql) . ' WHERE forum_id = ' . $forum_id; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // Add it back $forum_data['forum_id'] = $forum_id; @@ -1278,13 +1278,13 @@ class acp_forums SET right_id = right_id - $diff, forum_parents = '' WHERE left_id < " . $from_data['right_id'] . " AND right_id > " . $from_data['right_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // Resync righthand side of tree $sql = 'UPDATE ' . FORUMS_TABLE . " SET left_id = left_id - $diff, right_id = right_id - $diff, forum_parents = '' WHERE left_id > " . $from_data['right_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); if ($to_id > 0) { @@ -1295,15 +1295,15 @@ class acp_forums $sql = 'UPDATE ' . FORUMS_TABLE . " SET right_id = right_id + $diff, forum_parents = '' WHERE " . $to_data['right_id'] . ' BETWEEN left_id AND right_id - AND ' . $db->sql_in_set('forum_id', $moved_ids, true); - $db->sql_query($sql); + AND ' . phpbb::$db->sql_in_set('forum_id', $moved_ids, true); + phpbb::$db->sql_query($sql); // Resync the righthand side of the tree $sql = 'UPDATE ' . FORUMS_TABLE . " SET left_id = left_id + $diff, right_id = right_id + $diff, forum_parents = '' WHERE left_id > " . $to_data['right_id'] . ' - AND ' . $db->sql_in_set('forum_id', $moved_ids, true); - $db->sql_query($sql); + AND ' . phpbb::$db->sql_in_set('forum_id', $moved_ids, true); + phpbb::$db->sql_query($sql); // Resync moved branch $to_data['right_id'] += $diff; @@ -1321,18 +1321,18 @@ class acp_forums { $sql = 'SELECT MAX(right_id) AS right_id FROM ' . FORUMS_TABLE . ' - WHERE ' . $db->sql_in_set('forum_id', $moved_ids, true); - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + WHERE ' . phpbb::$db->sql_in_set('forum_id', $moved_ids, true); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); $diff = '+ ' . ($row['right_id'] - $from_data['left_id'] + 1); } $sql = 'UPDATE ' . FORUMS_TABLE . " SET left_id = left_id $diff, right_id = right_id $diff, forum_parents = '' - WHERE " . $db->sql_in_set('forum_id', $moved_ids); - $db->sql_query($sql); + WHERE " . phpbb::$db->sql_in_set('forum_id', $moved_ids); + phpbb::$db->sql_query($sql); return $errors; } @@ -1349,7 +1349,7 @@ class acp_forums $sql = "UPDATE $table SET forum_id = $to_id WHERE forum_id = $from_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } unset($table_ary); @@ -1359,7 +1359,7 @@ class acp_forums { $sql = "DELETE FROM $table WHERE forum_id = $from_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } if ($sync) @@ -1401,9 +1401,9 @@ class acp_forums $sql = 'SELECT forum_name FROM ' . FORUMS_TABLE . ' WHERE forum_id = ' . $posts_to_id; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$row) { @@ -1441,16 +1441,16 @@ class acp_forums $diff = sizeof($forum_ids) * 2; $sql = 'DELETE FROM ' . FORUMS_TABLE . ' - WHERE ' . $db->sql_in_set('forum_id', $forum_ids); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('forum_id', $forum_ids); + phpbb::$db->sql_query($sql); $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . ' - WHERE ' . $db->sql_in_set('forum_id', $forum_ids); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('forum_id', $forum_ids); + phpbb::$db->sql_query($sql); $sql = 'DELETE FROM ' . ACL_USERS_TABLE . ' - WHERE ' . $db->sql_in_set('forum_id', $forum_ids); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('forum_id', $forum_ids); + phpbb::$db->sql_query($sql); } else if ($action_subforums == 'move') { @@ -1465,9 +1465,9 @@ class acp_forums $sql = 'SELECT forum_name FROM ' . FORUMS_TABLE . ' WHERE forum_id = ' . $subforums_to_id; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$row) { @@ -1480,13 +1480,13 @@ class acp_forums $sql = 'SELECT forum_id FROM ' . FORUMS_TABLE . " WHERE parent_id = $forum_id"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $this->move_forum($row['forum_id'], $subforums_to_id); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Grab new forum data for correct tree updating later $forum_data = $this->get_forum_info($forum_id); @@ -1494,20 +1494,20 @@ class acp_forums $sql = 'UPDATE ' . FORUMS_TABLE . " SET parent_id = $subforums_to_id WHERE parent_id = $forum_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $diff = 2; $sql = 'DELETE FROM ' . FORUMS_TABLE . " WHERE forum_id = $forum_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . " WHERE forum_id = $forum_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $sql = 'DELETE FROM ' . ACL_USERS_TABLE . " WHERE forum_id = $forum_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } } @@ -1521,34 +1521,34 @@ class acp_forums $diff = 2; $sql = 'DELETE FROM ' . FORUMS_TABLE . " WHERE forum_id = $forum_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . " WHERE forum_id = $forum_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $sql = 'DELETE FROM ' . ACL_USERS_TABLE . " WHERE forum_id = $forum_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } // Resync tree $sql = 'UPDATE ' . FORUMS_TABLE . " SET right_id = right_id - $diff WHERE left_id < {$forum_data['right_id']} AND right_id > {$forum_data['right_id']}"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $sql = 'UPDATE ' . FORUMS_TABLE . " SET left_id = left_id - $diff, right_id = right_id - $diff WHERE left_id > {$forum_data['right_id']}"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // Delete forum ids from extension groups table $sql = 'SELECT group_id, allowed_forums FROM ' . EXTENSION_GROUPS_TABLE; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if (!$row['allowed_forums']) { @@ -1561,9 +1561,9 @@ class acp_forums $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . " SET allowed_forums = '" . ((sizeof($allowed_forums)) ? serialize($allowed_forums) : '') . "' WHERE group_id = {$row['group_id']}"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); phpbb::$acm->destroy('extensions'); @@ -1618,7 +1618,7 @@ class acp_forums { include_once(PHPBB_ROOT_PATH . 'includes/functions_posting.' . PHP_EXT); - $db->sql_transaction('begin'); + phpbb::$db->sql_transaction('begin'); // Select then delete all attachments $sql = 'SELECT a.topic_id @@ -1626,14 +1626,14 @@ class acp_forums WHERE p.forum_id = $forum_id AND a.in_message = 0 AND a.topic_id = p.topic_id"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $topic_ids = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $topic_ids[] = $row['topic_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); delete_attachments('topic', $topic_ids, false); @@ -1643,16 +1643,16 @@ class acp_forums WHERE forum_id = ' . $forum_id . ' AND post_postcount = 1 AND post_approved = 1'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $post_counts = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $post_counts[$row['poster_id']] = (!empty($post_counts[$row['poster_id']])) ? $post_counts[$row['poster_id']] + 1 : 1; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); - switch ($db->dbms_type) + switch (phpbb::$db->dbms_type) { case 'mysql': @@ -1679,7 +1679,7 @@ class acp_forums $sql_where .= "\nAND $table.$field = " . POSTS_TABLE . ".$field"; } - $db->sql_query($sql . $sql_using . $sql_where); + phpbb::$db->sql_query($sql . $sql_using . $sql_where); break; @@ -1711,14 +1711,14 @@ class acp_forums $sql = "SELECT $field FROM " . POSTS_TABLE . ' WHERE forum_id = ' . $forum_id; - $result = $db->sql_query_limit($sql, 500, $start); + $result = phpbb::$db->sql_query_limit($sql, 500, $start); $ids = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $ids[] = $row[$field]; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($ids)) { @@ -1726,7 +1726,7 @@ class acp_forums foreach ($tables as $table) { - $db->sql_query("DELETE FROM $table WHERE " . $db->sql_in_set($field, $ids)); + phpbb::$db->sql_query("DELETE FROM $table WHERE " . phpbb::$db->sql_in_set($field, $ids)); } } } @@ -1741,7 +1741,7 @@ class acp_forums foreach ($table_ary as $table) { - $db->sql_query("DELETE FROM $table WHERE forum_id = $forum_id"); + phpbb::$db->sql_query("DELETE FROM $table WHERE forum_id = $forum_id"); } // Set forum ids to 0 @@ -1749,7 +1749,7 @@ class acp_forums foreach ($table_ary as $table) { - $db->sql_query("UPDATE $table SET forum_id = 0 WHERE forum_id = $forum_id"); + phpbb::$db->sql_query("UPDATE $table SET forum_id = 0 WHERE forum_id = $forum_id"); } // Adjust users post counts @@ -1761,50 +1761,50 @@ class acp_forums SET user_posts = 0 WHERE user_id = ' . $poster_id . ' AND user_posts < ' . $substract; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $sql = 'UPDATE ' . USERS_TABLE . ' SET user_posts = user_posts - ' . $substract . ' WHERE user_id = ' . $poster_id . ' AND user_posts >= ' . $substract; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } } - $db->sql_transaction('commit'); + phpbb::$db->sql_transaction('commit'); // Make sure the overall post/topic count is correct... $sql = 'SELECT COUNT(post_id) AS stat FROM ' . POSTS_TABLE . ' WHERE post_approved = 1'; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); set_config('num_posts', (int) $row['stat'], true); $sql = 'SELECT COUNT(topic_id) AS stat FROM ' . TOPICS_TABLE . ' WHERE topic_approved = 1'; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); set_config('num_topics', (int) $row['stat'], true); $sql = 'SELECT COUNT(attach_id) as stat FROM ' . ATTACHMENTS_TABLE; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); set_config('num_files', (int) $row['stat'], true); $sql = 'SELECT SUM(filesize) as stat FROM ' . ATTACHMENTS_TABLE; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); set_config('upload_dir_size', (float) $row['stat'], true); @@ -1826,14 +1826,14 @@ class acp_forums FROM ' . FORUMS_TABLE . " WHERE parent_id = {$forum_row['parent_id']} AND " . (($action == 'move_up') ? "right_id < {$forum_row['right_id']} ORDER BY right_id DESC" : "left_id > {$forum_row['left_id']} ORDER BY left_id ASC"); - $result = $db->sql_query_limit($sql, $steps); + $result = phpbb::$db->sql_query_limit($sql, $steps); $target = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $target = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (!sizeof($target)) { @@ -1885,7 +1885,7 @@ class acp_forums WHERE left_id BETWEEN {$left_id} AND {$right_id} AND right_id BETWEEN {$left_id} AND {$right_id}"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); return $target['forum_name']; } diff --git a/phpBB/modules/acp/acp_groups.php b/phpBB/modules/acp/acp_groups.php index d1ececfdfd..9ee936339a 100644 --- a/phpBB/modules/acp/acp_groups.php +++ b/phpBB/modules/acp/acp_groups.php @@ -57,9 +57,9 @@ class acp_groups $sql = 'SELECT * FROM ' . GROUPS_TABLE . " WHERE group_id = $group_id"; - $result = $db->sql_query($sql); - $group_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $group_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$group_row) { @@ -134,16 +134,16 @@ class acp_groups FROM ' . USER_GROUP_TABLE . " WHERE group_id = $group_id ORDER BY user_id"; - $result = $db->sql_query_limit($sql, 200, $start); + $result = phpbb::$db->sql_query_limit($sql, 200, $start); $mark_ary = array(); - if ($row = $db->sql_fetchrow($result)) + if ($row = phpbb::$db->sql_fetchrow($result)) { do { $mark_ary[] = $row['user_id']; } - while ($row = $db->sql_fetchrow($result)); + while ($row = phpbb::$db->sql_fetchrow($result)); group_user_attributes('default', $group_id, $mark_ary, false, $group_name, $group_row); @@ -153,7 +153,7 @@ class acp_groups { $start = 0; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } while ($start); } @@ -421,9 +421,9 @@ class acp_groups $sql = 'SELECT group_founder_manage FROM ' . GROUPS_TABLE . ' WHERE group_id = ' . $group_perm_from; - $result = $db->sql_query($sql); - $check_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $check_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); // Check the group if non-founder if ($check_row && (phpbb::$user->is_founder || $check_row['group_founder_manage'] == 0)) @@ -437,10 +437,10 @@ class acp_groups $sql = 'SELECT forum_id, auth_option_id, auth_role_id, auth_setting FROM ' . ACL_GROUPS_TABLE . ' WHERE group_id = ' . $group_perm_from; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $groups_sql_ary = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $groups_sql_ary[] = array( 'group_id' => (int) $group_id, @@ -450,10 +450,10 @@ class acp_groups 'auth_setting' => (int) $row['auth_setting'] ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Now insert the data - $db->sql_multi_insert(ACL_GROUPS_TABLE, $groups_sql_ary); + phpbb::$db->sql_multi_insert(ACL_GROUPS_TABLE, $groups_sql_ary); phpbb::$acl->acl_clear_prefetch(); } @@ -502,16 +502,16 @@ class acp_groups FROM ' . RANKS_TABLE . ' WHERE rank_special = 1 ORDER BY rank_title'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $rank_options = '<option value="0"' . ((!$group_rank) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['USER_DEFAULT'] . '</option>'; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $selected = ($group_rank && $row['rank_id'] == $group_rank) ? ' selected="selected"' : ''; $rank_options .= '<option value="' . $row['rank_id'] . '"' . $selected . '>' . $row['rank_title'] . '</option>'; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $type_free = ($group_type == GROUP_FREE) ? ' checked="checked"' : ''; $type_open = ($group_type == GROUP_OPEN) ? ' checked="checked"' : ''; @@ -613,9 +613,9 @@ class acp_groups AND u.user_id = ug.user_id AND ug.group_leader = 1 ORDER BY ug.group_leader DESC, ug.user_pending ASC, u.username_clean"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $template->assign_block_vars('leader', array( 'U_USER_EDIT' => append_sid(PHPBB_ADMIN_PATH . 'index.' . PHP_EXT, "i=users&action=edit&u={$row['user_id']}"), @@ -627,16 +627,16 @@ class acp_groups 'USER_ID' => $row['user_id']) ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Total number of group members (non-leaders) $sql = 'SELECT COUNT(user_id) AS total_members FROM ' . USER_GROUP_TABLE . " WHERE group_id = $group_id AND group_leader = 0"; - $result = $db->sql_query($sql); - $total_members = (int) $db->sql_fetchfield('total_members'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $total_members = (int) phpbb::$db->sql_fetchfield('total_members'); + phpbb::$db->sql_freeresult($result); $s_action_options = ''; $options = array('default' => 'DEFAULT', 'approve' => 'APPROVE', 'demote' => 'DEMOTE', 'promote' => 'PROMOTE', 'deleteusers' => 'DELETE'); @@ -668,11 +668,11 @@ class acp_groups AND u.user_id = ug.user_id AND ug.group_leader = 0 ORDER BY ug.group_leader DESC, ug.user_pending ASC, u.username_clean"; - $result = $db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); + $result = phpbb::$db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); $pending = false; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if ($row['user_pending'] && !$pending) { @@ -693,7 +693,7 @@ class acp_groups 'USER_ID' => $row['user_id']) ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); return; break; @@ -708,10 +708,10 @@ class acp_groups $sql = 'SELECT g.group_id, g.group_name, g.group_type FROM ' . GROUPS_TABLE . ' g ORDER BY g.group_type ASC, g.group_name'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $lookup = $cached_group_data = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $type = ($row['group_type'] == GROUP_SPECIAL) ? 'special' : 'normal'; @@ -722,21 +722,21 @@ class acp_groups $cached_group_data[$type][$row['group_id']] = $row; $cached_group_data[$type][$row['group_id']]['total_members'] = 0; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // How many people are in which group? $sql = 'SELECT COUNT(ug.user_id) AS total_members, ug.group_id FROM ' . USER_GROUP_TABLE . ' ug - WHERE ' . $db->sql_in_set('ug.group_id', array_keys($lookup)) . ' + WHERE ' . phpbb::$db->sql_in_set('ug.group_id', array_keys($lookup)) . ' GROUP BY ug.group_id'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $type = $lookup[$row['group_id']]; $cached_group_data[$type][$row['group_id']]['total_members'] = $row['total_members']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // The order is... normal, then special ksort($cached_group_data); diff --git a/phpBB/modules/acp/acp_icons.php b/phpBB/modules/acp/acp_icons.php index a8fc4ff1c5..87bf369ac7 100644 --- a/phpBB/modules/acp/acp_icons.php +++ b/phpBB/modules/acp/acp_icons.php @@ -130,16 +130,16 @@ class acp_icons $sql = 'SELECT * FROM ' . SMILIES_TABLE . ' ORDER BY smiley_order'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if (empty($smilies[$row['smiley_url']])) { $smilies[$row['smiley_url']] = $row; } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($smilies)) { @@ -169,7 +169,7 @@ class acp_icons $sql = "SELECT * FROM $table ORDER BY {$fields}_order " . (($icon_id || $action == 'add') ? 'DESC' : 'ASC'); - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $data = array(); $after = false; @@ -178,7 +178,7 @@ class acp_icons $add_order_lists = array('', ''); $display_count = 0; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if ($action == 'add') { @@ -218,7 +218,7 @@ class acp_icons } } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $order_list = '<option value="1"' . ((!isset($after)) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['FIRST'] . '</option>'; $add_order_list = '<option value="1">' . phpbb::$user->lang['FIRST'] . '</option>'; @@ -392,7 +392,7 @@ class acp_icons $sql = "UPDATE $table SET {$fields}_order = {$fields}_order + 1 WHERE {$fields}_order >= {$image_order[$image]}"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // If we adjust the order, we need to adjust all other orders too - they became inaccurate... foreach ($image_order as $_image => $_order) @@ -412,15 +412,15 @@ class acp_icons if ($action == 'modify' && !empty($image_id[$image])) { $sql = "UPDATE $table - SET " . $db->sql_build_array('UPDATE', $img_sql) . " + SET " . phpbb::$db->sql_build_array('UPDATE', $img_sql) . " WHERE {$fields}_id = " . $image_id[$image]; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $icons_updated++; } else if ($action !== 'modify') { - $sql = "INSERT INTO $table " . $db->sql_build_array('INSERT', $img_sql); - $db->sql_query($sql); + $sql = "INSERT INTO $table " . phpbb::$db->sql_build_array('INSERT', $img_sql); + phpbb::$db->sql_query($sql); $icons_updated++; } @@ -496,13 +496,13 @@ class acp_icons // The user has already selected a smilies_pak file if ($current == 'delete') { - if ($db->truncate) + if (phpbb::$db->truncate) { - $db->sql_query('TRUNCATE TABLE ' . $table); + phpbb::$db->sql_query('TRUNCATE TABLE ' . $table); } else { - $db->sql_query('DELETE FROM ' . $table); + phpbb::$db->sql_query('DELETE FROM ' . $table); } switch ($mode) @@ -512,8 +512,8 @@ class acp_icons case 'icons': // Reset all icon_ids - $db->sql_query('UPDATE ' . TOPICS_TABLE . ' SET icon_id = 0'); - $db->sql_query('UPDATE ' . POSTS_TABLE . ' SET icon_id = 0'); + phpbb::$db->sql_query('UPDATE ' . TOPICS_TABLE . ' SET icon_id = 0'); + phpbb::$db->sql_query('UPDATE ' . POSTS_TABLE . ' SET icon_id = 0'); break; } } @@ -525,14 +525,14 @@ class acp_icons $sql = "SELECT $field_sql FROM $table"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { ++$order; $cur_img[$row[$field_sql]] = 1; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } foreach ($pak_ary as $pak_entry) @@ -577,9 +577,9 @@ class acp_icons )); } - $sql = "UPDATE $table SET " . $db->sql_build_array('UPDATE', $sql) . " - WHERE $field_sql = '" . $db->sql_escape($replace_sql) . "'"; - $db->sql_query($sql); + $sql = "UPDATE $table SET " . phpbb::$db->sql_build_array('UPDATE', $sql) . " + WHERE $field_sql = '" . phpbb::$db->sql_escape($replace_sql) . "'"; + phpbb::$db->sql_query($sql); } else { @@ -600,7 +600,7 @@ class acp_icons 'emotion' => $emotion, )); } - $db->sql_query("INSERT INTO $table " . $db->sql_build_array('INSERT', $sql)); + phpbb::$db->sql_query("INSERT INTO $table " . phpbb::$db->sql_build_array('INSERT', $sql)); } } } @@ -659,10 +659,10 @@ class acp_icons $sql = "SELECT * FROM $table ORDER BY {$fields}_order"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $pak = ''; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $pak .= "'" . addslashes($row[$fields . '_url']) . "', "; $pak .= "'" . addslashes($row[$fields . '_width']) . "', "; @@ -677,7 +677,7 @@ class acp_icons $pak .= "\n"; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if ($pak != '') { @@ -706,7 +706,7 @@ class acp_icons { $sql = "DELETE FROM $table WHERE {$fields}_id = $icon_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); switch ($mode) { @@ -715,11 +715,11 @@ class acp_icons case 'icons': // Reset appropriate icon_ids - $db->sql_query('UPDATE ' . TOPICS_TABLE . " + phpbb::$db->sql_query('UPDATE ' . TOPICS_TABLE . " SET icon_id = 0 WHERE icon_id = $icon_id"); - $db->sql_query('UPDATE ' . POSTS_TABLE . " + phpbb::$db->sql_query('UPDATE ' . POSTS_TABLE . " SET icon_id = 0 WHERE icon_id = $icon_id"); break; @@ -749,9 +749,9 @@ class acp_icons $sql = "SELECT {$fields}_order as current_order FROM $table WHERE {$fields}_id = $icon_id"; - $result = $db->sql_query($sql); - $current_order = (int) $db->sql_fetchfield('current_order'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $current_order = (int) phpbb::$db->sql_fetchfield('current_order'); + phpbb::$db->sql_freeresult($result); if ($current_order == 0 && $action == 'move_up') { @@ -767,16 +767,16 @@ class acp_icons SET {$fields}_order = $current_order WHERE {$fields}_order = $switch_order_id AND {$fields}_id <> $icon_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // Only update the other entry too if the previous entry got updated - if ($db->sql_affectedrows()) + if (phpbb::$db->sql_affectedrows()) { $sql = "UPDATE $table SET {$fields}_order = $switch_order_id WHERE {$fields}_order = $current_order AND {$fields}_id = $icon_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } phpbb::$acm->destroy('icons'); @@ -789,9 +789,9 @@ class acp_icons $sql = "SELECT {$fields}_id AS order_id, {$fields}_order AS fields_order FROM $table ORDER BY display_on_posting DESC, {$fields}_order"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - if ($row = $db->sql_fetchrow($result)) + if ($row = phpbb::$db->sql_fetchrow($result)) { $order = 0; do @@ -799,14 +799,14 @@ class acp_icons ++$order; if ($row['fields_order'] != $order) { - $db->sql_query("UPDATE $table + phpbb::$db->sql_query("UPDATE $table SET {$fields}_order = $order WHERE {$fields}_id = " . $row['order_id']); } } - while ($row = $db->sql_fetchrow($result)); + while ($row = phpbb::$db->sql_fetchrow($result)); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $template->assign_vars(array( 'L_TITLE' => phpbb::$user->lang['ACP_' . $lang], @@ -833,9 +833,9 @@ class acp_icons $sql = "SELECT * FROM $table ORDER BY {$fields}_order ASC"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $alt_text = ($mode == 'smilies') ? $row['code'] : ''; @@ -858,7 +858,7 @@ class acp_icons $spacer = true; } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } } diff --git a/phpBB/modules/acp/acp_inactive.php b/phpBB/modules/acp/acp_inactive.php index 68363a587b..508aefe034 100644 --- a/phpBB/modules/acp/acp_inactive.php +++ b/phpBB/modules/acp/acp_inactive.php @@ -62,15 +62,15 @@ class acp_inactive $sql = 'SELECT user_id, username FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('user_id', $mark); - $result = $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('user_id', $mark); + $result = phpbb::$db->sql_query($sql); $user_affected = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $user_affected[$row['user_id']] = $row['username']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if ($action == 'activate') { @@ -79,16 +79,16 @@ class acp_inactive // Get those 'being activated'... $sql = 'SELECT user_id, username, user_email, user_lang FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('user_id', $mark) . ' + WHERE ' . phpbb::$db->sql_in_set('user_id', $mark) . ' AND user_type = ' . phpbb::USER_INACTIVE; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $inactive_users = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $inactive_users[] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } user_active_flip('activate', $mark); @@ -158,10 +158,10 @@ class acp_inactive $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type, user_regdate, user_actkey FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('user_id', $mark); - $result = $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('user_id', $mark); + $result = phpbb::$db->sql_query($sql); - if ($row = $db->sql_fetchrow($result)) + if ($row = phpbb::$db->sql_fetchrow($result)) { // Send the messages include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); @@ -186,14 +186,14 @@ class acp_inactive $usernames[] = $row['username']; } - while ($row = $db->sql_fetchrow($result)); + while ($row = phpbb::$db->sql_fetchrow($result)); $messenger->save_queue(); add_log('admin', 'LOG_INACTIVE_REMIND', implode(', ', $usernames)); unset($usernames); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); break; } diff --git a/phpBB/modules/acp/acp_jabber.php b/phpBB/modules/acp/acp_jabber.php index 67a986516d..e0fe8aba25 100644 --- a/phpBB/modules/acp/acp_jabber.php +++ b/phpBB/modules/acp/acp_jabber.php @@ -91,9 +91,9 @@ class acp_jabber ); $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_notify_type = ' . NOTIFY_IM; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } set_config('jab_enable', $jab_enable); diff --git a/phpBB/modules/acp/acp_language.php b/phpBB/modules/acp/acp_language.php index 97e80ec8f9..82c18c79aa 100644 --- a/phpBB/modules/acp/acp_language.php +++ b/phpBB/modules/acp/acp_language.php @@ -171,9 +171,9 @@ class acp_language $sql = 'SELECT * FROM ' . LANG_TABLE . " WHERE lang_id = $lang_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); $sql_ary = array( 'lang_english_name' => request_var('lang_english_name', $row['lang_english_name']), @@ -181,8 +181,8 @@ class acp_language 'lang_author' => utf8_normalize_nfc(request_var('lang_author', $row['lang_author'], true)), ); - $db->sql_query('UPDATE ' . LANG_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + phpbb::$db->sql_query('UPDATE ' . LANG_TABLE . ' + SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . ' WHERE lang_id = ' . $lang_id); add_log('admin', 'LOG_LANGUAGE_PACK_UPDATED', $sql_ary['lang_english_name']); @@ -217,9 +217,9 @@ class acp_language $sql = 'SELECT * FROM ' . LANG_TABLE . " WHERE lang_id = $lang_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$row) { @@ -382,9 +382,9 @@ class acp_language $sql = 'SELECT lang_iso FROM ' . LANG_TABLE . " WHERE lang_id = $lang_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); $file = request_var('file', ''); $dir = request_var('dir', ''); @@ -451,9 +451,9 @@ class acp_language $sql = 'SELECT * FROM ' . LANG_TABLE . ' WHERE lang_id = ' . $lang_id; - $result = $db->sql_query($sql); - $lang_entries = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $lang_entries = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); $lang_iso = $lang_entries['lang_iso']; $missing_vars = $missing_files = array(); @@ -769,31 +769,31 @@ class acp_language $sql = 'SELECT * FROM ' . LANG_TABLE . ' WHERE lang_id = ' . $lang_id; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if ($row['lang_iso'] == phpbb::$config['default_lang']) { trigger_error(phpbb::$user->lang['NO_REMOVE_DEFAULT_LANG'] . adm_back_link($this->u_action), E_USER_WARNING); } - $db->sql_query('DELETE FROM ' . LANG_TABLE . ' WHERE lang_id = ' . $lang_id); + phpbb::$db->sql_query('DELETE FROM ' . LANG_TABLE . ' WHERE lang_id = ' . $lang_id); $sql = 'UPDATE ' . USERS_TABLE . " - SET user_lang = '" . $db->sql_escape(phpbb::$config['default_lang']) . "' - WHERE user_lang = '" . $db->sql_escape($row['lang_iso']) . "'"; - $db->sql_query($sql); + SET user_lang = '" . phpbb::$db->sql_escape(phpbb::$config['default_lang']) . "' + WHERE user_lang = '" . phpbb::$db->sql_escape($row['lang_iso']) . "'"; + phpbb::$db->sql_query($sql); // We also need to remove the translated entries for custom profile fields - we want clean tables, don't we? $sql = 'DELETE FROM ' . PROFILE_LANG_TABLE . ' WHERE lang_id = ' . $lang_id; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $sql = 'DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . ' WHERE lang_id = ' . $lang_id; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); - $sql = 'DELETE FROM ' . STYLES_IMAGESET_DATA_TABLE . " WHERE image_lang = '" . $db->sql_escape($row['lang_iso']) . "'"; - $result = $db->sql_query($sql); + $sql = 'DELETE FROM ' . STYLES_IMAGESET_DATA_TABLE . " WHERE image_lang = '" . phpbb::$db->sql_escape($row['lang_iso']) . "'"; + $result = phpbb::$db->sql_query($sql); phpbb::$acm->destroy_sql(STYLES_IMAGESET_DATA_TABLE); @@ -823,10 +823,10 @@ class acp_language $sql = 'SELECT lang_iso FROM ' . LANG_TABLE . " - WHERE lang_iso = '" . $db->sql_escape($lang_iso) . "'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + WHERE lang_iso = '" . phpbb::$db->sql_escape($lang_iso) . "'"; + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if ($row) { @@ -847,8 +847,8 @@ class acp_language 'lang_author' => $lang_pack['author'] ); - $db->sql_query('INSERT INTO ' . LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); - $lang_id = $db->sql_nextid(); + phpbb::$db->sql_query('INSERT INTO ' . LANG_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary)); + $lang_id = phpbb::$db->sql_nextid(); $valid_localized = array( 'icon_back_top', 'icon_contact_aim', 'icon_contact_email', 'icon_contact_icq', 'icon_contact_jabber', 'icon_contact_msnm', 'icon_contact_pm', 'icon_contact_yahoo', 'icon_contact_www', 'icon_post_delete', 'icon_post_edit', 'icon_post_info', 'icon_post_quote', 'icon_post_report', 'icon_user_online', 'icon_user_offline', 'icon_user_profile', 'icon_user_search', 'icon_user_warn', 'button_pm_forward', 'button_pm_new', 'button_pm_reply', 'button_topic_locked', 'button_topic_new', 'button_topic_reply', @@ -858,8 +858,8 @@ class acp_language $sql = 'SELECT * FROM ' . STYLES_IMAGESET_TABLE; - $result = $db->sql_query($sql); - while ($imageset_row = $db->sql_fetchrow($result)) + $result = phpbb::$db->sql_query($sql); + while ($imageset_row = phpbb::$db->sql_fetchrow($result)) { if (@file_exists(PHPBB_ROOT_PATH . "styles/{$imageset_row['imageset_path']}/imageset/{$lang_pack['iso']}/imageset.cfg")) { @@ -902,21 +902,21 @@ class acp_language } } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($sql_ary)) { - $db->sql_multi_insert(STYLES_IMAGESET_DATA_TABLE, $sql_ary); + phpbb::$db->sql_multi_insert(STYLES_IMAGESET_DATA_TABLE, $sql_ary); phpbb::$acm->destroy_sql(STYLES_IMAGESET_DATA_TABLE); } // Now let's copy the default language entries for custom profile fields for this new language - makes admin's life easier. $sql = 'SELECT lang_id FROM ' . LANG_TABLE . " - WHERE lang_iso = '" . $db->sql_escape(phpbb::$config['default_lang']) . "'"; - $result = $db->sql_query($sql); - $default_lang_id = (int) $db->sql_fetchfield('lang_id'); - $db->sql_freeresult($result); + WHERE lang_iso = '" . phpbb::$db->sql_escape(phpbb::$config['default_lang']) . "'"; + $result = phpbb::$db->sql_query($sql); + $default_lang_id = (int) phpbb::$db->sql_fetchfield('lang_id'); + phpbb::$db->sql_freeresult($result); // From the mysql documentation: // Prior to MySQL 4.0.14, the target table of the INSERT statement cannot appear in the FROM clause of the SELECT part of the query. This limitation is lifted in 4.0.14. @@ -925,26 +925,26 @@ class acp_language $sql = 'SELECT field_id, lang_name, lang_explain, lang_default_value FROM ' . PROFILE_LANG_TABLE . ' WHERE lang_id = ' . $default_lang_id; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $row['lang_id'] = $lang_id; - $db->sql_query('INSERT INTO ' . PROFILE_LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $row)); + phpbb::$db->sql_query('INSERT INTO ' . PROFILE_LANG_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $row)); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql = 'SELECT field_id, option_id, field_type, lang_value FROM ' . PROFILE_FIELDS_LANG_TABLE . ' WHERE lang_id = ' . $default_lang_id; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $row['lang_id'] = $lang_id; - $db->sql_query('INSERT INTO ' . PROFILE_FIELDS_LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $row)); + phpbb::$db->sql_query('INSERT INTO ' . PROFILE_FIELDS_LANG_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $row)); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); add_log('admin', 'LOG_LANGUAGE_PACK_INSTALLED', $lang_pack['name']); @@ -962,9 +962,9 @@ class acp_language $sql = 'SELECT * FROM ' . LANG_TABLE . ' WHERE lang_id = ' . $lang_id; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); $use_method = request_var('use_method', ''); $methods = array('.tar'); @@ -1077,23 +1077,23 @@ class acp_language $sql = 'SELECT user_lang, COUNT(user_lang) AS lang_count FROM ' . USERS_TABLE . ' GROUP BY user_lang'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $lang_count = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $lang_count[$row['user_lang']] = $row['lang_count']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql = 'SELECT * FROM ' . LANG_TABLE . ' ORDER BY lang_english_name'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $installed = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $installed[] = $row['lang_iso']; $tagstyle = ($row['lang_iso'] == phpbb::$config['default_lang']) ? '*' : ''; @@ -1110,7 +1110,7 @@ class acp_language 'USED_BY' => (isset($lang_count[$row['lang_iso']])) ? $lang_count[$row['lang_iso']] : 0, )); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $new_ary = $iso = array(); $dp = @opendir(PHPBB_ROOT_PATH . 'language'); diff --git a/phpBB/modules/acp/acp_logs.php b/phpBB/modules/acp/acp_logs.php index 9b8e77706e..63f57c7d21 100644 --- a/phpBB/modules/acp/acp_logs.php +++ b/phpBB/modules/acp/acp_logs.php @@ -57,7 +57,7 @@ class acp_logs { $sql_in[] = $mark; } - $where_sql = ' AND ' . $db->sql_in_set('log_id', $sql_in); + $where_sql = ' AND ' . phpbb::$db->sql_in_set('log_id', $sql_in); unset($sql_in); } @@ -66,7 +66,7 @@ class acp_logs $sql = 'DELETE FROM ' . LOG_TABLE . " WHERE log_type = {$this->log_type} $where_sql"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); add_log('admin', 'LOG_CLEAR_' . strtoupper($mode)); } diff --git a/phpBB/modules/acp/acp_permission_roles.php b/phpBB/modules/acp/acp_permission_roles.php index ca497850ac..aba743cc7a 100644 --- a/phpBB/modules/acp/acp_permission_roles.php +++ b/phpBB/modules/acp/acp_permission_roles.php @@ -90,9 +90,9 @@ class acp_permission_roles $sql = 'SELECT * FROM ' . ACL_ROLES_TABLE . ' WHERE role_id = ' . $role_id; - $result = $db->sql_query($sql); - $role_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $role_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$role_row) { @@ -129,9 +129,9 @@ class acp_permission_roles $sql = 'SELECT * FROM ' . ACL_ROLES_TABLE . ' WHERE role_id = ' . $role_id; - $result = $db->sql_query($sql); - $role_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $role_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$role_row) { @@ -164,11 +164,11 @@ class acp_permission_roles // if we add/edit a role we check the name to be unique among the settings... $sql = 'SELECT role_id FROM ' . ACL_ROLES_TABLE . " - WHERE role_type = '" . $db->sql_escape($permission_type) . "' - AND role_name = '" . $db->sql_escape($role_name) . "'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + WHERE role_type = '" . phpbb::$db->sql_escape($permission_type) . "' + AND role_name = '" . phpbb::$db->sql_escape($role_name) . "'"; + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); // Make sure we only print out the error if we add the role or change it's name if ($row && ($mode == 'add' || ($mode == 'edit' && $role_row['role_name'] != $role_name))) @@ -185,26 +185,26 @@ class acp_permission_roles if ($action == 'edit') { $sql = 'UPDATE ' . ACL_ROLES_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . ' WHERE role_id = ' . $role_id; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } else { // Get maximum role order for inserting a new role... $sql = 'SELECT MAX(role_order) as max_order FROM ' . ACL_ROLES_TABLE . " - WHERE role_type = '" . $db->sql_escape($permission_type) . "'"; - $result = $db->sql_query($sql); - $max_order = (int) $db->sql_fetchfield('max_order'); - $db->sql_freeresult($result); + WHERE role_type = '" . phpbb::$db->sql_escape($permission_type) . "'"; + $result = phpbb::$db->sql_query($sql); + $max_order = (int) phpbb::$db->sql_fetchfield('max_order'); + phpbb::$db->sql_freeresult($result); $sql_ary['role_order'] = $max_order + 1; - $sql = 'INSERT INTO ' . ACL_ROLES_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); - $db->sql_query($sql); + $sql = 'INSERT INTO ' . ACL_ROLES_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary); + phpbb::$db->sql_query($sql); - $role_id = $db->sql_nextid(); + $role_id = phpbb::$db->sql_nextid(); } // Now add the auth settings @@ -239,30 +239,30 @@ class acp_permission_roles WHERE o.auth_option_id = p.auth_option_id AND p.role_id = ' . $options_from . ' ORDER BY p.auth_option_id'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $auth_options = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $auth_options[$row['auth_option']] = $row['auth_setting']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } else { $sql = 'SELECT auth_option_id, auth_option FROM ' . ACL_OPTIONS_TABLE . " - WHERE auth_option " . $db->sql_like_expression($permission_type . $db->any_char) . " + WHERE auth_option " . phpbb::$db->sql_like_expression($permission_type . phpbb::$db->any_char) . " AND auth_option <> '{$permission_type}' ORDER BY auth_option_id"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $auth_options = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $auth_options[$row['auth_option']] = phpbb::ACL_NO; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } // no break; @@ -279,23 +279,23 @@ class acp_permission_roles $sql = 'SELECT * FROM ' . ACL_ROLES_TABLE . ' WHERE role_id = ' . $role_id; - $result = $db->sql_query($sql); - $role_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $role_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); $sql = 'SELECT p.auth_option_id, p.auth_setting, o.auth_option FROM ' . ACL_ROLES_DATA_TABLE . ' p, ' . ACL_OPTIONS_TABLE . ' o WHERE o.auth_option_id = p.auth_option_id AND p.role_id = ' . $role_id . ' ORDER BY p.auth_option_id'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $auth_options = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $auth_options[$row['auth_option']] = $row['auth_setting']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } if (!$role_row) @@ -318,19 +318,19 @@ class acp_permission_roles // We need to fill the auth options array with ACL_NO options ;) $sql = 'SELECT auth_option_id, auth_option FROM ' . ACL_OPTIONS_TABLE . " - WHERE auth_option " . $db->sql_like_expression($permission_type . $db->any_char) . " + WHERE auth_option " . phpbb::$db->sql_like_expression($permission_type . phpbb::$db->any_char) . " AND auth_option <> '{$permission_type}' ORDER BY auth_option_id"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if (!isset($auth_options[$row['auth_option']])) { $auth_options[$row['auth_option']] = phpbb::ACL_NO; } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Unset global permission option unset($auth_options[$permission_type]); @@ -367,9 +367,9 @@ class acp_permission_roles $sql = 'UPDATE ' . ACL_ROLES_TABLE . ' SET role_order = ' . $order_total . " - role_order - WHERE role_type = '" . $db->sql_escape($permission_type) . "' + WHERE role_type = '" . phpbb::$db->sql_escape($permission_type) . "' AND role_order IN ($order, " . (($action == 'move_up') ? $order - 1 : $order + 1) . ')'; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); break; } @@ -377,11 +377,11 @@ class acp_permission_roles // By default, check that role_order is valid and fix it if necessary $sql = 'SELECT role_id, role_order FROM ' . ACL_ROLES_TABLE . " - WHERE role_type = '" . $db->sql_escape($permission_type) . "' + WHERE role_type = '" . phpbb::$db->sql_escape($permission_type) . "' ORDER BY role_order ASC"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - if ($row = $db->sql_fetchrow($result)) + if ($row = phpbb::$db->sql_fetchrow($result)) { $order = 0; do @@ -389,12 +389,12 @@ class acp_permission_roles $order++; if ($row['role_order'] != $order) { - $db->sql_query('UPDATE ' . ACL_ROLES_TABLE . " SET role_order = $order WHERE role_id = {$row['role_id']}"); + phpbb::$db->sql_query('UPDATE ' . ACL_ROLES_TABLE . " SET role_order = $order WHERE role_id = {$row['role_id']}"); } } - while ($row = $db->sql_fetchrow($result)); + while ($row = phpbb::$db->sql_fetchrow($result)); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Display assigned items? $display_item = request_var('display_item', 0); @@ -402,12 +402,12 @@ class acp_permission_roles // Select existing roles $sql = 'SELECT * FROM ' . ACL_ROLES_TABLE . " - WHERE role_type = '" . $db->sql_escape($permission_type) . "' + WHERE role_type = '" . phpbb::$db->sql_escape($permission_type) . "' ORDER BY role_order ASC"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $s_role_options = ''; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $role_name = (!empty(phpbb::$user->lang[$row['role_name']])) ? phpbb::$user->lang[$row['role_name']] : $row['role_name']; @@ -431,7 +431,7 @@ class acp_permission_roles ); } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $template->assign_vars(array( 'S_ROLE_OPTIONS' => $s_role_options) @@ -499,28 +499,28 @@ class acp_permission_roles // Get complete auth array $sql = 'SELECT auth_option, auth_option_id FROM ' . ACL_OPTIONS_TABLE . " - WHERE auth_option " . $db->sql_like_expression($permission_type . $db->any_char); - $result = $db->sql_query($sql); + WHERE auth_option " . phpbb::$db->sql_like_expression($permission_type . phpbb::$db->any_char); + $result = phpbb::$db->sql_query($sql); $auth_settings = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $auth_settings[$row['auth_option']] = phpbb::ACL_NO; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Get the role auth settings we need to re-set... $sql = 'SELECT o.auth_option, r.auth_setting FROM ' . ACL_ROLES_DATA_TABLE . ' r, ' . ACL_OPTIONS_TABLE . ' o WHERE o.auth_option_id = r.auth_option_id AND r.role_id = ' . $role_id; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $auth_settings[$row['auth_option']] = $row['auth_setting']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Get role assignments $hold_ary = $auth_admin->get_role_mask($role_id); @@ -542,20 +542,20 @@ class acp_permission_roles // Remove role from users and groups just to be sure (happens through acl_set) $sql = 'DELETE FROM ' . ACL_USERS_TABLE . ' WHERE auth_role_id = ' . $role_id; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . ' WHERE auth_role_id = ' . $role_id; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // Remove role data and role $sql = 'DELETE FROM ' . ACL_ROLES_DATA_TABLE . ' WHERE role_id = ' . $role_id; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $sql = 'DELETE FROM ' . ACL_ROLES_TABLE . ' WHERE role_id = ' . $role_id; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $auth_admin->acl_clear_prefetch(); } diff --git a/phpBB/modules/acp/acp_permissions.php b/phpBB/modules/acp/acp_permissions.php index f411105433..aaa601229e 100644 --- a/phpBB/modules/acp/acp_permissions.php +++ b/phpBB/modules/acp/acp_permissions.php @@ -83,13 +83,13 @@ class acp_permissions FROM ' . GROUPS_TABLE . ' WHERE group_type = ' . GROUP_SPECIAL . " $sql_and"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $group_id[] = $row['group_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } // Map usernames to ids and vice versa @@ -116,14 +116,14 @@ class acp_permissions $sql = 'SELECT forum_id FROM ' . FORUMS_TABLE . ' ORDER BY left_id'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $forum_id = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $forum_id[] = (int) $row['forum_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } else if ($subforum_id) { @@ -439,16 +439,16 @@ class acp_permissions { $sql = 'SELECT forum_name FROM ' . FORUMS_TABLE . ' - WHERE ' . $db->sql_in_set('forum_id', $forum_id) . ' + WHERE ' . phpbb::$db->sql_in_set('forum_id', $forum_id) . ' ORDER BY left_id ASC'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $forum_names = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $forum_names[] = $row['forum_name']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $template->assign_vars(array( 'S_FORUM_NAMES' => (sizeof($forum_names)) ? true : false, @@ -583,15 +583,15 @@ class acp_permissions { $sql = "SELECT $sql_id FROM $table - WHERE " . $db->sql_in_set($sql_id, $ids); - $result = $db->sql_query($sql); + WHERE " . phpbb::$db->sql_in_set($sql_id, $ids); + $result = phpbb::$db->sql_query($sql); $ids = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $ids[] = (int) $row[$sql_id]; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } if (!sizeof($ids)) @@ -756,14 +756,14 @@ class acp_permissions FROM ' . ACL_OPTIONS_TABLE . ' o, ' . ACL_ROLES_DATA_TABLE . ' r WHERE o.auth_option_id = r.auth_option_id AND r.role_id = ' . $role_id; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $test_auth_settings = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $test_auth_settings[$row['auth_option']] = $row['auth_setting']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // We need to add any ACL_NO setting from auth_settings to compare correctly foreach ($auth_settings as $option => $setting) @@ -826,15 +826,15 @@ class acp_permissions // Logging ... first grab user or groupnames ... $sql = ($ug_type == 'group') ? 'SELECT group_name as name, group_type FROM ' . GROUPS_TABLE . ' WHERE ' : 'SELECT username as name FROM ' . USERS_TABLE . ' WHERE '; - $sql .= $db->sql_in_set(($ug_type == 'group') ? 'group_id' : 'user_id', array_map('intval', $ug_id)); - $result = $db->sql_query($sql); + $sql .= phpbb::$db->sql_in_set(($ug_type == 'group') ? 'group_id' : 'user_id', array_map('intval', $ug_id)); + $result = phpbb::$db->sql_query($sql); $l_ug_list = ''; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $l_ug_list .= (($l_ug_list != '') ? ', ' : '') . ((isset($row['group_type']) && $row['group_type'] == GROUP_SPECIAL) ? '<span class="sep">' . phpbb::$user->lang['G_' . $row['name']] . '</span>' : $row['name']); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $mode = str_replace('setting_', '', $mode); @@ -847,15 +847,15 @@ class acp_permissions // Grab the forum details if non-zero forum_id $sql = 'SELECT forum_name FROM ' . FORUMS_TABLE . ' - WHERE ' . $db->sql_in_set('forum_id', $forum_id); - $result = $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('forum_id', $forum_id); + $result = phpbb::$db->sql_query($sql); $l_forum_list = ''; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $l_forum_list .= (($l_forum_list != '') ? ', ' : '') . $row['forum_name']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); add_log('admin', 'LOG_ACL_' . strtoupper($action) . '_' . strtoupper($mode) . '_' . strtoupper($permission_type), $l_forum_list, $l_ug_list); } @@ -871,9 +871,9 @@ class acp_permissions $sql = 'SELECT user_id, username, user_permissions, user_type FROM ' . USERS_TABLE . ' WHERE user_id = ' . $user_id; - $result = $db->sql_query($sql); - $userdata = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $userdata = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); } else { @@ -892,9 +892,9 @@ class acp_permissions $sql = 'SELECT forum_name FROM ' . FORUMS_TABLE . " WHERE forum_id = $forum_id"; - $result = $db->sql_query($sql, 3600); - $forum_name = $db->sql_fetchfield('forum_name'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql, 3600); + $forum_name = phpbb::$db->sql_fetchfield('forum_name'); + phpbb::$db->sql_freeresult($result); } $back = request_var('back', 0); @@ -923,17 +923,17 @@ class acp_permissions WHERE ug.user_id = ' . $user_id . ' AND ug.user_pending = 0 ORDER BY g.group_type DESC, g.group_id DESC'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $groups = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $groups[$row['group_id']] = array( 'auth_setting' => phpbb::ACL_NO, 'group_name' => ($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name'] ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $total = phpbb::ACL_NO; $add_key = (($forum_id) ? '_LOCAL' : ''); @@ -1087,43 +1087,43 @@ class acp_permissions */ function retrieve_defined_user_groups($permission_scope, $forum_id, $permission_type) { - $sql_forum_id = ($permission_scope == 'global') ? 'AND a.forum_id = 0' : ((sizeof($forum_id)) ? 'AND ' . $db->sql_in_set('a.forum_id', $forum_id) : 'AND a.forum_id <> 0'); + $sql_forum_id = ($permission_scope == 'global') ? 'AND a.forum_id = 0' : ((sizeof($forum_id)) ? 'AND ' . phpbb::$db->sql_in_set('a.forum_id', $forum_id) : 'AND a.forum_id <> 0'); // Permission options are only able to be a permission set... therefore we will pre-fetch the possible options and also the possible roles $option_ids = $role_ids = array(); $sql = 'SELECT auth_option_id FROM ' . ACL_OPTIONS_TABLE . ' - WHERE auth_option ' . $db->sql_like_expression($permission_type . $db->any_char); - $result = $db->sql_query($sql); + WHERE auth_option ' . phpbb::$db->sql_like_expression($permission_type . phpbb::$db->any_char); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $option_ids[] = (int) $row['auth_option_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($option_ids)) { $sql = 'SELECT DISTINCT role_id FROM ' . ACL_ROLES_DATA_TABLE . ' - WHERE ' . $db->sql_in_set('auth_option_id', $option_ids); - $result = $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('auth_option_id', $option_ids); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $role_ids[] = (int) $row['role_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } if (sizeof($option_ids) && sizeof($role_ids)) { - $sql_where = 'AND (' . $db->sql_in_set('a.auth_option_id', $option_ids) . ' OR ' . $db->sql_in_set('a.auth_role_id', $role_ids) . ')'; + $sql_where = 'AND (' . phpbb::$db->sql_in_set('a.auth_option_id', $option_ids) . ' OR ' . phpbb::$db->sql_in_set('a.auth_role_id', $role_ids) . ')'; } else { - $sql_where = 'AND ' . $db->sql_in_set('a.auth_option_id', $option_ids); + $sql_where = 'AND ' . phpbb::$db->sql_in_set('a.auth_option_id', $option_ids); } // Not ideal, due to the filesort, non-use of indexes, etc. @@ -1133,16 +1133,16 @@ class acp_permissions $sql_forum_id $sql_where ORDER BY u.username_clean, u.user_regdate ASC"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $s_defined_user_options = ''; $defined_user_ids = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $s_defined_user_options .= '<option value="' . $row['user_id'] . '">' . $row['username'] . '</option>'; $defined_user_ids[] = $row['user_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql = 'SELECT DISTINCT g.group_type, g.group_name, g.group_id FROM ' . GROUPS_TABLE . ' g, ' . ACL_GROUPS_TABLE . " a @@ -1150,16 +1150,16 @@ class acp_permissions $sql_forum_id $sql_where ORDER BY g.group_type DESC, g.group_name ASC"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $s_defined_group_options = ''; $defined_group_ids = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $s_defined_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . (($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; $defined_group_ids[] = $row['group_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); return array( 'group_ids' => $defined_group_ids, diff --git a/phpBB/modules/acp/acp_profile.php b/phpBB/modules/acp/acp_profile.php index fc1c8e1004..98012c77a7 100644 --- a/phpBB/modules/acp/acp_profile.php +++ b/phpBB/modules/acp/acp_profile.php @@ -60,27 +60,27 @@ class acp_profile $sql = 'SELECT lang_id, lang_iso FROM ' . LANG_TABLE . ' ORDER BY lang_english_name'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { // Make some arrays with all available languages $this->lang_defs['id'][$row['lang_id']] = $row['lang_iso']; $this->lang_defs['iso'][$row['lang_iso']] = $row['lang_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql = 'SELECT field_id, lang_id FROM ' . PROFILE_LANG_TABLE . ' ORDER BY lang_id'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { // Which languages are available for each item $this->lang_defs['entry'][$row['field_id']][] = $row['lang_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Have some fields been defined? if (isset($this->lang_defs['entry'])) @@ -107,31 +107,31 @@ class acp_profile $sql = 'SELECT field_ident FROM ' . PROFILE_FIELDS_TABLE . " WHERE field_id = $field_id"; - $result = $db->sql_query($sql); - $field_ident = (string) $db->sql_fetchfield('field_ident'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $field_ident = (string) phpbb::$db->sql_fetchfield('field_ident'); + phpbb::$db->sql_freeresult($result); - $db->sql_transaction('begin'); + phpbb::$db->sql_transaction('begin'); - $db->sql_query('DELETE FROM ' . PROFILE_FIELDS_TABLE . " WHERE field_id = $field_id"); - $db->sql_query('DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . " WHERE field_id = $field_id"); - $db->sql_query('DELETE FROM ' . PROFILE_LANG_TABLE . " WHERE field_id = $field_id"); + phpbb::$db->sql_query('DELETE FROM ' . PROFILE_FIELDS_TABLE . " WHERE field_id = $field_id"); + phpbb::$db->sql_query('DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . " WHERE field_id = $field_id"); + phpbb::$db->sql_query('DELETE FROM ' . PROFILE_LANG_TABLE . " WHERE field_id = $field_id"); - if ($db->dbms_type == 'sqlite') + if (phpbb::$db->dbms_type == 'sqlite') { $sql = "SELECT sql FROM sqlite_master WHERE type = 'table' AND name = '" . PROFILE_FIELDS_DATA_TABLE . "' ORDER BY type DESC, name;"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); // Create a temp table and populate it, destroy the existing one - $db->sql_query(preg_replace('#CREATE\s+TABLE\s+"?' . PROFILE_FIELDS_DATA_TABLE . '"?#i', 'CREATE TEMPORARY TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp', $row['sql'])); - $db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . '_temp SELECT * FROM ' . PROFILE_FIELDS_DATA_TABLE); - $db->sql_query('DROP TABLE ' . PROFILE_FIELDS_DATA_TABLE); + phpbb::$db->sql_query(preg_replace('#CREATE\s+TABLE\s+"?' . PROFILE_FIELDS_DATA_TABLE . '"?#i', 'CREATE TEMPORARY TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp', $row['sql'])); + phpbb::$db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . '_temp SELECT * FROM ' . PROFILE_FIELDS_DATA_TABLE); + phpbb::$db->sql_query('DROP TABLE ' . PROFILE_FIELDS_DATA_TABLE); preg_match('#\((.*)\)#s', $row['sql'], $matches); @@ -159,13 +159,13 @@ class acp_profile $new_table_cols = preg_replace('/' . 'pf_' . $field_ident . '[^,]+,/', '', $new_table_cols); // create a new table and fill it up. destroy the temp one - $db->sql_query('CREATE TABLE ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $new_table_cols . ');'); - $db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . PROFILE_FIELDS_DATA_TABLE . '_temp;'); - $db->sql_query('DROP TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp'); + phpbb::$db->sql_query('CREATE TABLE ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $new_table_cols . ');'); + phpbb::$db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . PROFILE_FIELDS_DATA_TABLE . '_temp;'); + phpbb::$db->sql_query('DROP TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp'); } else { - $db->sql_query('ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " DROP COLUMN pf_$field_ident"); + phpbb::$db->sql_query('ALTER TABLE ' . PROFILE_FIELDS_DATA_TABLE . " DROP COLUMN pf_$field_ident"); } $order = 0; @@ -173,9 +173,9 @@ class acp_profile $sql = 'SELECT * FROM ' . PROFILE_FIELDS_TABLE . ' ORDER BY field_order'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $order++; if ($row['field_order'] != $order) @@ -183,12 +183,12 @@ class acp_profile $sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . " SET field_order = $order WHERE field_id = {$row['field_id']}"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); - $db->sql_transaction('commit'); + phpbb::$db->sql_transaction('commit'); add_log('admin', 'LOG_PROFILE_FIELD_REMOVED', $field_ident); trigger_error(phpbb::$user->lang['REMOVED_PROFILE_FIELD'] . adm_back_link($this->u_action)); @@ -215,10 +215,10 @@ class acp_profile $sql = 'SELECT lang_id FROM ' . LANG_TABLE . " - WHERE lang_iso = '" . $db->sql_escape(phpbb::$config['default_lang']) . "'"; - $result = $db->sql_query($sql); - $default_lang_id = (int) $db->sql_fetchfield('lang_id'); - $db->sql_freeresult($result); + WHERE lang_iso = '" . phpbb::$db->sql_escape(phpbb::$config['default_lang']) . "'"; + $result = phpbb::$db->sql_query($sql); + $default_lang_id = (int) phpbb::$db->sql_fetchfield('lang_id'); + phpbb::$db->sql_freeresult($result); if (!in_array($default_lang_id, $this->lang_defs['entry'][$field_id])) { @@ -228,14 +228,14 @@ class acp_profile $sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . " SET field_active = 1 WHERE field_id = $field_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $sql = 'SELECT field_ident FROM ' . PROFILE_FIELDS_TABLE . " WHERE field_id = $field_id"; - $result = $db->sql_query($sql); - $field_ident = (string) $db->sql_fetchfield('field_ident'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $field_ident = (string) phpbb::$db->sql_fetchfield('field_ident'); + phpbb::$db->sql_freeresult($result); add_log('admin', 'LOG_PROFILE_FIELD_ACTIVATE', $field_ident); trigger_error(phpbb::$user->lang['PROFILE_FIELD_ACTIVATED'] . adm_back_link($this->u_action)); @@ -253,14 +253,14 @@ class acp_profile $sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . " SET field_active = 0 WHERE field_id = $field_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $sql = 'SELECT field_ident FROM ' . PROFILE_FIELDS_TABLE . " WHERE field_id = $field_id"; - $result = $db->sql_query($sql); - $field_ident = (string) $db->sql_fetchfield('field_ident'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $field_ident = (string) phpbb::$db->sql_fetchfield('field_ident'); + phpbb::$db->sql_freeresult($result); add_log('admin', 'LOG_PROFILE_FIELD_DEACTIVATE', $field_ident); trigger_error(phpbb::$user->lang['PROFILE_FIELD_DEACTIVATED'] . adm_back_link($this->u_action)); @@ -275,7 +275,7 @@ class acp_profile $sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . " SET field_order = $order_total - field_order WHERE field_order IN ($field_order, " . (($action == 'move_up') ? $field_order - 1 : $field_order + 1) . ')'; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); break; @@ -304,9 +304,9 @@ class acp_profile WHERE l.lang_id = ' . $this->edit_lang_id . " AND f.field_id = $field_id AND l.field_id = f.field_id"; - $result = $db->sql_query($sql); - $field_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $field_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$field_row) { @@ -316,9 +316,9 @@ class acp_profile WHERE l.lang_id <> ' . $this->edit_lang_id . " AND f.field_id = $field_id AND l.field_id = f.field_id"; - $result = $db->sql_query($sql); - $field_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $field_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$field_row) { @@ -335,14 +335,14 @@ class acp_profile WHERE lang_id = ' . $this->edit_lang_id . " AND field_id = $field_id ORDER BY option_id ASC"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $lang_options = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $lang_options[$row['option_id']] = $row['lang_value']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $s_hidden_fields = '<input type="hidden" name="field_id" value="' . $field_id . '" />'; } @@ -531,14 +531,14 @@ class acp_profile WHERE lang_id <> ' . $this->edit_lang_id . " AND field_id = $field_id ORDER BY option_id ASC"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $l_lang_options = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $l_lang_options[$row['lang_id']][$row['option_id']] = $row['lang_value']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql = 'SELECT lang_id, lang_name, lang_explain, lang_default_value @@ -546,16 +546,16 @@ class acp_profile WHERE lang_id <> ' . $this->edit_lang_id . " AND field_id = $field_id ORDER BY lang_id ASC"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $l_lang_name = $l_lang_explain = $l_lang_default_value = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $l_lang_name[$row['lang_id']] = $row['lang_name']; $l_lang_explain[$row['lang_id']] = $row['lang_explain']; $l_lang_default_value[$row['lang_id']] = $row['lang_default_value']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } foreach ($exclude[3] as $key) @@ -619,10 +619,10 @@ class acp_profile { $sql = 'SELECT field_ident FROM ' . PROFILE_FIELDS_TABLE . " - WHERE field_ident = '" . $db->sql_escape($cp->vars['field_ident']) . "'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + WHERE field_ident = '" . phpbb::$db->sql_escape($cp->vars['field_ident']) . "'"; + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if ($row) { @@ -844,10 +844,10 @@ class acp_profile $sql = 'SELECT * FROM ' . PROFILE_FIELDS_TABLE . ' ORDER BY field_order'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $s_one_need_edit = false; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $active_lang = (!$row['field_active']) ? 'ACTIVATE' : 'DEACTIVATE'; $active_value = (!$row['field_active']) ? 'activate' : 'deactivate'; @@ -875,7 +875,7 @@ class acp_profile 'S_NEED_EDIT' => $s_need_edit) ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // At least one option field needs editing? if ($s_one_need_edit) @@ -906,14 +906,14 @@ class acp_profile FROM ' . LANG_TABLE . ' WHERE lang_id <> ' . (int) $default_lang_id . ' ORDER BY lang_english_name'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $languages = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $languages[$row['lang_id']] = $row['lang_iso']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $options = array(); $options['lang_name'] = 'string'; @@ -1029,9 +1029,9 @@ class acp_profile { $sql = 'SELECT MAX(field_order) as max_field_order FROM ' . PROFILE_FIELDS_TABLE; - $result = $db->sql_query($sql); - $new_field_order = (int) $db->sql_fetchfield('max_field_order'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $new_field_order = (int) phpbb::$db->sql_fetchfield('max_field_order'); + phpbb::$db->sql_freeresult($result); $field_ident = $cp->vars['field_ident']; } @@ -1060,17 +1060,17 @@ class acp_profile 'field_active' => 1 ); - $sql = 'INSERT INTO ' . PROFILE_FIELDS_TABLE . ' ' . $db->sql_build_array('INSERT', $profile_fields); - $db->sql_query($sql); + $sql = 'INSERT INTO ' . PROFILE_FIELDS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $profile_fields); + phpbb::$db->sql_query($sql); - $field_id = $db->sql_nextid(); + $field_id = phpbb::$db->sql_nextid(); } else { $sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $profile_fields) . " + SET ' . phpbb::$db->sql_build_array('UPDATE', $profile_fields) . " WHERE field_id = $field_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } if ($action == 'create') @@ -1090,7 +1090,7 @@ class acp_profile $sql_ary['field_id'] = $field_id; $sql_ary['lang_id'] = $default_lang_id; - $profile_sql[] = 'INSERT INTO ' . PROFILE_LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); + $profile_sql[] = 'INSERT INTO ' . PROFILE_LANG_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary); } else { @@ -1126,7 +1126,7 @@ class acp_profile $sql = 'DELETE FROM ' . PROFILE_LANG_TABLE . " WHERE field_id = $field_id AND lang_id = " . (int) $lang_id; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } } @@ -1160,7 +1160,7 @@ class acp_profile $sql = 'DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . " WHERE field_id = $field_id AND lang_id = " . (int) $default_lang_id; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } foreach ($cp->vars['lang_options'] as $option_id => $value) @@ -1176,7 +1176,7 @@ class acp_profile $sql_ary['lang_id'] = $default_lang_id; $sql_ary['option_id'] = (int) $option_id; - $profile_sql[] = 'INSERT INTO ' . PROFILE_FIELDS_LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); + $profile_sql[] = 'INSERT INTO ' . PROFILE_FIELDS_LANG_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary); } else { @@ -1212,7 +1212,7 @@ class acp_profile $sql = 'DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . " WHERE field_id = $field_id AND lang_id = " . (int) $lang_id; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } foreach ($lang_ary as $option_id => $value) @@ -1233,7 +1233,7 @@ class acp_profile $sql = 'DELETE FROM ' . PROFILE_FIELDS_LANG_TABLE . " WHERE field_id = $field_id AND lang_id = " . (int) $lang_id; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } } @@ -1241,7 +1241,7 @@ class acp_profile { if ($action == 'create') { - $profile_sql[] = 'INSERT INTO ' . PROFILE_LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $sql); + $profile_sql[] = 'INSERT INTO ' . PROFILE_LANG_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql); } else { @@ -1258,7 +1258,7 @@ class acp_profile { if ($action == 'create') { - $profile_sql[] = 'INSERT INTO ' . PROFILE_FIELDS_LANG_TABLE . ' ' . $db->sql_build_array('INSERT', $sql); + $profile_sql[] = 'INSERT INTO ' . PROFILE_FIELDS_LANG_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql); } else { @@ -1276,17 +1276,17 @@ class acp_profile } - $db->sql_transaction('begin'); + phpbb::$db->sql_transaction('begin'); if ($action == 'create') { foreach ($profile_sql as $sql) { - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } } - $db->sql_transaction('commit'); + phpbb::$db->sql_transaction('commit'); if ($action == 'edit') { @@ -1311,7 +1311,7 @@ class acp_profile foreach ($where_fields as $key => $value) { $check_key = (!$check_key) ? $key : $check_key; - $where_sql[] = $key . ' = ' . ((is_string($value)) ? "'" . $db->sql_escape($value) . "'" : (int) $value); + $where_sql[] = $key . ' = ' . ((is_string($value)) ? "'" . phpbb::$db->sql_escape($value) . "'" : (int) $value); } if (!sizeof($where_sql)) @@ -1322,9 +1322,9 @@ class acp_profile $sql = "SELECT $check_key FROM $table WHERE " . implode(' AND ', $where_sql); - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$row) { @@ -1332,16 +1332,16 @@ class acp_profile if (sizeof($sql_ary)) { - $db->sql_query("INSERT INTO $table " . $db->sql_build_array('INSERT', $sql_ary)); + phpbb::$db->sql_query("INSERT INTO $table " . phpbb::$db->sql_build_array('INSERT', $sql_ary)); } } else { if (sizeof($sql_ary)) { - $sql = "UPDATE $table SET " . $db->sql_build_array('UPDATE', $sql_ary) . ' + $sql = "UPDATE $table SET " . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . ' WHERE ' . implode(' AND ', $where_sql); - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } } } @@ -1351,7 +1351,7 @@ class acp_profile */ function add_field_ident($field_ident, $field_type) { - switch ($db->dbms_type) + switch (phpbb::$db->dbms_type) { case 'mysql': @@ -1428,14 +1428,14 @@ class acp_profile WHERE type = 'table' AND name = '" . PROFILE_FIELDS_DATA_TABLE . "' ORDER BY type DESC, name;"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); // Create a temp table and populate it, destroy the existing one - $db->sql_query(preg_replace('#CREATE\s+TABLE\s+"?' . PROFILE_FIELDS_DATA_TABLE . '"?#i', 'CREATE TEMPORARY TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp', $row['sql'])); - $db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . '_temp SELECT * FROM ' . PROFILE_FIELDS_DATA_TABLE); - $db->sql_query('DROP TABLE ' . PROFILE_FIELDS_DATA_TABLE); + phpbb::$db->sql_query(preg_replace('#CREATE\s+TABLE\s+"?' . PROFILE_FIELDS_DATA_TABLE . '"?#i', 'CREATE TEMPORARY TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp', $row['sql'])); + phpbb::$db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . '_temp SELECT * FROM ' . PROFILE_FIELDS_DATA_TABLE); + phpbb::$db->sql_query('DROP TABLE ' . PROFILE_FIELDS_DATA_TABLE); preg_match('#\((.*)\)#s', $row['sql'], $matches); @@ -1458,9 +1458,9 @@ class acp_profile $new_table_cols = $field_ident . ' ' . $type . ',' . $new_table_cols; // create a new table and fill it up. destroy the temp one - $db->sql_query('CREATE TABLE ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $new_table_cols . ');'); - $db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . PROFILE_FIELDS_DATA_TABLE . '_temp;'); - $db->sql_query('DROP TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp'); + phpbb::$db->sql_query('CREATE TABLE ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $new_table_cols . ');'); + phpbb::$db->sql_query('INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . PROFILE_FIELDS_DATA_TABLE . '_temp;'); + phpbb::$db->sql_query('DROP TABLE ' . PROFILE_FIELDS_DATA_TABLE . '_temp'); } else { diff --git a/phpBB/modules/acp/acp_prune.php b/phpBB/modules/acp/acp_prune.php index 689d160cd9..7803c9d869 100644 --- a/phpBB/modules/acp/acp_prune.php +++ b/phpBB/modules/acp/acp_prune.php @@ -58,14 +58,14 @@ class acp_prune $sql = 'SELECT forum_id FROM ' . FORUMS_TABLE . ' ORDER BY left_id'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $forum_id = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $forum_id[] = $row['forum_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } if ($submit) @@ -89,7 +89,7 @@ class acp_prune 'S_PRUNED' => true) ); - $sql_forum = (sizeof($forum_id)) ? ' AND ' . $db->sql_in_set('forum_id', $forum_id) : ''; + $sql_forum = (sizeof($forum_id)) ? ' AND ' . phpbb::$db->sql_in_set('forum_id', $forum_id) : ''; // Get a list of forum's or the data for the forum that we are pruning. $sql = 'SELECT forum_id, forum_name @@ -97,9 +97,9 @@ class acp_prune WHERE forum_type = ' . FORUM_POST . " $sql_forum ORDER BY left_id ASC"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - if ($row = $db->sql_fetchrow($result)) + if ($row = phpbb::$db->sql_fetchrow($result)) { $prune_ids = array(); $p_result['topics'] = 0; @@ -144,13 +144,13 @@ class acp_prune $log_data .= (($log_data != '') ? ', ' : '') . $row['forum_name']; } - while ($row = $db->sql_fetchrow($result)); + while ($row = phpbb::$db->sql_fetchrow($result)); // Sync all pruned forums at once sync('forum', 'forum_id', $prune_ids, true, true); add_log('admin', 'LOG_PRUNE', $log_data); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); return; } @@ -186,13 +186,13 @@ class acp_prune { $sql = 'SELECT forum_id, forum_name FROM ' . FORUMS_TABLE . ' - WHERE ' . $db->sql_in_set('forum_id', $forum_id); - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); + WHERE ' . phpbb::$db->sql_in_set('forum_id', $forum_id); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); if (!$row) { - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); trigger_error(phpbb::$user->lang['NO_FORUM'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -202,9 +202,9 @@ class acp_prune $forum_list .= (($forum_list != '') ? ', ' : '') . '<b>' . $row['forum_name'] . '</b>'; $s_hidden_fields .= '<input type="hidden" name="f[]" value="' . $row['forum_id'] . '" />'; } - while ($row = $db->sql_fetchrow($result)); + while ($row = phpbb::$db->sql_fetchrow($result)); - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $l_selected_forums = (sizeof($forum_id) == 1) ? 'SELECTED_FORUM' : 'SELECTED_FORUMS'; @@ -364,7 +364,7 @@ class acp_prune if ($users) { $users = explode("\n", $users); - $where_sql = ' AND ' . $db->sql_in_set('username_clean', array_map('utf8_clean_string', $users)); + $where_sql = ' AND ' . phpbb::$db->sql_in_set('username_clean', array_map('utf8_clean_string', $users)); } else { @@ -391,8 +391,8 @@ class acp_prune $sort_by_types = array('username', 'user_email', 'user_posts', 'user_regdate', 'user_lastvisit'); $where_sql = ''; - $where_sql .= ($username) ? ' AND username_clean ' . $db->sql_like_expression(str_replace('*', $db->any_char, utf8_clean_string($username))) : ''; - $where_sql .= ($email) ? ' AND user_email ' . $db->sql_like_expression(str_replace('*', $db->any_char, $email)) . ' ' : ''; + $where_sql .= ($username) ? ' AND username_clean ' . phpbb::$db->sql_like_expression(str_replace('*', phpbb::$db->any_char, utf8_clean_string($username))) : ''; + $where_sql .= ($email) ? ' AND user_email ' . phpbb::$db->sql_like_expression(str_replace('*', phpbb::$db->any_char, $email)) . ' ' : ''; $where_sql .= (sizeof($joined)) ? " AND user_regdate " . $key_match[$joined_select] . ' ' . gmmktime(0, 0, 0, (int) $joined[1], (int) $joined[2], (int) $joined[0]) : ''; $where_sql .= ($count !== '') ? " AND user_posts " . $key_match[$count_select] . ' ' . (int) $count . ' ' : ''; @@ -415,14 +415,14 @@ class acp_prune // Get bot ids $sql = 'SELECT user_id FROM ' . BOTS_TABLE; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $bot_ids = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $bot_ids[] = $row['user_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Do not prune founder members $sql = 'SELECT user_id, username @@ -430,12 +430,12 @@ class acp_prune WHERE user_id <> ' . ANONYMOUS . ' AND user_type <> ' . phpbb::USER_FOUNDER . " $where_sql"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $where_sql = ''; $user_ids = $usernames = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { // Do not prune bots and the user currently pruning. if ($row['user_id'] != phpbb::$user->data['user_id'] && !in_array($row['user_id'], $bot_ids)) @@ -444,7 +444,7 @@ class acp_prune $usernames[$row['user_id']] = $row['username']; } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } } diff --git a/phpBB/modules/acp/acp_ranks.php b/phpBB/modules/acp/acp_ranks.php index de4b9d4b54..9b890aa230 100644 --- a/phpBB/modules/acp/acp_ranks.php +++ b/phpBB/modules/acp/acp_ranks.php @@ -72,19 +72,19 @@ class acp_ranks if ($rank_id) { - $sql = 'UPDATE ' . RANKS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE rank_id = $rank_id"; + $sql = 'UPDATE ' . RANKS_TABLE . ' SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . " WHERE rank_id = $rank_id"; $message = phpbb::$user->lang['RANK_UPDATED']; add_log('admin', 'LOG_RANK_UPDATED', $rank_title); } else { - $sql = 'INSERT INTO ' . RANKS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); + $sql = 'INSERT INTO ' . RANKS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary); $message = phpbb::$user->lang['RANK_ADDED']; add_log('admin', 'LOG_RANK_ADDED', $rank_title); } - $db->sql_query($sql); + phpbb::$db->sql_query($sql); phpbb::$acm->destroy('ranks'); @@ -104,18 +104,18 @@ class acp_ranks $sql = 'SELECT rank_title FROM ' . RANKS_TABLE . ' WHERE rank_id = ' . $rank_id; - $result = $db->sql_query($sql); - $rank_title = (string) $db->sql_fetchfield('rank_title'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $rank_title = (string) phpbb::$db->sql_fetchfield('rank_title'); + phpbb::$db->sql_freeresult($result); $sql = 'DELETE FROM ' . RANKS_TABLE . " WHERE rank_id = $rank_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $sql = 'UPDATE ' . USERS_TABLE . " SET user_rank = 0 WHERE user_rank = $rank_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); phpbb::$acm->destroy('ranks'); @@ -141,9 +141,9 @@ class acp_ranks $sql = 'SELECT * FROM ' . RANKS_TABLE . ' ORDER BY rank_min ASC, rank_special ASC'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $existing_imgs[] = $row['rank_image']; @@ -152,7 +152,7 @@ class acp_ranks $ranks = $row; } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $imglist = filelist(PHPBB_ROOT_PATH . phpbb::$config['ranks_path'], ''); $edit_img = $filename_list = ''; @@ -216,9 +216,9 @@ class acp_ranks $sql = 'SELECT * FROM ' . RANKS_TABLE . ' ORDER BY rank_special DESC, rank_min ASC, rank_title ASC'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $template->assign_block_vars('ranks', array( 'S_RANK_IMAGE' => ($row['rank_image']) ? true : false, @@ -232,7 +232,7 @@ class acp_ranks 'U_DELETE' => $this->u_action . '&action=delete&id=' . $row['rank_id']) ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } } diff --git a/phpBB/modules/acp/acp_reasons.php b/phpBB/modules/acp/acp_reasons.php index 4dac0895fd..81484abd95 100644 --- a/phpBB/modules/acp/acp_reasons.php +++ b/phpBB/modules/acp/acp_reasons.php @@ -69,9 +69,9 @@ class acp_reasons $sql = 'SELECT reason_title FROM ' . REPORTS_REASONS_TABLE . " WHERE reason_id = $reason_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (strtolower($row['reason_title']) == 'other' || strtolower($reason_row['reason_title']) == 'other') { @@ -89,10 +89,10 @@ class acp_reasons { $sql = 'SELECT reason_id FROM ' . REPORTS_REASONS_TABLE . " - WHERE reason_title = '" . $db->sql_escape($reason_row['reason_title']) . "'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + WHERE reason_title = '" . phpbb::$db->sql_escape($reason_row['reason_title']) . "'"; + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if ($row || ($action == 'add' && strtolower($reason_row['reason_title']) == 'other')) { @@ -108,9 +108,9 @@ class acp_reasons // Get new order... $sql = 'SELECT MAX(reason_order) as max_reason_order FROM ' . REPORTS_REASONS_TABLE; - $result = $db->sql_query($sql); - $max_order = (int) $db->sql_fetchfield('max_reason_order'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $max_order = (int) phpbb::$db->sql_fetchfield('max_reason_order'); + phpbb::$db->sql_freeresult($result); $sql_ary = array( 'reason_title' => (string) $reason_row['reason_title'], @@ -118,7 +118,7 @@ class acp_reasons 'reason_order' => $max_order + 1 ); - $db->sql_query('INSERT INTO ' . REPORTS_REASONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + phpbb::$db->sql_query('INSERT INTO ' . REPORTS_REASONS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary)); $log = 'ADDED'; } @@ -129,7 +129,7 @@ class acp_reasons 'reason_description' => (string) $reason_row['reason_description'], ); - $db->sql_query('UPDATE ' . REPORTS_REASONS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + phpbb::$db->sql_query('UPDATE ' . REPORTS_REASONS_TABLE . ' SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . ' WHERE reason_id = ' . $reason_id); $log = 'UPDATED'; @@ -144,9 +144,9 @@ class acp_reasons $sql = 'SELECT * FROM ' . REPORTS_REASONS_TABLE . ' WHERE reason_id = ' . $reason_id; - $result = $db->sql_query($sql); - $reason_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $reason_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$reason_row) { @@ -191,9 +191,9 @@ class acp_reasons $sql = 'SELECT * FROM ' . REPORTS_REASONS_TABLE . ' WHERE reason_id = ' . $reason_id; - $result = $db->sql_query($sql); - $reason_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $reason_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$reason_row) { @@ -211,22 +211,22 @@ class acp_reasons $sql = 'SELECT reason_id, report_text FROM ' . REPORTS_REASONS_TABLE . " WHERE LOWER(reason_title) = 'other'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); $other_reason_id = (int) $row['reason_id']; $report_text = $row['report_text']; - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $report_text .= $reason_row['reason_description'] . "\n\n"; $sql = 'UPDATE ' . REPORTS_TABLE . ' - SET reason_id = ' . $other_reason_id . ", report_text = '" . $db->sql_escape($report_text) . "' + SET reason_id = ' . $other_reason_id . ", report_text = '" . phpbb::$db->sql_escape($report_text) . "' WHERE reason_id = $reason_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); - $db->sql_query('DELETE FROM ' . REPORTS_REASONS_TABLE . ' WHERE reason_id = ' . $reason_id); + phpbb::$db->sql_query('DELETE FROM ' . REPORTS_REASONS_TABLE . ' WHERE reason_id = ' . $reason_id); add_log('admin', 'LOG_REASON_REMOVED', $reason_row['reason_title']); trigger_error(phpbb::$user->lang['REASON_REMOVED'] . adm_back_link($this->u_action)); @@ -252,7 +252,7 @@ class acp_reasons $sql = 'UPDATE ' . REPORTS_REASONS_TABLE . ' SET reason_order = ' . $order_total . ' - reason_order WHERE reason_order IN (' . $order . ', ' . (($action == 'move_up') ? $order - 1 : $order + 1) . ')'; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); break; } @@ -261,9 +261,9 @@ class acp_reasons $sql = 'SELECT reason_id, reason_order FROM ' . REPORTS_REASONS_TABLE . ' ORDER BY reason_order'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - if ($row = $db->sql_fetchrow($result)) + if ($row = phpbb::$db->sql_fetchrow($result)) { $order = 0; do @@ -275,12 +275,12 @@ class acp_reasons $sql = 'UPDATE ' . REPORTS_REASONS_TABLE . " SET reason_order = $order WHERE reason_id = {$row['reason_id']}"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } } - while ($row = $db->sql_fetchrow($result)); + while ($row = phpbb::$db->sql_fetchrow($result)); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $template->assign_vars(array( 'U_ACTION' => $this->u_action, @@ -291,21 +291,21 @@ class acp_reasons $sql = 'SELECT reason_id, COUNT(reason_id) AS reason_count FROM ' . REPORTS_TABLE . ' GROUP BY reason_id'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $reason_count = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $reason_count[$row['reason_id']] = $row['reason_count']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql = 'SELECT * FROM ' . REPORTS_REASONS_TABLE . ' ORDER BY reason_order ASC'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $translated = false; $other_reason = ($row['reason_title'] == 'other') ? true : false; @@ -333,7 +333,7 @@ class acp_reasons 'U_MOVE_DOWN' => $this->u_action . '&action=move_down&order=' . $row['reason_order']) ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } } diff --git a/phpBB/modules/acp/acp_search.php b/phpBB/modules/acp/acp_search.php index d5440080fb..e7fab69c0e 100644 --- a/phpBB/modules/acp/acp_search.php +++ b/phpBB/modules/acp/acp_search.php @@ -307,16 +307,16 @@ class acp_search FROM ' . POSTS_TABLE . ' WHERE post_id >= ' . (int) ($post_counter + 1) . ' AND post_id <= ' . (int) ($post_counter + $this->batch_size); - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $ids = $posters = $forum_ids = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $ids[] = $row['post_id']; $posters[] = $row['poster_id']; $forum_ids[] = $row['forum_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $row_count += sizeof($ids); if (sizeof($ids)) @@ -363,13 +363,13 @@ class acp_search { $sql = 'SELECT forum_id, enable_indexing FROM ' . FORUMS_TABLE; - $result = $db->sql_query($sql, 3600); + $result = phpbb::$db->sql_query($sql, 3600); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $forums[$row['forum_id']] = (bool) $row['enable_indexing']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $starttime = explode(' ', microtime()); $starttime = $starttime[1] + $starttime[0]; @@ -380,9 +380,9 @@ class acp_search FROM ' . POSTS_TABLE . ' WHERE post_id >= ' . (int) ($post_counter + 1) . ' AND post_id <= ' . (int) ($post_counter + $this->batch_size); - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { // Indexing enabled for this forum or global announcement? // Global announcements get indexed by default. @@ -392,7 +392,7 @@ class acp_search } $row_count++; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $post_counter += $this->batch_size; } @@ -561,9 +561,9 @@ class acp_search { $sql = 'SELECT MAX(post_id) as max_post_id FROM '. POSTS_TABLE; - $result = $db->sql_query($sql); - $max_post_id = (int) $db->sql_fetchfield('max_post_id'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $max_post_id = (int) phpbb::$db->sql_fetchfield('max_post_id'); + phpbb::$db->sql_freeresult($result); return $max_post_id; } diff --git a/phpBB/modules/acp/acp_styles.php b/phpBB/modules/acp/acp_styles.php index dc12063c95..a88778e598 100644 --- a/phpBB/modules/acp/acp_styles.php +++ b/phpBB/modules/acp/acp_styles.php @@ -198,7 +198,7 @@ parse_css_file = {PARSE_CSS_FILE} $sql = 'UPDATE ' . STYLES_TABLE . ' SET style_active = ' . (($action == 'activate') ? 1 : 0) . ' WHERE style_id = ' . $style_id; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // Set style to default for any member using deactivated style if ($action == 'deactivate') @@ -206,12 +206,12 @@ parse_css_file = {PARSE_CSS_FILE} $sql = 'UPDATE ' . USERS_TABLE . ' SET user_style = ' . phpbb::$config['default_style'] . " WHERE user_style = $style_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $sql = 'UPDATE ' . FORUMS_TABLE . ' SET forum_style = 0 WHERE forum_style = ' . $style_id; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } break; } @@ -229,9 +229,9 @@ parse_css_file = {PARSE_CSS_FILE} $sql = 'SELECT * FROM ' . STYLES_TEMPLATE_TABLE . " WHERE template_id = $style_id"; - $result = $db->sql_query($sql); - $template_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $template_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$template_row) { @@ -270,9 +270,9 @@ parse_css_file = {PARSE_CSS_FILE} $sql = 'SELECT * FROM ' . STYLES_THEME_TABLE . " WHERE theme_id = $style_id"; - $result = $db->sql_query($sql); - $theme_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $theme_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$theme_row) { @@ -294,9 +294,9 @@ parse_css_file = {PARSE_CSS_FILE} 'theme_data' => self::db_theme_data($theme_row) ); - $sql = 'UPDATE ' . STYLES_THEME_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + $sql = 'UPDATE ' . STYLES_THEME_TABLE . ' SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . " WHERE theme_id = $style_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); phpbb::$acm->destroy_sql(STYLES_THEME_TABLE); @@ -328,9 +328,9 @@ parse_css_file = {PARSE_CSS_FILE} $sql = 'SELECT * FROM ' . STYLES_IMAGESET_TABLE . " WHERE imageset_id = $style_id"; - $result = $db->sql_query($sql); - $imageset_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $imageset_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$imageset_row) { @@ -349,11 +349,11 @@ parse_css_file = {PARSE_CSS_FILE} $cfg_data_imageset = parse_cfg_file(PHPBB_ROOT_PATH . "styles/{$imageset_row['imageset_path']}/imageset/imageset.cfg"); - $db->sql_transaction('begin'); + phpbb::$db->sql_transaction('begin'); $sql = 'DELETE FROM ' . STYLES_IMAGESET_DATA_TABLE . ' WHERE imageset_id = ' . $style_id; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); foreach ($cfg_data_imageset as $image_name => $value) { @@ -394,9 +394,9 @@ parse_css_file = {PARSE_CSS_FILE} $sql = 'SELECT lang_dir FROM ' . LANG_TABLE; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if (@file_exists(PHPBB_ROOT_PATH . "styles/{$imageset_row['imageset_path']}/imageset/{$row['lang_dir']}/imageset.cfg")) { @@ -439,11 +439,11 @@ parse_css_file = {PARSE_CSS_FILE} } } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); - $db->sql_multi_insert(STYLES_IMAGESET_DATA_TABLE, $sql_ary); + phpbb::$db->sql_multi_insert(STYLES_IMAGESET_DATA_TABLE, $sql_ary); - $db->sql_transaction('commit'); + phpbb::$db->sql_transaction('commit'); phpbb::$acm->destroy_sql(STYLES_IMAGESET_DATA_TABLE); @@ -483,13 +483,13 @@ parse_css_file = {PARSE_CSS_FILE} $sql = 'SELECT user_style, COUNT(user_style) AS style_count FROM ' . USERS_TABLE . ' GROUP BY user_style'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $style_count[$row['user_style']] = $row['style_count']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); break; @@ -528,12 +528,12 @@ parse_css_file = {PARSE_CSS_FILE} $sql = "SELECT * FROM $sql_from"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $installed = array(); $basis_options = '<option class="sep" value="">' . phpbb::$user->lang['OPTIONAL_BASIS'] . '</option>'; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $installed[] = $row[$mode . '_name']; $basis_options .= '<option value="' . $row[$mode . '_id'] . '">' . $row[$mode . '_name'] . '</option>'; @@ -566,7 +566,7 @@ parse_css_file = {PARSE_CSS_FILE} ) ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Grab uninstalled items $new_ary = $cfg = array(); @@ -651,9 +651,9 @@ parse_css_file = {PARSE_CSS_FILE} $sql = 'SELECT template_path, template_name FROM ' . STYLES_TEMPLATE_TABLE . " WHERE template_id = $template_id"; - $result = $db->sql_query($sql); - $template_info = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $template_info = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$template_info) { @@ -804,9 +804,9 @@ parse_css_file = {PARSE_CSS_FILE} $sql = 'SELECT * FROM ' . STYLES_TEMPLATE_TABLE . " WHERE template_id = $template_id"; - $result = $db->sql_query($sql); - $template_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $template_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$template_row) { @@ -933,13 +933,13 @@ parse_css_file = {PARSE_CSS_FILE} $sql = 'SELECT theme_storedb, theme_path, theme_name, theme_data FROM ' . STYLES_THEME_TABLE . " WHERE theme_id = $theme_id"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - if (!($theme_info = $db->sql_fetchrow($result))) + if (!($theme_info = phpbb::$db->sql_fetchrow($result))) { trigger_error(phpbb::$user->lang['NO_THEME'] . adm_back_link($this->u_action), E_USER_WARNING); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $theme_info['theme_id'] = $theme_id; self::generate_stylesheets($theme_info); @@ -971,9 +971,9 @@ parse_css_file = {PARSE_CSS_FILE} 'theme_data' => self::db_theme_data($theme_info, $theme_data), ); $sql = 'UPDATE ' . STYLES_THEME_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . ' WHERE theme_id = ' . $theme_id; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); phpbb::$acm->destroy_sql(STYLES_THEME_TABLE); @@ -1119,9 +1119,9 @@ parse_css_file = {PARSE_CSS_FILE} $sql = 'SELECT imageset_path, imageset_name FROM ' . STYLES_IMAGESET_TABLE . " WHERE imageset_id = $imageset_id"; - $result = $db->sql_query($sql); - $imageset_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $imageset_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); $imageset_path = $imageset_row['imageset_path']; $imageset_name = $imageset_row['imageset_name']; @@ -1130,16 +1130,16 @@ parse_css_file = {PARSE_CSS_FILE} if (strpos($imgname, '-') !== false) { list($imgname, $imgnamelang) = explode('-', $imgname); - $sql_extra = " AND image_lang IN ('" . $db->sql_escape($imgnamelang) . "', '')"; + $sql_extra = " AND image_lang IN ('" . phpbb::$db->sql_escape($imgnamelang) . "', '')"; } $sql = 'SELECT image_filename, image_width, image_height, image_lang, image_id FROM ' . STYLES_IMAGESET_DATA_TABLE . " WHERE imageset_id = $imageset_id - AND image_name = '" . $db->sql_escape($imgname) . "'$sql_extra"; - $result = $db->sql_query($sql); - $imageset_data_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + AND image_name = '" . phpbb::$db->sql_escape($imgname) . "'$sql_extra"; + $result = phpbb::$db->sql_query($sql); + $imageset_data_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); $image_filename = $imageset_data_row['image_filename']; $image_width = $imageset_data_row['image_width']; @@ -1212,16 +1212,16 @@ parse_css_file = {PARSE_CSS_FILE} if ($imageset_data_row) { $sql = 'UPDATE ' . STYLES_IMAGESET_DATA_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . " WHERE image_id = $image_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } // does not exist else if (!$imageset_data_row) { $sql_ary['image_name'] = $imgname; $sql_ary['imageset_id'] = (int) $imageset_id; - $db->sql_query('INSERT INTO ' . STYLES_IMAGESET_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + phpbb::$db->sql_query('INSERT INTO ' . STYLES_IMAGESET_DATA_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary)); } phpbb::$acm->destroy_sql(STYLES_IMAGESET_DATA_TABLE); @@ -1401,9 +1401,9 @@ parse_css_file = {PARSE_CSS_FILE} $sql = "SELECT $sql_select FROM $sql_from WHERE {$mode}_id = $style_id"; - $result = $db->sql_query($sql); - $style_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $style_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$style_row) { @@ -1415,41 +1415,41 @@ parse_css_file = {PARSE_CSS_FILE} WHERE {$mode}_id <> $style_id $sql_where ORDER BY {$mode}_name ASC"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $s_options = ''; - if ($row = $db->sql_fetchrow($result)) + if ($row = phpbb::$db->sql_fetchrow($result)) { do { $s_options .= '<option value="' . $row[$mode . '_id'] . '">' . $row[$mode . '_name'] . '</option>'; } - while ($row = $db->sql_fetchrow($result)); + while ($row = phpbb::$db->sql_fetchrow($result)); } else { trigger_error(phpbb::$user->lang['ONLY_' . $l_prefix] . adm_back_link($this->u_action), E_USER_WARNING); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if ($update) { $sql = "DELETE FROM $sql_from WHERE {$mode}_id = $style_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); if ($mode == 'style') { $sql = 'UPDATE ' . USERS_TABLE . " SET user_style = $new_id WHERE user_style = $style_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $sql = 'UPDATE ' . FORUMS_TABLE . " SET forum_style = $new_id WHERE forum_style = $style_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); if ($style_id == phpbb::$config['default_style']) { @@ -1462,12 +1462,12 @@ parse_css_file = {PARSE_CSS_FILE} { $sql = 'DELETE FROM ' . STYLES_IMAGESET_DATA_TABLE . " WHERE imageset_id = $style_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } $sql = 'UPDATE ' . STYLES_TABLE . " SET {$mode}_id = $new_id WHERE {$mode}_id = $style_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } phpbb::$acm->destroy_sql(STYLES_TABLE); @@ -1585,9 +1585,9 @@ parse_css_file = {PARSE_CSS_FILE} $sql = "SELECT $sql_select FROM $sql_from WHERE $sql_where"; - $result = $db->sql_query($sql); - $style_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $style_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$style_row) { @@ -1691,12 +1691,12 @@ parse_css_file = {PARSE_CSS_FILE} FROM ' . STYLES_IMAGESET_DATA_TABLE . " WHERE imageset_id = $style_id AND image_lang = ''"; - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + $result = phpbb::$db->sql_query($sql); + while ($row = phpbb::$db->sql_fetchrow($result)) { $imageset_main[$row['image_name']] = $row['image_filename'] . ($row['image_height'] ? '*' . $row['image_height']: '') . ($row['image_width'] ? '*' . $row['image_width']: ''); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); foreach ($this->imageset_keys as $topic => $key_array) { @@ -1743,12 +1743,12 @@ parse_css_file = {PARSE_CSS_FILE} FROM ' . STYLES_IMAGESET_DATA_TABLE . " WHERE imageset_id = $style_id AND image_lang <> ''"; - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + $result = phpbb::$db->sql_query($sql); + while ($row = phpbb::$db->sql_fetchrow($result)) { $imageset_lang[$row['image_lang']][$row['image_name']] = $row['image_filename'] . ($row['image_height'] ? '*' . $row['image_height']: '') . ($row['image_width'] ? '*' . $row['image_width']: ''); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); foreach ($imageset_lang as $lang => $imageset_localized) { @@ -1857,9 +1857,9 @@ parse_css_file = {PARSE_CSS_FILE} $sql = "SELECT {$mode}_id, {$mode}_name FROM " . (($mode == 'style') ? STYLES_TABLE : $sql_from) . " WHERE {$mode}_id = $style_id"; - $result = $db->sql_query($sql); - $style_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $style_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$style_row) { @@ -1927,9 +1927,9 @@ parse_css_file = {PARSE_CSS_FILE} $sql = "SELECT * FROM $sql_from WHERE {$mode}_id = $style_id"; - $result = $db->sql_query($sql); - $style_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $style_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$style_row) { @@ -1953,10 +1953,10 @@ parse_css_file = {PARSE_CSS_FILE} $sql = "SELECT {$mode}_id FROM $sql_from WHERE {$mode}_id <> $style_id - AND {$mode}_name = '" . $db->sql_escape(strtolower($name)) . "'"; - $result = $db->sql_query($sql); - $conflict = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + AND {$mode}_name = '" . phpbb::$db->sql_escape(strtolower($name)) . "'"; + $result = phpbb::$db->sql_query($sql); + $conflict = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if ($mode == 'style' && (!$template_id || !$theme_id || !$imageset_id)) { @@ -2033,9 +2033,9 @@ parse_css_file = {PARSE_CSS_FILE} if (sizeof($sql_ary)) { $sql = "UPDATE $sql_from - SET " . $db->sql_build_array('UPDATE', $sql_ary) . " + SET " . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . " WHERE {$mode}_id = $style_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // Making this the default style? if ($mode == 'style' && $style_default) @@ -2064,15 +2064,15 @@ parse_css_file = {PARSE_CSS_FILE} $sql = "SELECT {$element}_id, {$element}_name FROM $table ORDER BY {$element}_id ASC"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); ${$element . '_options'} = ''; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $selected = ($row[$element . '_id'] == $style_row[$element . '_id']) ? ' selected="selected"' : ''; ${$element . '_options'} .= '<option value="' . $row[$element . '_id'] . '"' . $selected . '>' . $row[$element . '_name'] . '</option>'; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } } @@ -2442,9 +2442,9 @@ parse_css_file = {PARSE_CSS_FILE} $sql = "SELECT $sql_select FROM $sql_from WHERE {$mode}_id = $basis"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$row) { @@ -2496,15 +2496,15 @@ parse_css_file = {PARSE_CSS_FILE} $sql = "SELECT {$element}_id, {$element}_name FROM $table ORDER BY {$element}_id ASC"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); ${$element . '_options'} = ''; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $selected = ($row[$element . '_id'] == $style_row[$element . '_id']) ? ' selected="selected"' : ''; ${$element . '_options'} .= '<option value="' . $row[$element . '_id'] . '"' . $selected . '>' . $row[$element . '_name'] . '</option>'; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } } @@ -2546,12 +2546,12 @@ parse_css_file = {PARSE_CSS_FILE} // get all the lang_dirs $sql = 'SELECT lang_dir FROM ' . LANG_TABLE; - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + $result = phpbb::$db->sql_query($sql); + while ($row = phpbb::$db->sql_fetchrow($result)) { $lang_dirs[] = $row['lang_dir']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // get all imagesets this theme is associated with $sql = 'SELECT si.imageset_id, si.imageset_path, st.template_path @@ -2559,8 +2559,8 @@ parse_css_file = {PARSE_CSS_FILE} WHERE s.theme_id = ' . (int) $theme['theme_id'] . ' AND s.imageset_id = si.imageset_id AND s.template_id = st.template_id'; - $result = $db->sql_query($sql); - while ($theme_row = $db->sql_fetchrow($result)) + $result = phpbb::$db->sql_query($sql); + while ($theme_row = phpbb::$db->sql_fetchrow($result)) { foreach ($lang_dirs as $lang_dir) { @@ -2584,15 +2584,15 @@ parse_css_file = {PARSE_CSS_FILE} FROM ' . STYLES_IMAGESET_DATA_TABLE . ' WHERE imageset_id = ' . $theme['imageset_id'] . " AND image_filename <> '' - AND image_lang IN ('" . $db->sql_escape($user_image_lang) . "', '')"; - $result2 = $db->sql_query($sql); + AND image_lang IN ('" . phpbb::$db->sql_escape($user_image_lang) . "', '')"; + $result2 = phpbb::$db->sql_query($sql); $img_array = array(); - while ($row = $db->sql_fetchrow($result2)) + while ($row = phpbb::$db->sql_fetchrow($result2)) { $img_array[$row['image_name']] = $row; } - $db->sql_freeresult($result2); + phpbb::$db->sql_freeresult($result2); $specific_theme_data = str_replace(array_keys($replace), array_values($replace), $theme['theme_data']); @@ -2651,7 +2651,7 @@ parse_css_file = {PARSE_CSS_FILE} file_put_contents(PHPBB_ROOT_PATH . '/store/' . $theme['theme_id'] . '_' . $theme['imageset_id'] . '_' . $lang_dir . '.css', $specific_theme_data, LOCK_EX); } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } /** @@ -2694,10 +2694,10 @@ parse_css_file = {PARSE_CSS_FILE} $sql = "SELECT {$element}_id, {$element}_name FROM $sql_from - WHERE {$element}_name = '" . $db->sql_escape($chk_name) . "'"; - $result = $db->sql_query($sql); + WHERE {$element}_name = '" . phpbb::$db->sql_escape($chk_name) . "'"; + $result = phpbb::$db->sql_query($sql); - if ($row = $db->sql_fetchrow($result)) + if ($row = phpbb::$db->sql_fetchrow($result)) { $name = $row[$element . '_name']; $id = $row[$element . '_id']; @@ -2718,7 +2718,7 @@ parse_css_file = {PARSE_CSS_FILE} unset($cfg); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } /** @@ -2747,10 +2747,10 @@ parse_css_file = {PARSE_CSS_FILE} // Check if the name already exist $sql = 'SELECT style_id FROM ' . STYLES_TABLE . " - WHERE style_name = '" . $db->sql_escape($name) . "'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + WHERE style_name = '" . phpbb::$db->sql_escape($name) . "'"; + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if ($row) { @@ -2782,7 +2782,7 @@ parse_css_file = {PARSE_CSS_FILE} return false; } - $db->sql_transaction('begin'); + phpbb::$db->sql_transaction('begin'); $sql_ary = array( 'style_name' => $name, @@ -2794,22 +2794,22 @@ parse_css_file = {PARSE_CSS_FILE} ); $sql = 'INSERT INTO ' . STYLES_TABLE . ' - ' . $db->sql_build_array('INSERT', $sql_ary); - $db->sql_query($sql); + ' . phpbb::$db->sql_build_array('INSERT', $sql_ary); + phpbb::$db->sql_query($sql); - $id = $db->sql_nextid(); + $id = phpbb::$db->sql_nextid(); if ($default) { $sql = 'UPDATE ' . USERS_TABLE . " SET user_style = $id WHERE user_style = " . phpbb::$config['default_style']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); set_config('default_style', $id); } - $db->sql_transaction('commit'); + phpbb::$db->sql_transaction('commit'); add_log('admin', 'LOG_STYLE_ADD', $name); } @@ -2855,10 +2855,10 @@ parse_css_file = {PARSE_CSS_FILE} // Check if the name already exist $sql = "SELECT {$mode}_id FROM $sql_from - WHERE {$mode}_name = '" . $db->sql_escape($name) . "'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + WHERE {$mode}_name = '" . phpbb::$db->sql_escape($name) . "'"; + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if ($row) @@ -2921,13 +2921,13 @@ parse_css_file = {PARSE_CSS_FILE} break; } - $db->sql_transaction('begin'); + phpbb::$db->sql_transaction('begin'); $sql = "INSERT INTO $sql_from - " . $db->sql_build_array('INSERT', $sql_ary); - $db->sql_query($sql); + " . phpbb::$db->sql_build_array('INSERT', $sql_ary); + phpbb::$db->sql_query($sql); - $id = $db->sql_nextid(); + $id = phpbb::$db->sql_nextid(); if ($mode == 'imageset') { @@ -2972,7 +2972,7 @@ parse_css_file = {PARSE_CSS_FILE} 'imageset_id' => (int) $id, 'image_lang' => '', ); - $db->sql_query('INSERT INTO ' . STYLES_IMAGESET_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + phpbb::$db->sql_query('INSERT INTO ' . STYLES_IMAGESET_DATA_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary)); } } } @@ -2980,9 +2980,9 @@ parse_css_file = {PARSE_CSS_FILE} $sql = 'SELECT lang_dir FROM ' . LANG_TABLE; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if (@file_exists("$root_path$mode/{$row['lang_dir']}/imageset.cfg")) { @@ -3020,17 +3020,17 @@ parse_css_file = {PARSE_CSS_FILE} 'imageset_id' => (int) $id, 'image_lang' => $row['lang_dir'], ); - $db->sql_query('INSERT INTO ' . STYLES_IMAGESET_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + phpbb::$db->sql_query('INSERT INTO ' . STYLES_IMAGESET_DATA_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary)); } } } unset($cfg_data_imageset_data); } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } - $db->sql_transaction('commit'); + phpbb::$db->sql_transaction('commit'); $log = ($store_db) ? 'LOG_' . $l_type . '_ADD_DB' : 'LOG_' . $l_type . '_ADD_FS'; add_log('admin', $log, $name); diff --git a/phpBB/modules/acp/acp_update.php b/phpBB/modules/acp/acp_update.php index f65ca47a33..8424992d50 100644 --- a/phpBB/modules/acp/acp_update.php +++ b/phpBB/modules/acp/acp_update.php @@ -51,9 +51,9 @@ class acp_update $sql = 'SELECT config_value FROM ' . CONFIG_TABLE . " WHERE config_name = 'version_update_from'"; - $result = $db->sql_query($sql); - $version_update_from = (string) $db->sql_fetchfield('config_value'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $version_update_from = (string) phpbb::$db->sql_fetchfield('config_value'); + phpbb::$db->sql_freeresult($result); $current_version = (!empty($version_update_from)) ? $version_update_from : phpbb::$config['version']; diff --git a/phpBB/modules/acp/acp_users.php b/phpBB/modules/acp/acp_users.php index c08a5675d3..9cdd26622a 100644 --- a/phpBB/modules/acp/acp_users.php +++ b/phpBB/modules/acp/acp_users.php @@ -87,10 +87,10 @@ class acp_users { $sql = 'SELECT user_id FROM ' . USERS_TABLE . " - WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; - $result = $db->sql_query($sql); - $user_id = (int) $db->sql_fetchfield('user_id'); - $db->sql_freeresult($result); + WHERE username_clean = '" . phpbb::$db->sql_escape(utf8_clean_string($username)) . "'"; + $result = phpbb::$db->sql_query($sql); + $user_id = (int) phpbb::$db->sql_fetchfield('user_id'); + phpbb::$db->sql_freeresult($result); if (!$user_id) { @@ -104,9 +104,9 @@ class acp_users LEFT JOIN ' . SESSIONS_TABLE . ' s ON (s.session_user_id = u.user_id) WHERE u.user_id = ' . $user_id . ' ORDER BY s.session_time DESC'; - $result = $db->sql_query($sql); - $user_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $user_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$user_row) { @@ -123,10 +123,10 @@ class acp_users AND module_enabled = 1 AND module_class = 'acp' ORDER BY left_id, module_mode"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $dropdown_modes = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if (!$this->p_master->module_auth($row['module_auth'])) { @@ -135,7 +135,7 @@ class acp_users $dropdown_modes[$row['module_mode']] = true; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); foreach ($dropdown_modes as $module_mode => $null) { @@ -255,13 +255,13 @@ class acp_users $sql = 'SELECT DISTINCT poster_ip FROM ' . POSTS_TABLE . " WHERE poster_id = $user_id"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $ban[] = $row['poster_ip']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $reason = 'USER_ADMIN_BAN_IP_REASON'; $log = 'LOG_USER_BAN_IP'; @@ -317,9 +317,9 @@ class acp_users user_active_flip('deactivate', $user_id, INACTIVE_REMIND); $sql = 'UPDATE ' . USERS_TABLE . " - SET user_actkey = '" . $db->sql_escape($user_actkey) . "' + SET user_actkey = '" . phpbb::$db->sql_escape($user_actkey) . "' WHERE user_id = $user_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } else { @@ -327,9 +327,9 @@ class acp_users $sql = 'SELECT user_actkey FROM ' . USERS_TABLE . ' WHERE user_id = ' . $user_id; - $result = $db->sql_query($sql); - $user_actkey = (string) $db->sql_fetchfield('user_actkey'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $user_actkey = (string) phpbb::$db->sql_fetchfield('user_actkey'); + phpbb::$db->sql_freeresult($result); } $messenger = new messenger(false); @@ -407,9 +407,9 @@ class acp_users 'user_sig_bbcode_bitfield' => '' ); - $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . " WHERE user_id = $user_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); add_log('admin', 'LOG_USER_DEL_SIG', $user_row['username']); add_log('user', $user_id, 'LOG_USER_DEL_SIG_USER'); @@ -433,9 +433,9 @@ class acp_users ); $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . " WHERE user_id = $user_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // Delete old avatar if present if ($user_row['user_avatar'] && $user_row['user_avatar_type'] != AVATAR_GALLERY) @@ -523,9 +523,9 @@ class acp_users $sql = 'SELECT forum_name, forum_type FROM ' . FORUMS_TABLE . " WHERE forum_id = $new_forum_id"; - $result = $db->sql_query($sql); - $forum_info = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $forum_info = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$forum_info) { @@ -547,22 +547,22 @@ class acp_users WHERE poster_id = $user_id AND forum_id <> $new_forum_id GROUP BY topic_id"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $topic_id_ary[$row['topic_id']] = $row['total_posts']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($topic_id_ary)) { $sql = 'SELECT topic_id, forum_id, topic_title, topic_replies, topic_replies_real, topic_attachment FROM ' . TOPICS_TABLE . ' - WHERE ' . $db->sql_in_set('topic_id', array_keys($topic_id_ary)); - $result = $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('topic_id', array_keys($topic_id_ary)); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if (max($row['topic_replies'], $row['topic_replies_real']) + 1 == $topic_id_ary[$row['topic_id']]) { @@ -576,7 +576,7 @@ class acp_users $forum_id_ary[] = $row['forum_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } // Entire topic comprises posts by this user, move these topics @@ -592,7 +592,7 @@ class acp_users foreach ($move_post_ary as $topic_id => $post_ary) { // Create new topic - $sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', array( + $sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', array( 'topic_poster' => $user_id, 'topic_time' => time(), 'forum_id' => $new_forum_id, @@ -604,16 +604,16 @@ class acp_users 'topic_time_limit' => 0, 'topic_attachment' => $post_ary['attach']) ); - $db->sql_query($sql); + phpbb::$db->sql_query($sql); - $new_topic_id = $db->sql_nextid(); + $new_topic_id = phpbb::$db->sql_nextid(); // Move posts $sql = 'UPDATE ' . POSTS_TABLE . " SET forum_id = $new_forum_id, topic_id = $new_topic_id WHERE topic_id = $topic_id AND poster_id = $user_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); if ($post_ary['attach']) { @@ -621,7 +621,7 @@ class acp_users SET topic_id = $new_topic_id WHERE topic_id = $topic_id AND poster_id = $user_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } $new_topic_id_ary[] = $new_topic_id; @@ -746,9 +746,9 @@ class acp_users FROM ' . USERS_TABLE . ' WHERE user_type = ' . phpbb::USER_FOUNDER . ' AND user_id <> ' . $user_id; - $result = $db->sql_query_limit($sql, 1); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query_limit($sql, 1); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if ($row) { @@ -795,9 +795,9 @@ class acp_users if (sizeof($sql_ary)) { $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $user_id; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } if ($update_username) @@ -854,9 +854,9 @@ class acp_users $sql = 'SELECT MAX(session_time) AS session_time, MIN(session_viewonline) AS session_viewonline FROM ' . SESSIONS_TABLE . " WHERE session_user_id = $user_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); $user_row['session_time'] = (isset($row['session_time'])) ? $row['session_time'] : 0; $user_row['session_viewonline'] = (isset($row['session_viewonline'])) ? $row['session_viewonline'] : 0; @@ -895,9 +895,9 @@ class acp_users FROM ' . POSTS_TABLE . ' WHERE poster_id = ' . $user_id . ' AND post_approved = 0'; - $result = $db->sql_query($sql); - $user_row['posts_in_queue'] = (int) $db->sql_fetchfield('posts_in_queue'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $user_row['posts_in_queue'] = (int) phpbb::$db->sql_fetchfield('posts_in_queue'); + phpbb::$db->sql_freeresult($result); $template->assign_vars(array( 'L_NAME_CHARS_EXPLAIN' => sprintf(phpbb::$user->lang[phpbb::$config['allow_name_chars'] . '_EXPLAIN'], phpbb::$config['min_name_chars'], phpbb::$config['max_name_chars']), @@ -963,7 +963,7 @@ class acp_users { $sql_in[] = $mark; } - $where_sql = ' AND ' . $db->sql_in_set('log_id', $sql_in); + $where_sql = ' AND ' . phpbb::$db->sql_in_set('log_id', $sql_in); unset($sql_in); } @@ -972,7 +972,7 @@ class acp_users $sql = 'DELETE FROM ' . LOG_TABLE . ' WHERE log_type = ' . LOG_USERS . " $where_sql"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); add_log('admin', 'LOG_CLEAR_USER', $user_row['username']); } @@ -1044,10 +1044,10 @@ class acp_users $sql = 'SELECT lang_id FROM ' . LANG_TABLE . " - WHERE lang_iso = '" . $db->sql_escape(phpbb::$user->data['user_lang']) . "'"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + WHERE lang_iso = '" . phpbb::$db->sql_escape(phpbb::$user->data['user_lang']) . "'"; + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); $user_row['iso_lang_id'] = $row['lang_id']; @@ -1129,14 +1129,14 @@ class acp_users ); $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . " WHERE user_id = $user_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // Update Custom Fields if (sizeof($cp_data)) { - switch ($db->dbms_type) + switch (phpbb::$db->dbms_type) { case 'oracle': case 'firebird': @@ -1163,20 +1163,20 @@ class acp_users } $sql = 'UPDATE ' . PROFILE_FIELDS_DATA_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $cp_data) . " + SET ' . phpbb::$db->sql_build_array('UPDATE', $cp_data) . " WHERE user_id = $user_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); - if (!$db->sql_affectedrows()) + if (!phpbb::$db->sql_affectedrows()) { $cp_data['user_id'] = (int) $user_id; - $db->sql_return_on_error(true); + phpbb::$db->sql_return_on_error(true); - $sql = 'INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $cp_data); - $db->sql_query($sql); + $sql = 'INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $cp_data); + phpbb::$db->sql_query($sql); - $db->sql_return_on_error(false); + phpbb::$db->sql_return_on_error(false); } } @@ -1334,9 +1334,9 @@ class acp_users ); $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . " WHERE user_id = $user_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); trigger_error(phpbb::$user->lang['USER_PREFS_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); } @@ -1514,7 +1514,7 @@ class acp_users $sql = 'UPDATE ' . USERS_TABLE . " SET user_rank = $rank_id WHERE user_id = $user_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); trigger_error(phpbb::$user->lang['USER_RANK_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); } @@ -1523,16 +1523,16 @@ class acp_users FROM ' . RANKS_TABLE . ' WHERE rank_special = 1 ORDER BY rank_title'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $s_rank_options = '<option value="0"' . ((!$user_row['user_rank']) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['NO_SPECIAL_RANK'] . '</option>'; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $selected = ($user_row['user_rank'] && $row['rank_id'] == $user_row['user_rank']) ? ' selected="selected"' : ''; $s_rank_options .= '<option value="' . $row['rank_id'] . '"' . $selected . '>' . $row['rank_title'] . '</option>'; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $template->assign_vars(array( 'S_RANK' => true, @@ -1581,9 +1581,9 @@ class acp_users ); $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $user_id; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); trigger_error(phpbb::$user->lang['USER_SIG_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); } @@ -1649,15 +1649,15 @@ class acp_users FROM ' . ATTACHMENTS_TABLE . ' WHERE poster_id = ' . $user_id . ' AND is_orphan = 0 - AND ' . $db->sql_in_set('attach_id', $marked); - $result = $db->sql_query($sql); + AND ' . phpbb::$db->sql_in_set('attach_id', $marked); + $result = phpbb::$db->sql_query($sql); $marked = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $marked[] = $row['attach_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } if ($deletemark && sizeof($marked)) @@ -1666,15 +1666,15 @@ class acp_users { $sql = 'SELECT real_filename FROM ' . ATTACHMENTS_TABLE . ' - WHERE ' . $db->sql_in_set('attach_id', $marked); - $result = $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('attach_id', $marked); + $result = phpbb::$db->sql_query($sql); $log_attachments = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $log_attachments[] = $row['real_filename']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); delete_attachments('attach', $marked); @@ -1726,9 +1726,9 @@ class acp_users FROM ' . ATTACHMENTS_TABLE . " WHERE poster_id = $user_id AND is_orphan = 0"; - $result = $db->sql_query_limit($sql, 1); - $num_attachments = (int) $db->sql_fetchfield('num_attachments'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query_limit($sql, 1); + $num_attachments = (int) phpbb::$db->sql_fetchfield('num_attachments'); + phpbb::$db->sql_freeresult($result); $sql = 'SELECT a.*, t.topic_title, p.message_subject as message_title FROM ' . ATTACHMENTS_TABLE . ' a @@ -1739,9 +1739,9 @@ class acp_users WHERE a.poster_id = ' . $user_id . " AND a.is_orphan = 0 ORDER BY $order_by"; - $result = $db->sql_query_limit($sql, phpbb::$config['posts_per_page'], $start); + $result = phpbb::$db->sql_query_limit($sql, phpbb::$config['posts_per_page'], $start); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if ($row['in_message']) { @@ -1771,7 +1771,7 @@ class acp_users 'U_VIEW_TOPIC' => $view_topic) ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $template->assign_vars(array( 'S_ATTACHMENTS' => true, @@ -1797,9 +1797,9 @@ class acp_users $sql = 'SELECT group_founder_manage FROM ' . GROUPS_TABLE . ' WHERE group_id = ' . $group_id; - $result = $db->sql_query($sql); - $founder_manage = (int) $db->sql_fetchfield('group_founder_manage'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $founder_manage = (int) phpbb::$db->sql_fetchfield('group_founder_manage'); + phpbb::$db->sql_freeresult($result); if (!phpbb::$user->is_founder && $founder_manage) { @@ -1887,11 +1887,11 @@ class acp_users WHERE ug.user_id = $user_id AND g.group_id = ug.group_id ORDER BY g.group_type DESC, ug.user_pending ASC, g.group_name"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $i = 0; $group_data = $id_ary = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $type = ($row['group_type'] == GROUP_SPECIAL) ? 'special' : (($row['user_pending']) ? 'pending' : 'normal'); @@ -1903,17 +1903,17 @@ class acp_users $i++; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Select box for other groups $sql = 'SELECT group_id, group_name, group_type, group_founder_manage FROM ' . GROUPS_TABLE . ' - ' . ((sizeof($id_ary)) ? 'WHERE ' . $db->sql_in_set('group_id', $id_ary, true) : '') . ' + ' . ((sizeof($id_ary)) ? 'WHERE ' . phpbb::$db->sql_in_set('group_id', $id_ary, true) : '') . ' ORDER BY group_type DESC, group_name ASC'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $s_group_options = ''; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if (!phpbb::$config['coppa_enable'] && $row['group_name'] == 'REGISTERED_COPPA') { @@ -1928,7 +1928,7 @@ class acp_users $s_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . (($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $current_type = ''; foreach ($group_data as $group_type => $data_ary) @@ -1983,19 +1983,19 @@ class acp_users // Select auth options $sql = 'SELECT auth_option, is_local, is_global FROM ' . ACL_OPTIONS_TABLE . ' - WHERE auth_option ' . $db->sql_like_expression($db->any_char . '_') . ' + WHERE auth_option ' . phpbb::$db->sql_like_expression(phpbb::$db->any_char . '_') . ' AND is_global = 1 ORDER BY auth_option'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $hold_ary = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $hold_ary = $auth_admin->get_mask('view', $user_id, false, false, $row['auth_option'], 'global', phpbb::ACL_NEVER); $auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', false, false); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); unset($hold_ary); } @@ -2003,17 +2003,17 @@ class acp_users { $sql = 'SELECT auth_option, is_local, is_global FROM ' . ACL_OPTIONS_TABLE . " - WHERE auth_option " . $db->sql_like_expression($db->any_char . '_') . " + WHERE auth_option " . phpbb::$db->sql_like_expression(phpbb::$db->any_char . '_') . " AND is_local = 1 ORDER BY is_global DESC, auth_option"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $hold_ary = $auth_admin->get_mask('view', $user_id, false, $forum_id, $row['auth_option'], 'local', phpbb::ACL_NEVER); $auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', true, false); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } $s_forum_options = '<option value="0"' . ((!$forum_id) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['VIEW_GLOBAL_PERMS'] . '</option>'; diff --git a/phpBB/modules/acp/acp_words.php b/phpBB/modules/acp/acp_words.php index 878c23acc1..d9411ce6e3 100644 --- a/phpBB/modules/acp/acp_words.php +++ b/phpBB/modules/acp/acp_words.php @@ -54,9 +54,9 @@ class acp_words $sql = 'SELECT * FROM ' . WORDS_TABLE . " WHERE word_id = $word_id"; - $result = $db->sql_query($sql); - $word_info = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $word_info = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); $s_hidden_fields .= '<input type="hidden" name="id" value="' . $word_id . '" />'; @@ -97,11 +97,11 @@ class acp_words if ($word_id) { - $db->sql_query('UPDATE ' . WORDS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE word_id = ' . $word_id); + phpbb::$db->sql_query('UPDATE ' . WORDS_TABLE . ' SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . ' WHERE word_id = ' . $word_id); } else { - $db->sql_query('INSERT INTO ' . WORDS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + phpbb::$db->sql_query('INSERT INTO ' . WORDS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary)); } phpbb::$acm->destroy('word_censors'); @@ -128,13 +128,13 @@ class acp_words $sql = 'SELECT word FROM ' . WORDS_TABLE . " WHERE word_id = $word_id"; - $result = $db->sql_query($sql); - $deleted_word = $db->sql_fetchfield('word'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $deleted_word = phpbb::$db->sql_fetchfield('word'); + phpbb::$db->sql_freeresult($result); $sql = 'DELETE FROM ' . WORDS_TABLE . " WHERE word_id = $word_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); phpbb::$acm->destroy('word_censors'); @@ -164,9 +164,9 @@ class acp_words $sql = 'SELECT * FROM ' . WORDS_TABLE . ' ORDER BY word'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $template->assign_block_vars('words', array( 'WORD' => $row['word'], @@ -175,7 +175,7 @@ class acp_words 'U_DELETE' => $this->u_action . '&action=delete&id=' . $row['word_id']) ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } } diff --git a/phpBB/modules/acp/auth.php b/phpBB/modules/acp/auth.php index 649ffee656..a959911bc9 100644 --- a/phpBB/modules/acp/auth.php +++ b/phpBB/modules/acp/auth.php @@ -32,11 +32,11 @@ class auth_admin extends auth $sql = 'SELECT auth_option_id, auth_option, is_global, is_local FROM ' . ACL_OPTIONS_TABLE . ' ORDER BY auth_option_id'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $global = $local = 0; $this->acl_options = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if ($row['is_global']) { @@ -51,7 +51,7 @@ class auth_admin extends auth $this->acl_options['id'][$row['auth_option']] = (int) $row['auth_option_id']; $this->acl_options['option'][(int) $row['auth_option_id']] = $row['auth_option']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); phpbb::$acm->put('acl_options', $this->acl_options); } @@ -105,13 +105,13 @@ class auth_admin extends auth { $sql = 'SELECT forum_id FROM ' . FORUMS_TABLE; - $result = $db->sql_query($sql, 120); + $result = phpbb::$db->sql_query($sql, 120); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $forum_ids[] = (int) $row['forum_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } if ($view_user_mask) @@ -120,10 +120,10 @@ class auth_admin extends auth $sql = 'SELECT user_id, user_permissions, user_type FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('user_id', $ug_id); - $result = $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('user_id', $ug_id); + $result = phpbb::$db->sql_query($sql); - while ($userdata = $db->sql_fetchrow($result)) + while ($userdata = phpbb::$db->sql_fetchrow($result)) { if (phpbb::$user->data['user_id'] != $userdata['user_id']) { @@ -147,7 +147,7 @@ class auth_admin extends auth } } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); unset($userdata); unset($auth2); @@ -227,26 +227,26 @@ class auth_admin extends auth FROM ' . ACL_USERS_TABLE . ' WHERE auth_role_id = ' . $role_id . ' ORDER BY forum_id'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $hold_ary[$row['forum_id']]['users'][] = $row['user_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Now grab groups... $sql = 'SELECT group_id, forum_id FROM ' . ACL_GROUPS_TABLE . ' WHERE auth_role_id = ' . $role_id . ' ORDER BY forum_id'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $hold_ary[$row['forum_id']]['groups'][] = $row['group_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); return $hold_ary; } @@ -272,24 +272,24 @@ class auth_admin extends auth { $sql = 'SELECT user_id as ug_id, username as ug_name FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('user_id', array_keys($hold_ary)) . ' + WHERE ' . phpbb::$db->sql_in_set('user_id', array_keys($hold_ary)) . ' ORDER BY username_clean ASC'; } else { $sql = 'SELECT group_id as ug_id, group_name as ug_name, group_type FROM ' . GROUPS_TABLE . ' - WHERE ' . $db->sql_in_set('group_id', array_keys($hold_ary)) . ' + WHERE ' . phpbb::$db->sql_in_set('group_id', array_keys($hold_ary)) . ' ORDER BY group_type DESC, group_name ASC'; } - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $ug_names_ary = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $ug_names_ary[$row['ug_id']] = ($user_mode == 'user') ? $row['ug_name'] : (($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['ug_name']] : $row['ug_name']); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Get used forums $forum_ids = array(); @@ -322,16 +322,16 @@ class auth_admin extends auth // Get available roles $sql = 'SELECT * FROM ' . ACL_ROLES_TABLE . " - WHERE role_type = '" . $db->sql_escape($permission_type) . "' + WHERE role_type = '" . phpbb::$db->sql_escape($permission_type) . "' ORDER BY role_order ASC"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $roles = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $roles[$row['role_id']] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $cur_roles = $this->acl_role_data($user_mode, $permission_type, array_keys($hold_ary)); @@ -351,10 +351,10 @@ class auth_admin extends auth $sql = 'SELECT r.role_id, o.auth_option, r.auth_setting FROM ' . ACL_ROLES_DATA_TABLE . ' r, ' . ACL_OPTIONS_TABLE . ' o WHERE o.auth_option_id = r.auth_option_id - AND ' . $db->sql_in_set('r.role_id', array_keys($roles)); - $result = $db->sql_query($sql); + AND ' . phpbb::$db->sql_in_set('r.role_id', array_keys($roles)); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $flag = substr($row['auth_option'], 0, strpos($row['auth_option'], '_') + 1); if ($flag == $row['auth_option']) @@ -364,7 +364,7 @@ class auth_admin extends auth $s_role_js_array[$row['role_id']] .= 'role_options[' . $row['role_id'] . '][\'' . addslashes($row['auth_option']) . '\'] = ' . $row['auth_setting'] . '; '; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $s_role_js_array = implode('', $s_role_js_array); } @@ -379,14 +379,14 @@ class auth_admin extends auth $sql = 'SELECT group_id, group_name, group_type FROM ' . GROUPS_TABLE . ' ORDER BY group_type DESC, group_name ASC'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $groups = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $groups[$row['group_id']] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $memberships = group_memberships(false, array_keys($hold_ary), false); @@ -606,17 +606,17 @@ class auth_admin extends auth // Get forum names $sql = 'SELECT forum_id, forum_name FROM ' . FORUMS_TABLE . ' - WHERE ' . $db->sql_in_set('forum_id', array_keys($hold_ary)) . ' + WHERE ' . phpbb::$db->sql_in_set('forum_id', array_keys($hold_ary)) . ' ORDER BY left_id'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); // If the role is used globally, then reflect that $forum_names = (isset($hold_ary[0])) ? array(0 => '') : array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $forum_names[$row['forum_id']] = $row['forum_name']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); foreach ($forum_names as $forum_id => $forum_name) { @@ -631,11 +631,11 @@ class auth_admin extends auth { $sql = 'SELECT user_id, username FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('user_id', $auth_ary['users']) . ' + WHERE ' . phpbb::$db->sql_in_set('user_id', $auth_ary['users']) . ' ORDER BY username_clean ASC'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $template->assign_block_vars('role_mask.users', array( 'USER_ID' => $row['user_id'], @@ -643,18 +643,18 @@ class auth_admin extends auth 'U_PROFILE' => append_sid('memberlist', "mode=viewprofile&u={$row['user_id']}")) ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } if (isset($auth_ary['groups']) && sizeof($auth_ary['groups'])) { $sql = 'SELECT group_id, group_name, group_type FROM ' . GROUPS_TABLE . ' - WHERE ' . $db->sql_in_set('group_id', $auth_ary['groups']) . ' + WHERE ' . phpbb::$db->sql_in_set('group_id', $auth_ary['groups']) . ' ORDER BY group_type ASC, group_name'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $template->assign_block_vars('role_mask.groups', array( 'GROUP_ID' => $row['group_id'], @@ -662,7 +662,7 @@ class auth_admin extends auth 'U_PROFILE' => append_sid('memberlist', "mode=group&g={$row['group_id']}")) ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } } } @@ -682,9 +682,9 @@ class auth_admin extends auth $sql = 'SELECT auth_option, is_global, is_local FROM ' . ACL_OPTIONS_TABLE . ' ORDER BY auth_option_id'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if ($row['is_global']) { @@ -696,7 +696,7 @@ class auth_admin extends auth $cur_options['local'][] = $row['auth_option']; } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Here we need to insert new options ... this requires discovering whether // an options is global, local or both and whether we need to add an permission @@ -743,7 +743,7 @@ class auth_admin extends auth } } - $db->sql_multi_insert(ACL_OPTIONS_TABLE, $sql_ary); + phpbb::$db->sql_multi_insert(ACL_OPTIONS_TABLE, $sql_ary); phpbb::$acm->destroy('acl_options'); $this->acl_clear_prefetch(); @@ -772,8 +772,8 @@ class auth_admin extends auth $ug_id = array($ug_id); } - $ug_id_sql = $db->sql_in_set($ug_type . '_id', array_map('intval', $ug_id)); - $forum_sql = $db->sql_in_set('forum_id', array_map('intval', $forum_id)); + $ug_id_sql = phpbb::$db->sql_in_set($ug_type . '_id', array_map('intval', $ug_id)); + $forum_sql = phpbb::$db->sql_in_set('forum_id', array_map('intval', $forum_id)); // Instead of updating, inserting, removing we just remove all current settings and re-set everything... $table = ($ug_type == 'user') ? ACL_USERS_TABLE : ACL_GROUPS_TABLE; @@ -803,21 +803,21 @@ class auth_admin extends auth $sql = "DELETE FROM $table WHERE $forum_sql AND $ug_id_sql - AND " . $db->sql_in_set('auth_option_id', $auth_option_ids); - $db->sql_query($sql); + AND " . phpbb::$db->sql_in_set('auth_option_id', $auth_option_ids); + phpbb::$db->sql_query($sql); // Remove those having a role assigned... the correct type of course... $sql = 'SELECT role_id FROM ' . ACL_ROLES_TABLE . " - WHERE role_type = '" . $db->sql_escape($flag) . "'"; - $result = $db->sql_query($sql); + WHERE role_type = '" . phpbb::$db->sql_escape($flag) . "'"; + $result = phpbb::$db->sql_query($sql); $role_ids = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $role_ids[] = $row['role_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($role_ids)) { @@ -825,8 +825,8 @@ class auth_admin extends auth WHERE $forum_sql AND $ug_id_sql AND auth_option_id = 0 - AND " . $db->sql_in_set('auth_role_id', $role_ids); - $db->sql_query($sql); + AND " . phpbb::$db->sql_in_set('auth_role_id', $role_ids); + phpbb::$db->sql_query($sql); } // Ok, include the any-flag if one or more auth options are set to yes... @@ -878,7 +878,7 @@ class auth_admin extends auth } } - $db->sql_multi_insert($table, $sql_ary); + phpbb::$db->sql_multi_insert($table, $sql_ary); if ($clear_prefetch) { @@ -939,10 +939,10 @@ class auth_admin extends auth // Remove current auth options... $sql = 'DELETE FROM ' . ACL_ROLES_DATA_TABLE . ' WHERE role_id = ' . $role_id; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // Now insert the new values - $db->sql_multi_insert(ACL_ROLES_DATA_TABLE, $sql_ary); + phpbb::$db->sql_multi_insert(ACL_ROLES_DATA_TABLE, $sql_ary); $this->acl_clear_prefetch(); } @@ -965,12 +965,12 @@ class auth_admin extends auth if ($forum_id !== false) { - $where_sql[] = (!is_array($forum_id)) ? 'forum_id = ' . (int) $forum_id : $db->sql_in_set('forum_id', array_map('intval', $forum_id)); + $where_sql[] = (!is_array($forum_id)) ? 'forum_id = ' . (int) $forum_id : phpbb::$db->sql_in_set('forum_id', array_map('intval', $forum_id)); } if ($ug_id !== false) { - $where_sql[] = (!is_array($ug_id)) ? $id_field . ' = ' . (int) $ug_id : $db->sql_in_set($id_field, array_map('intval', $ug_id)); + $where_sql[] = (!is_array($ug_id)) ? $id_field . ' = ' . (int) $ug_id : phpbb::$db->sql_in_set($id_field, array_map('intval', $ug_id)); } // There seem to be auth options involved, therefore we need to go through the list and make sure we capture roles correctly @@ -979,16 +979,16 @@ class auth_admin extends auth // Get permission type $sql = 'SELECT auth_option, auth_option_id FROM ' . ACL_OPTIONS_TABLE . " - WHERE auth_option " . $db->sql_like_expression($permission_type . $db->any_char); - $result = $db->sql_query($sql); + WHERE auth_option " . phpbb::$db->sql_like_expression($permission_type . phpbb::$db->any_char); + $result = phpbb::$db->sql_query($sql); $auth_id_ary = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $option_id_ary[] = $row['auth_option_id']; $auth_id_ary[$row['auth_option']] = phpbb::ACL_NO; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // First of all, lets grab the items having roles with the specified auth options assigned $sql = "SELECT auth_role_id, $id_field, forum_id @@ -998,14 +998,14 @@ class auth_admin extends auth AND r.role_type = '{$permission_type}' AND " . implode(' AND ', $where_sql) . ' ORDER BY auth_role_id'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $cur_role_auth = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $cur_role_auth[$row['auth_role_id']][$row['forum_id']][] = $row[$id_field]; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Get role data for resetting data if (sizeof($cur_role_auth)) @@ -1013,11 +1013,11 @@ class auth_admin extends auth $sql = 'SELECT ao.auth_option, rd.role_id, rd.auth_setting FROM ' . ACL_OPTIONS_TABLE . ' ao, ' . ACL_ROLES_DATA_TABLE . ' rd WHERE ao.auth_option_id = rd.auth_option_id - AND ' . $db->sql_in_set('rd.role_id', array_keys($cur_role_auth)); - $result = $db->sql_query($sql); + AND ' . phpbb::$db->sql_in_set('rd.role_id', array_keys($cur_role_auth)); + $result = phpbb::$db->sql_query($sql); $auth_settings = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { // We need to fill all auth_options, else setting it will fail... if (!isset($auth_settings[$row['role_id']])) @@ -1026,7 +1026,7 @@ class auth_admin extends auth } $auth_settings[$row['role_id']][$row['auth_option']] = $row['auth_setting']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Set the options foreach ($cur_role_auth as $role_id => $auth_row) @@ -1042,12 +1042,12 @@ class auth_admin extends auth // Now, normally remove permissions... if ($permission_type !== false) { - $where_sql[] = $db->sql_in_set('auth_option_id', array_map('intval', $option_id_ary)); + $where_sql[] = phpbb::$db->sql_in_set('auth_option_id', array_map('intval', $option_id_ary)); } $sql = "DELETE FROM $table WHERE " . implode(' AND ', $where_sql); - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $this->acl_clear_prefetch(); } @@ -1224,10 +1224,10 @@ class auth_admin extends auth } $sql = 'UPDATE ' . USERS_TABLE . " - SET user_permissions = '" . $db->sql_escape($user_permissions) . "', + SET user_permissions = '" . phpbb::$db->sql_escape($user_permissions) . "', user_perm_from = $from_user_id WHERE user_id = " . $to_user_id; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); return true; } diff --git a/phpBB/modules/mcp/mcp_ban.php b/phpBB/modules/mcp/mcp_ban.php index b9f6c3e634..0a0452ccf9 100644 --- a/phpBB/modules/mcp/mcp_ban.php +++ b/phpBB/modules/mcp/mcp_ban.php @@ -163,22 +163,22 @@ class mcp_ban $sql = 'SELECT username, user_email, user_ip FROM ' . USERS_TABLE . ' WHERE user_id = ' . $user_id; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); switch ($mode) { case 'user': - $pre_fill = (string) $db->sql_fetchfield('username'); + $pre_fill = (string) phpbb::$db->sql_fetchfield('username'); break; case 'ip': - $pre_fill = (string) $db->sql_fetchfield('user_ip'); + $pre_fill = (string) phpbb::$db->sql_fetchfield('user_ip'); break; case 'email': - $pre_fill = (string) $db->sql_fetchfield('user_email'); + $pre_fill = (string) phpbb::$db->sql_fetchfield('user_email'); break; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } else if ($post_id) { diff --git a/phpBB/modules/mcp/mcp_forum.php b/phpBB/modules/mcp/mcp_forum.php index d7185bcca6..1a9028d232 100644 --- a/phpBB/modules/mcp/mcp_forum.php +++ b/phpBB/modules/mcp/mcp_forum.php @@ -154,26 +154,26 @@ function mcp_forum_view($id, $mode, $action, $forum_info) " . ((phpbb::$acl->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1') . " $limit_time_sql ORDER BY t.topic_type DESC, $sort_order_sql"; - $result = $db->sql_query_limit($sql, $topics_per_page, $start); + $result = phpbb::$db->sql_query_limit($sql, $topics_per_page, $start); $topic_list = $topic_tracking_info = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $topic_list[] = $row['topic_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql = "SELECT t.*$read_tracking_select FROM " . TOPICS_TABLE . " t $read_tracking_join - WHERE " . $db->sql_in_set('t.topic_id', $topic_list, false, true); + WHERE " . phpbb::$db->sql_in_set('t.topic_id', $topic_list, false, true); - $result = $db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + $result = phpbb::$db->sql_query($sql); + while ($row = phpbb::$db->sql_fetchrow($result)) { $topic_rows[$row['topic_id']] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // If there is more than one page, but we have no topic list, then the start parameter is... erm... out of sync if (!sizeof($topic_list) && $forum_topics && $start > 0) @@ -312,15 +312,15 @@ function mcp_resync_topics($topic_ids) $sql = 'SELECT topic_id, forum_id, topic_title FROM ' . TOPICS_TABLE . ' - WHERE ' . $db->sql_in_set('topic_id', $topic_ids); - $result = $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_ids); + $result = phpbb::$db->sql_query($sql); // Log this action - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_TOPIC_RESYNC', $row['topic_title']); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $msg = (sizeof($topic_ids) == 1) ? phpbb::$user->lang['TOPIC_RESYNC_SUCCESS'] : phpbb::$user->lang['TOPICS_RESYNC_SUCCESS']; @@ -365,15 +365,15 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) { $sql = 'SELECT post_id FROM ' . POSTS_TABLE . ' - WHERE ' . $db->sql_in_set('topic_id', $topic_ids); - $result = $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_ids); + $result = phpbb::$db->sql_query($sql); $post_id_list = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $post_id_list[] = $row['post_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } if (!sizeof($post_id_list)) @@ -414,11 +414,11 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) // If the topic no longer exist, we will update the topic watch table. // To not let it error out on users watching both topics, we just return on an error... - $db->sql_return_on_error(true); - $db->sql_query('UPDATE ' . TOPICS_WATCH_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids)); - $db->sql_return_on_error(false); + phpbb::$db->sql_return_on_error(true); + phpbb::$db->sql_query('UPDATE ' . TOPICS_WATCH_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_ids)); + phpbb::$db->sql_return_on_error(false); - $db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE ' . $db->sql_in_set('topic_id', $topic_ids)); + phpbb::$db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_ids)); // Link to the new topic $return_link .= (($return_link) ? '<br /><br />' : '') . sprintf(phpbb::$user->lang['RETURN_NEW_TOPIC'], '<a href="' . append_sid('viewtopic', 'f=' . $to_forum_id . '&t=' . $to_topic_id) . '">', '</a>'); diff --git a/phpBB/modules/mcp/mcp_front.php b/phpBB/modules/mcp/mcp_front.php index 95b12e9a7b..932c5e9b1e 100644 --- a/phpBB/modules/mcp/mcp_front.php +++ b/phpBB/modules/mcp/mcp_front.php @@ -40,9 +40,9 @@ function mcp_front_view($id, $mode, $action) FROM ' . POSTS_TABLE . ' WHERE forum_id IN (0, ' . implode(', ', $forum_list) . ') AND post_approved = 0'; - $result = $db->sql_query($sql); - $total = (int) $db->sql_fetchfield('total'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $total = (int) phpbb::$db->sql_fetchfield('total'); + phpbb::$db->sql_freeresult($result); if ($total) { @@ -50,27 +50,27 @@ function mcp_front_view($id, $mode, $action) $sql = 'SELECT forum_id, forum_name FROM ' . FORUMS_TABLE . ' - WHERE ' . $db->sql_in_set('forum_id', $forum_list); - $result = $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('forum_id', $forum_list); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $forum_names[$row['forum_id']] = $row['forum_name']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $sql = 'SELECT post_id FROM ' . POSTS_TABLE . ' WHERE forum_id IN (0, ' . implode(', ', $forum_list) . ') AND post_approved = 0 ORDER BY post_time DESC'; - $result = $db->sql_query_limit($sql, 5); + $result = phpbb::$db->sql_query_limit($sql, 5); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $post_list[] = $row['post_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (empty($post_list)) { @@ -82,13 +82,13 @@ function mcp_front_view($id, $mode, $action) { $sql = 'SELECT p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.username, u.username_clean, u.user_colour, t.topic_id, t.topic_title, t.topic_first_post_id, p.forum_id FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u - WHERE ' . $db->sql_in_set('p.post_id', $post_list) . ' + WHERE ' . phpbb::$db->sql_in_set('p.post_id', $post_list) . ' AND t.topic_id = p.topic_id AND p.poster_id = u.user_id ORDER BY p.post_time DESC'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $global_topic = ($row['forum_id']) ? false : true; if ($global_topic) @@ -115,7 +115,7 @@ function mcp_front_view($id, $mode, $action) 'POST_TIME' => phpbb::$user->format_date($row['post_time'])) ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } $template->assign_vars(array( @@ -153,15 +153,15 @@ function mcp_front_view($id, $mode, $action) WHERE r.post_id = p.post_id AND r.report_closed = 0 AND p.forum_id IN (0, ' . implode(', ', $forum_list) . ')'; - $result = $db->sql_query($sql); - $total = (int) $db->sql_fetchfield('total'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $total = (int) phpbb::$db->sql_fetchfield('total'); + phpbb::$db->sql_freeresult($result); if ($total) { $global_id = $forum_list[0]; - $sql = $db->sql_build_query('SELECT', array( + $sql = phpbb::$db->sql_build_query('SELECT', array( 'SELECT' => 'r.report_time, p.post_id, p.post_subject, p.post_time, u.username, u.username_clean, u.user_colour, u.user_id, u2.username as author_name, u2.username_clean as author_name_clean, u2.user_colour as author_colour, u2.user_id as author_id, t.topic_id, t.topic_title, f.forum_id, f.forum_name', 'FROM' => array( @@ -189,9 +189,9 @@ function mcp_front_view($id, $mode, $action) 'ORDER_BY' => 'p.post_time DESC' )); - $result = $db->sql_query_limit($sql, 5); + $result = phpbb::$db->sql_query_limit($sql, 5); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $global_topic = ($row['forum_id']) ? false : true; if ($global_topic) diff --git a/phpBB/modules/mcp/mcp_logs.php b/phpBB/modules/mcp/mcp_logs.php index 026609e09f..5fe8ff1df1 100644 --- a/phpBB/modules/mcp/mcp_logs.php +++ b/phpBB/modules/mcp/mcp_logs.php @@ -87,9 +87,9 @@ class mcp_logs $sql = 'SELECT forum_id FROM ' . TOPICS_TABLE . ' WHERE topic_id = ' . $topic_id; - $result = $db->sql_query($sql); - $forum_id = (int) $db->sql_fetchfield('forum_id'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $forum_id = (int) phpbb::$db->sql_fetchfield('forum_id'); + phpbb::$db->sql_freeresult($result); if (!in_array($forum_id, $forum_list)) { @@ -109,9 +109,9 @@ class mcp_logs { $sql = 'DELETE FROM ' . LOG_TABLE . ' WHERE log_type = ' . LOG_MOD . ' - AND ' . $db->sql_in_set('forum_id', $forum_list) . ' - AND ' . $db->sql_in_set('log_id', $marked); - $db->sql_query($sql); + AND ' . phpbb::$db->sql_in_set('forum_id', $forum_list) . ' + AND ' . phpbb::$db->sql_in_set('log_id', $marked); + phpbb::$db->sql_query($sql); add_log('admin', 'LOG_CLEAR_MOD'); } @@ -119,13 +119,13 @@ class mcp_logs { $sql = 'DELETE FROM ' . LOG_TABLE . ' WHERE log_type = ' . LOG_MOD . ' - AND ' . $db->sql_in_set('forum_id', $forum_list); + AND ' . phpbb::$db->sql_in_set('forum_id', $forum_list); if ($mode == 'topic_logs') { $sql .= ' AND topic_id = ' . $topic_id; } - $db->sql_query($sql); + phpbb::$db->sql_query($sql); add_log('admin', 'LOG_CLEAR_MOD'); } diff --git a/phpBB/modules/mcp/mcp_main.php b/phpBB/modules/mcp/mcp_main.php index 73b4e880ea..2d172075ca 100644 --- a/phpBB/modules/mcp/mcp_main.php +++ b/phpBB/modules/mcp/mcp_main.php @@ -245,8 +245,8 @@ function lock_unlock($action, $ids) { $sql = "UPDATE $table SET $set_id = " . (($action == 'lock' || $action == 'lock_post') ? ITEM_LOCKED : ITEM_UNLOCKED) . ' - WHERE ' . $db->sql_in_set($sql_id, $ids); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set($sql_id, $ids); + phpbb::$db->sql_query($sql); $data = ($action == 'lock' || $action == 'unlock') ? get_topic_data($ids) : get_post_data($ids); @@ -332,9 +332,9 @@ function change_topic_type($action, $topic_ids) { $sql = 'UPDATE ' . TOPICS_TABLE . " SET topic_type = $new_topic_type - WHERE " . $db->sql_in_set('topic_id', $topic_ids) . ' + WHERE " . phpbb::$db->sql_in_set('topic_id', $topic_ids) . ' AND forum_id <> 0'; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // Reset forum id if a global topic is within the array $to_forum_id = request_var('to_forum_id', 0); @@ -343,24 +343,24 @@ function change_topic_type($action, $topic_ids) { $sql = 'UPDATE ' . TOPICS_TABLE . " SET topic_type = $new_topic_type, forum_id = $to_forum_id - WHERE " . $db->sql_in_set('topic_id', $topic_ids) . ' + WHERE " . phpbb::$db->sql_in_set('topic_id', $topic_ids) . ' AND forum_id = 0'; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // Update forum_ids for all posts $sql = 'UPDATE ' . POSTS_TABLE . " SET forum_id = $to_forum_id - WHERE " . $db->sql_in_set('topic_id', $topic_ids) . ' + WHERE " . phpbb::$db->sql_in_set('topic_id', $topic_ids) . ' AND forum_id = 0'; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // Do a little forum sync stuff $sql = 'SELECT SUM(t.topic_replies + t.topic_approved) as topic_posts, COUNT(t.topic_approved) as topics_authed FROM ' . TOPICS_TABLE . ' t - WHERE ' . $db->sql_in_set('t.topic_id', $topic_ids); - $result = $db->sql_query($sql); - $row_data = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + WHERE ' . phpbb::$db->sql_in_set('t.topic_id', $topic_ids); + $result = phpbb::$db->sql_query($sql); + $row_data = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); $sync_sql = array(); @@ -381,7 +381,7 @@ function change_topic_type($action, $topic_ids) $sql = 'UPDATE ' . FORUMS_TABLE . ' SET ' . implode(', ', $array) . ' WHERE forum_id = ' . $forum_id_key; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } sync('forum', 'forum_id', $to_forum_id); @@ -392,42 +392,42 @@ function change_topic_type($action, $topic_ids) // Get away with those topics already being a global announcement by re-calculating $topic_ids $sql = 'SELECT topic_id FROM ' . TOPICS_TABLE . ' - WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . ' + WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_ids) . ' AND forum_id <> 0'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $topic_ids = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $topic_ids[] = $row['topic_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($topic_ids)) { // Delete topic shadows for global announcements $sql = 'DELETE FROM ' . TOPICS_TABLE . ' - WHERE ' . $db->sql_in_set('topic_moved_id', $topic_ids); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('topic_moved_id', $topic_ids); + phpbb::$db->sql_query($sql); $sql = 'UPDATE ' . TOPICS_TABLE . " SET topic_type = $new_topic_type, forum_id = 0 - WHERE " . $db->sql_in_set('topic_id', $topic_ids); - $db->sql_query($sql); + WHERE " . phpbb::$db->sql_in_set('topic_id', $topic_ids); + phpbb::$db->sql_query($sql); // Update forum_ids for all posts $sql = 'UPDATE ' . POSTS_TABLE . ' SET forum_id = 0 - WHERE ' . $db->sql_in_set('topic_id', $topic_ids); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_ids); + phpbb::$db->sql_query($sql); // Do a little forum sync stuff $sql = 'SELECT SUM(t.topic_replies + t.topic_approved) as topic_posts, COUNT(t.topic_approved) as topics_authed FROM ' . TOPICS_TABLE . ' t - WHERE ' . $db->sql_in_set('t.topic_id', $topic_ids); - $result = $db->sql_query($sql); - $row_data = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + WHERE ' . phpbb::$db->sql_in_set('t.topic_id', $topic_ids); + $result = phpbb::$db->sql_query($sql); + $row_data = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); $sync_sql = array(); @@ -448,7 +448,7 @@ function change_topic_type($action, $topic_ids) $sql = 'UPDATE ' . FORUMS_TABLE . ' SET ' . implode(', ', $array) . ' WHERE forum_id = ' . $forum_id_key; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } sync('forum', 'forum_id', $forum_id); @@ -476,11 +476,11 @@ function change_topic_type($action, $topic_ids) { $sql = 'SELECT forum_id FROM ' . TOPICS_TABLE . ' - WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . ' + WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_ids) . ' AND forum_id = 0'; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if ($row) { @@ -593,14 +593,14 @@ function mcp_move_topic($topic_ids) } } - $db->sql_transaction('begin'); + phpbb::$db->sql_transaction('begin'); $sql = 'SELECT SUM(t.topic_replies + t.topic_approved) as topic_posts FROM ' . TOPICS_TABLE . ' t - WHERE ' . $db->sql_in_set('t.topic_id', $topic_ids); - $result = $db->sql_query($sql); - $row_data = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + WHERE ' . phpbb::$db->sql_in_set('t.topic_id', $topic_ids); + $result = phpbb::$db->sql_query($sql); + $row_data = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); $sync_sql = array(); @@ -633,7 +633,7 @@ function mcp_move_topic($topic_ids) $sql = 'UPDATE ' . TOPICS_TABLE . ' SET topic_type = ' . POST_ANNOUNCE . ' WHERE topic_id = ' . (int) $row['topic_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } // Leave a redirection if required and only if the topic is visible to users @@ -674,7 +674,7 @@ function mcp_move_topic($topic_ids) 'poll_last_vote' => (int) $row['poll_last_vote'] ); - $db->sql_query('INSERT INTO ' . TOPICS_TABLE . $db->sql_build_array('INSERT', $shadow)); + phpbb::$db->sql_query('INSERT INTO ' . TOPICS_TABLE . phpbb::$db->sql_build_array('INSERT', $shadow)); $topics_authed_moved--; $topics_moved--; @@ -696,10 +696,10 @@ function mcp_move_topic($topic_ids) $sql = 'UPDATE ' . FORUMS_TABLE . ' SET ' . implode(', ', $array) . ' WHERE forum_id = ' . $forum_id_key; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } - $db->sql_transaction('commit'); + phpbb::$db->sql_transaction('commit'); sync('forum', 'forum_id', array($forum_id, $to_forum_id)); } @@ -830,16 +830,16 @@ function mcp_delete_post($post_ids) $sql = 'SELECT DISTINCT topic_id FROM ' . POSTS_TABLE . ' - WHERE ' . $db->sql_in_set('post_id', $post_ids); - $result = $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('post_id', $post_ids); + $result = phpbb::$db->sql_query($sql); $topic_id_list = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $topic_id_list[] = $row['topic_id']; } $affected_topics = sizeof($topic_id_list); - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $post_data = get_post_data($post_ids); @@ -853,11 +853,11 @@ function mcp_delete_post($post_ids) $sql = 'SELECT COUNT(topic_id) AS topics_left FROM ' . TOPICS_TABLE . ' - WHERE ' . $db->sql_in_set('topic_id', $topic_id_list); - $result = $db->sql_query_limit($sql, 1); + WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_id_list); + $result = phpbb::$db->sql_query_limit($sql, 1); - $deleted_topics = ($row = $db->sql_fetchrow($result)) ? ($affected_topics - $row['topics_left']) : $affected_topics; - $db->sql_freeresult($result); + $deleted_topics = ($row = phpbb::$db->sql_fetchrow($result)) ? ($affected_topics - $row['topics_left']) : $affected_topics; + phpbb::$db->sql_freeresult($result); $topic_id = request_var('t', 0); @@ -1001,8 +1001,8 @@ function mcp_fork_topic($topic_ids) 'poll_length' => (int) $topic_row['poll_length'] ); - $db->sql_query('INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); - $new_topic_id = $db->sql_nextid(); + phpbb::$db->sql_query('INSERT INTO ' . TOPICS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary)); + $new_topic_id = phpbb::$db->sql_nextid(); $new_topic_id_list[$topic_id] = $new_topic_id; if ($topic_row['poll_start']) @@ -1012,9 +1012,9 @@ function mcp_fork_topic($topic_ids) $sql = 'SELECT * FROM ' . POLL_OPTIONS_TABLE . " WHERE topic_id = $topic_id"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $sql_ary = array( 'poll_option_id' => (int) $row['poll_option_id'], @@ -1023,7 +1023,7 @@ function mcp_fork_topic($topic_ids) 'poll_option_total' => 0 ); - $db->sql_query('INSERT INTO ' . POLL_OPTIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + phpbb::$db->sql_query('INSERT INTO ' . POLL_OPTIONS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary)); } } @@ -1031,14 +1031,14 @@ function mcp_fork_topic($topic_ids) FROM ' . POSTS_TABLE . " WHERE topic_id = $topic_id ORDER BY post_time ASC"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $post_rows = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $post_rows[] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (!sizeof($post_rows)) { @@ -1076,8 +1076,8 @@ function mcp_fork_topic($topic_ids) 'post_postcount' => 0, ); - $db->sql_query('INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); - $new_post_id = $db->sql_nextid(); + phpbb::$db->sql_query('INSERT INTO ' . POSTS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary)); + $new_post_id = phpbb::$db->sql_nextid(); // Copy whether the topic is dotted markread('post', $to_forum_id, $new_topic_id, 0, $row['poster_id']); @@ -1089,10 +1089,10 @@ function mcp_fork_topic($topic_ids) WHERE post_msg_id = {$row['post_id']} AND topic_id = $topic_id AND in_message = 0"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $sql_ary = array(); - while ($attach_row = $db->sql_fetchrow($result)) + while ($attach_row = phpbb::$db->sql_fetchrow($result)) { $sql_ary[] = array( 'post_msg_id' => (int) $new_post_id, @@ -1111,11 +1111,11 @@ function mcp_fork_topic($topic_ids) 'thumbnail' => (int) $attach_row['thumbnail'] ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($sql_ary)) { - $db->sql_multi_insert(ATTACHMENTS_TABLE, $sql_ary); + phpbb::$db->sql_multi_insert(ATTACHMENTS_TABLE, $sql_ary); } } } @@ -1123,10 +1123,10 @@ function mcp_fork_topic($topic_ids) $sql = 'SELECT user_id, notify_status FROM ' . TOPICS_WATCH_TABLE . ' WHERE topic_id = ' . $topic_id; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $sql_ary = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $sql_ary[] = array( 'topic_id' => (int) $new_topic_id, @@ -1134,11 +1134,11 @@ function mcp_fork_topic($topic_ids) 'notify_status' => (int) $row['notify_status'], ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($sql_ary)) { - $db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary); + phpbb::$db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary); } } @@ -1156,7 +1156,7 @@ function mcp_fork_topic($topic_ids) $sql = 'UPDATE ' . FORUMS_TABLE . ' SET ' . implode(', ', $array) . ' WHERE forum_id = ' . $forum_id_key; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } sync('forum', 'forum_id', $to_forum_id); diff --git a/phpBB/modules/mcp/mcp_notes.php b/phpBB/modules/mcp/mcp_notes.php index ae5c975ccf..44dcec52c6 100644 --- a/phpBB/modules/mcp/mcp_notes.php +++ b/phpBB/modules/mcp/mcp_notes.php @@ -78,14 +78,14 @@ class mcp_notes add_form_key('mcp_notes'); - $sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; + $sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . phpbb::$db->sql_escape(utf8_clean_string($username)) . "'"; $sql = 'SELECT * FROM ' . USERS_TABLE . " WHERE $sql_where"; - $result = $db->sql_query($sql); - $userrow = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $userrow = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$userrow) { @@ -119,7 +119,7 @@ class mcp_notes { $sql_in[] = $mark; } - $where_sql = ' AND ' . $db->sql_in_set('log_id', $sql_in); + $where_sql = ' AND ' . phpbb::$db->sql_in_set('log_id', $sql_in); unset($sql_in); } @@ -131,7 +131,7 @@ class mcp_notes WHERE log_type = ' . LOG_USERS . " AND reportee_id = $user_id $where_sql"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); add_log('admin', 'LOG_CLEAR_USER', $userrow['username']); diff --git a/phpBB/modules/mcp/mcp_post.php b/phpBB/modules/mcp/mcp_post.php index 0ba2becec1..0c21fc5dc5 100644 --- a/phpBB/modules/mcp/mcp_post.php +++ b/phpBB/modules/mcp/mcp_post.php @@ -68,7 +68,7 @@ function mcp_post_details($id, $mode, $action) if ($action == 'chgposter') { $username = request_var('username', '', true); - $sql_where = "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; + $sql_where = "username_clean = '" . phpbb::$db->sql_escape(utf8_clean_string($username)) . "'"; } else { @@ -79,9 +79,9 @@ function mcp_post_details($id, $mode, $action) $sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE ' . $sql_where; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$row) { @@ -145,13 +145,13 @@ function mcp_post_details($id, $mode, $action) WHERE post_msg_id = ' . $post_id . ' AND in_message = 0 ORDER BY filetime DESC, post_msg_id ASC'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $attachments[] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($attachments)) { @@ -252,9 +252,9 @@ function mcp_post_details($id, $mode, $action) AND r.reason_id = re.reason_id AND u.user_id = r.user_id ORDER BY r.report_time DESC"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - if ($row = $db->sql_fetchrow($result)) + if ($row = phpbb::$db->sql_fetchrow($result)) { $template->assign_var('S_SHOW_REPORTS', true); @@ -278,9 +278,9 @@ function mcp_post_details($id, $mode, $action) 'REPORT_TEXT' => bbcode_nl2br(trim($row['report_text'])), )); } - while ($row = $db->sql_fetchrow($result)); + while ($row = phpbb::$db->sql_fetchrow($result)); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } // Get IP @@ -298,12 +298,12 @@ function mcp_post_details($id, $mode, $action) // Get other users who've posted under this IP $sql = 'SELECT poster_id, COUNT(poster_id) as postings FROM ' . POSTS_TABLE . " - WHERE poster_ip = '" . $db->sql_escape($post_info['poster_ip']) . "' + WHERE poster_ip = '" . phpbb::$db->sql_escape($post_info['poster_ip']) . "' GROUP BY poster_id ORDER BY postings DESC"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { // Fill the user select list with users who have posted under this IP if ($row['poster_id'] != $post_info['poster_id']) @@ -311,22 +311,22 @@ function mcp_post_details($id, $mode, $action) $users_ary[$row['poster_id']] = $row; } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($users_ary)) { // Get the usernames $sql = 'SELECT user_id, username FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('user_id', array_keys($users_ary)); - $result = $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('user_id', array_keys($users_ary)); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $users_ary[$row['user_id']]['username'] = $row['username']; $usernames_ary[utf8_clean_string($row['username'])] = $users_ary[$row['user_id']]; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); foreach ($users_ary as $user_id => $user_row) { @@ -352,9 +352,9 @@ function mcp_post_details($id, $mode, $action) WHERE poster_id = ' . $post_info['poster_id'] . " GROUP BY poster_ip ORDER BY postings DESC"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $hostname = (($rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all') && $row['poster_ip']) ? @gethostbyaddr($row['poster_ip']) : ''; @@ -368,7 +368,7 @@ function mcp_post_details($id, $mode, $action) 'U_WHOIS' => append_sid('mcp', "i=$id&mode=$mode&action=whois&p=$post_id&ip={$row['poster_ip']}")) ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $user_select = ''; @@ -402,7 +402,7 @@ function change_poster(&$post_info, $userdata) $sql = 'UPDATE ' . POSTS_TABLE . " SET poster_id = {$userdata['user_id']} WHERE post_id = $post_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // Resync topic/forum if needed if ($post_info['topic_last_post_id'] == $post_id || $post_info['forum_last_post_id'] == $post_id || $post_info['topic_first_post_id'] == $post_id) @@ -418,12 +418,12 @@ function change_poster(&$post_info, $userdata) SET user_posts = user_posts - 1 WHERE user_id = ' . $post_info['user_id'] .' AND user_posts > 0'; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $sql = 'UPDATE ' . USERS_TABLE . ' SET user_posts = user_posts + 1 WHERE user_id = ' . $userdata['user_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } // Add posted to information for this topic for the new user @@ -436,16 +436,16 @@ function change_poster(&$post_info, $userdata) FROM ' . POSTS_TABLE . ' WHERE topic_id = ' . $post_info['topic_id'] . ' AND poster_id = ' . $post_info['user_id']; - $result = $db->sql_query_limit($sql, 1); - $topic_id = (int) $db->sql_fetchfield('topic_id'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query_limit($sql, 1); + $topic_id = (int) phpbb::$db->sql_fetchfield('topic_id'); + phpbb::$db->sql_freeresult($result); if (!$topic_id) { $sql = 'DELETE FROM ' . TOPICS_POSTED_TABLE . ' WHERE user_id = ' . $post_info['user_id'] . ' AND topic_id = ' . $post_info['topic_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } } @@ -457,7 +457,7 @@ function change_poster(&$post_info, $userdata) WHERE poster_id = ' . $post_info['user_id'] . ' AND post_msg_id = ' . $post_info['post_id'] . ' AND topic_id = ' . $post_info['topic_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } // refresh search cache of this post diff --git a/phpBB/modules/mcp/mcp_queue.php b/phpBB/modules/mcp/mcp_queue.php index 27db877836..b429ffea32 100644 --- a/phpBB/modules/mcp/mcp_queue.php +++ b/phpBB/modules/mcp/mcp_queue.php @@ -146,13 +146,13 @@ class mcp_queue WHERE post_msg_id = ' . $post_id . ' AND in_message = 0 ORDER BY filetime DESC, post_msg_id ASC'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $attachments[] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($attachments)) { @@ -273,9 +273,9 @@ class mcp_queue $sql = 'SELECT SUM(forum_topics) as sum_forum_topics FROM ' . FORUMS_TABLE . " WHERE forum_id IN (0, $forum_list)"; - $result = $db->sql_query($sql); - $forum_info['forum_topics'] = (int) $db->sql_fetchfield('sum_forum_topics'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $forum_info['forum_topics'] = (int) phpbb::$db->sql_fetchfield('sum_forum_topics'); + phpbb::$db->sql_freeresult($result); } else { @@ -319,29 +319,29 @@ class mcp_queue AND t.topic_first_post_id <> p.post_id $limit_time_sql ORDER BY $sort_order_sql"; - $result = $db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); + $result = phpbb::$db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); $i = 0; $post_ids = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $post_ids[] = $row['post_id']; $row_num[$row['post_id']] = $i++; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($post_ids)) { $sql = 'SELECT t.topic_id, t.topic_title, t.forum_id, p.post_id, p.post_subject, p.post_username, p.poster_id, p.post_time, u.username, u.username_clean, u.user_colour FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u - WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . ' + WHERE ' . phpbb::$db->sql_in_set('p.post_id', $post_ids) . ' AND t.topic_id = p.topic_id AND u.user_id = p.poster_id ORDER BY ' . $sort_order_sql; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $post_data = $rowset = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if ($row['forum_id']) { @@ -349,7 +349,7 @@ class mcp_queue } $post_data[$row['post_id']] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); foreach ($post_ids as $post_id) { @@ -370,10 +370,10 @@ class mcp_queue AND topic_approved = 0 $limit_time_sql ORDER BY $sort_order_sql"; - $result = $db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); + $result = phpbb::$db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); $rowset = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if ($row['forum_id']) { @@ -381,7 +381,7 @@ class mcp_queue } $rowset[] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } if (sizeof($forum_names)) @@ -389,15 +389,15 @@ class mcp_queue // Select the names for the forum_ids $sql = 'SELECT forum_id, forum_name FROM ' . FORUMS_TABLE . ' - WHERE ' . $db->sql_in_set('forum_id', $forum_names); - $result = $db->sql_query($sql, 3600); + WHERE ' . phpbb::$db->sql_in_set('forum_id', $forum_names); + $result = phpbb::$db->sql_query($sql, 3600); $forum_names = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $forum_names[$row['forum_id']] = $row['forum_name']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } foreach ($rowset as $row) @@ -584,16 +584,16 @@ function approve_post($post_id_list, $id, $mode) { $sql = 'UPDATE ' . TOPICS_TABLE . ' SET topic_approved = 1 - WHERE ' . $db->sql_in_set('topic_id', $topic_approve_sql); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('topic_id', $topic_approve_sql); + phpbb::$db->sql_query($sql); } if (sizeof($post_approve_sql)) { $sql = 'UPDATE ' . POSTS_TABLE . ' SET post_approved = 1 - WHERE ' . $db->sql_in_set('post_id', $post_approve_sql); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('post_id', $post_approve_sql); + phpbb::$db->sql_query($sql); } foreach ($approve_log as $log_data) @@ -608,7 +608,7 @@ function approve_post($post_id_list, $id, $mode) $sql = 'UPDATE ' . TOPICS_TABLE . " SET topic_replies = topic_replies + $num_replies WHERE topic_id = $topic_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } } @@ -623,7 +623,7 @@ function approve_post($post_id_list, $id, $mode) $sql .= ($row['forum_posts']) ? "forum_posts = forum_posts + {$row['forum_posts']}" : ''; $sql .= " WHERE forum_id = $forum_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } } @@ -641,8 +641,8 @@ function approve_post($post_id_list, $id, $mode) { $sql = 'UPDATE ' . USERS_TABLE . ' SET user_posts = user_posts + ' . $user_posts . ' - WHERE ' . $db->sql_in_set('user_id', $user_id_ary); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('user_id', $user_id_ary); + phpbb::$db->sql_query($sql); } } @@ -810,9 +810,9 @@ function disapprove_post($post_id_list, $id, $mode) $sql = 'SELECT reason_title, reason_description FROM ' . REPORTS_REASONS_TABLE . " WHERE reason_id = $reason_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$row || (!$reason && strtolower($row['reason_title']) == 'other')) { @@ -904,7 +904,7 @@ function disapprove_post($post_id_list, $id, $mode) $sql = 'UPDATE ' . FORUMS_TABLE . " SET forum_topics_real = forum_topics_real - $topics_real WHERE forum_id = $forum_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } } @@ -915,7 +915,7 @@ function disapprove_post($post_id_list, $id, $mode) $sql = 'UPDATE ' . TOPICS_TABLE . " SET topic_replies_real = topic_replies_real - $num_replies WHERE topic_id = $topic_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } } diff --git a/phpBB/modules/mcp/mcp_reports.php b/phpBB/modules/mcp/mcp_reports.php index 5deaa7a728..d79abb209e 100644 --- a/phpBB/modules/mcp/mcp_reports.php +++ b/phpBB/modules/mcp/mcp_reports.php @@ -77,9 +77,9 @@ class mcp_reports AND rr.reason_id = r.reason_id AND r.user_id = u.user_id ORDER BY report_closed ASC'; - $result = $db->sql_query_limit($sql, 1); - $report = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query_limit($sql, 1); + $report = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$report) { @@ -155,13 +155,13 @@ class mcp_reports WHERE post_msg_id = ' . $post_id . ' AND in_message = 0 ORDER BY filetime DESC, post_msg_id ASC'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $attachments[] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($attachments)) { @@ -292,10 +292,10 @@ class mcp_reports $sql = 'SELECT SUM(forum_topics) as sum_forum_topics FROM ' . FORUMS_TABLE . ' - WHERE ' . $db->sql_in_set('forum_id', $forum_list); - $result = $db->sql_query($sql); - $forum_info['forum_topics'] = (int) $db->sql_fetchfield('sum_forum_topics'); - $db->sql_freeresult($result); + WHERE ' . phpbb::$db->sql_in_set('forum_id', $forum_list); + $result = phpbb::$db->sql_query($sql); + $forum_info['forum_topics'] = (int) phpbb::$db->sql_fetchfield('sum_forum_topics'); + phpbb::$db->sql_freeresult($result); } else { @@ -341,7 +341,7 @@ class mcp_reports $sql = 'SELECT r.report_id FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . REPORTS_TABLE . ' r ' . (($sort_order_sql[0] == 'u') ? ', ' . USERS_TABLE . ' u' : '') . (($sort_order_sql[0] == 'r') ? ', ' . USERS_TABLE . ' ru' : '') . ' - WHERE ' . $db->sql_in_set('p.forum_id', $forum_list) . " + WHERE ' . phpbb::$db->sql_in_set('p.forum_id', $forum_list) . " $report_state AND r.post_id = p.post_id " . (($sort_order_sql[0] == 'u') ? 'AND u.user_id = p.poster_id' : '') . ' @@ -350,31 +350,31 @@ class mcp_reports AND t.topic_id = p.topic_id $limit_time_sql ORDER BY $sort_order_sql"; - $result = $db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); + $result = phpbb::$db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); $i = 0; $report_ids = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $report_ids[] = $row['report_id']; $row_num[$row['report_id']] = $i++; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($report_ids)) { $sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, p.post_id, p.post_subject, p.post_username, p.poster_id, p.post_time, u.username, u.username_clean, u.user_colour, r.user_id as reporter_id, ru.username as reporter_name, ru.user_colour as reporter_colour, r.report_time, r.report_id FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u, ' . USERS_TABLE . ' ru - WHERE ' . $db->sql_in_set('r.report_id', $report_ids) . ' + WHERE ' . phpbb::$db->sql_in_set('r.report_id', $report_ids) . ' AND t.topic_id = p.topic_id AND r.post_id = p.post_id AND u.user_id = p.poster_id AND ru.user_id = r.user_id ORDER BY ' . $sort_order_sql; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $report_data = $rowset = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $global_topic = ($row['forum_id']) ? false : true; if ($global_topic) @@ -406,7 +406,7 @@ class mcp_reports 'TOPIC_TITLE' => $row['topic_title']) ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); unset($report_ids, $row); } @@ -441,11 +441,11 @@ function close_report($report_id_list, $mode, $action) { $sql = 'SELECT r.post_id FROM ' . REPORTS_TABLE . ' r - WHERE ' . $db->sql_in_set('r.report_id', $report_id_list); - $result = $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('r.report_id', $report_id_list); + $result = phpbb::$db->sql_query($sql); $post_id_list = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $post_id_list[] = $row['post_id']; } @@ -486,13 +486,13 @@ function close_report($report_id_list, $mode, $action) $sql = 'SELECT r.report_id, r.post_id, r.report_closed, r.user_id, r.user_notify, u.username, u.username_clean, u.user_email, u.user_jabber, u.user_lang, u.user_notify_type FROM ' . REPORTS_TABLE . ' r, ' . USERS_TABLE . ' u - WHERE ' . $db->sql_in_set('r.report_id', $report_id_list) . ' + WHERE ' . phpbb::$db->sql_in_set('r.report_id', $report_id_list) . ' ' . (($action == 'close') ? 'AND r.report_closed = 0' : '') . ' AND r.user_id = u.user_id'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $reports = $close_report_posts = $close_report_topics = $notify_reporters = $report_id_list = array(); - while ($report = $db->sql_fetchrow($result)) + while ($report = phpbb::$db->sql_fetchrow($result)) { $reports[$report['report_id']] = $report; $report_id_list[] = $report['report_id']; @@ -508,7 +508,7 @@ function close_report($report_id_list, $mode, $action) $notify_reporters[$report['report_id']] = &$reports[$report['report_id']]; } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($reports)) { @@ -520,56 +520,56 @@ function close_report($report_id_list, $mode, $action) // Get a list of topics that still contain reported posts $sql = 'SELECT DISTINCT topic_id FROM ' . POSTS_TABLE . ' - WHERE ' . $db->sql_in_set('topic_id', $close_report_topics) . ' + WHERE ' . phpbb::$db->sql_in_set('topic_id', $close_report_topics) . ' AND post_reported = 1 - AND ' . $db->sql_in_set('post_id', $close_report_posts, true); - $result = $db->sql_query($sql); + AND ' . phpbb::$db->sql_in_set('post_id', $close_report_posts, true); + $result = phpbb::$db->sql_query($sql); $keep_report_topics = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $keep_report_topics[] = $row['topic_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $close_report_topics = array_diff($close_report_topics, $keep_report_topics); unset($keep_report_topics); } - $db->sql_transaction('begin'); + phpbb::$db->sql_transaction('begin'); if ($action == 'close') { $sql = 'UPDATE ' . REPORTS_TABLE . ' SET report_closed = 1 - WHERE ' . $db->sql_in_set('report_id', $report_id_list); + WHERE ' . phpbb::$db->sql_in_set('report_id', $report_id_list); } else { $sql = 'DELETE FROM ' . REPORTS_TABLE . ' - WHERE ' . $db->sql_in_set('report_id', $report_id_list); + WHERE ' . phpbb::$db->sql_in_set('report_id', $report_id_list); } - $db->sql_query($sql); + phpbb::$db->sql_query($sql); if (sizeof($close_report_posts)) { $sql = 'UPDATE ' . POSTS_TABLE . ' SET post_reported = 0 - WHERE ' . $db->sql_in_set('post_id', $close_report_posts); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('post_id', $close_report_posts); + phpbb::$db->sql_query($sql); if (sizeof($close_report_topics)) { $sql = 'UPDATE ' . TOPICS_TABLE . ' SET topic_reported = 0 - WHERE ' . $db->sql_in_set('topic_id', $close_report_topics) . ' - OR ' . $db->sql_in_set('topic_moved_id', $close_report_topics); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('topic_id', $close_report_topics) . ' + OR ' . phpbb::$db->sql_in_set('topic_moved_id', $close_report_topics); + phpbb::$db->sql_query($sql); } } - $db->sql_transaction('commit'); + phpbb::$db->sql_transaction('commit'); } unset($close_report_posts, $close_report_topics); diff --git a/phpBB/modules/mcp/mcp_topic.php b/phpBB/modules/mcp/mcp_topic.php index 8f645be185..ab7bd0e983 100644 --- a/phpBB/modules/mcp/mcp_topic.php +++ b/phpBB/modules/mcp/mcp_topic.php @@ -131,17 +131,17 @@ function mcp_topic_view($id, $mode, $action) AND p.poster_id = u.user_id ' . $limit_time_sql . ' ORDER BY ' . $sort_order_sql; - $result = $db->sql_query_limit($sql, $posts_per_page, $start); + $result = phpbb::$db->sql_query_limit($sql, $posts_per_page, $start); $rowset = $post_id_list = array(); $bbcode_bitfield = ''; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $rowset[] = $row; $post_id_list[] = $row['post_id']; $bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if ($bbcode_bitfield !== '') { @@ -176,16 +176,16 @@ function mcp_topic_view($id, $mode, $action) { $sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . ' - WHERE ' . $db->sql_in_set('post_msg_id', $post_id_list) . ' + WHERE ' . phpbb::$db->sql_in_set('post_msg_id', $post_id_list) . ' AND in_message = 0 ORDER BY filetime DESC, post_msg_id ASC'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $attachments[$row['post_msg_id']][] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } } @@ -435,11 +435,11 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) $limit_time_sql ORDER BY $sort_order_sql"; } - $result = $db->sql_query_limit($sql, 0, $start); + $result = phpbb::$db->sql_query_limit($sql, 0, $start); $store = false; $post_id_list = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { // If split from selected post (split_beyond), we split the unapproved items too. if (!$row['post_approved'] && !phpbb::$acl->acl_get('m_approve', $row['forum_id'])) @@ -458,7 +458,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) $post_id_list[] = $row['post_id']; } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } if (!sizeof($post_id_list)) @@ -475,10 +475,10 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) 'topic_approved'=> 1 ); - $sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); - $db->sql_query($sql); + $sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary); + phpbb::$db->sql_query($sql); - $to_topic_id = $db->sql_nextid(); + $to_topic_id = phpbb::$db->sql_nextid(); move_posts($post_id_list, $to_topic_id); $topic_info = get_topic_data(array($topic_id)); @@ -489,9 +489,9 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) // Change topic title of first post $sql = 'UPDATE ' . POSTS_TABLE . " - SET post_subject = '" . $db->sql_escape($subject) . "' + SET post_subject = '" . phpbb::$db->sql_escape($subject) . "' WHERE post_id = {$post_id_list[0]}"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $success_msg = 'TOPIC_SPLIT_SUCCESS'; @@ -583,9 +583,9 @@ function merge_posts($topic_id, $to_topic_id) $sql = 'SELECT forum_id FROM ' . TOPICS_TABLE . ' WHERE topic_id = ' . $topic_id; - $result = $db->sql_query_limit($sql, 1); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query_limit($sql, 1); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if ($row) { @@ -595,11 +595,11 @@ function merge_posts($topic_id, $to_topic_id) { // If the topic no longer exist, we will update the topic watch table. // To not let it error out on users watching both topics, we just return on an error... - $db->sql_return_on_error(true); - $db->sql_query('UPDATE ' . TOPICS_WATCH_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE topic_id = ' . (int) $topic_id); - $db->sql_return_on_error(false); + phpbb::$db->sql_return_on_error(true); + phpbb::$db->sql_query('UPDATE ' . TOPICS_WATCH_TABLE . ' SET topic_id = ' . (int) $to_topic_id . ' WHERE topic_id = ' . (int) $topic_id); + phpbb::$db->sql_return_on_error(false); - $db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE topic_id = ' . (int) $topic_id); + phpbb::$db->sql_query('DELETE FROM ' . TOPICS_WATCH_TABLE . ' WHERE topic_id = ' . (int) $topic_id); } // Link to the new topic diff --git a/phpBB/modules/mcp/mcp_warn.php b/phpBB/modules/mcp/mcp_warn.php index 05e994858a..d3fbdccc2c 100644 --- a/phpBB/modules/mcp/mcp_warn.php +++ b/phpBB/modules/mcp/mcp_warn.php @@ -105,9 +105,9 @@ class mcp_warn FROM ' . USERS_TABLE . ' u, ' . WARNINGS_TABLE . ' w WHERE u.user_id = w.user_id ORDER BY w.warning_time DESC'; - $result = $db->sql_query_limit($sql, 5); + $result = phpbb::$db->sql_query_limit($sql, 5); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $template->assign_block_vars('latest', array( 'U_NOTES' => append_sid('mcp', 'i=notes&mode=user_notes&u=' . $row['user_id']), @@ -121,7 +121,7 @@ class mcp_warn 'WARNINGS' => $row['user_warnings'], )); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } /** @@ -194,9 +194,9 @@ class mcp_warn FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u WHERE post_id = $post_id AND u.user_id = p.poster_id"; - $result = $db->sql_query($sql); - $user_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $user_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$user_row) { @@ -220,9 +220,9 @@ class mcp_warn $sql = 'SELECT post_id FROM ' . WARNINGS_TABLE . " WHERE post_id = $post_id"; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if ($row) { @@ -331,14 +331,14 @@ class mcp_warn $notify = phpbb_request::is_set('notify_user'); $warning = utf8_normalize_nfc(request_var('warning', '', true)); - $sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; + $sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . phpbb::$db->sql_escape(utf8_clean_string($username)) . "'"; $sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE ' . $sql_where; - $result = $db->sql_query($sql); - $user_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $user_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$user_row) { @@ -470,21 +470,21 @@ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0) 'warning_time' => time(), ); - $db->sql_query('INSERT INTO ' . WARNINGS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + phpbb::$db->sql_query('INSERT INTO ' . WARNINGS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $sql_ary)); $sql = 'UPDATE ' . USERS_TABLE . ' SET user_warnings = user_warnings + 1, user_last_warning = ' . time() . ' WHERE user_id = ' . $user_row['user_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // We add this to the mod log too for moderators to see that a specific user got warned. $sql = 'SELECT forum_id, topic_id FROM ' . POSTS_TABLE . ' WHERE post_id = ' . $post_id; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_USER_WARNING', $user_row['username']); } diff --git a/phpBB/modules/ucp/ucp_activate.php b/phpBB/modules/ucp/ucp_activate.php index 967deb6740..2738da4275 100644 --- a/phpBB/modules/ucp/ucp_activate.php +++ b/phpBB/modules/ucp/ucp_activate.php @@ -33,9 +33,9 @@ class ucp_activate $sql = 'SELECT user_id, username, user_type, user_email, user_newpasswd, user_lang, user_notify_type, user_actkey, user_inactive_reason FROM ' . USERS_TABLE . " WHERE user_id = $user_id"; - $result = $db->sql_query($sql); - $user_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $user_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$user_row) { @@ -66,9 +66,9 @@ class ucp_activate ); $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . $user_row['user_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } if (!$update_password) @@ -80,7 +80,7 @@ class ucp_activate $sql = 'UPDATE ' . USERS_TABLE . " SET user_actkey = '' WHERE user_id = {$user_row['user_id']}"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } if (phpbb::$config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password) diff --git a/phpBB/modules/ucp/ucp_attachments.php b/phpBB/modules/ucp/ucp_attachments.php index 97d0e630f9..a4610c6a98 100644 --- a/phpBB/modules/ucp/ucp_attachments.php +++ b/phpBB/modules/ucp/ucp_attachments.php @@ -42,15 +42,15 @@ class ucp_attachments FROM ' . ATTACHMENTS_TABLE . ' WHERE poster_id = ' . phpbb::$user->data['user_id'] . ' AND is_orphan = 0 - AND ' . $db->sql_in_set('attach_id', $delete_ids); - $result = $db->sql_query($sql); + AND ' . phpbb::$db->sql_in_set('attach_id', $delete_ids); + $result = phpbb::$db->sql_query($sql); $delete_ids = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $delete_ids[] = $row['attach_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } if ($delete && sizeof($delete_ids)) @@ -114,9 +114,9 @@ class ucp_attachments FROM ' . ATTACHMENTS_TABLE . ' WHERE poster_id = ' . phpbb::$user->data['user_id'] . ' AND is_orphan = 0'; - $result = $db->sql_query($sql); - $num_attachments = $db->sql_fetchfield('num_attachments'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $num_attachments = phpbb::$db->sql_fetchfield('num_attachments'); + phpbb::$db->sql_freeresult($result); $sql = 'SELECT a.*, t.topic_title, p.message_subject as message_title FROM ' . ATTACHMENTS_TABLE . ' a @@ -125,10 +125,10 @@ class ucp_attachments WHERE a.poster_id = ' . phpbb::$user->data['user_id'] . " AND a.is_orphan = 0 ORDER BY $order_by"; - $result = $db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); + $result = phpbb::$db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); $row_count = 0; - if ($row = $db->sql_fetchrow($result)) + if ($row = phpbb::$db->sql_fetchrow($result)) { $template->assign_var('S_ATTACHMENT_ROWS', true); @@ -165,9 +165,9 @@ class ucp_attachments $row_count++; } - while ($row = $db->sql_fetchrow($result)); + while ($row = phpbb::$db->sql_fetchrow($result)); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $template->assign_vars(array( 'PAGE_NUMBER' => on_page($num_attachments, phpbb::$config['topics_per_page'], $start), diff --git a/phpBB/modules/ucp/ucp_groups.php b/phpBB/modules/ucp/ucp_groups.php index 83b9cf42f0..97446f4d97 100644 --- a/phpBB/modules/ucp/ucp_groups.php +++ b/phpBB/modules/ucp/ucp_groups.php @@ -54,15 +54,15 @@ class ucp_groups $sql = 'SELECT group_id, group_name, group_type FROM ' . GROUPS_TABLE . ' WHERE group_id IN (' . $group_id . ', ' . phpbb::$user->data['group_id'] . ')'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $group_row = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $row['group_name'] = ($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name']; $group_row[$row['group_id']] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (!sizeof($group_row)) { @@ -127,9 +127,9 @@ class ucp_groups $sql = 'SELECT group_type FROM ' . GROUPS_TABLE . ' WHERE group_id = ' . $group_id; - $result = $db->sql_query($sql); - $group_type = (int) $db->sql_fetchfield('group_type'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $group_type = (int) phpbb::$db->sql_fetchfield('group_type'); + phpbb::$db->sql_freeresult($result); if ($group_type != GROUP_OPEN && $group_type != GROUP_FREE) { @@ -165,9 +165,9 @@ class ucp_groups WHERE ug.user_id = u.user_id AND ug.group_id = ' . $group_id . ' AND ug.user_id = ' . phpbb::$user->data['user_id']; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if ($row) { @@ -208,9 +208,9 @@ class ucp_groups WHERE ug.user_id = u.user_id AND ' . (($group_row[$group_id]['group_type'] == GROUP_FREE) ? 'ug.user_id = ' . phpbb::$user->data['user_id'] : 'ug.group_leader = 1') . " AND ug.group_id = $group_id"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $messenger->template($email_template, $row['user_lang']); @@ -228,7 +228,7 @@ class ucp_groups $messenger->send($row['user_notify_type']); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $messenger->save_queue(); @@ -292,11 +292,11 @@ class ucp_groups WHERE ug.user_id = ' . phpbb::$user->data['user_id'] . ' AND g.group_id = ug.group_id ORDER BY g.group_type DESC, g.group_name'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $group_id_ary = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $block = ($row['group_leader']) ? 'leader' : (($row['user_pending']) ? 'pending' : 'member'); @@ -338,19 +338,19 @@ class ucp_groups $group_id_ary[] = $row['group_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Hide hidden groups unless user is an admin with group privileges $sql_and = (phpbb::$acl->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? '<> ' . GROUP_SPECIAL : 'NOT IN (' . GROUP_SPECIAL . ', ' . GROUP_HIDDEN . ')'; $sql = 'SELECT group_id, group_name, group_colour, group_desc, group_desc_uid, group_desc_bitfield, group_desc_options, group_type, group_founder_manage FROM ' . GROUPS_TABLE . ' - WHERE ' . ((sizeof($group_id_ary)) ? $db->sql_in_set('group_id', $group_id_ary, true) . ' AND ' : '') . " + WHERE ' . ((sizeof($group_id_ary)) ? phpbb::$db->sql_in_set('group_id', $group_id_ary, true) . ' AND ' : '') . " group_type $sql_and ORDER BY group_type DESC, group_name"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { switch ($row['group_type']) { @@ -388,7 +388,7 @@ class ucp_groups 'U_VIEW_GROUP' => append_sid('memberlist', 'mode=group&g=' . $row['group_id'])) ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $template->assign_vars(array( 'S_CHANGE_DEFAULT' => (phpbb::$acl->acl_get('u_chggrp')) ? true : false, @@ -417,9 +417,9 @@ class ucp_groups $sql = 'SELECT * FROM ' . GROUPS_TABLE . " WHERE group_id = $group_id"; - $result = $db->sql_query($sql); - $group_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $group_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$group_row) { @@ -651,15 +651,15 @@ class ucp_groups FROM ' . RANKS_TABLE . ' WHERE rank_special = 1 ORDER BY rank_title'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $rank_options = '<option value="0"' . ((!$group_rank) ? ' selected="selected"' : '') . '>' . phpbb::$user->lang['USER_DEFAULT'] . '</option>'; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $selected = ($group_rank && $row['rank_id'] == $group_rank) ? ' selected="selected"' : ''; $rank_options .= '<option value="' . $row['rank_id'] . '"' . $selected . '>' . $row['rank_title'] . '</option>'; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $type_free = ($group_type == GROUP_FREE) ? ' checked="checked"' : ''; $type_open = ($group_type == GROUP_OPEN) ? ' checked="checked"' : ''; @@ -745,9 +745,9 @@ class ucp_groups AND u.user_id = ug.user_id AND ug.group_leader = 1 ORDER BY ug.user_pending DESC, u.username_clean"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $template->assign_block_vars('leader', array( 'USERNAME' => $row['username'], @@ -760,16 +760,16 @@ class ucp_groups 'USER_ID' => $row['user_id']) ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // Total number of group members (non-leaders) $sql = 'SELECT COUNT(user_id) AS total_members FROM ' . USER_GROUP_TABLE . " WHERE group_id = $group_id AND group_leader = 0"; - $result = $db->sql_query($sql); - $total_members = (int) $db->sql_fetchfield('total_members'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $total_members = (int) phpbb::$db->sql_fetchfield('total_members'); + phpbb::$db->sql_freeresult($result); // Grab the members $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_colour, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending @@ -778,12 +778,12 @@ class ucp_groups AND u.user_id = ug.user_id AND ug.group_leader = 0 ORDER BY ug.user_pending DESC, u.username_clean"; - $result = $db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); + $result = phpbb::$db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); $pending = false; $approved = false; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if ($row['user_pending'] && !$pending) { @@ -815,7 +815,7 @@ class ucp_groups 'USER_ID' => $row['user_id']) ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $s_action_options = ''; $options = array('default' => 'DEFAULT', 'approve' => 'APPROVE', 'deleteusers' => 'DELETE'); @@ -896,16 +896,16 @@ class ucp_groups FROM ' . USER_GROUP_TABLE . " WHERE group_id = $group_id ORDER BY user_id"; - $result = $db->sql_query_limit($sql, 200, $start); + $result = phpbb::$db->sql_query_limit($sql, 200, $start); $mark_ary = array(); - if ($row = $db->sql_fetchrow($result)) + if ($row = phpbb::$db->sql_fetchrow($result)) { do { $mark_ary[] = $row['user_id']; } - while ($row = $db->sql_fetchrow($result)); + while ($row = phpbb::$db->sql_fetchrow($result)); group_user_attributes('default', $group_id, $mark_ary, false, $group_row['group_name'], $group_row); @@ -915,7 +915,7 @@ class ucp_groups { $start = 0; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } while ($start); } @@ -1057,9 +1057,9 @@ class ucp_groups AND g.group_id = ug.group_id AND ug.group_leader = 1 ORDER BY g.group_type DESC, g.group_name'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($value = $db->sql_fetchrow($result)) + while ($value = phpbb::$db->sql_fetchrow($result)) { $template->assign_block_vars('leader', array( 'GROUP_NAME' => ($value['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $value['group_name']] : $value['group_name'], @@ -1072,7 +1072,7 @@ class ucp_groups 'U_EDIT' => $this->u_action . "&action=edit&g={$value['group_id']}") ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); break; } diff --git a/phpBB/modules/ucp/ucp_main.php b/phpBB/modules/ucp/ucp_main.php index 550d586744..37a1037e2d 100644 --- a/phpBB/modules/ucp/ucp_main.php +++ b/phpBB/modules/ucp/ucp_main.php @@ -71,11 +71,11 @@ class ucp_main if (sizeof($forum_ary)) { - $sql .= ' AND ' . $db->sql_in_set('forum_id', $forum_ary, true); + $sql .= ' AND ' . phpbb::$db->sql_in_set('forum_id', $forum_ary, true); } - $result = $db->sql_query_limit($sql, 1); - $g_forum_id = (int) $db->sql_fetchfield('forum_id'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query_limit($sql, 1); + $g_forum_id = (int) phpbb::$db->sql_fetchfield('forum_id'); + phpbb::$db->sql_freeresult($result); $sql = "SELECT t.* $sql_select FROM $sql_from @@ -87,14 +87,14 @@ class ucp_main // If the user can't see any forums, he can't read any posts because fid of 0 is invalid if ($g_forum_id) { - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $topic_list[] = $row['topic_id']; $rowset[$row['topic_id']] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } $topic_tracking_info = array(); @@ -218,9 +218,9 @@ class ucp_main if (sizeof($forums)) { $sql = 'DELETE FROM ' . FORUMS_WATCH_TABLE . ' - WHERE ' . $db->sql_in_set('forum_id', $forums) . ' + WHERE ' . phpbb::$db->sql_in_set('forum_id', $forums) . ' AND user_id = ' . phpbb::$user->data['user_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $l_unwatch .= '_FORUMS'; } @@ -228,9 +228,9 @@ class ucp_main if (sizeof($topics)) { $sql = 'DELETE FROM ' . TOPICS_WATCH_TABLE . ' - WHERE ' . $db->sql_in_set('topic_id', $topics) . ' + WHERE ' . phpbb::$db->sql_in_set('topic_id', $topics) . ' AND user_id = ' . phpbb::$user->data['user_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $l_unwatch .= '_TOPICS'; } @@ -267,7 +267,7 @@ class ucp_main 'WHERE' => 'fw.user_id = ' . phpbb::$user->data['user_id'] . ' AND f.forum_id = fw.forum_id - AND ' . $db->sql_in_set('f.forum_id', $forbidden_forums, true, true), + AND ' . phpbb::$db->sql_in_set('f.forum_id', $forbidden_forums, true, true), 'ORDER_BY' => 'left_id' ); @@ -289,10 +289,10 @@ class ucp_main $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); } - $sql = $db->sql_build_query('SELECT', $sql_array); - $result = $db->sql_query($sql); + $sql = phpbb::$db->sql_build_query('SELECT', $sql_array); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $forum_id = $row['forum_id']; @@ -350,7 +350,7 @@ class ucp_main 'U_VIEWFORUM' => append_sid('viewforum', 'f=' . $row['forum_id'])) ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } // Subscribed Topics @@ -405,8 +405,8 @@ class ucp_main { $sql = 'DELETE FROM ' . BOOKMARKS_TABLE . ' WHERE user_id = ' . phpbb::$user->data['user_id'] . ' - AND ' . $db->sql_in_set('topic_id', $topics); - $db->sql_query($sql); + AND ' . phpbb::$db->sql_in_set('topic_id', $topics); + phpbb::$db->sql_query($sql); meta_refresh(3, $url); $message = phpbb::$user->lang['BOOKMARKS_REMOVED'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $url . '">', '</a>'); @@ -449,9 +449,9 @@ class ucp_main if (sizeof($drafts)) { $sql = 'DELETE FROM ' . DRAFTS_TABLE . ' - WHERE ' . $db->sql_in_set('draft_id', $drafts) . ' + WHERE ' . phpbb::$db->sql_in_set('draft_id', $drafts) . ' AND user_id = ' . phpbb::$user->data['user_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } $msg = phpbb::$user->lang['DRAFTS_DELETED']; unset($drafts); @@ -479,10 +479,10 @@ class ucp_main ); $sql = 'UPDATE ' . DRAFTS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $draft_row) . " + SET ' . phpbb::$db->sql_build_array('UPDATE', $draft_row) . " WHERE draft_id = $draft_id AND user_id = " . phpbb::$user->data['user_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $message = phpbb::$user->lang['DRAFT_UPDATED'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); @@ -518,11 +518,11 @@ class ucp_main AND topic_id = 0 ORDER BY save_time DESC'; } - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $draftrows = $topic_ids = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if ($row['topic_id']) { @@ -530,20 +530,20 @@ class ucp_main } $draftrows[] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($topic_ids)) { $sql = 'SELECT topic_id, forum_id, topic_title FROM ' . TOPICS_TABLE . ' - WHERE ' . $db->sql_in_set('topic_id', array_unique($topic_ids)); - $result = $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('topic_id', array_unique($topic_ids)); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $topic_rows[$row['topic_id']] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } unset($topic_ids); @@ -644,12 +644,12 @@ class ucp_main 'WHERE' => 'i.topic_id = t.topic_id AND i.user_id = ' . phpbb::$user->data['user_id'] . ' - AND ' . $db->sql_in_set('t.forum_id', $forbidden_forum_ary, true, true), + AND ' . phpbb::$db->sql_in_set('t.forum_id', $forbidden_forum_ary, true, true), ); - $sql = $db->sql_build_query('SELECT', $sql_array); - $result = $db->sql_query($sql); - $topics_count = (int) $db->sql_fetchfield('topics_count'); - $db->sql_freeresult($result); + $sql = phpbb::$db->sql_build_query('SELECT', $sql_array); + $result = phpbb::$db->sql_query($sql); + $topics_count = (int) phpbb::$db->sql_fetchfield('topics_count'); + phpbb::$db->sql_freeresult($result); if ($topics_count) { @@ -672,7 +672,7 @@ class ucp_main 'WHERE' => 'tw.user_id = ' . phpbb::$user->data['user_id'] . ' AND t.topic_id = tw.topic_id - AND ' . $db->sql_in_set('t.forum_id', $forbidden_forum_ary, true, true), + AND ' . phpbb::$db->sql_in_set('t.forum_id', $forbidden_forum_ary, true, true), 'ORDER_BY' => 't.topic_last_post_time DESC' @@ -690,7 +690,7 @@ class ucp_main ), 'WHERE' => 'b.user_id = ' . phpbb::$user->data['user_id'] . ' - AND ' . $db->sql_in_set('f.forum_id', $forbidden_forum_ary, true, true), + AND ' . phpbb::$db->sql_in_set('f.forum_id', $forbidden_forum_ary, true, true), 'ORDER_BY' => 't.topic_last_post_time DESC' ); @@ -714,11 +714,11 @@ class ucp_main $sql_array['SELECT'] .= ', tp.topic_posted'; } - $sql = $db->sql_build_query('SELECT', $sql_array); - $result = $db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); + $sql = phpbb::$db->sql_build_query('SELECT', $sql_array); + $result = phpbb::$db->sql_query_limit($sql, phpbb::$config['topics_per_page'], $start); $topic_list = $topic_forum_list = $global_announce_list = $rowset = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $topic_id = (isset($row['b_topic_id'])) ? $row['b_topic_id'] : $row['topic_id']; @@ -733,7 +733,7 @@ class ucp_main $global_announce_list[] = $topic_id; } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $topic_tracking_info = array(); if (phpbb::$config['load_db_lastread']) diff --git a/phpBB/modules/ucp/ucp_pm.php b/phpBB/modules/ucp/ucp_pm.php index d8efc0ad9b..794649d199 100644 --- a/phpBB/modules/ucp/ucp_pm.php +++ b/phpBB/modules/ucp/ucp_pm.php @@ -252,9 +252,9 @@ class ucp_pm WHERE msg_id = $msg_id AND folder_id <> " . PRIVMSGS_NO_BOX . ' AND user_id = ' . phpbb::$user->data['user_id']; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$row) { @@ -280,9 +280,9 @@ class ucp_pm AND t.msg_id = p.msg_id AND p.message_time $sql_condition p2.message_time ORDER BY p.message_time $sql_ordering"; - $result = $db->sql_query_limit($sql, 1); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query_limit($sql, 1); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$row) { @@ -302,9 +302,9 @@ class ucp_pm AND t.folder_id = $folder_id AND t.msg_id = p.msg_id AND p.msg_id = $msg_id"; - $result = $db->sql_query($sql); - $message_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $message_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$message_row) { diff --git a/phpBB/modules/ucp/ucp_pm_compose.php b/phpBB/modules/ucp/ucp_pm_compose.php index 1426b802f1..931efefdd4 100644 --- a/phpBB/modules/ucp/ucp_pm_compose.php +++ b/phpBB/modules/ucp/ucp_pm_compose.php @@ -99,14 +99,14 @@ function compose_pm($id, $mode, $action) $sql .= 'g.group_receive_pm = 1 ORDER BY g.group_type DESC, g.group_name ASC'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $group_options = ''; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . (($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } $template->assign_vars(array( @@ -216,9 +216,9 @@ function compose_pm($id, $mode, $action) if ($sql) { - $result = $db->sql_query($sql); - $post = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $post = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$post) { @@ -230,9 +230,9 @@ function compose_pm($id, $mode, $action) WHERE t.user_id = ' . phpbb::$user->data['user_id'] . " AND t.msg_id = $msg_id AND t.msg_id = p.msg_id"; - $result = $db->sql_query($sql); - $post = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $post = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if ($post) { @@ -256,9 +256,9 @@ function compose_pm($id, $mode, $action) $sql = 'SELECT forum_password FROM ' . FORUMS_TABLE . ' WHERE forum_id = ' . (int) $post['forum_id']; - $result = $db->sql_query($sql); - $forum_password = (string) $db->sql_fetchfield('forum_password'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $forum_password = (string) phpbb::$db->sql_fetchfield('forum_password'); + phpbb::$db->sql_freeresult($result); if ($forum_password) { @@ -422,9 +422,9 @@ function compose_pm($id, $mode, $action) WHERE ug.user_id = ' . phpbb::$user->data['user_id'] . ' AND ug.user_pending = 0 AND ug.group_id = g.group_id'; - $result = $db->sql_query($sql); - $max_recipients = (int) $db->sql_fetchfield('max_recipients'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $max_recipients = (int) phpbb::$db->sql_fetchfield('max_recipients'); + phpbb::$db->sql_freeresult($result); $max_recipients = (!$max_recipients) ? phpbb::$config['pm_max_recipients'] : $max_recipients; @@ -485,9 +485,9 @@ function compose_pm($id, $mode, $action) AND in_message = 1 AND is_orphan = 0 ORDER BY filetime DESC"; - $result = $db->sql_query($sql); - $message_parser->attachment_data = array_merge($message_parser->attachment_data, $db->sql_fetchrowset($result)); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $message_parser->attachment_data = array_merge($message_parser->attachment_data, phpbb::$db->sql_fetchrowset($result)); + phpbb::$db->sql_freeresult($result); } if (!in_array($action, array('quote', 'edit', 'delete', 'forward'))) @@ -509,9 +509,9 @@ function compose_pm($id, $mode, $action) AND topic_id = 0 AND user_id = ' . phpbb::$user->data['user_id'] . (($draft_id) ? " AND draft_id <> $draft_id" : ''); - $result = $db->sql_query_limit($sql, 1); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query_limit($sql, 1); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if ($row) { @@ -541,7 +541,7 @@ function compose_pm($id, $mode, $action) { if (confirm_box(true)) { - $sql = 'INSERT INTO ' . DRAFTS_TABLE . ' ' . $db->sql_build_array('INSERT', array( + $sql = 'INSERT INTO ' . DRAFTS_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', array( 'user_id' => phpbb::$user->data['user_id'], 'topic_id' => 0, 'forum_id' => 0, @@ -550,7 +550,7 @@ function compose_pm($id, $mode, $action) 'draft_message' => $message ) ); - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $redirect_url = append_sid('ucp', "i=pm&mode=$mode"); @@ -602,9 +602,9 @@ function compose_pm($id, $mode, $action) AND topic_id = 0 AND forum_id = 0 AND user_id = " . phpbb::$user->data['user_id']; - $result = $db->sql_query_limit($sql, 1); + $result = phpbb::$db->sql_query_limit($sql, 1); - if ($row = $db->sql_fetchrow($result)) + if ($row = phpbb::$db->sql_fetchrow($result)) { $message_parser->message = $row['draft_message']; $message_subject = $row['draft_subject']; @@ -615,7 +615,7 @@ function compose_pm($id, $mode, $action) { $draft_id = 0; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } // Load Drafts @@ -877,9 +877,9 @@ function compose_pm($id, $mode, $action) { $sql = 'SELECT user_id as id, username as name, user_colour as colour FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('user_id', array_map('intval', array_keys($address_list['u']))) . ' + WHERE ' . phpbb::$db->sql_in_set('user_id', array_map('intval', array_keys($address_list['u']))) . ' ORDER BY username_clean ASC'; - $result['u'] = $db->sql_query($sql); + $result['u'] = phpbb::$db->sql_query($sql); } if (!empty($address_list['g'])) @@ -901,10 +901,10 @@ function compose_pm($id, $mode, $action) $sql .= (phpbb::$acl->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? ' WHERE ' : ' AND '; $sql .= 'g.group_receive_pm = 1 - AND ' . $db->sql_in_set('g.group_id', array_map('intval', array_keys($address_list['g']))) . ' + AND ' . phpbb::$db->sql_in_set('g.group_id', array_map('intval', array_keys($address_list['g']))) . ' ORDER BY g.group_name ASC'; - $result['g'] = $db->sql_query($sql); + $result['g'] = phpbb::$db->sql_query($sql); } $u = $g = array(); @@ -913,7 +913,7 @@ function compose_pm($id, $mode, $action) { if (isset($result[$type]) && $result[$type]) { - while ($row = $db->sql_fetchrow($result[$type])) + while ($row = phpbb::$db->sql_fetchrow($result[$type])) { if ($type == 'g') { @@ -922,7 +922,7 @@ function compose_pm($id, $mode, $action) ${$type}[$row['id']] = array('name' => $row['name'], 'colour' => $row['colour']); } - $db->sql_freeresult($result[$type]); + phpbb::$db->sql_freeresult($result[$type]); } } @@ -1176,17 +1176,17 @@ function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove { $sql = 'SELECT user_id FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('user_id', array_keys($address_list['u'])) . ' + WHERE ' . phpbb::$db->sql_in_set('user_id', array_keys($address_list['u'])) . ' AND user_allow_pm = 0'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $removed = false; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $removed = true; unset($address_list['u'][$row['user_id']]); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // print a notice about users not being added who do not want to receive pms if ($removed) diff --git a/phpBB/modules/ucp/ucp_pm_options.php b/phpBB/modules/ucp/ucp_pm_options.php index a82a8a1388..4319cd2c38 100644 --- a/phpBB/modules/ucp/ucp_pm_options.php +++ b/phpBB/modules/ucp/ucp_pm_options.php @@ -55,7 +55,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $sql = 'UPDATE ' . USERS_TABLE . ' SET user_full_folder = ' . $set_folder_id . ' WHERE user_id = ' . phpbb::$user->data['user_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); phpbb::$user->data['user_full_folder'] = $set_folder_id; @@ -77,11 +77,11 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit { $sql = 'SELECT folder_name FROM ' . PRIVMSGS_FOLDER_TABLE . " - WHERE folder_name = '" . $db->sql_escape($folder_name) . "' + WHERE folder_name = '" . phpbb::$db->sql_escape($folder_name) . "' AND user_id = " . phpbb::$user->data['user_id']; - $result = $db->sql_query_limit($sql, 1); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query_limit($sql, 1); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if ($row) { @@ -91,20 +91,20 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $sql = 'SELECT COUNT(folder_id) as num_folder FROM ' . PRIVMSGS_FOLDER_TABLE . ' WHERE user_id = ' . phpbb::$user->data['user_id']; - $result = $db->sql_query($sql); - $num_folder = (int) $db->sql_fetchfield('num_folder'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $num_folder = (int) phpbb::$db->sql_fetchfield('num_folder'); + phpbb::$db->sql_freeresult($result); if ($num_folder >= phpbb::$config['pm_max_boxes']) { trigger_error('MAX_FOLDER_REACHED'); } - $sql = 'INSERT INTO ' . PRIVMSGS_FOLDER_TABLE . ' ' . $db->sql_build_array('INSERT', array( + $sql = 'INSERT INTO ' . PRIVMSGS_FOLDER_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', array( 'user_id' => (int) phpbb::$user->data['user_id'], 'folder_name' => $folder_name) ); - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $msg = phpbb::$user->lang['FOLDER_ADDED']; } } @@ -135,9 +135,9 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit FROM ' . PRIVMSGS_FOLDER_TABLE . ' WHERE user_id = ' . phpbb::$user->data['user_id'] . " AND folder_id = $rename_folder_id"; - $result = $db->sql_query_limit($sql, 1); - $folder_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query_limit($sql, 1); + $folder_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$folder_row) { @@ -145,10 +145,10 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit } $sql = 'UPDATE ' . PRIVMSGS_FOLDER_TABLE . " - SET folder_name = '" . $db->sql_escape($new_folder_name) . "' + SET folder_name = '" . phpbb::$db->sql_escape($new_folder_name) . "' WHERE folder_id = $rename_folder_id AND user_id = " . phpbb::$user->data['user_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $msg = phpbb::$user->lang['FOLDER_RENAMED']; } else @@ -182,9 +182,9 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit FROM ' . PRIVMSGS_FOLDER_TABLE . ' WHERE user_id = ' . phpbb::$user->data['user_id'] . " AND folder_id = $remove_folder_id"; - $result = $db->sql_query_limit($sql, 1); - $folder_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query_limit($sql, 1); + $folder_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$folder_row) { @@ -206,14 +206,14 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit FROM ' . PRIVMSGS_TO_TABLE . ' WHERE user_id = ' . phpbb::$user->data['user_id'] . " AND folder_id = $remove_folder_id"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $msg_ids = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $msg_ids[] = (int) $row['msg_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // First of all, copy all messages to another folder... or delete all messages switch ($remove_action) @@ -239,7 +239,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $sql = 'DELETE FROM ' . PRIVMSGS_FOLDER_TABLE . ' WHERE user_id = ' . phpbb::$user->data['user_id'] . " AND folder_id = $remove_folder_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // Check full folder option. If the removed folder has been specified as destination switch back to inbox if (phpbb::$user->data['user_full_folder'] == $remove_folder_id) @@ -247,7 +247,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $sql = 'UPDATE ' . USERS_TABLE . ' SET user_full_folder = ' . PRIVMSGS_INBOX . ' WHERE user_id = ' . phpbb::$user->data['user_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); phpbb::$user->data['user_full_folder'] = PRIVMSGS_INBOX; } @@ -258,7 +258,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $sql .= ($remove_action == 1) ? $move_to : PRIVMSGS_INBOX; $sql .= ' WHERE rule_folder_id = ' . $remove_folder_id; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $meta_info = append_sid('ucp', "i=pm&mode=$mode"); $message = phpbb::$user->lang['FOLDER_REMOVED']; @@ -312,24 +312,24 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $sql = 'SELECT rule_id FROM ' . PRIVMSGS_RULES_TABLE . ' - WHERE ' . $db->sql_build_array('SELECT', $rule_ary); - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + WHERE ' . phpbb::$db->sql_build_array('SELECT', $rule_ary); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if ($row) { trigger_error('RULE_ALREADY_DEFINED'); } - $sql = 'INSERT INTO ' . PRIVMSGS_RULES_TABLE . ' ' . $db->sql_build_array('INSERT', $rule_ary); - $db->sql_query($sql); + $sql = 'INSERT INTO ' . PRIVMSGS_RULES_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $rule_ary); + phpbb::$db->sql_query($sql); // Update users message rules $sql = 'UPDATE ' . USERS_TABLE . ' SET user_message_rules = 1 WHERE user_id = ' . phpbb::$user->data['user_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $msg = phpbb::$user->lang['RULE_ADDED']; } @@ -359,7 +359,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $sql = 'DELETE FROM ' . PRIVMSGS_RULES_TABLE . ' WHERE user_id = ' . phpbb::$user->data['user_id'] . " AND rule_id = $delete_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $meta_info = append_sid('ucp', 'i=pm&mode=' . $mode); $message = phpbb::$user->lang['RULE_DELETED']; @@ -368,9 +368,9 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $sql = 'SELECT rule_id FROM ' . PRIVMSGS_RULES_TABLE . ' WHERE user_id = ' . phpbb::$user->data['user_id']; - $result = $db->sql_query_limit($sql, 1); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query_limit($sql, 1); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); // Update users message rules if (!$row) @@ -378,7 +378,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $sql = 'UPDATE ' . USERS_TABLE . ' SET user_message_rules = 0 WHERE user_id = ' . phpbb::$user->data['user_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } meta_refresh(3, $meta_info); @@ -397,9 +397,9 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit FROM ' . PRIVMSGS_TO_TABLE . ' WHERE user_id = ' . phpbb::$user->data['user_id'] . ' AND folder_id = ' . PRIVMSGS_INBOX; - $result = $db->sql_query($sql); - $num_messages = (int) $db->sql_fetchfield('num_messages'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $num_messages = (int) phpbb::$db->sql_fetchfield('num_messages'); + phpbb::$db->sql_freeresult($result); $folder[PRIVMSGS_INBOX] = array( 'folder_name' => phpbb::$user->lang['PM_INBOX'], @@ -409,10 +409,10 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit $sql = 'SELECT folder_id, folder_name, pm_count FROM ' . PRIVMSGS_FOLDER_TABLE . ' WHERE user_id = ' . phpbb::$user->data['user_id']; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $num_user_folder = 0; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $num_user_folder++; $folder[$row['folder_id']] = array( @@ -420,7 +420,7 @@ function message_options($id, $mode, $global_privmsgs_rules, $global_rule_condit 'message_status' => sprintf(phpbb::$user->lang['FOLDER_MESSAGE_STATUS'], $row['pm_count'], phpbb::$user->data['message_limit']) ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $s_full_folder_options = $s_to_folder_options = $s_folder_options = ''; @@ -691,10 +691,10 @@ function define_cond_option($hardcoded, $cond_option, $rule_option, $global_rule { $sql = 'SELECT user_id FROM ' . USERS_TABLE . " - WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($rule_string)) . "'"; - $result = $db->sql_query($sql); - $rule_user_id = (int) $db->sql_fetchfield('user_id'); - $db->sql_freeresult($result); + WHERE username_clean = '" . phpbb::$db->sql_escape(utf8_clean_string($rule_string)) . "'"; + $result = phpbb::$db->sql_query($sql); + $rule_user_id = (int) phpbb::$db->sql_fetchfield('user_id'); + phpbb::$db->sql_freeresult($result); if (!$rule_user_id) { @@ -706,9 +706,9 @@ function define_cond_option($hardcoded, $cond_option, $rule_option, $global_rule $sql = 'SELECT username FROM ' . USERS_TABLE . " WHERE user_id = $rule_user_id"; - $result = $db->sql_query($sql); - $rule_string = $db->sql_fetchfield('username'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $rule_string = phpbb::$db->sql_fetchfield('username'); + phpbb::$db->sql_freeresult($result); if (!$rule_string) { @@ -752,10 +752,10 @@ function define_cond_option($hardcoded, $cond_option, $rule_option, $global_rule $sql .= " (g.group_name NOT IN ('GUESTS', 'BOTS') OR g.group_type <> " . GROUP_SPECIAL . ') ORDER BY g.group_type DESC, g.group_name ASC'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $s_group_options = ''; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if ($rule_group_id && ($row['group_id'] == $rule_group_id)) { @@ -767,7 +767,7 @@ function define_cond_option($hardcoded, $cond_option, $rule_option, $global_rule $s_group_options .= '<option value="' . $row['group_id'] . '"' . $s_class . $s_selected . '>' . (($row['group_type'] == GROUP_SPECIAL) ? phpbb::$user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>'; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $template->assign_vars(array( 'S_GROUP_CONDITION' => true, @@ -799,10 +799,10 @@ function show_defined_rules($user_id, $check_lang, $rule_lang, $action_lang, $fo FROM ' . PRIVMSGS_RULES_TABLE . ' WHERE user_id = ' . $user_id . ' ORDER BY rule_id ASC'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $count = 0; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $template->assign_block_vars('rule', array( 'COUNT' => ++$count, @@ -814,7 +814,7 @@ function show_defined_rules($user_id, $check_lang, $rule_lang, $action_lang, $fo 'FOLDER' => ($row['rule_action'] == ACTION_PLACE_INTO_FOLDER) ? $folder[$row['rule_folder_id']]['folder_name'] : '') ); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } ?>
\ No newline at end of file diff --git a/phpBB/modules/ucp/ucp_pm_viewfolder.php b/phpBB/modules/ucp/ucp_pm_viewfolder.php index f1f6d0a41e..35d9336c16 100644 --- a/phpBB/modules/ucp/ucp_pm_viewfolder.php +++ b/phpBB/modules/ucp/ucp_pm_viewfolder.php @@ -90,14 +90,14 @@ function view_folder($id, $mode, $folder_id, $folder) $sql = 'SELECT * FROM ' . ZEBRA_TABLE . ' WHERE user_id = ' . phpbb::$user->data['user_id']; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $friend[$row['zebra_id']] = $row['friend']; $foe[$row['zebra_id']] = $row['foe']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $template->assign_vars(array( 'S_MARK_OPTIONS' => $s_mark_options, @@ -147,11 +147,11 @@ function view_folder($id, $mode, $folder_id, $folder) FROM ' . GROUPS_TABLE . ' WHERE '; } - $sql .= $db->sql_in_set(($ug_type == 'u') ? 'user_id' : 'group_id', array_map('intval', array_keys($recipient_list[$ug_type]))); + $sql .= phpbb::$db->sql_in_set(($ug_type == 'u') ? 'user_id' : 'group_id', array_map('intval', array_keys($recipient_list[$ug_type]))); - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if ($ug_type == 'g') { @@ -160,7 +160,7 @@ function view_folder($id, $mode, $folder_id, $folder) $recipient_list[$ug_type][$row['id']] = array('name' => $row['name'], 'colour' => $row['colour']); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } } @@ -286,9 +286,9 @@ function view_folder($id, $mode, $folder_id, $folder) AND t.folder_id = $folder_id AND t.msg_id = p.msg_id AND p.msg_id = $message_id"; - $result = $db->sql_query_limit($sql, 1); - $message_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query_limit($sql, 1); + $message_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); $_types = array('u', 'g'); foreach ($_types as $ug_type) @@ -307,16 +307,16 @@ function view_folder($id, $mode, $folder_id, $folder) FROM ' . GROUPS_TABLE . ' WHERE '; } - $sql .= $db->sql_in_set(($ug_type == 'u') ? 'user_id' : 'group_id', array_map('intval', array_keys($address[$message_id][$ug_type]))); + $sql .= phpbb::$db->sql_in_set(($ug_type == 'u') ? 'user_id' : 'group_id', array_map('intval', array_keys($address[$message_id][$ug_type]))); - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($info_row = $db->sql_fetchrow($result)) + while ($info_row = phpbb::$db->sql_fetchrow($result)) { $address[$message_id][$ug_type][$address[$message_id][$ug_type][$info_row['id']]][] = $info_row['name']; unset($address[$message_id][$ug_type][$info_row['id']]); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } } @@ -480,9 +480,9 @@ function get_pm_from($folder_id, $folder, $user_id) AND t.user_id = $user_id AND t.msg_id = p.msg_id AND p.message_time >= $min_post_time"; - $result = $db->sql_query_limit($sql, 1); - $pm_count = (int) $db->sql_fetchfield('pm_count'); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query_limit($sql, 1); + $pm_count = (int) phpbb::$db->sql_fetchfield('pm_count'); + phpbb::$db->sql_freeresult($result); $sql_limit_time = "AND p.message_time >= $min_post_time"; } @@ -544,14 +544,14 @@ function get_pm_from($folder_id, $folder, $user_id) AND t.msg_id = p.msg_id $sql_limit_time ORDER BY $sql_sort_order"; - $result = $db->sql_query_limit($sql, $sql_limit, $sql_start); + $result = phpbb::$db->sql_query_limit($sql, $sql_limit, $sql_start); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $rowset[$row['msg_id']] = $row; $pm_list[] = $row['msg_id']; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $pm_list = ($store_reverse) ? array_reverse($pm_list) : $pm_list; diff --git a/phpBB/modules/ucp/ucp_pm_viewmessage.php b/phpBB/modules/ucp/ucp_pm_viewmessage.php index d535098328..0a0ba0ed94 100644 --- a/phpBB/modules/ucp/ucp_pm_viewmessage.php +++ b/phpBB/modules/ucp/ucp_pm_viewmessage.php @@ -102,13 +102,13 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) WHERE post_msg_id = $msg_id AND in_message = 1 ORDER BY filetime DESC, post_msg_id ASC"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $attachments[] = $row; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // No attachments exist, but message table thinks they do so go ahead and reset attach flags if (!sizeof($attachments)) @@ -116,7 +116,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) $sql = 'UPDATE ' . PRIVMSGS_TABLE . " SET message_attachment = 0 WHERE msg_id = $msg_id"; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } } else @@ -136,8 +136,8 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) { $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' SET download_count = download_count + 1 - WHERE ' . $db->sql_in_set('attach_id', array_unique($update_count)); - $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('attach_id', array_unique($update_count)); + phpbb::$db->sql_query($sql); } } @@ -261,9 +261,9 @@ function get_user_information($user_id, $user_row) $sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE user_id = ' . (int) $user_id; - $result = $db->sql_query($sql); - $user_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $user_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); } // Some standard values @@ -277,9 +277,9 @@ function get_user_information($user_id, $user_row) FROM ' . SESSIONS_TABLE . " WHERE session_user_id = $user_id GROUP BY session_user_id"; - $result = $db->sql_query_limit($sql, 1); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query_limit($sql, 1); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); $update_time = phpbb::$config['load_online_time'] * 60; if ($row) diff --git a/phpBB/modules/ucp/ucp_prefs.php b/phpBB/modules/ucp/ucp_prefs.php index 598015380c..d288df8082 100644 --- a/phpBB/modules/ucp/ucp_prefs.php +++ b/phpBB/modules/ucp/ucp_prefs.php @@ -93,9 +93,9 @@ class ucp_prefs ); $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . phpbb::$user->data['user_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); meta_refresh(3, $this->u_action); $message = phpbb::$user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); @@ -215,9 +215,9 @@ class ucp_prefs ); $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . phpbb::$user->data['user_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); meta_refresh(3, $this->u_action); $message = phpbb::$user->lang['PREFERENCES_UPDATED'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); @@ -316,9 +316,9 @@ class ucp_prefs ); $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . phpbb::$user->data['user_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $msg = phpbb::$user->lang['PREFERENCES_UPDATED']; } diff --git a/phpBB/modules/ucp/ucp_profile.php b/phpBB/modules/ucp/ucp_profile.php index 716af62b19..2369b9eac3 100644 --- a/phpBB/modules/ucp/ucp_profile.php +++ b/phpBB/modules/ucp/ucp_profile.php @@ -174,15 +174,15 @@ class ucp_profile if (sizeof($admin_ary)) { - $where_sql .= ' OR ' . $db->sql_in_set('user_id', $admin_ary); + $where_sql .= ' OR ' . phpbb::$db->sql_in_set('user_id', $admin_ary); } $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type FROM ' . USERS_TABLE . ' ' . $where_sql; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $messenger->template('admin_activate', $row['user_lang']); $messenger->to($row['user_email'], $row['username']); @@ -196,7 +196,7 @@ class ucp_profile $messenger->send($row['user_notify_type']); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } user_active_flip('deactivate', phpbb::$user->data['user_id'], INACTIVE_PROFILE); @@ -209,9 +209,9 @@ class ucp_profile if (sizeof($sql_ary)) { $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . phpbb::$user->data['user_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); } // Need to update config, forum, topic, posting, messages, etc. @@ -373,28 +373,28 @@ class ucp_profile } $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . phpbb::$user->data['user_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); // Update Custom Fields if (sizeof($cp_data)) { $sql = 'UPDATE ' . PROFILE_FIELDS_DATA_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $cp_data) . ' + SET ' . phpbb::$db->sql_build_array('UPDATE', $cp_data) . ' WHERE user_id = ' . phpbb::$user->data['user_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); - if (!$db->sql_affectedrows()) + if (!phpbb::$db->sql_affectedrows()) { $cp_data['user_id'] = (int) phpbb::$user->data['user_id']; - $db->sql_return_on_error(true); + phpbb::$db->sql_return_on_error(true); - $sql = 'INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $cp_data); - $db->sql_query($sql); + $sql = 'INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' ' . phpbb::$db->sql_build_array('INSERT', $cp_data); + phpbb::$db->sql_query($sql); - $db->sql_return_on_error(false); + phpbb::$db->sql_return_on_error(false); } } @@ -510,9 +510,9 @@ class ucp_profile ); $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + SET ' . phpbb::$db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . phpbb::$user->data['user_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); $message = phpbb::$user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf(phpbb::$user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>'); trigger_error($message); diff --git a/phpBB/modules/ucp/ucp_register.php b/phpBB/modules/ucp/ucp_register.php index e57ed9271f..fc0a832839 100644 --- a/phpBB/modules/ucp/ucp_register.php +++ b/phpBB/modules/ucp/ucp_register.php @@ -253,11 +253,11 @@ class ucp_register $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " - WHERE group_name = '" . $db->sql_escape($group_name) . "' + WHERE group_name = '" . phpbb::$db->sql_escape($group_name) . "' AND group_type = " . GROUP_SPECIAL; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$row) { @@ -377,15 +377,15 @@ class ucp_register if (sizeof($admin_ary)) { - $where_sql .= ' OR ' . $db->sql_in_set('user_id', $admin_ary); + $where_sql .= ' OR ' . phpbb::$db->sql_in_set('user_id', $admin_ary); } $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type FROM ' . USERS_TABLE . ' ' . $where_sql; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $messenger->template('admin_activate', $row['user_lang']); $messenger->to($row['user_email'], $row['username']); @@ -399,7 +399,7 @@ class ucp_register $messenger->send($row['user_notify_type']); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } } diff --git a/phpBB/modules/ucp/ucp_remind.php b/phpBB/modules/ucp/ucp_remind.php index 378fa49f08..63ce234ab4 100644 --- a/phpBB/modules/ucp/ucp_remind.php +++ b/phpBB/modules/ucp/ucp_remind.php @@ -35,11 +35,11 @@ class ucp_remind { $sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason FROM ' . USERS_TABLE . " - WHERE user_email = '" . $db->sql_escape($email) . "' - AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; - $result = $db->sql_query($sql); - $user_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + WHERE user_email = '" . phpbb::$db->sql_escape($email) . "' + AND username_clean = '" . phpbb::$db->sql_escape(utf8_clean_string($username)) . "'"; + $result = phpbb::$db->sql_query($sql); + $user_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$user_row) { @@ -81,9 +81,9 @@ class ucp_remind $user_password = gen_rand_string(8); $sql = 'UPDATE ' . USERS_TABLE . " - SET user_newpasswd = '" . $db->sql_escape(phpbb_hash($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "' + SET user_newpasswd = '" . phpbb::$db->sql_escape(phpbb_hash($user_password)) . "', user_actkey = '" . phpbb::$db->sql_escape($user_actkey) . "' WHERE user_id = " . $user_row['user_id']; - $db->sql_query($sql); + phpbb::$db->sql_query($sql); include_once(PHPBB_ROOT_PATH . 'includes/functions_messenger.' . PHP_EXT); diff --git a/phpBB/modules/ucp/ucp_resend.php b/phpBB/modules/ucp/ucp_resend.php index 35af962a2a..3d70485739 100644 --- a/phpBB/modules/ucp/ucp_resend.php +++ b/phpBB/modules/ucp/ucp_resend.php @@ -42,11 +42,11 @@ class ucp_resend $sql = 'SELECT user_id, group_id, username, user_email, user_type, user_lang, user_actkey, user_inactive_reason FROM ' . USERS_TABLE . " - WHERE user_email = '" . $db->sql_escape($email) . "' - AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; - $result = $db->sql_query($sql); - $user_row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + WHERE user_email = '" . phpbb::$db->sql_escape($email) . "' + AND username_clean = '" . phpbb::$db->sql_escape(utf8_clean_string($username)) . "'"; + $result = phpbb::$db->sql_query($sql); + $user_row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$user_row) { @@ -72,9 +72,9 @@ class ucp_resend $sql = 'SELECT group_name, group_type FROM ' . GROUPS_TABLE . ' WHERE group_id = ' . $user_row['group_id']; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $result = phpbb::$db->sql_query($sql); + $row = phpbb::$db->sql_fetchrow($result); + phpbb::$db->sql_freeresult($result); if (!$row) { @@ -121,10 +121,10 @@ class ucp_resend $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('user_id', $admin_ary[0]['a_user']); - $result = $db->sql_query($sql); + WHERE ' . phpbb::$db->sql_in_set('user_id', $admin_ary[0]['a_user']); + $result = phpbb::$db->sql_query($sql); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $messenger->template('admin_activate', $row['user_lang']); $messenger->to($row['user_email'], $row['username']); @@ -138,7 +138,7 @@ class ucp_resend $messenger->send($row['user_notify_type']); } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); } meta_refresh(3, append_sid('index')); diff --git a/phpBB/modules/ucp/ucp_zebra.php b/phpBB/modules/ucp/ucp_zebra.php index aa698eecae..1ac6888ca4 100644 --- a/phpBB/modules/ucp/ucp_zebra.php +++ b/phpBB/modules/ucp/ucp_zebra.php @@ -62,10 +62,10 @@ class ucp_zebra FROM ' . ZEBRA_TABLE . ' z, ' . USERS_TABLE . ' u WHERE z.user_id = ' . phpbb::$user->data['user_id'] . ' AND u.user_id = z.zebra_id'; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $friends = $foes = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if ($row['friend']) { @@ -76,7 +76,7 @@ class ucp_zebra $foes[] = utf8_clean_string($row['username']); } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); // remove friends from the username array $n = sizeof($data['add']); @@ -111,12 +111,12 @@ class ucp_zebra { $sql = 'SELECT user_id, user_type FROM ' . USERS_TABLE . ' - WHERE ' . $db->sql_in_set('username_clean', $data['add']) . ' + WHERE ' . phpbb::$db->sql_in_set('username_clean', $data['add']) . ' AND user_type <> ' . phpbb::USER_INACTIVE; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $user_id_ary = array(); - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { if ($row['user_id'] != ANONYMOUS && $row['user_type'] != phpbb::USER_IGNORE) { @@ -127,7 +127,7 @@ class ucp_zebra $error[] = phpbb::$user->lang['NOT_ADDED_' . $l_mode . '_ANONYMOUS']; } } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); if (sizeof($user_id_ary)) { @@ -169,7 +169,7 @@ class ucp_zebra ); } - $db->sql_multi_insert(ZEBRA_TABLE, $sql_ary); + phpbb::$db->sql_multi_insert(ZEBRA_TABLE, $sql_ary); $updated = true; } @@ -188,8 +188,8 @@ class ucp_zebra $sql = 'DELETE FROM ' . ZEBRA_TABLE . ' WHERE user_id = ' . phpbb::$user->data['user_id'] . ' - AND ' . $db->sql_in_set('zebra_id', $data['usernames']); - $db->sql_query($sql); + AND ' . phpbb::$db->sql_in_set('zebra_id', $data['usernames']); + phpbb::$db->sql_query($sql); $updated = true; } @@ -224,14 +224,14 @@ class ucp_zebra AND $sql_and AND u.user_id = z.zebra_id ORDER BY u.username_clean ASC"; - $result = $db->sql_query($sql); + $result = phpbb::$db->sql_query($sql); $s_username_options = ''; - while ($row = $db->sql_fetchrow($result)) + while ($row = phpbb::$db->sql_fetchrow($result)) { $s_username_options .= '<option value="' . $row['zebra_id'] . '">' . $row['username'] . '</option>'; } - $db->sql_freeresult($result); + phpbb::$db->sql_freeresult($result); $template->assign_vars(array( 'L_TITLE' => phpbb::$user->lang['UCP_ZEBRA_' . $l_mode], |