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.php26
-rw-r--r--phpBB/includes/acp/acp_main.php29
-rw-r--r--phpBB/includes/acp/acp_profile.php14
-rw-r--r--phpBB/includes/acp/acp_users.php3
4 files changed, 64 insertions, 8 deletions
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php
index e9e75ed57d..aad3306f3e 100644
--- a/phpBB/includes/acp/acp_forums.php
+++ b/phpBB/includes/acp/acp_forums.php
@@ -1315,6 +1315,20 @@ class acp_forums
delete_attachments('topic', $topic_ids, false);
+ // Before we remove anything we make sure we are able to adjust the post counts later. ;)
+ $sql = 'SELECT poster_id
+ FROM ' . POSTS_TABLE . '
+ WHERE forum_id = ' . $forum_id . '
+ AND post_postcount = 1';
+ $result = $db->sql_query($sql);
+
+ $post_counts = array();
+ while ($row = $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);
+
switch (SQL_LAYER)
{
case 'mysql4':
@@ -1416,6 +1430,18 @@ class acp_forums
$db->sql_query("UPDATE $table SET forum_id = 0 WHERE forum_id = $forum_id");
}
+ // Adjust users post counts
+ if (sizeof($post_counts))
+ {
+ foreach ($post_counts as $poster_id => $substract)
+ {
+ $sql = 'UPDATE ' . USERS_TABLE . '
+ SET user_posts = user_posts - ' . $substract . '
+ WHERE user_id = ' . $poster_id;
+ $db->sql_query($sql);
+ }
+ }
+
$db->sql_transaction('commit');
// Make sure the overall post/topic count is correct...
diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php
index 93f8733daa..7246395ecc 100644
--- a/phpBB/includes/acp/acp_main.php
+++ b/phpBB/includes/acp/acp_main.php
@@ -20,6 +20,35 @@ class acp_main
global $config, $db, $user, $auth, $template;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
+ // Show restore permissions notice
+ if ($user->data['user_perm_from'] && $auth->acl_get('a_switchperm'))
+ {
+ $this->tpl_name = 'acp_main';
+ $this->page_title = 'ACP_MAIN';
+
+ $sql = 'SELECT user_id, username, user_colour
+ FROM ' . USERS_TABLE . '
+ WHERE user_id = ' . $user->data['user_perm_from'];
+ $result = $db->sql_query($sql);
+ $user_row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ $perm_from = '<strong' . (($user_row['user_colour']) ? ' style="color: #' . $user_row['user_colour'] . '">' : '>');
+ $perm_from .= ($user_row['user_id'] != ANONYMOUS) ? '<a href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&amp;u=' . $user_row['user_id']) . '">' : '';
+ $perm_from .= $user_row['username'];
+ $perm_from .= ($user_row['user_id'] != ANONYMOUS) ? '</a>' : '';
+ $perm_from .= '</strong>';
+
+ $template->assign_vars(array(
+ 'S_RESTORE_PERMISSIONS' => true,
+ 'U_RESTORE_PERMISSIONS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=restore_perm'),
+ 'PERM_FROM' => $perm_from,
+ 'L_PERMISSIONS_TRANSFERED_EXPLAIN' => sprintf($user->lang['PERMISSIONS_TRANSFERED_EXPLAIN'], $perm_from, append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=restore_perm')),
+ ));
+
+ return;
+ }
+
$action = request_var('action', '');
$mark = (isset($_REQUEST['mark'])) ? request_var('mark', array(0)) : array();
diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php
index 756a94cb2c..e0339ddccb 100644
--- a/phpBB/includes/acp/acp_profile.php
+++ b/phpBB/includes/acp/acp_profile.php
@@ -831,12 +831,11 @@ class acp_profile
$lang_options[$lang_id]['lang_iso'] = $lang_iso;
foreach ($options as $field => $field_type)
{
- $value = ($action == 'create') ? request_var('l_' . $field, '', true) : $cp->vars['l_' . $field];
+ $value = ($action == 'create') ? request_var('l_' . $field, array(0 => ''), true) : $cp->vars['l_' . $field];
if ($field == 'lang_options')
{
-
- $var = ($action == 'create' || !is_array($cp->vars['lang_options'][$lang_id])) ? $cp->vars['lang_options'] : $cp->vars['lang_options'][$lang_id];
+ $var = ($action == 'create' || !is_array($cp->vars['l_lang_options'][$lang_id])) ? $cp->vars['l_lang_options'] : $cp->vars['l_lang_options'][$lang_id];
switch ($field_type)
{
@@ -1003,10 +1002,11 @@ class acp_profile
}
}
- $cp->vars['l_lang_name'] = request_var('l_lang_name', '', true);
- $cp->vars['l_lang_explain'] = request_var('l_lang_explain', '', true);
- $cp->vars['l_lang_default_value'] = request_var('l_lang_default_value', '', true);
- $cp->vars['l_lang_options'] = request_var('l_lang_options', '', true);
+ // These are always arrays because the key is the language id...
+ $cp->vars['l_lang_name'] = request_var('l_lang_name', array(0 => ''), true);
+ $cp->vars['l_lang_explain'] = request_var('l_lang_explain', array(0 => ''), true);
+ $cp->vars['l_lang_default_value'] = request_var('l_lang_default_value', array(0 => ''), true);
+ $cp->vars['l_lang_options'] = request_var('l_lang_options', array(0 => ''), true);
if ($cp->vars['lang_options'])
{
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index bd4b0b1407..12fb528830 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -806,6 +806,7 @@ class acp_users
'S_USER_FOUNDER' => ($user_row['user_type'] == USER_FOUNDER) ? true : false,
'S_ACTION_OPTIONS' => $s_action_options,
'S_OWN_ACCOUNT' => ($user_id == $user->data['user_id']) ? true : false,
+ 'S_USER_INACTIVE' => ($user_row['user_type'] == USER_IGNORE || $user_row['user_type'] == USER_INACTIVE) ? true : false,
'U_SHOW_IP' => $this->u_action . "&amp;u=$user_id&amp;ip=" . (($ip == 'ip') ? 'hostname' : 'ip'),
'U_WHOIS' => $this->u_action . "&amp;action=whois&amp;user_ip={$user_row['user_ip']}",
@@ -924,7 +925,7 @@ class acp_users
$sql = 'SELECT lang_id
FROM ' . LANG_TABLE . "
- WHERE lang_iso = '" . $db->sql_escape($user_row['user_lang']) . "'";
+ WHERE lang_iso = '" . $db->sql_escape($user->data['user_lang']) . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);