diff options
Diffstat (limited to 'phpBB/includes/acp')
-rw-r--r-- | phpBB/includes/acp/acp_board.php | 2 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_forums.php | 39 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_language.php | 81 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_permissions.php | 5 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_profile.php | 2 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_users.php | 33 |
6 files changed, 134 insertions, 28 deletions
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index cb27314f74..af5dcc6acc 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -363,7 +363,7 @@ class acp_board } $this->new_config = $config; - $cfg_array = (isset($_REQUEST['config'])) ? request_var('config', array('' => '')) : $this->new_config; + $cfg_array = (isset($_REQUEST['config'])) ? request_var('config', array('' => ''), true) : $this->new_config; // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to... foreach ($display_vars['vars'] as $config_name => $null) diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 75395d4b81..257ad8e333 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -293,7 +293,7 @@ class acp_forums trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); } - $sql = 'SELECT forum_name + $sql = 'SELECT forum_name, forum_type FROM ' . FORUMS_TABLE . " WHERE forum_id = $forum_id"; $result = $db->sql_query($sql); @@ -1377,6 +1377,43 @@ class acp_forums $db->sql_transaction('commit'); + // Make sure the overall post/topic count is correct... + $sql = 'SELECT COUNT(post_id) AS stat + FROM ' . POSTS_TABLE . ' + WHERE post_approved = 1'; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + set_config('num_posts', (int) $row['stat'], true); + + $sql = 'SELECT COUNT(topic_id) AS stat + FROM ' . TOPICS_TABLE . ' + WHERE topic_approved = 1'; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + set_config('num_topics', (int) $row['stat'], true); + + $sql = 'SELECT COUNT(attach_id) as stat + FROM ' . ATTACHMENTS_TABLE; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + set_config('num_files', (int) $row['stat'], true); + + $sql = 'SELECT SUM(filesize) as stat + FROM ' . ATTACHMENTS_TABLE; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + set_config('upload_dir_size', (int) $row['stat'], true); + + add_log('admin', 'LOG_RESYNC_STATS'); + return array(); } diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index 668422a90b..9c32aa74db 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -211,7 +211,6 @@ class acp_language { // Email Template $entry = (STRIP) ? stripslashes($_POST['entry']) : $_POST['entry']; - $entry = preg_replace('#&(\#[0-9]+;)#', '&\1', $entry); fwrite($fp, $entry); } else @@ -237,15 +236,14 @@ class acp_language foreach ($value as $_key => $_value) { $_value = (STRIP) ? stripslashes($_value) : $_value; - $_value = preg_replace('#&(\#[0-9]+;)#', '&\1', $_value); $entry .= "\t\t" . (int) $_key . "\t=> '" . str_replace("'", "\\'", $_value) . "',\n"; } - + $entry .= "\t),\n"; } - + fwrite($fp, $entry); - } + } } else { @@ -258,7 +256,6 @@ class acp_language if (!is_array($value)) { $value = (STRIP) ? stripslashes($value) : $value; - $value = preg_replace('#&(\#[0-9]+;)#', '&\1', $value); $entry = "\t'" . $key . "'\t=> '" . str_replace("'", "\\'", $value) . "',\n"; } else @@ -267,9 +264,23 @@ class acp_language foreach ($value as $_key => $_value) { - $_value = (STRIP) ? stripslashes($_value) : $_value; - $_value = preg_replace('#&(\#[0-9]+;)#', '&\1', $_value); - $entry .= "\t\t'" . $_key . "'\t=> '" . str_replace("'", "\\'", $_value) . "',\n"; + if (!is_array($_value)) + { + $_value = (STRIP) ? stripslashes($_value) : $_value; + $entry .= "\t\t'" . $_key . "'\t=> '" . str_replace("'", "\\'", $_value) . "',\n"; + } + else + { + $entry .= "\n\t\t'" . $_key . "'\t=> array(\n"; + + foreach ($_value as $__key => $__value) + { + $__value = (STRIP) ? stripslashes($__value) : $__value; + $entry .= "\t\t\t'" . $__key . "'\t=> '" . str_replace("'", "\\'", $__value) . "',\n"; + } + + $entry .= "\t\t),\n\n"; + } } $entry .= "\t),\n\n"; @@ -1041,22 +1052,52 @@ $lang = array_merge($lang, array( foreach ($value as $_key => $_value) { - $tpl .= ' - <tr> - <td class="row1" style="white-space: nowrap;">' . $key_prefix . '<b>' . $_key . '</b></td> - <td class="row2">'; - - if ($input_field) + if (is_array($_value)) { - $tpl .= '<input type="text" name="entry[' . $key . '][' . $_key . ']" value="' . htmlspecialchars($_value) . '" size="50" />'; + $tpl .= ' + <tr> + <td class="row3" colspan="2">' . $key_prefix . ' <b>' . $_key . '</b></td> + </tr>'; + + foreach ($_value as $__key => $__value) + { + $tpl .= ' + <tr> + <td class="row1" style="white-space: nowrap;">' . $key_prefix . '<b>' . $__key . '</b></td> + <td class="row2">'; + + if ($input_field) + { + $tpl .= '<input type="text" name="entry[' . $key . '][' . $_key . '][' . $__key . ']" value="' . htmlspecialchars($__value) . '" size="50" />'; + } + else + { + $tpl .= '<b>' . htmlspecialchars($__value) . '</b>'; + } + + $tpl .= '</td> + </tr>'; + } } else { - $tpl .= '<b>' . htmlspecialchars($_value) . '</b>'; + $tpl .= ' + <tr> + <td class="row1" style="white-space: nowrap;">' . $key_prefix . '<b>' . $_key . '</b></td> + <td class="row2">'; + + if ($input_field) + { + $tpl .= '<input type="text" name="entry[' . $key . '][' . $_key . ']" value="' . htmlspecialchars($_value) . '" size="50" />'; + } + else + { + $tpl .= '<b>' . htmlspecialchars($_value) . '</b>'; + } + + $tpl .= '</td> + </tr>'; } - - $tpl .= '</td> - </tr>'; } $tpl .= ' diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index 5505794999..04766eccab 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -213,7 +213,10 @@ class acp_permissions switch ($action) { case 'delete': - $this->remove_permissions($mode, $permission_type, $auth_admin, $user_id, $group_id, $forum_id); + if (sizeof($user_id) || sizeof($group_id)) + { + $this->remove_permissions($mode, $permission_type, $auth_admin, $user_id, $group_id, $forum_id); + } break; case 'apply_permissions': diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index 7299192773..738eda5101 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -536,7 +536,7 @@ class acp_profile if ($cp->vars['lang_name'] == '') { - $error[] = $user->lang['EMPTY_USER_FIELD_IDENT']; + $error[] = $user->lang['EMPTY_USER_FIELD_NAME']; } if ($field_type == FIELD_BOOL || $field_type == FIELD_DROPDOWN) diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index a30078d7bf..6875d19178 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -133,7 +133,7 @@ class acp_users // Prevent normal users/admins change/view founders if they are not a founder by themselves if ($user->data['user_type'] != USER_FOUNDER && $user_row['user_type'] == USER_FOUNDER) { - trigger_error($user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action)); + trigger_error($user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id)); } switch ($mode) @@ -657,9 +657,34 @@ class acp_users $sql_ary['user_warnings'] = $data['warnings']; } - if (($user_row['user_type'] == USER_FOUNDER && !$data['user_founder']) || ($user_row['user_type'] != USER_FOUNDER && $data['user_founder'])) + // Only allow founders updating the founder status... + if ($user->data['user_type'] == USER_FOUNDER) { - $sql_ary['user_type'] = ($data['user_founder']) ? USER_FOUNDER : USER_NORMAL; + // Setting a normal member to be a founder + if ($data['user_founder'] && $user_row['user_type'] != USER_FOUNDER) + { + $sql_ary['user_type'] = USER_FOUNDER; + } + else if (!$data['user_founder'] && $user_row['user_type'] == USER_FOUNDER) + { + // Check if at least one founder is present + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . ' + WHERE user_type = ' . USER_FOUNDER . ' + AND user_id <> ' . $user_id; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $sql_ary['user_type'] = USER_NORMAL; + } + else + { + trigger_error($user->lang['AT_LEAST_ONE_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + } } } @@ -1252,7 +1277,7 @@ class acp_users 'S_LANG_OPTIONS' => language_select($lang), 'S_STYLE_OPTIONS' => style_select($style), - 'S_TZ_OPTIONS' => tz_select($tz), + 'S_TZ_OPTIONS' => tz_select($tz, true), ) ); |