aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2005-11-28 18:38:49 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2005-11-28 18:38:49 +0000
commit6d101df7dc3dc6f5542ccb11d626dcacbd148de6 (patch)
treef55c85d2de9f11e9517b7f54fe3d0e2548af41e8 /phpBB/includes
parent0dc59b9e0d1bd7d10fa3dddae3541f2dba01f4ef (diff)
downloadforums-6d101df7dc3dc6f5542ccb11d626dcacbd148de6.tar
forums-6d101df7dc3dc6f5542ccb11d626dcacbd148de6.tar.gz
forums-6d101df7dc3dc6f5542ccb11d626dcacbd148de6.tar.bz2
forums-6d101df7dc3dc6f5542ccb11d626dcacbd148de6.tar.xz
forums-6d101df7dc3dc6f5542ccb11d626dcacbd148de6.zip
- some SQL:2003 changes (basicly joins, mysql5 is sql:2003 compliant in strict mode now) - postgresql not supporting this standard. :/
- acp changes git-svn-id: file:///svn/phpbb/trunk@5313 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acp/acp_attachments.php2
-rw-r--r--phpBB/includes/acp/acp_bbcodes.php1
-rw-r--r--phpBB/includes/acp/acp_jabber.php2
-rw-r--r--phpBB/includes/acp/acp_logs.php169
-rw-r--r--phpBB/includes/acp/acp_modules.php4
-rw-r--r--phpBB/includes/db/mysql4.php5
-rw-r--r--phpBB/includes/db/mysqli.php3
-rw-r--r--phpBB/includes/db/postgres.php5
-rw-r--r--phpBB/includes/functions_admin.php41
-rw-r--r--phpBB/includes/functions_display.php2
-rw-r--r--phpBB/includes/functions_module.php5
-rw-r--r--phpBB/includes/mcp/mcp_front.php4
-rw-r--r--phpBB/includes/message_parser.php10
-rw-r--r--phpBB/includes/ucp/ucp_main.php26
14 files changed, 231 insertions, 48 deletions
diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php
index 25161d05f0..e14053fe34 100644
--- a/phpBB/includes/acp/acp_attachments.php
+++ b/phpBB/includes/acp/acp_attachments.php
@@ -1406,7 +1406,7 @@ class acp_attachments_info
{
return array(
'filename' => 'acp_attachments',
- 'title' => 'Attachments',
+ 'title' => 'ACP_ATTACHMENTS',
'version' => '1.0.0',
'modes' => array(
'attach' => array('title' => 'ACP_ATTACHMENT_SETTINGS', 'auth' => 'acl_a_attach'),
diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php
index 9e8fb8feae..9ddd925557 100644
--- a/phpBB/includes/acp/acp_bbcodes.php
+++ b/phpBB/includes/acp/acp_bbcodes.php
@@ -25,6 +25,7 @@ class acp_bbcodes
$bbcode_id = request_var('bbcode', 0);
$this->tpl_name = 'acp_bbcodes';
+ $this->page_title = 'ACP_BBCODES';
$u_action = "{$phpbb_admin_path}index.$phpEx$SID&amp;i=$id&amp;mode=$mode";
diff --git a/phpBB/includes/acp/acp_jabber.php b/phpBB/includes/acp/acp_jabber.php
index bfbcec9001..89490349a9 100644
--- a/phpBB/includes/acp/acp_jabber.php
+++ b/phpBB/includes/acp/acp_jabber.php
@@ -170,7 +170,7 @@ class acp_jabber_info
{
return array(
'filename' => 'acp_jabber',
- 'title' => 'Jabber',
+ 'title' => 'ACP_JABBER_SETTINGS',
'version' => '1.0.0',
'modes' => array(
'settings' => array('title' => 'ACP_JABBER_SETTINGS', 'auth' => 'acl_a_server'),
diff --git a/phpBB/includes/acp/acp_logs.php b/phpBB/includes/acp/acp_logs.php
new file mode 100644
index 0000000000..197ada5cfc
--- /dev/null
+++ b/phpBB/includes/acp/acp_logs.php
@@ -0,0 +1,169 @@
+<?php
+/**
+*
+* @package acp
+* @version $Id$
+* @copyright (c) 2005 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License
+*
+*/
+
+/**
+* @package acp
+*/
+class acp_logs
+{
+ function main($id, $mode)
+ {
+ global $db, $user, $auth, $template, $cache;
+ global $config, $SID, $phpbb_root_path, $phpbb_admin_path, $phpEx;
+
+ $user->add_lang('mcp');
+
+ // Set up general vars
+ $action = request_var('action', '');
+ $forum_id = request_var('f', 0);
+ $start = request_var('start', 0);
+ $deletemark = (isset($_POST['delmarked'])) ? true : false;
+ $deleteall = (isset($_POST['delall'])) ? true : false;
+ $marked = request_var('mark', array(0));
+
+ // Sort keys
+ $sort_days = request_var('st', 0);
+ $sort_key = request_var('sk', 't');
+ $sort_dir = request_var('sd', 'd');
+
+ $this->tpl_name = 'acp_logs';
+ $this->log_type = constant('LOG_' . strtoupper($mode));
+
+ $u_action = "{$phpbb_admin_path}index.$phpEx$SID&amp;i=$id&amp;mode=$mode";
+
+ // Delete entries if requested and able
+ if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs'))
+ {
+ $where_sql = '';
+ if ($deletemark && $marked)
+ {
+ $sql_in = array();
+ foreach ($marked as $mark)
+ {
+ $sql_in[] = $mark;
+ }
+ $where_sql = ' AND log_id IN (' . implode(', ', $sql_in) . ')';
+ unset($sql_in);
+ }
+
+ if ($where_sql)
+ {
+ $sql = 'DELETE FROM ' . LOG_TABLE . "
+ WHERE log_type = {$this->log_type}
+ $where_sql";
+ $db->sql_query($sql);
+
+ add_log('admin', 'LOG_' . strtoupper($mode) . '_CLEAR');
+ }
+ }
+
+ // Sorting
+ $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 364 => $user->lang['1_YEAR']);
+ $sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']);
+ $sort_by_sql = array('u' => 'l.user_id', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation');
+
+ $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
+ gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
+
+ // Define where and sort sql for use in displaying logs
+ $sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0;
+ $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC');
+
+ $l_title = $user->lang['ACP_' . strtoupper($mode) . '_LOGS'];
+ $l_title_explain = $user->lang['ACP_' . strtoupper($mode) . '_LOGS_EXPLAIN'];
+
+ $this->page_title = $l_title;
+
+ // Define forum list if we're looking @ mod logs
+ if ($mode == 'mod')
+ {
+ $forum_box = '<option value="0">' . $user->lang['ALL_FORUMS'] . '</option>' . make_forum_select($forum_id);
+
+ $template->assign_vars(array(
+ 'S_SHOW_FORUMS' => true,
+ 'S_FORUM_BOX' => $forum_box)
+ );
+ }
+
+ // Grab log data
+ $log_data = array();
+ $log_count = 0;
+ view_log($mode, $log_data, $log_count, $config['topics_per_page'], $start, $forum_id, 0, 0, $sql_where, $sql_sort);
+
+ $template->assign_vars(array(
+ 'L_TITLE' => $l_title,
+ 'L_EXPLAIN' => $l_title_explain,
+ 'U_ACTION' => $u_action,
+
+ 'S_ON_PAGE' => on_page($log_count, $config['topics_per_page'], $start),
+ 'PAGINATION' => generate_pagination($u_action . "&amp;$u_sort_param", $log_count, $config['topics_per_page'], $start, true),
+
+ 'S_LIMIT_DAYS' => $s_limit_days,
+ 'S_SORT_KEY' => $s_sort_key,
+ 'S_SORT_DIR' => $s_sort_dir,
+ 'S_CLEARLOGS' => $auth->acl_get('a_clearlogs'),
+
+ )
+ );
+
+ foreach ($log_data as $row)
+ {
+ $data = array();
+
+ foreach (array('viewtopic', 'viewlogs', 'viewforum') as $check)
+ {
+ if (isset($row[$check]) && $row[$check])
+ {
+ $data[] = '<a href="' . $row[$check] . '">' . $user->lang['LOGVIEW_' . strtoupper($check)] . '</a>';
+ }
+ }
+
+ $template->assign_block_vars('log', array(
+ 'USERNAME' => $row['username'],
+ 'IP' => $row['ip'],
+ 'DATE' => $user->format_date($row['time']),
+ 'ACTION' => $row['action'],
+ 'DATA' => (sizeof($data)) ? implode(' | ', $data) : '',
+ 'ID' => $row['id'],
+ )
+ );
+ }
+ }
+}
+
+/**
+* @package module_install
+*/
+class acp_logs_info
+{
+ function module()
+ {
+ return array(
+ 'filename' => 'acp_logs',
+ 'title' => 'ACP_LOGGING',
+ 'version' => '1.0.0',
+ 'modes' => array(
+ 'admin' => array('title' => 'ACP_ADMIN_LOGS', 'auth' => 'acl_a_'),
+ 'mod' => array('title' => 'ACP_MOD_LOGS', 'auth' => 'acl_a_'),
+ 'critical' => array('title' => 'ACP_CRITICAL_LOGS', 'auth' => 'acl_a_'),
+ ),
+ );
+ }
+
+ function install()
+ {
+ }
+
+ function uninstall()
+ {
+ }
+}
+
+?> \ No newline at end of file
diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php
index 86a7c8467f..2b1c522f50 100644
--- a/phpBB/includes/acp/acp_modules.php
+++ b/phpBB/includes/acp/acp_modules.php
@@ -716,8 +716,8 @@ class acp_modules
$rows = array();
$sql = 'SELECT m2.*
- FROM (' . MODULES_TABLE . ' m1
- LEFT JOIN ' . MODULES_TABLE . " m2 ON $condition)
+ FROM ' . MODULES_TABLE . ' m1
+ LEFT JOIN ' . MODULES_TABLE . " m2 ON ($condition)
WHERE m1.module_class = '" . $db->sql_escape($this->module_class) . "'
AND m2.module_class = '" . $db->sql_escape($this->module_class) . "'
AND m1.module_id = $module_id
diff --git a/phpBB/includes/db/mysql4.php b/phpBB/includes/db/mysql4.php
index ce56efc664..3df2c0ad0d 100644
--- a/phpBB/includes/db/mysql4.php
+++ b/phpBB/includes/db/mysql4.php
@@ -20,7 +20,10 @@ if (!defined('SQL_LAYER'))
/**
* @package dbal
* MySQL4 Database Abstraction Layer
-* Minimum Requirement is 4.0+ (4.1+ compatible)
+* Compatible with:
+* MySQL 4.0+
+* MySQL 4.1+
+* MySQL 5.0+
*/
class dbal_mysql4 extends dbal
{
diff --git a/phpBB/includes/db/mysqli.php b/phpBB/includes/db/mysqli.php
index 5bd4b124db..82ee6ecf21 100644
--- a/phpBB/includes/db/mysqli.php
+++ b/phpBB/includes/db/mysqli.php
@@ -20,7 +20,8 @@ if (!defined('SQL_LAYER'))
/**
* @package dbal
* MySQLi Database Abstraction Layer
-* Minimum Requirement is MySQL 4.1+ and the mysqli-extension
+* mysqli-extension has to be compiled with:
+* MySQL 4.1+ or MySQL 5.0+
*/
class dbal_mysqli extends dbal
{
diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php
index 72590d6330..f371202578 100644
--- a/phpBB/includes/db/postgres.php
+++ b/phpBB/includes/db/postgres.php
@@ -120,6 +120,11 @@ class dbal_postgres extends dbal
{
global $cache;
+ if (strpos($query, 'SELECT') === 0 && strpos($query, 'FROM (') !== false)
+ {
+ $query = preg_replace('#FROM \((.+)\) #', 'FROM \1 ', $query);
+ }
+
// EXPLAIN only in extra debug mode
if (defined('DEBUG_EXTRA'))
{
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index a4fe26bccd..48de517083 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -201,7 +201,7 @@ function size_select($select_name, $size_compare)
/**
* Obtain authed forums list
*/
-function get_forum_list($acl_list = 'f_list', $id_only = TRUE, $postable_only = FALSE, $no_cache = FALSE)
+function get_forum_list($acl_list = 'f_list', $id_only = true, $postable_only = false, $no_cache = false)
{
global $db, $auth;
static $forum_rows;
@@ -242,7 +242,7 @@ function get_forum_list($acl_list = 'f_list', $id_only = TRUE, $postable_only =
/**
* Get forum branch
*/
-function get_forum_branch($forum_id, $type = 'all', $order = 'descending', $include_forum = TRUE)
+function get_forum_branch($forum_id, $type = 'all', $order = 'descending', $include_forum = true)
{
global $db;
@@ -263,8 +263,8 @@ function get_forum_branch($forum_id, $type = 'all', $order = 'descending', $incl
$rows = array();
$sql = 'SELECT f2.*
- FROM (' . FORUMS_TABLE . ' f1
- LEFT JOIN ' . FORUMS_TABLE . " f2 ON $condition)
+ FROM ' . FORUMS_TABLE . ' f1
+ LEFT JOIN ' . FORUMS_TABLE . " f2 ON ($condition)
WHERE f1.forum_id = $forum_id
ORDER BY f2.left_id " . (($order == 'descending') ? 'ASC' : 'DESC');
$result = $db->sql_query($sql);
@@ -431,7 +431,7 @@ function move_posts($post_ids, $topic_id, $auto_sync = true)
/**
* Remove topic(s)
*/
-function delete_topics($where_type, $where_ids, $auto_sync = TRUE)
+function delete_topics($where_type, $where_ids, $auto_sync = true)
{
global $db;
$forum_ids = $topic_ids = array();
@@ -502,7 +502,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = TRUE)
/**
* Remove post(s)
*/
-function delete_posts($where_type, $where_ids, $auto_sync = TRUE)
+function delete_posts($where_type, $where_ids, $auto_sync = true)
{
global $db;
@@ -567,7 +567,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = TRUE)
* ids => (post_ids, topic_ids, attach_ids, user_ids)
* resync => set this to false if you are deleting posts or topics...
*/
-function delete_attachments($mode, $ids, $resync = TRUE)
+function delete_attachments($mode, $ids, $resync = true)
{
global $db, $config;
@@ -758,7 +758,7 @@ function delete_attachments($mode, $ids, $resync = TRUE)
/**
* Remove topic shadows
*/
-function delete_topic_shadows($max_age, $forum_id = '', $auto_sync = TRUE)
+function delete_topic_shadows($max_age, $forum_id = '', $auto_sync = true)
{
$where = (is_array($forum_id)) ? 'AND t.forum_id IN (' . implode(', ', $forum_id) . ')' : (($forum_id) ? "AND t.forum_id = $forum_id" : '');
@@ -799,7 +799,7 @@ function delete_topic_shadows($max_age, $forum_id = '', $auto_sync = TRUE)
if ($auto_sync)
{
$where_type = ($forum_id) ? 'forum_id' : '';
- sync('forum', $where_type, $forum_id, TRUE);
+ sync('forum', $where_type, $forum_id, true);
}
}
@@ -831,7 +831,7 @@ function phpbb_unlink($filename, $mode = 'file')
* - post_attachement Same as post_reported, thanks to a quick Search/Replace
* - topic_attachement Same as topic_reported, thanks to a quick Search/Replace
*/
-function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE, $sync_extra = FALSE)
+function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $sync_extra = false)
{
global $db;
@@ -839,7 +839,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
{
$where_ids = array_unique($where_ids);
}
- elseif ($where_type != 'range')
+ else if ($where_type != 'range')
{
$where_ids = ($where_ids) ? array($where_ids) : array();
}
@@ -851,7 +851,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
$where_sql = '';
$where_sql_and = 'WHERE';
}
- elseif ($where_type == 'range')
+ else if ($where_type == 'range')
{
// Only check a range of topics/forums. For instance: 'topic_id BETWEEN 1 AND 60'
$where_sql = 'WHERE (' . $mode{0} . ".$where_ids)";
@@ -1346,14 +1346,14 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
// Now we delete empty topics and orphan posts
if (sizeof($delete_posts))
{
- delete_posts('topic_id', array_keys($delete_posts), FALSE);
+ delete_posts('topic_id', array_keys($delete_posts), false);
unset($delete_posts);
}
if (!sizeof($topic_data))
{
// If we get there, topic ids were invalid or topics did not contain any posts
- delete_topics($where_type, $where_ids, TRUE);
+ delete_topics($where_type, $where_ids, true);
return;
}
if (sizeof($delete_topics))
@@ -1365,7 +1365,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
$delete_topic_ids[] = $topic_id;
}
- delete_topics('topic_id', $delete_topic_ids, FALSE);
+ delete_topics('topic_id', $delete_topic_ids, false);
unset($delete_topics, $delete_topic_ids);
}
@@ -1472,11 +1472,11 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE,
unset($topic_data);
// if some topics have been resync'ed then resync parent forums
- // except when we're only syncing a range, we don't want to sync forums during
- // batch processing.
+ // except when we're only syncing a range, we don't want to sync forums during
+ // batch processing.
if ($resync_parents && sizeof($resync_forums) && $where_type != 'range')
{
- sync('forum', 'forum_id', $resync_forums, TRUE);
+ sync('forum', 'forum_id', $resync_forums, true);
}
break;
}
@@ -1636,9 +1636,8 @@ function split_sql_file($sql, $delimiter)
// we don't actually care about the matches preg gives us.
$matches = array();
- // this is faster than calling count($oktens) every time thru the loop.
- $token_count = sizeof($tokens);
- for ($i = 0; $i < $token_count; $i++)
+ // this is faster than calling sizeof($oktens) every time thru the loop.
+ for ($i = 0, $token_count = sizeof($tokens); $i < $token_count; $i++)
{
// Don't wanna add an empty string as the last thing in the array.
if ($i != $token_count - 1)
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index c887c28aef..adb838f371 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -48,7 +48,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
if ($config['load_db_track'] && $user->data['is_registered'])
{
- $sql_from = '(' . FORUMS_TABLE . ' f LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id))';
+ $sql_from = FORUMS_TABLE . ' f LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id)';
$lastread_select = ', ft.mark_time ';
}
else
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php
index 9841a6f15b..ba43943406 100644
--- a/phpBB/includes/functions_module.php
+++ b/phpBB/includes/functions_module.php
@@ -358,6 +358,11 @@ class p_master
{
global $user;
+ if (!isset($this->module->page_title))
+ {
+ return '';
+ }
+
return (isset($user->lang[$this->module->page_title])) ? $user->lang[$this->module->page_title] : $this->module->page_title;
}
diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php
index 2aafb49180..8659c0b2f1 100644
--- a/phpBB/includes/mcp/mcp_front.php
+++ b/phpBB/includes/mcp/mcp_front.php
@@ -118,8 +118,8 @@ function mcp_front_view($id, $mode, $action, $url)
if ($total)
{
$sql = 'SELECT r.*, p.post_id, p.post_subject, u.username, t.topic_id, t.topic_title, f.forum_id, f.forum_name
- FROM ' . REPORTS_TABLE . ' r, ' . REASONS_TABLE . ' rr,' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u
- LEFT JOIN ' . FORUMS_TABLE . ' f ON f.forum_id = p.forum_id
+ FROM (' . REPORTS_TABLE . ' r, ' . REASONS_TABLE . ' rr,' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u)
+ LEFT JOIN ' . FORUMS_TABLE . ' f ON (f.forum_id = p.forum_id)
WHERE r.post_id = p.post_id
AND r.reason_id = rr.reason_id
AND p.topic_id = t.topic_id
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index 71cff5ce0c..1aad064c07 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -103,7 +103,7 @@ class bbcode_firstpass extends bbcode
'attachment'=> array('bbcode_id' => 12, 'regexp' => array('#\[attachment=([0-9]+)\](.*?)\[/attachment\]#ise' => "\$this->bbcode_attachment('\$1', '\$2')")),
'b' => array('bbcode_id' => 1, 'regexp' => array('#\[b\](.*?)\[/b\]#ise' => "\$this->bbcode_strong('\$1')")),
'i' => array('bbcode_id' => 2, 'regexp' => array('#\[i\](.*?)\[/i\]#ise' => "\$this->bbcode_italic('\$1')")),
- 'url' => array('bbcode_id' => 3, 'regexp' => array('#\[url(=(.*))?\](.*)\[/url\]#ie' => "\$this->validate_url('\$2', '\$3')")),
+ 'url' => array('bbcode_id' => 3, 'regexp' => array('#\[url(=(.*))?\](.*)\[/url\]#iUe' => "\$this->validate_url('\$2', '\$3')")),
'img' => array('bbcode_id' => 4, 'regexp' => array('#\[img\](https?://)([a-z0-9\-\.,\?!%\*_:;~\\&$@/=\+]+)\[/img\]#ie' => "\$this->bbcode_img('\$1\$2')")),
'size' => array('bbcode_id' => 5, 'regexp' => array('#\[size=([\-\+]?[1-2]?[0-9])\](.*?)\[/size\]#ise' => "\$this->bbcode_size('\$1', '\$2')")),
'color' => array('bbcode_id' => 6, 'regexp' => array('!\[color=(#[0-9A-F]{6}|[a-z\-]+)\](.*?)\[/color\]!ise' => "\$this->bbcode_color('\$1', '\$2')")),
@@ -419,7 +419,7 @@ class bbcode_firstpass extends bbcode
$out .= array_pop($list_end_tags) . ']';
$tok = '[';
}
- elseif (preg_match('#list(=?(?:[0-9]|[a-z]|))#i', $buffer, $m))
+ else if (preg_match('#list(=?(?:[0-9]|[a-z]|))#i', $buffer, $m))
{
// sub-list, add a closing tag
if (!$m[1] || preg_match('/^(disc|square|circle)$/i', $m[1]))
@@ -505,7 +505,7 @@ class bbcode_firstpass extends bbcode
$tok = '[';
$buffer = '';
}
- elseif (preg_match('#^quote(?:=&quot;(.*?)&quot;)?$#is', $buffer, $m))
+ else if (preg_match('#^quote(?:=&quot;(.*?)&quot;)?$#is', $buffer, $m))
{
$this->parsed_items['quote']++;
@@ -565,7 +565,7 @@ class bbcode_firstpass extends bbcode
$tok = '[';
$buffer = '';
}
- elseif (preg_match('#^quote=&quot;(.*?)#is', $buffer, $m))
+ else if (preg_match('#^quote=&quot;(.*?)#is', $buffer, $m))
{
// the buffer holds an invalid opening tag
$buffer .= ']';
@@ -1508,7 +1508,7 @@ class fulltext_search
// Remove words with no matches ... this is a potentially nasty query
$sql = 'SELECT w.word_id
FROM ' . SEARCH_WORD_TABLE . ' w
- LEFT JOIN ' . SEARCH_MATCH_TABLE . ' m ON w.word_id = m.word_id
+ LEFT JOIN ' . SEARCH_MATCH_TABLE . ' m ON (w.word_id = m.word_id)
WHERE w.word_common = 0 AND m.word_id IS NULL
GROUP BY m.word_id';
$result = $db->sql_query($sql);
diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php
index eb52c5f485..30bf123078 100644
--- a/phpBB/includes/ucp/ucp_main.php
+++ b/phpBB/includes/ucp/ucp_main.php
@@ -294,20 +294,21 @@ class ucp_main
if ($config['load_db_lastread'])
{
- $sql_from = '(' . FORUMS_TABLE . ' f LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id))';
+ $sql_join = ' LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id)';
$lastread_select = ', ft.mark_time ';
}
else
{
- $sql_from = FORUMS_TABLE . ' f ';
+ $sql_join = '';
$lastread_select = '';
$tracking_topics = (isset($_COOKIE[$config['cookie_name'] . '_track'])) ? unserialize(stripslashes($_COOKIE[$config['cookie_name'] . '_track'])) : array();
}
$sql = "SELECT f.*$lastread_select
- FROM $sql_from, " . FORUMS_WATCH_TABLE . ' fw
- WHERE fw.user_id = ' . $user->data['user_id'] . '
+ FROM (" . FORUMS_TABLE . ' f, ' . FORUMS_WATCH_TABLE . " fw)
+ $sql_join
+ WHERE fw.user_id = " . $user->data['user_id'] . '
AND f.forum_id = fw.forum_id
ORDER BY left_id';
$result = $db->sql_query($sql);
@@ -390,30 +391,29 @@ class ucp_main
);
}
- $sql_f_tracking = ($config['load_db_lastread']) ? 'LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.forum_id = t.forum_id AND ft.user_id = ' . $user->data['user_id'] . ')' : '';
+ $sql_join = ($config['load_db_lastread']) ? ' LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.forum_id = t.forum_id AND ft.user_id = ' . $user->data['user_id'] . ')' : '';
$sql_f_select = ($config['load_db_lastread']) ? ', ft.mark_time AS forum_mark_time' : '';
-
- $sql_from = TOPICS_TABLE . ' t';
$sql_t_select = '';
if ($config['load_db_track'])
{
- $sql_from .= ' LEFT JOIN ' . TOPICS_POSTED_TABLE . ' tp ON (tp.topic_id = t.topic_id
+ $sql_join .= ' LEFT JOIN ' . TOPICS_POSTED_TABLE . ' tp ON (tp.topic_id = t.topic_id
AND tp.user_id = ' . $user->data['user_id'] . ')';
$sql_t_select .= ', tp.topic_posted';
}
if ($config['load_db_lastread'])
{
- $sql_from .= ' LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id
+ $sql_join .= ' LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.topic_id = t.topic_id
AND tt.user_id = ' . $user->data['user_id'] . ')';
$sql_t_select .= ', tt.mark_time';
}
$sql = "SELECT t.* $sql_f_select $sql_t_select
- FROM $sql_from $sql_f_tracking, " . TOPICS_WATCH_TABLE . ' tw
- WHERE tw.user_id = ' . $user->data['user_id'] . '
+ FROM (" . TOPICS_TABLE . ' t, ' . TOPICS_WATCH_TABLE . " tw
+ $sql_join
+ WHERE tw.user_id = " . $user->data['user_id'] . '
AND t.topic_id = tw.topic_id
ORDER BY t.topic_last_post_time DESC';
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
@@ -590,8 +590,8 @@ class ucp_main
// But since bookmarks are sensible to the user, they should not be deleted without notice.
$sql = 'SELECT b.order_id, b.topic_id as b_topic_id, t.*, f.forum_name
FROM ' . BOOKMARKS_TABLE . ' b
- LEFT JOIN ' . TOPICS_TABLE . ' t ON b.topic_id = t.topic_id
- LEFT JOIN ' . FORUMS_TABLE . ' f ON t.forum_id = f.forum_id
+ LEFT JOIN ' . TOPICS_TABLE . ' t ON (b.topic_id = t.topic_id)
+ LEFT JOIN ' . FORUMS_TABLE . ' f ON (t.forum_id = f.forum_id)
WHERE b.user_id = ' . $user->data['user_id'] . '
ORDER BY b.order_id ASC';
$result = $db->sql_query($sql);