1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

time to squash some bugs

git-svn-id: file:///svn/phpbb/trunk@6114 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2006-06-22 15:14:03 +00:00
parent daa0435614
commit 725b21f2d2
58 changed files with 354 additions and 196 deletions

View File

@@ -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)

View File

@@ -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();
}

View File

@@ -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 . '&nbsp; &nbsp;<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 .= '

View File

@@ -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':

View File

@@ -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)

View File

@@ -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 . '&amp;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 . '&amp;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),
)
);