diff --git a/phpBB/adm/style/acp_forums.html b/phpBB/adm/style/acp_forums.html
index d46753c2a0..6025629ce1 100644
--- a/phpBB/adm/style/acp_forums.html
+++ b/phpBB/adm/style/acp_forums.html
@@ -23,6 +23,17 @@
}
+
+ if (value == {FORUM_LINK})
+ {
+ dE('cat_to_link_actions', 1);
+ }
+ else
+ {
+ dE('cat_to_link_actions', -1);
+ }
+
+
if (value == {FORUM_POST})
{
dE('forum_post_options', 1);
@@ -58,6 +69,12 @@
+
+
+ dE('cat_to_link_actions', -1);
+
+
+
dE('forum_post_options', -1);
@@ -108,6 +125,18 @@
+
+
+
diff --git a/phpBB/adm/style/acp_permissions.html b/phpBB/adm/style/acp_permissions.html
index e04ae5a717..5c7b9d6e7f 100644
--- a/phpBB/adm/style/acp_permissions.html
+++ b/phpBB/adm/style/acp_permissions.html
@@ -61,23 +61,6 @@
-
-
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php
index c505a3c4a2..fc524e0c75 100644
--- a/phpBB/includes/acp/acp_forums.php
+++ b/phpBB/includes/acp/acp_forums.php
@@ -524,6 +524,39 @@ class acp_forums
}
$db->sql_freeresult($result);
+ // Subforum move options
+ if ($action == 'edit' && $forum_data['forum_type'] == FORUM_CAT)
+ {
+ $subforums_id = array();
+ $subforums = get_forum_branch($forum_id, 'children');
+
+ foreach ($subforums as $row)
+ {
+ $subforums_id[] = $row['forum_id'];
+ }
+
+ $forums_list = make_forum_select($forum_data['parent_id'], $subforums_id);
+
+ $sql = 'SELECT forum_id
+ FROM ' . FORUMS_TABLE . '
+ WHERE forum_type = ' . FORUM_POST . "
+ AND forum_id <> $forum_id";
+ $result = $db->sql_query($sql);
+
+ if ($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);
+
+ $template->assign_vars(array(
+ 'S_HAS_SUBFORUMS' => ($forum_data['right_id'] - $forum_data['left_id'] > 1) ? true : false,
+ 'S_FORUMS_LIST' => $forums_list)
+ );
+ }
+
$s_show_display_on_index = false;
if ($forum_data['parent_id'] > 0)
@@ -586,6 +619,8 @@ class acp_forums
'S_SHOW_DISPLAY_ON_INDEX' => $s_show_display_on_index,
'S_FORUM_POST' => ($forum_data['forum_type'] == FORUM_POST) ? true : false,
'S_FORUM_ORIG_POST' => (isset($old_forum_type) && $old_forum_type == FORUM_POST) ? true : false,
+ 'S_FORUM_ORIG_CAT' => (isset($old_forum_type) && $old_forum_type == FORUM_CAT) ? true : false,
+ 'S_FORUM_ORIG_LINK' => (isset($old_forum_type) && $old_forum_type == FORUM_LINK) ? true : false,
'S_FORUM_LINK' => ($forum_data['forum_type'] == FORUM_LINK) ? true : false,
'S_FORUM_CAT' => ($forum_data['forum_type'] == FORUM_CAT) ? true : false,
'S_ENABLE_INDEXING' => ($forum_data['enable_indexing']) ? true : false,
@@ -802,7 +837,7 @@ class acp_forums
*/
function update_forum_data(&$forum_data)
{
- global $db, $user;
+ global $db, $user, $cache;
$errors = array();
@@ -943,6 +978,123 @@ class acp_forums
$forum_data_sql['forum_posts'] = $forum_data_sql['forum_topics'] = $forum_data_sql['forum_topics_real'] = $forum_data_sql['forum_last_post_id'] = $forum_data_sql['forum_last_poster_id'] = $forum_data_sql['forum_last_post_time'] = 0;
$forum_data_sql['forum_last_poster_name'] = $forum_data_sql['forum_last_poster_colour'] = '';
}
+ else if ($row['forum_type'] == FORUM_CAT && $forum_data_sql['forum_type'] == FORUM_LINK)
+ {
+ // Has subforums?
+ if ($row['right_id'] - $row['left_id'] > 1)
+ {
+ // We are turning a category into a link - but need to decide what to do with the subforums.
+ $action_subforums = request_var('action_subforums', '');
+ $subforums_to_id = request_var('subforums_to_id', 0);
+
+ if ($action_subforums == 'delete')
+ {
+ $log_action_forums = 'FORUMS';
+ $rows = get_forum_branch($row['forum_id'], 'children', 'descending', false);
+
+ foreach ($rows as $_row)
+ {
+ // Do not remove the forum id we are about to change. ;)
+ if ($_row['forum_id'] == $row['forum_id'])
+ {
+ continue;
+ }
+
+ $forum_ids[] = $_row['forum_id'];
+ $errors = array_merge($errors, $this->delete_forum_content($_row['forum_id']));
+ }
+
+ if (sizeof($errors))
+ {
+ return $errors;
+ }
+
+ if (sizeof($forum_ids))
+ {
+ $sql = 'DELETE FROM ' . FORUMS_TABLE . '
+ WHERE ' . $db->sql_in_set('forum_id', $forum_ids);
+ $db->sql_query($sql);
+
+ $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . '
+ WHERE ' . $db->sql_in_set('forum_id', $forum_ids);
+ $db->sql_query($sql);
+
+ $sql = 'DELETE FROM ' . ACL_USERS_TABLE . '
+ WHERE ' . $db->sql_in_set('forum_id', $forum_ids);
+ $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);
+
+ while ($_row = $db->sql_fetchrow($result))
+ {
+ if (!$_row['allowed_forums'])
+ {
+ continue;
+ }
+
+ $allowed_forums = unserialize(trim($_row['allowed_forums']));
+ $allowed_forums = array_diff($allowed_forums, $forum_ids);
+
+ $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . "
+ SET allowed_forums = '" . ((sizeof($allowed_forums)) ? serialize($allowed_forums) : '') . "'
+ WHERE group_id = {$_row['group_id']}";
+ $db->sql_query($sql);
+ }
+ $db->sql_freeresult($result);
+
+ $cache->destroy('_extensions');
+ }
+ }
+ else if ($action_subforums == 'move')
+ {
+ if (!$subforums_to_id)
+ {
+ return array($user->lang['NO_DESTINATION_FORUM']);
+ }
+
+ $log_action_forums = 'MOVE_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);
+
+ if (!$_row)
+ {
+ return array($user->lang['NO_FORUM']);
+ }
+
+ $subforums_to_name = $_row['forum_name'];
+
+ $sql = 'SELECT forum_id
+ FROM ' . FORUMS_TABLE . "
+ WHERE parent_id = {$row['forum_id']}";
+ $result = $db->sql_query($sql);
+
+ while ($_row = $db->sql_fetchrow($result))
+ {
+ $this->move_forum($_row['forum_id'], $subforums_to_id);
+ }
+ $db->sql_freeresult($result);
+
+ $sql = 'UPDATE ' . FORUMS_TABLE . "
+ SET parent_id = $subforums_to_id
+ WHERE parent_id = {$row['forum_id']}";
+ $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);
+ }
+ }
if (sizeof($errors))
{
@@ -1534,8 +1686,6 @@ class acp_forums
set_config('upload_dir_size', (int) $row['stat'], true);
- add_log('admin', 'LOG_RESYNC_STATS');
-
return array();
}
diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php
index 9df1c52d65..fb58c33897 100644
--- a/phpBB/includes/acp/acp_groups.php
+++ b/phpBB/includes/acp/acp_groups.php
@@ -214,9 +214,10 @@ class acp_groups
}
$name_ary = array_unique(explode("\n", $name_ary));
+ $group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'];
// Add user/s to group
- if ($error = group_user_add($group_id, false, $name_ary, $group_row['group_name'], $default, $leader, 0, $group_row))
+ if ($error = group_user_add($group_id, false, $name_ary, $group_name, $default, $leader, 0, $group_row))
{
trigger_error($user->lang[$error] . adm_back_link($this->u_action . '&action=list&g=' . $group_id), E_USER_WARNING);
}
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index cb0da02317..c7f0a81e62 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -1921,7 +1921,7 @@ class acp_users
if ($db->sql_layer == 'mssql' || $db->sql_layer == 'mssql_odbc')
{
- $sql .= " ESCAPE '\\'";
+ $sql .= " ESCAPE '\\' ";
}
$sql .= 'AND is_global = 1
@@ -1941,7 +1941,7 @@ class acp_users
if ($db->sql_layer == 'mssql' || $db->sql_layer == 'mssql_odbc')
{
- $sql .= " ESCAPE '\\'";
+ $sql .= " ESCAPE '\\' ";
}
$sql .= 'AND is_local = 1
diff --git a/phpBB/includes/auth.php b/phpBB/includes/auth.php
index 8ee4a23abb..c174fc6769 100644
--- a/phpBB/includes/auth.php
+++ b/phpBB/includes/auth.php
@@ -478,11 +478,11 @@ class auth
$sql_user = ($user_id !== false) ? ((!is_array($user_id)) ? "user_id = $user_id" : $db->sql_in_set('user_id', $user_id)) : '';
$sql_forum = ($forum_id !== false) ? ((!is_array($forum_id)) ? "AND a.forum_id = $forum_id" : 'AND ' . $db->sql_in_set('a.forum_id', $forum_id)) : '';
- $sql_opts = $sql_escape = '';
+ $sql_opts = '';
if ($opts !== false)
{
- $this->build_auth_option_statement('ao.auth_option', $opts, $sql_opts, $sql_escape);
+ $this->build_auth_option_statement('ao.auth_option', $opts, $sql_opts);
}
$hold_ary = array();
@@ -512,7 +512,7 @@ class auth
'ORDER_BY' => 'a.forum_id, ao.auth_option'
));
- $result = $db->sql_query($sql . $sql_escape);
+ $result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
@@ -588,11 +588,11 @@ class auth
$sql_user = ($user_id !== false) ? ((!is_array($user_id)) ? "user_id = $user_id" : $db->sql_in_set('user_id', $user_id)) : '';
$sql_forum = ($forum_id !== false) ? ((!is_array($forum_id)) ? "AND a.forum_id = $forum_id" : 'AND ' . $db->sql_in_set('a.forum_id', $forum_id)) : '';
- $sql_opts = $sql_escape = '';
+ $sql_opts = '';
if ($opts !== false)
{
- $this->build_auth_option_statement('ao.auth_option', $opts, $sql_opts, $sql_escape);
+ $this->build_auth_option_statement('ao.auth_option', $opts, $sql_opts);
}
$hold_ary = array();
@@ -620,7 +620,7 @@ class auth
'ORDER_BY' => 'a.forum_id, ao.auth_option'
));
- $result = $db->sql_query($sql . $sql_escape);
+ $result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
@@ -642,11 +642,11 @@ class auth
$sql_group = ($group_id !== false) ? ((!is_array($group_id)) ? "group_id = $group_id" : $db->sql_in_set('group_id', $group_id)) : '';
$sql_forum = ($forum_id !== false) ? ((!is_array($forum_id)) ? "AND a.forum_id = $forum_id" : 'AND ' . $db->sql_in_set('a.forum_id', $forum_id)) : '';
- $sql_opts = $sql_escape = '';
+ $sql_opts = '';
if ($opts !== false)
{
- $this->build_auth_option_statement('ao.auth_option', $opts, $sql_opts, $sql_escape);
+ $this->build_auth_option_statement('ao.auth_option', $opts, $sql_opts);
}
$hold_ary = array();
@@ -674,7 +674,7 @@ class auth
'ORDER_BY' => 'a.forum_id, ao.auth_option'
));
- $result = $db->sql_query($sql . $sql_escape);
+ $result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
@@ -791,7 +791,7 @@ class auth
/**
* Fill auth_option statement for later querying based on the supplied options
*/
- function build_auth_option_statement($key, $auth_options, &$sql_opts, &$sql_escape)
+ function build_auth_option_statement($key, $auth_options, &$sql_opts)
{
global $db;
@@ -802,7 +802,7 @@ class auth
if (strpos($auth_options, '_') !== false)
{
$sql_opts = "AND $key LIKE '" . $db->sql_escape(str_replace('_', "\_", $auth_options)) . "'";
- $sql_escape = ($db->sql_layer == 'mssql' || $db->sql_layer == 'mssql_odbc') ? " ESCAPE '\\'" : '';
+ $sql_opts .= ($db->sql_layer == 'mssql' || $db->sql_layer == 'mssql_odbc') ? " ESCAPE '\\' " : '';
}
else
{
@@ -816,7 +816,7 @@ class auth
}
else
{
- $is_like_expression = $is_underline = false;
+ $is_like_expression = false;
foreach ($auth_options as $option)
{
@@ -824,11 +824,6 @@ class auth
{
$is_like_expression = true;
}
-
- if (strpos($option, '_') !== false)
- {
- $is_underline = true;
- }
}
if (!$is_like_expression)
@@ -841,15 +836,26 @@ class auth
foreach ($auth_options as $option)
{
- $sql[] = $key . " LIKE '" . $db->sql_escape(str_replace('_', "\_", $option)) . "'";
+ if (strpos($option, '%') !== false)
+ {
+ if (strpos($option, '_') !== false)
+ {
+ $_sql = $key . " LIKE '" . $db->sql_escape(str_replace('_', "\_", $option)) . "'";
+ $_sql .= ($db->sql_layer == 'mssql' || $db->sql_layer == 'mssql_odbc') ? " ESCAPE '\\'" : '';
+ $sql[] = $_sql;
+ }
+ else
+ {
+ $sql[] = $key . " LIKE '" . $db->sql_escape($option) . "'";
+ }
+ }
+ else
+ {
+ $sql[] = $key . " = '" . $db->sql_escape($option) . "'";
+ }
}
$sql_opts = 'AND (' . implode(' OR ', $sql) . ')';
-
- if ($is_underline)
- {
- $sql_escape = ($db->sql_layer == 'mssql' || $db->sql_layer == 'mssql_odbc') ? " ESCAPE '\\'" : '';
- }
}
}
}
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index f76f918451..a9c5c5263d 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -2512,7 +2512,7 @@ function _build_hidden_fields($key, $value, $specialchar, $stripslashes)
{
foreach ($value as $_key => $_value)
{
- $_key = ($stripslashes) ? stripslashes($_key) : $key;
+ $_key = ($stripslashes) ? stripslashes($_key) : $_key;
$_key = ($specialchar) ? htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') : $_key;
$hidden_fields .= _build_hidden_fields($key . '[' . $_key . ']', $_value, $specialchar, $stripslashes);
@@ -3085,7 +3085,7 @@ function page_header($page_title = '', $display_online_list = true)
// Specify escape character for MSSQL
if ($db->sql_layer == 'mssql' || $db->sql_layer == 'mssql_odbc')
{
- $reading_sql .= " ESCAPE '\\'";
+ $reading_sql .= " ESCAPE '\\' ";
}
}
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 78900e2bf4..6d3fcd47dd 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -367,7 +367,7 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage
// Check Image Size, if it is an image
if (!$auth->acl_get('a_') && !$auth->acl_get('m_', $forum_id) && $cat_id == ATTACHMENT_CATEGORY_IMAGE)
{
- $file->upload->set_allowed_dimensions(0, 0, $config['img_max_width'], $config['img_max_height']);
+ $file->upload->set_allowed_dimensions(0, 0, $config['img_max_width'], $config['img_max_height']);
}
// Admins and mods are allowed to exceed the allowed filesize
@@ -561,6 +561,12 @@ function create_thumbnail($source, $destination, $mimetype)
list($new_width, $new_height) = get_img_size_format($width, $height);
+ // Do not create a thumbnail if the resulting width/height is bigger than the original one
+ if ($new_width > $width && $new_height > $height)
+ {
+ return false;
+ }
+
$used_imagick = false;
// Only use imagemagick if defined and the passthru function not disabled
diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php
index b20bd63a08..b8b1ffd302 100644
--- a/phpBB/includes/mcp/mcp_forum.php
+++ b/phpBB/includes/mcp/mcp_forum.php
@@ -79,7 +79,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id),
'U_VIEW_FORUM_LOGS' => ($auth->acl_gets('a_', 'm_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=logs&mode=forum_logs&f=' . $forum_id) : '',
- 'S_MCP_ACTION' => $url . "&i=$id&action=$action&mode=$mode&start=$start" . (($action == 'merge_select') ? $selected_ids : ''),
+ 'S_MCP_ACTION' => $url . "&i=$id&mode=$mode&start=$start" . (($action == 'merge_select') ? $selected_ids : ''),
'PAGINATION' => generate_pagination($url . "&i=$id&action=$action&mode=$mode" . (($action == 'merge_select') ? $selected_ids : ''), $forum_topics, $topics_per_page, $start),
'PAGE_NUMBER' => on_page($forum_topics, $topics_per_page, $start),
@@ -159,14 +159,13 @@ function mcp_resync_topics($topic_ids)
{
global $auth, $db, $template, $phpEx, $user, $phpbb_root_path;
- if (!($forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', 'm_')))
- {
- return;
- }
-
if (!sizeof($topic_ids))
{
trigger_error($user->lang['NO_TOPIC_SELECTED']);
+ }
+
+ if (check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_')))
+ {
return;
}
diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php
index 8b798fc1b2..2d5aff70b6 100644
--- a/phpBB/includes/mcp/mcp_front.php
+++ b/phpBB/includes/mcp/mcp_front.php
@@ -222,7 +222,7 @@ function mcp_front_view($id, $mode, $action)
'IP' => $row['ip'],
'TIME' => $user->format_date($row['time']),
'ACTION' => $row['action'],
- 'U_VIEWTOPIC' => (!empty($row['viewtopic'])) ? $row['viewtopic'] : '',
+ 'U_VIEW_TOPIC' => (!empty($row['viewtopic'])) ? $row['viewtopic'] : '',
'U_VIEWLOGS' => (!empty($row['viewlogs'])) ? $row['viewlogs'] : '')
);
}
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index 1fe9233ba9..a59d965300 100644
--- a/phpBB/includes/mcp/mcp_main.php
+++ b/phpBB/includes/mcp/mcp_main.php
@@ -207,7 +207,9 @@ function lock_unlock($action, $ids)
$l_prefix = 'POST';
}
- if (!($forum_id = check_ids($ids, $table, $sql_id, array('m_lock'))))
+ $orig_ids = $ids;
+
+ if (!check_ids($ids, $table, $sql_id, array('m_lock')))
{
// Make sure that for f_user_lock only the lock action is triggered.
if ($action != 'lock')
@@ -215,13 +217,16 @@ function lock_unlock($action, $ids)
return;
}
- if (!($forum_id = check_ids($ids, $table, $sql_id, array('f_user_lock'))))
+ $ids = $orig_ids;
+
+ if (!check_ids($ids, $table, $sql_id, array('f_user_lock')))
{
return;
}
}
+ unset($orig_ids);
- $redirect = request_var('redirect', $user->data['session_page']);
+ $redirect = request_var('redirect', build_url(array('_f_', 'action')));
$s_hidden_fields = build_hidden_fields(array(
$sql_id . '_list' => $ids,
@@ -241,7 +246,7 @@ function lock_unlock($action, $ids)
foreach ($data as $id => $row)
{
- add_log('mod', $forum_id, $row['topic_id'], 'LOG_' . strtoupper($action), $row['topic_title']);
+ add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_' . strtoupper($action), $row['topic_title']);
}
$success_msg = $l_prefix . ((sizeof($ids) == 1) ? '' : 'S') . '_' . (($action == 'lock' || $action == 'lock_post') ? 'LOCKED' : 'UNLOCKED') . '_SUCCESS';
@@ -272,7 +277,10 @@ function change_topic_type($action, $topic_ids)
{
global $auth, $user, $db, $phpEx, $phpbb_root_path;
- if (!($forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('f_announce', 'f_sticky', 'm_'))))
+ // For changing topic types, we only allow operations in one forum.
+ $forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('f_announce', 'f_sticky', 'm_'), true);
+
+ if ($forum_id === false)
{
return;
}
@@ -420,7 +428,10 @@ function mcp_move_topic($topic_ids)
global $auth, $user, $db, $template;
global $phpEx, $phpbb_root_path;
- if (!($forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', 'm_move')))
+ // Here we limit the operation to one forum only
+ $forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_move'), true);
+
+ if ($forum_id === false)
{
return;
}
@@ -575,12 +586,13 @@ function mcp_delete_topic($topic_ids)
{
global $auth, $user, $db, $phpEx, $phpbb_root_path;
- if (!($forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', 'm_delete')))
+ if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_delete')))
{
return;
}
- $redirect = request_var('redirect', $user->data['session_page']);
+ $redirect = request_var('redirect', build_url(array('_f_', 'action')));
+ $forum_id = request_var('f', 0);
$s_hidden_fields = build_hidden_fields(array(
'topic_id_list' => $topic_ids,
@@ -598,7 +610,7 @@ function mcp_delete_topic($topic_ids)
foreach ($data as $topic_id => $row)
{
- add_log('mod', $forum_id, 0, 'LOG_TOPIC_DELETED', $row['topic_title']);
+ add_log('mod', $row['forum_id'], 0, 'LOG_TOPIC_DELETED', $row['topic_title']);
}
$return = delete_topics('topic_id', $topic_ids);
@@ -630,12 +642,13 @@ function mcp_delete_post($post_ids)
{
global $auth, $user, $db, $phpEx, $phpbb_root_path;
- if (!($forum_id = check_ids($post_ids, POSTS_TABLE, 'post_id', 'm_delete')))
+ if (!check_ids($post_ids, POSTS_TABLE, 'post_id', array('m_delete')))
{
return;
}
- $redirect = request_var('redirect', $user->data['session_page']);
+ $redirect = request_var('redirect', build_url(array('_f_', 'action')));
+ $forum_id = request_var('f', 0);
$s_hidden_fields = build_hidden_fields(array(
'post_id_list' => $post_ids,
@@ -649,7 +662,7 @@ function mcp_delete_post($post_ids)
{
if (!function_exists('delete_posts'))
{
- include_once($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
+ include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
}
// Count the number of topics that are affected
@@ -750,13 +763,14 @@ function mcp_fork_topic($topic_ids)
global $auth, $user, $db, $template, $config;
global $phpEx, $phpbb_root_path;
- if (!($forum_id = check_ids($topic_ids, TOPICS_TABLE, 'topic_id', 'm_')))
+ if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_')))
{
return;
}
$to_forum_id = request_var('to_forum_id', 0);
- $redirect = request_var('redirect', $user->data['session_page']);
+ $forum_id = request_var('forum_id', 0);
+ $redirect = request_var('redirect', build_url(array('_f_', 'action')));
$additional_msg = $success_msg = '';
$s_hidden_fields = build_hidden_fields(array(
@@ -835,11 +849,6 @@ function mcp_fork_topic($topic_ids)
$new_topic_id = $db->sql_nextid();
$new_topic_id_list[$topic_id] = $new_topic_id;
- /**
- * @todo enable? (is this still needed?)
- * markread('topic', $to_forum_id, $new_topic_id);
- */
-
if ($topic_row['poll_start'])
{
$poll_rows = array();
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index a9301d2b64..32aaa3e533 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -248,7 +248,7 @@ class mcp_queue
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
+ $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.user_colour
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . ' u
WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . '
AND t.topic_id = p.topic_id
@@ -279,7 +279,7 @@ class mcp_queue
}
else
{
- $sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, t.topic_title AS post_subject, t.topic_time AS post_time, t.topic_poster AS poster_id, t.topic_first_post_id AS post_id, t.topic_first_poster_name AS username
+ $sql = 'SELECT t.forum_id, t.topic_id, t.topic_title, t.topic_title AS post_subject, t.topic_time AS post_time, t.topic_poster AS poster_id, t.topic_first_post_id AS post_id, t.topic_first_poster_name AS username, t.topic_first_poster_colour AS user_colour
FROM ' . TOPICS_TABLE . " t
WHERE forum_id IN (0, $forum_list)
AND topic_approved = 0
@@ -323,6 +323,11 @@ class mcp_queue
$row['forum_id'] = $global_id;
}
+ if (empty($row['post_username']))
+ {
+ $row['post_username'] = $user->lang['GUEST'];
+ }
+
$template->assign_block_vars('postrow', array(
'U_VIEWFORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '',
'U_VIEWPOST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['post_id']) . (($mode == 'unapproved_posts') ? '#p' . $row['post_id'] : ''),
@@ -372,19 +377,18 @@ function approve_post($post_id_list, $mode)
global $db, $template, $user, $config;
global $phpEx, $phpbb_root_path;
- if (!($forum_id = check_ids($post_id_list, POSTS_TABLE, 'post_id', 'm_approve')))
+ if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))
{
trigger_error('NOT_AUTHORIZED');
}
- $redirect = request_var('redirect', $user->data['session_page']);
+ $redirect = request_var('redirect', build_url(array('_f_')));
$success_msg = '';
$s_hidden_fields = build_hidden_fields(array(
'i' => 'queue',
'mode' => $mode,
'post_id_list' => $post_id_list,
- 'f' => $forum_id,
'action' => 'approve',
'redirect' => $redirect)
);
@@ -398,8 +402,8 @@ function approve_post($post_id_list, $mode)
// If Topic -> total_topics = total_topics+1, total_posts = total_posts+1, forum_topics = forum_topics+1, forum_posts = forum_posts+1
// If Post -> total_posts = total_posts+1, forum_posts = forum_posts+1, topic_replies = topic_replies+1
- $total_topics = $total_posts = $forum_topics = $forum_posts = 0;
- $topic_approve_sql = $topic_replies_sql = $post_approve_sql = $topic_id_list = array();
+ $total_topics = $total_posts = 0;
+ $forum_topics_posts = $topic_approve_sql = $topic_replies_sql = $post_approve_sql = $topic_id_list = $forum_id_list = array();
$update_forum_information = false;
@@ -407,13 +411,26 @@ function approve_post($post_id_list, $mode)
{
$topic_id_list[$post_data['topic_id']] = 1;
+ if ($post_data['forum_id'])
+ {
+ $forum_id_list[$post_data['forum_id']] = 1;
+ }
+
// Topic or Post. ;)
if ($post_data['topic_first_post_id'] == $post_id)
{
if ($post_data['forum_id'])
{
+ if (!isset($forum_topics_posts[$post_data['forum_id']]))
+ {
+ $forum_topics_posts[$post_data['forum_id']] = array(
+ 'forum_posts' => 0,
+ 'forum_topics' => 0
+ );
+ }
+
$total_topics++;
- $forum_topics++;
+ $forum_topics_posts[$post_data['forum_id']]['forum_topics']++;
}
$topic_approve_sql[] = $post_data['topic_id'];
@@ -422,18 +439,23 @@ function approve_post($post_id_list, $mode)
{
if (!isset($topic_replies_sql[$post_data['topic_id']]))
{
- $topic_replies_sql[$post_data['topic_id']] = 1;
- }
- else
- {
- $topic_replies_sql[$post_data['topic_id']]++;
+ $topic_replies_sql[$post_data['topic_id']] = 0;
}
+ $topic_replies_sql[$post_data['topic_id']]++;
}
if ($post_data['forum_id'])
{
+ if (!isset($forum_topics_posts[$post_data['forum_id']]))
+ {
+ $forum_topics_posts[$post_data['forum_id']] = array(
+ 'forum_posts' => 0,
+ 'forum_topics' => 0
+ );
+ }
+
$total_posts++;
- $forum_posts++;
+ $forum_topics_posts[$post_data['forum_id']]['forum_posts']++;
}
$post_approve_sql[] = $post_id;
@@ -472,16 +494,19 @@ function approve_post($post_id_list, $mode)
}
}
- if ($forum_topics || $forum_posts)
+ if (sizeof($forum_topics_posts))
{
- $sql = 'UPDATE ' . FORUMS_TABLE . '
- SET ';
- $sql .= ($forum_topics) ? "forum_topics = forum_topics + $forum_topics" : '';
- $sql .= ($forum_topics && $forum_posts) ? ', ' : '';
- $sql .= ($forum_posts) ? "forum_posts = forum_posts + $forum_posts" : '';
- $sql .= " WHERE forum_id = $forum_id";
+ foreach ($forum_topics_posts as $forum_id => $row)
+ {
+ $sql = 'UPDATE ' . FORUMS_TABLE . '
+ SET ';
+ $sql .= ($row['forum_topics']) ? "forum_topics = forum_topics + {$row['forum_topics']}" : '';
+ $sql .= ($row['forum_topics'] && $row['forum_posts']) ? ', ' : '';
+ $sql .= ($row['forum_posts']) ? "forum_posts = forum_posts + {$row['forum_posts']}" : '';
+ $sql .= " WHERE forum_id = $forum_id";
- $db->sql_query($sql);
+ $db->sql_query($sql);
+ }
}
if ($total_topics)
@@ -499,9 +524,9 @@ function approve_post($post_id_list, $mode)
if ($update_forum_information)
{
- update_post_information('forum', $forum_id);
+ update_post_information('forum', array_keys($forum_id_list));
}
- unset($topic_id_list);
+ unset($topic_id_list, $forum_id_list);
$messenger = new messenger();
@@ -528,8 +553,8 @@ function approve_post($post_id_list, $mode)
'POST_SUBJECT' => htmlspecialchars_decode(censor_text($post_data['post_subject'])),
'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($post_data['topic_title'])),
- 'U_VIEW_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t={$post_data['topic_id']}&e=0",
- 'U_VIEW_POST' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t={$post_data['topic_id']}&p=$post_id&e=$post_id")
+ 'U_VIEW_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f={$post_data['forum_id']}&t={$post_data['topic_id']}&e=0",
+ 'U_VIEW_POST' => generate_board_url() . "/viewtopic.$phpEx?f={$post_data['forum_id']}&t={$post_data['topic_id']}&p=$post_id&e=$post_id")
);
$messenger->send($post_data['user_notify_type']);
@@ -547,19 +572,19 @@ function approve_post($post_id_list, $mode)
if ($post_id == $post_data['topic_first_post_id'] && $post_id == $post_data['topic_last_post_id'])
{
// Forum Notifications
- user_notification('post', $post_data['topic_title'], $post_data['topic_title'], $post_data['forum_name'], $forum_id, $post_data['topic_id'], $post_id);
+ user_notification('post', $post_data['topic_title'], $post_data['topic_title'], $post_data['forum_name'], $post_data['forum_id'], $post_data['topic_id'], $post_id);
}
else
{
// Topic Notifications
- user_notification('reply', $post_data['post_subject'], $post_data['topic_title'], $post_data['forum_name'], $forum_id, $post_data['topic_id'], $post_id);
+ user_notification('reply', $post_data['post_subject'], $post_data['topic_title'], $post_data['forum_name'], $post_data['forum_id'], $post_data['topic_id'], $post_id);
}
}
unset($post_info);
- if ($forum_topics)
+ if ($total_topics)
{
- $success_msg = ($forum_topics == 1) ? 'TOPIC_APPROVED_SUCCESS' : 'TOPICS_APPROVED_SUCCESS';
+ $success_msg = ($total_topics == 1) ? 'TOPIC_APPROVED_SUCCESS' : 'TOPICS_APPROVED_SUCCESS';
}
else
{
@@ -598,12 +623,12 @@ function disapprove_post($post_id_list, $mode)
global $db, $template, $user, $config;
global $phpEx, $phpbb_root_path;
- if (!($forum_id = check_ids($post_id_list, POSTS_TABLE, 'post_id', 'm_approve')))
+ if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_approve')))
{
trigger_error('NOT_AUTHORIZED');
}
- $redirect = request_var('redirect', build_url(array('t', 'mode')) . '&mode=unapproved_topics');
+ $redirect = request_var('redirect', build_url(array('t', 'mode', '_f_')) . '&mode=unapproved_topics');
$reason = request_var('reason', '', true);
$reason_id = request_var('reason_id', 0);
$success_msg = $additional_msg = '';
@@ -612,7 +637,6 @@ function disapprove_post($post_id_list, $mode)
'i' => 'queue',
'mode' => $mode,
'post_id_list' => $post_id_list,
- 'f' => $forum_id,
'action' => 'disapprove',
'redirect' => $redirect)
);
@@ -649,42 +673,52 @@ function disapprove_post($post_id_list, $mode)
// If Topic -> forum_topics_real -= 1
// If Post -> topic_replies_real -= 1
- $forum_topics_real = 0;
- $topic_replies_real_sql = $post_disapprove_sql = $topic_id_list = array();
+ $num_disapproved = 0;
+ $forum_topics_real = $topic_id_list = $forum_id_list = $topic_replies_real_sql = $post_disapprove_sql = array();
foreach ($post_info as $post_id => $post_data)
{
$topic_id_list[$post_data['topic_id']] = 1;
+ if ($post_data['forum_id'])
+ {
+ $forum_id_list[$post_data['forum_id']] = 1;
+ }
+
// Topic or Post. ;)
if ($post_data['topic_first_post_id'] == $post_id && $post_data['topic_last_post_id'] == $post_id)
{
if ($post_data['forum_id'])
{
- $forum_topics_real++;
+ if (!isset($forum_topics_real[$post_data['forum_id']]))
+ {
+ $forum_topics_real[$post_data['forum_id']] = 0;
+ }
+ $forum_topics_real[$post_data['forum_id']]++;
+ $num_disapproved++;
}
}
else
{
if (!isset($topic_replies_real_sql[$post_data['topic_id']]))
{
- $topic_replies_real_sql[$post_data['topic_id']] = 1;
- }
- else
- {
- $topic_replies_real_sql[$post_data['topic_id']]++;
+ $topic_replies_real_sql[$post_data['topic_id']] = 0;
}
+ $topic_replies_real_sql[$post_data['topic_id']]++;
}
$post_disapprove_sql[] = $post_id;
}
- if ($forum_topics_real)
+ if (sizeof($forum_topics_real))
{
- $sql = 'UPDATE ' . FORUMS_TABLE . "
- SET forum_topics_real = forum_topics_real - $forum_topics_real
- WHERE forum_id = $forum_id";
- $db->sql_query($sql);
+ foreach ($forum_topics_real as $forum_id => $topics_real)
+ {
+ $sql = 'UPDATE ' . FORUMS_TABLE . "
+ SET forum_topics_real = forum_topics_real - $topics_real
+ WHERE forum_id = $forum_id";
+ $db->sql_query($sql);
+ }
}
if (sizeof($topic_replies_real_sql))
@@ -711,8 +745,12 @@ function disapprove_post($post_id_list, $mode)
unset($post_disapprove_sql, $topic_replies_real_sql);
update_post_information('topic', array_keys($topic_id_list));
- update_post_information('forum', $forum_id);
- unset($topic_id_list);
+
+ if (sizeof($forum_id_list))
+ {
+ update_post_information('forum', array_keys($forum_id_list));
+ }
+ unset($topic_id_list, $forum_id_list);
$messenger = new messenger();
@@ -749,9 +787,9 @@ function disapprove_post($post_id_list, $mode)
}
unset($post_info, $disapprove_reason);
- if ($forum_topics_real)
+ if (sizeof($forum_topics_real))
{
- $success_msg = ($forum_topics_real == 1) ? 'TOPIC_DISAPPROVED_SUCCESS' : 'TOPICS_DISAPPROVED_SUCCESS';
+ $success_msg = ($num_disapproved == 1) ? 'TOPIC_DISAPPROVED_SUCCESS' : 'TOPICS_DISAPPROVED_SUCCESS';
}
else
{
diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php
index 8fdc3ba7db..66452ad8e0 100755
--- a/phpBB/includes/mcp/mcp_reports.php
+++ b/phpBB/includes/mcp/mcp_reports.php
@@ -107,14 +107,6 @@ class mcp_reports
);
}
- // Set some vars
- if ($post_info['user_id'] == ANONYMOUS)
- {
- $poster = ($post_info['post_username']) ? $post_info['post_username'] : $user->lang['GUEST'];
- }
-
- $poster = ($post_info['user_colour']) ? '' . $post_info['username'] . '' : $post_info['username'];
-
// Process message, leave it uncensored
$message = $post_info['post_text'];
$message = str_replace("\n", '
', $message);
@@ -129,7 +121,7 @@ class mcp_reports
$template->assign_vars(array(
'S_MCP_REPORT' => true,
- 'S_CLOSE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=reports&p=$post_id&f=$forum_id"),
+ 'S_CLOSE_ACTION' => $this->u_action . '&p=' . $post_id . 'f=' . $forum_id,
'S_CAN_VIEWIP' => $auth->acl_get('m_info', $post_info['forum_id']),
'S_POST_REPORTED' => $post_info['post_reported'],
'S_POST_UNAPPROVED' => !$post_info['post_approved'],
@@ -150,7 +142,7 @@ class mcp_reports
'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']),
'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']),
- 'RETURN_REPORTS' => sprintf($user->lang['RETURN_REPORTS'], '', ''),
+ 'RETURN_REPORTS' => sprintf($user->lang['RETURN_REPORTS'], '', ''),
'REPORTED_IMG' => $user->img('icon_topic_reported', $user->lang['POST_REPORTED']),
'REPORT_REASON_TITLE' => $reason['title'],
'REPORT_REASON_DESCRIPTION' => $reason['description'],
@@ -284,7 +276,7 @@ class mcp_reports
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, r.user_id as reporter_id, ru.username as reporter_name, r.report_time, r.report_id
+ $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.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) . '
AND t.topic_id = p.topic_id
@@ -306,18 +298,21 @@ class mcp_reports
'U_VIEWFORUM' => (!$global_topic) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']) : '',
'U_VIEWPOST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id'] . '&p=' . $row['post_id']) . '#p' . $row['post_id'],
'U_VIEW_DETAILS' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=reports&start=$start&mode=report_details&f={$row['forum_id']}&r={$row['report_id']}"),
- 'U_VIEW_REPORTER_PROFILE' => ($row['reporter_id'] != ANONYMOUS) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u=' . $row['reporter_id']) : '',
'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']),
+ 'REPORTER_FULL' => get_username_string('full', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
+ 'REPORTER_COLOUR' => get_username_string('colour', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
+ 'REPORTER' => get_username_string('username', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
+ 'U_REPORTER' => get_username_string('profile', $row['reporter_id'], $row['reporter_name'], $row['reporter_colour']),
+
'FORUM_NAME' => (!$global_topic) ? $forum_data[$row['forum_id']]['forum_name'] : $user->lang['GLOBAL_ANNOUNCEMENT'],
'POST_ID' => $row['post_id'],
'POST_SUBJECT' => $row['post_subject'],
'POST_TIME' => $user->format_date($row['post_time']),
- 'REPORTER' => ($row['reporter_id'] == ANONYMOUS) ? $user->lang['GUEST'] : $row['reporter_name'],
'REPORT_TIME' => $user->format_date($row['report_time']),
'TOPIC_TITLE' => $row['topic_title'])
);
@@ -332,7 +327,7 @@ class mcp_reports
'L_TITLE' => ($mode == 'reports') ? $user->lang['MCP_REPORTS_OPEN'] : $user->lang['MCP_REPORTS_CLOSED'],
'L_ONLY_TOPIC' => ($topic_id) ? sprintf($user->lang['ONLY_TOPIC'], $topic_info['topic_title']) : '',
- 'S_MCP_ACTION' => build_url(array('t', 'f', 'sd', 'st', 'sk')),
+ 'S_MCP_ACTION' => $this->u_action,
'S_FORUM_OPTIONS' => $forum_options,
'S_CLOSED' => ($mode == 'reports_closed') ? true : false,
@@ -356,18 +351,18 @@ function close_report($post_id_list, $mode, $action)
global $db, $template, $user, $config;
global $phpEx, $phpbb_root_path;
- if (!($forum_id = check_ids($post_id_list, POSTS_TABLE, 'post_id', 'm_report')))
+ if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_report')))
{
trigger_error('NOT_AUTHORIZED');
}
if ($action == 'delete' && strpos($user->data['session_page'], 'mode=report_details') !== false)
{
- $redirect = request_var('redirect', build_url(array('mode')) . '&mode=reports');
+ $redirect = request_var('redirect', build_url(array('mode', '_f_', 'r')) . '&mode=reports');
}
else
{
- $redirect = request_var('redirect', $user->data['session_page']);
+ $redirect = request_var('redirect', build_url(array('_f_')));
}
$success_msg = '';
@@ -375,7 +370,6 @@ function close_report($post_id_list, $mode, $action)
'i' => 'reports',
'mode' => $mode,
'post_id_list' => $post_id_list,
- 'f' => $forum_id,
'action' => $action,
'redirect' => $redirect)
);
diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php
index 6bfbf6fdb2..de9f7ac91b 100644
--- a/phpBB/includes/mcp/mcp_topic.php
+++ b/phpBB/includes/mcp/mcp_topic.php
@@ -179,7 +179,7 @@ function mcp_topic_view($id, $mode, $action)
$template->assign_vars(array(
'TOPIC_TITLE' => $topic_info['topic_title'],
- 'U_VIEWTOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $topic_info['forum_id'] . '&t=' . $topic_info['topic_id']),
+ 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $topic_info['forum_id'] . '&t=' . $topic_info['topic_id']),
'TO_TOPIC_ID' => $to_topic_id,
'TO_TOPIC_INFO' => ($to_topic_id) ? sprintf($user->lang['YOU_SELECTED_TOPIC'], $to_topic_id, '' . $to_topic_info['topic_title'] . '') : '',
@@ -223,6 +223,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
global $db, $template, $user, $phpEx, $phpbb_root_path, $auth;
$post_id_list = request_var('post_id_list', array(0));
+ $forum_id = request_var('forum_id', 0);
$start = request_var('start', 0);
if (!sizeof($post_id_list))
@@ -231,7 +232,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
return;
}
- if (!($forum_id = check_ids($post_id_list, POSTS_TABLE, 'post_id', 'm_split')))
+ if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_split')))
{
return;
}
@@ -430,7 +431,7 @@ function merge_posts($topic_id, $to_topic_id)
return;
}
- if (!($forum_id = check_ids($post_id_list, POSTS_TABLE, 'post_id', 'm_merge')))
+ if (!check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_merge')))
{
return;
}
@@ -445,7 +446,6 @@ function merge_posts($topic_id, $to_topic_id)
'action' => 'merge_posts',
'start' => $start,
'redirect' => $redirect,
- 'f' => $forum_id,
't' => $topic_id)
);
$success_msg = $return_link = '';
@@ -465,7 +465,7 @@ function merge_posts($topic_id, $to_topic_id)
if (sizeof($topic_data))
{
- $return_link .= sprintf($user->lang['RETURN_TOPIC'], '', '');
+ $return_link .= sprintf($user->lang['RETURN_TOPIC'], '', '');
}
// Link to the new topic
diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php
index ad6bde9be7..49e73d2ac5 100644
--- a/phpBB/includes/ucp/ucp_groups.php
+++ b/phpBB/includes/ucp/ucp_groups.php
@@ -877,11 +877,12 @@ class ucp_groups
}
$name_ary = array_unique(explode("\n", $name_ary));
+ $group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'];
$default = request_var('default', 0);
// Add user/s to group
- if ($error = group_user_add($group_id, false, $name_ary, $group_row['group_name'], $default, 0, 0, $group_row))
+ if ($error = group_user_add($group_id, false, $name_ary, $group_name, $default, 0, 0, $group_row))
{
trigger_error($user->lang[$error] . $return_page);
}
diff --git a/phpBB/language/en/acp/forums.php b/phpBB/language/en/acp/forums.php
index ebfe3b2710..b0e6405690 100644
--- a/phpBB/language/en/acp/forums.php
+++ b/phpBB/language/en/acp/forums.php
@@ -45,6 +45,7 @@ $lang = array_merge($lang, array(
'CREATE_FORUM' => 'Create new forum',
'DECIDE_MOVE_DELETE_CONTENT' => 'Delete content or move to forum',
+ 'DECIDE_MOVE_DELETE_SUBFORUMS' => 'Delete subforums or move to forum',
'DEFAULT_STYLE' => 'Default Style',
'DELETE_ALL_POSTS' => 'Delete posts',
'DELETE_SUBFORUMS' => 'Delete subforums and posts',
@@ -106,8 +107,8 @@ $lang = array_merge($lang, array(
'LIST_INDEX_EXPLAIN' => 'Displays a link to this forum under the parent forums subforum listing if one exist.',
'LOCKED' => 'Locked',
- 'MOVE_POSTS_TO' => 'Move posts',
- 'MOVE_SUBFORUMS_TO' => 'Move subforums',
+ 'MOVE_POSTS_TO' => 'Move posts to',
+ 'MOVE_SUBFORUMS_TO' => 'Move subforums to',
'NO_DESTINATION_FORUM' => 'You have not specified a forum to move content to',
'NO_FORUM_ACTION' => 'No action defined for what happens with the forum content',
diff --git a/phpBB/mcp.php b/phpBB/mcp.php
index fe64058418..47a2b603fe 100644
--- a/phpBB/mcp.php
+++ b/phpBB/mcp.php
@@ -606,74 +606,74 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql,
/**
* Validate ids
+*
+* @param array &$ids The relevant ids to check
+* @param string $table The table to find the ids in
+* @param string $sql_id The ids relevant column name
+* @param array $acl_list A list of permissions the user need to have
+* @param mixed $singe_forum Limit to one forum id (int) or the first forum found (true)
+*
+* @return mixed False if no ids were able to be retrieved, true if at least one id left.
+* Additionally, this value can be the forum_id assigned if $single_forum was set.
+* Therefore checking the result for with !== false is the best method.
*/
-function check_ids(&$ids, $table, $sql_id, $acl_list = false)
+function check_ids(&$ids, $table, $sql_id, $acl_list = false, $single_forum = false)
{
global $db, $auth;
- if (!is_array($ids) || !$ids)
+ if (!is_array($ids) || empty($ids))
{
- return 0;
+ return false;
}
- // a small logical error, since global announcement are assigned to forum_id == 0
- // If the first topic id is a global announcement, we can force the forum. Though only global announcements can be
- // tricked... i really do not know how to prevent this atm.
-
- // With those two queries we make sure all ids are within one forum...
- $sql = "SELECT forum_id FROM $table
- WHERE $sql_id = {$ids[0]}";
- $result = $db->sql_query($sql);
- $forum_id = (int) $db->sql_fetchfield('forum_id');
- $db->sql_freeresult($result);
-
- if (!$forum_id)
- {
- // Global Announcement?
- $forum_id = request_var('f', 0);
- }
-
- if ($forum_id === 0)
- {
- // Determine first forum the user is able to read - for global announcements
- $forum_ary = array_unique(array_keys($auth->acl_getf('!f_read', true)));
-
- $sql = 'SELECT forum_id
- FROM ' . FORUMS_TABLE . '
- WHERE forum_type = ' . FORUM_POST;
- if (sizeof($forum_ary))
- {
- $sql .= ' AND ' . $db->sql_in_set('forum_id', $forum_ary, true);
- }
-
- $result = $db->sql_query_limit($sql, 1);
- $forum_id = (int) $db->sql_fetchfield('forum_id');
- $db->sql_freeresult($result);
- }
-
- if ($acl_list && !$auth->acl_gets($acl_list, $forum_id))
- {
- trigger_error('NOT_AUTHORIZED');
- }
-
- if (!$forum_id)
- {
- trigger_error('Missing forum_id, has to be in url if global announcement...', E_USER_ERROR);
- }
-
- $sql = "SELECT $sql_id FROM $table
- WHERE " . $db->sql_in_set($sql_id, $ids) . "
- AND (forum_id = $forum_id OR forum_id = 0)";
+ $sql = "SELECT $sql_id, forum_id FROM $table
+ WHERE " . $db->sql_in_set($sql_id, $ids);
$result = $db->sql_query($sql);
$ids = array();
+ $forum_id = false;
while ($row = $db->sql_fetchrow($result))
{
- $ids[] = $row[$sql_id];
+ if ($acl_list && $row['forum_id'] && !$auth->acl_gets($acl_list, $row['forum_id']))
+ {
+ continue;
+ }
+
+ if ($acl_list && !$row['forum_id'] && !$auth->acl_getf_global($acl_list))
+ {
+ continue;
+ }
+
+ // Limit forum? If not, just assign the id.
+ if ($single_forum === false)
+ {
+ $ids[] = $row[$sql_id];
+ continue;
+ }
+
+ // Limit forum to a specific forum id?
+ if ($single_forum !== true && $row['forum_id'] == (int) $single_forum)
+ {
+ $forum_id = (int) $single_forum;
+ }
+ else if ($forum_id === false)
+ {
+ $forum_id = $row['forum_id'];
+ }
+
+ if ($row['forum_id'] == $forum_id)
+ {
+ $ids[] = $row[$sql_id];
+ }
}
$db->sql_freeresult($result);
- return $forum_id;
+ if (!sizeof($ids))
+ {
+ return false;
+ }
+
+ return ($single_forum === false) ? true : (int) $forum_id;
}
?>
\ No newline at end of file
diff --git a/phpBB/posting.php b/phpBB/posting.php
index 64f99c6a7c..72151470d4 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -1117,7 +1117,7 @@ generate_forum_nav($post_data);
// Build Forum Rules
generate_forum_rules($post_data);
-if ($config['enable_post_confirm'] && !$user->data['is_registered'] && ($mode == 'post' || $mode == 'reply' || $mode == 'quote'))
+if ($config['enable_post_confirm'] && !$user->data['is_registered'] && $solved_captcha === false && ($mode == 'post' || $mode == 'reply' || $mode == 'quote'))
{
// Show confirm image
$sql = 'DELETE FROM ' . CONFIRM_TABLE . "
@@ -1126,32 +1126,38 @@ if ($config['enable_post_confirm'] && !$user->data['is_registered'] && ($mode ==
$db->sql_query($sql);
// Generate code
- if ($solved_captcha === false)
- {
- $code = gen_rand_string(mt_rand(5, 8));
- $confirm_id = md5(unique_id($user->ip));
+ $code = gen_rand_string(mt_rand(5, 8));
+ $confirm_id = md5(unique_id($user->ip));
- $sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array(
- 'confirm_id' => (string) $confirm_id,
- 'session_id' => (string) $user->session_id,
- 'confirm_type' => (int) CONFIRM_POST,
- 'code' => (string) $code)
- );
- $db->sql_query($sql);
+ $sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array(
+ 'confirm_id' => (string) $confirm_id,
+ 'session_id' => (string) $user->session_id,
+ 'confirm_type' => (int) CONFIRM_POST,
+ 'code' => (string) $code)
+ );
+ $db->sql_query($sql);
- $template->assign_vars(array(
- 'S_CONFIRM_CODE' => true,
- 'CONFIRM_ID' => $confirm_id,
- 'CONFIRM_IMAGE' => '
',
- 'L_POST_CONFIRM_EXPLAIN' => sprintf($user->lang['POST_CONFIRM_EXPLAIN'], '', ''),
- ));
- }
+ $template->assign_vars(array(
+ 'S_CONFIRM_CODE' => true,
+ 'CONFIRM_ID' => $confirm_id,
+ 'CONFIRM_IMAGE' => '
',
+ 'L_POST_CONFIRM_EXPLAIN' => sprintf($user->lang['POST_CONFIRM_EXPLAIN'], '', ''),
+ ));
}
$s_hidden_fields = ($mode == 'reply' || $mode == 'quote') ? '' : '';
$s_hidden_fields .= '';
$s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? '' : '';
+// Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview
+if ($solved_captcha !== false)
+{
+ $s_hidden_fields .= build_hidden_fields(array(
+ 'confirm_id' => request_var('confirm_id', ''),
+ 'confirm_code' => request_var('confirm_code', ''))
+ );
+}
+
$form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || @ini_get('file_uploads') == '0' || !$config['allow_attachments'] || !$auth->acl_get('u_attach') || !$auth->acl_get('f_attach', $forum_id)) ? '' : ' enctype="multipart/form-data"';
// Start assigning vars for main posting page ...
@@ -1178,7 +1184,7 @@ $template->assign_vars(array(
'TOPIC_TIME_LIMIT' => (int) $post_data['topic_time_limit'],
'EDIT_REASON' => $post_data['post_edit_reason'],
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id"),
- 'U_VIEWTOPIC' => ($mode != 'post') ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id") : '',
+ 'U_VIEW_TOPIC' => ($mode != 'post') ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id") : '',
'U_PROGRESS_BAR' => append_sid("{$phpbb_root_path}posting.$phpEx", "f=$forum_id&mode=popup"),
'UA_PROGRESS_BAR' => append_sid("{$phpbb_root_path}posting.$phpEx", "f=$forum_id&mode=popup", false),
diff --git a/phpBB/styles/subSilver/template/mcp_forum.html b/phpBB/styles/subSilver/template/mcp_forum.html
index 4aa6050a8d..05fad4b7f5 100644
--- a/phpBB/styles/subSilver/template/mcp_forum.html
+++ b/phpBB/styles/subSilver/template/mcp_forum.html
@@ -10,7 +10,7 @@