From 725b21f2d206efb4b34eb95ec3329bc81f66b805 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Thu, 22 Jun 2006 15:14:03 +0000 Subject: time to squash some bugs git-svn-id: file:///svn/phpbb/trunk@6114 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_board.php | 2 +- phpBB/includes/acp/acp_forums.php | 39 +++++++++++++++- phpBB/includes/acp/acp_language.php | 81 +++++++++++++++++++++++++--------- phpBB/includes/acp/acp_permissions.php | 5 ++- phpBB/includes/acp/acp_profile.php | 2 +- phpBB/includes/acp/acp_users.php | 33 ++++++++++++-- 6 files changed, 134 insertions(+), 28 deletions(-) (limited to 'phpBB/includes/acp') 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 .= ' - - ' . $key_prefix . '' . $_key . ' - '; - - if ($input_field) + if (is_array($_value)) { - $tpl .= ''; + $tpl .= ' + + ' . $key_prefix . '   ' . $_key . ' + '; + + foreach ($_value as $__key => $__value) + { + $tpl .= ' + + ' . $key_prefix . '' . $__key . ' + '; + + if ($input_field) + { + $tpl .= ''; + } + else + { + $tpl .= '' . htmlspecialchars($__value) . ''; + } + + $tpl .= ' + '; + } } else { - $tpl .= '' . htmlspecialchars($_value) . ''; + $tpl .= ' + + ' . $key_prefix . '' . $_key . ' + '; + + if ($input_field) + { + $tpl .= ''; + } + else + { + $tpl .= '' . htmlspecialchars($_value) . ''; + } + + $tpl .= ' + '; } - - $tpl .= ' - '; } $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), ) ); -- cgit v1.2.1