aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/acp
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/acp')
-rw-r--r--phpBB/includes/acp/acp_forums.php156
-rw-r--r--phpBB/includes/acp/acp_groups.php3
-rw-r--r--phpBB/includes/acp/acp_users.php4
3 files changed, 157 insertions, 6 deletions
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 . '&amp;action=list&amp;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