diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 913962f566..5efaecb503 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -977,9 +977,10 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = FALSE, } } - $sql = 'SELECT DISTINCT(post_id) + $sql = 'SELECT DISTINCT(post_msg_id) FROM ' . ATTACHMENTS_TABLE . ' - WHERE post_id IN (' . implode(', ', $post_ids) . ')'; + WHERE post_msg_id IN (' . implode(', ', $post_ids) . ') + AND in_message = 0'; $post_ids = array(); $result = $db->sql_query($sql); diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index cb0bd4f082..b1a72f19a9 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -163,6 +163,8 @@ class ucp_main extends module if ($post_count_sql) { + // NOTE: The following three queries could be a problem for big boards + // Grab all the relevant data $sql = 'SELECT COUNT(p.post_id) AS num_posts FROM ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . ' f diff --git a/phpBB/install/schemas/mysql_schema.sql b/phpBB/install/schemas/mysql_schema.sql index a21d6d7349..810046e2e8 100644 --- a/phpBB/install/schemas/mysql_schema.sql +++ b/phpBB/install/schemas/mysql_schema.sql @@ -98,6 +98,7 @@ CREATE TABLE phpbb_bbcodes ( PRIMARY KEY (bbcode_id) ); +# Table: 'phpbb_bookmarks' CREATE TABLE phpbb_bookmarks ( topic_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL, @@ -755,9 +756,6 @@ CREATE TABLE phpbb_styles_imageset ( poll_center varchar(200) DEFAULT '' NOT NULL, poll_right varchar(200) DEFAULT '' NOT NULL, attach_progress_bar varchar(200) DEFAULT '' NOT NULL, - karma_left varchar(200) DEFAULT '' NOT NULL, - karma_center varchar(200) DEFAULT '' NOT NULL, - karma_right varchar(200) DEFAULT '' NOT NULL, user_icon1 varchar(200) DEFAULT '' NOT NULL, user_icon2 varchar(200) DEFAULT '' NOT NULL, user_icon3 varchar(200) DEFAULT '' NOT NULL, diff --git a/phpBB/ucp.php b/phpBB/ucp.php index e49566b00e..596e345fad 100755 --- a/phpBB/ucp.php +++ b/phpBB/ucp.php @@ -321,16 +321,16 @@ switch ($mode) // We destroy the session here, the user will be logged out nevertheless $user->destroy(); - meta_refresh(3, "{$phpbb_root_path}index.$phpEx"); + meta_refresh(3, "{$phpbb_root_path}index.$phpEx$SID"); - $message = $user->lang['COOKIES_DELETED'] . '

' . sprintf($user->lang['RETURN_INDEX'], "", ''); + $message = $user->lang['COOKIES_DELETED'] . '

' . sprintf($user->lang['RETURN_INDEX'], "", ''); trigger_error($message); } else { confirm_box(false, 'DELETE_COOKIES', ''); } - redirect("index.$phpEx"); + redirect("index.$phpEx$SID"); break; } @@ -340,7 +340,7 @@ if ($user->data['user_id'] == ANONYMOUS || $user->data['user_type'] == USER_INAC { if ($user->data['user_id'] != ANONYMOUS) { - redirect("index.$phpEx"); + redirect("index.$phpEx$SID"); } login_box($user->cur_page, '', $user->lang['LOGIN_EXPLAIN_UCP']); diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 3040857c49..77a5d43faa 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -268,15 +268,17 @@ if ($forum_password) if (isset($_GET['e'])) { $jump_to = (int) $_GET['e']; - $redirect_url = htmlspecialchars(str_replace('&e=' . $jump_to, '', $_SERVER['REQUEST_URI'])) . (($jump_to) ? '#' . $jump_to : ''); + + $redirect_url = str_replace('&e=' . $jump_to, '', $_SERVER['REQUEST_URI']) . (($jump_to) ? '#' . $jump_to : ''); + if ($user->data['user_id'] == ANONYMOUS) { - login_box(preg_replace('#.*?([a-z]+?\.' . $phpEx . '.*?)$#i', '\1', $redirect_url), '', $user->lang['LOGIN_NOTIFY_TOPIC']); + login_box(preg_replace('#.*?([a-z]+?\.' . $phpEx . '.*?)$#i', '\1', htmlspecialchars($redirect_url)), '', $user->lang['LOGIN_NOTIFY_TOPIC']); } else if ($jump_to > 0) { // We direct the already logged in user to the correct post... - redirect($redirect_url); + redirect(preg_replace('#^' . $config['script_path'] . '#', '', $redirect_url)); } }