1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-11 03:04:09 +02:00

fixing some bugs

git-svn-id: file:///svn/phpbb/trunk@6905 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen
2007-01-18 14:41:13 +00:00
parent 916c410044
commit ff7686797a
15 changed files with 229 additions and 280 deletions

View File

@@ -224,7 +224,7 @@ class acp_forums
$auth->acl_clear_prefetch();
$cache->destroy('sql', FORUMS_TABLE);
$acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id'] . '&select_all_groups=1';
$acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id'];
$message = ($action == 'add') ? $user->lang['FORUM_CREATED'] : $user->lang['FORUM_UPDATED'];

View File

@@ -261,7 +261,9 @@ class acp_groups
$allow_desc_smilies = request_var('desc_parse_smilies', false);
$data['uploadurl'] = request_var('uploadurl', '');
$data['remotelink'] = request_var('remotelink', '');
$data['remotelink'] = request_var('remotelink', '');
$data['width'] = request_var('width', '');
$data['height'] = request_var('height', '');
$delete = request_var('delete', '');
$submit_ary = array(
@@ -283,9 +285,6 @@ class acp_groups
if (!empty($_FILES['uploadfile']['tmp_name']) || $data['uploadurl'] || $data['remotelink'])
{
$data['width'] = request_var('width', '');
$data['height'] = request_var('height', '');
// Avatar stuff
$var_ary = array(
'uploadurl' => array('string', true, 5, 255),
@@ -319,6 +318,34 @@ class acp_groups
$submit_ary['avatar'] = $category . '/' . $avatar_select;
}
}
else if ($data['width'] && $data['height'])
{
// Only update the dimensions?
if ($config['avatar_max_width'] || $config['avatar_max_height'])
{
if ($data['width'] > $config['avatar_max_width'] || $data['height'] > $config['avatar_max_height'])
{
$error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $data['width'], $data['height']);
}
}
if (!sizeof($error))
{
if ($config['avatar_min_width'] || $config['avatar_min_height'])
{
if ($data['width'] < $config['avatar_min_width'] || $data['height'] < $config['avatar_min_height'])
{
$error[] = sprintf($user->lang['AVATAR_WRONG_SIZE'], $config['avatar_min_width'], $config['avatar_min_height'], $config['avatar_max_width'], $config['avatar_max_height'], $data['width'], $data['height']);
}
}
}
if (!sizeof($error))
{
$submit_ary['avatar_width'] = $data['width'];
$submit_ary['avatar_height'] = $data['height'];
}
}
else if ($delete)
{
$submit_ary['avatar'] = '';

View File

@@ -53,7 +53,7 @@ class acp_prune
{
$prune_posted = request_var('prune_days', 0);
$prune_viewed = request_var('prune_vieweddays', 0);
$prune_all = !$prune_posted && !$prune_viewed;
$prune_all = (!$prune_posted && !$prune_viewed) ? true : false;
$prune_flags = 0;
$prune_flags += (request_var('prune_old_polls', 0)) ? 2 : 0;

View File

@@ -1373,95 +1373,13 @@ class acp_users
case 'avatar':
$avatar_select = basename(request_var('avatar_select', ''));
$category = basename(request_var('category', ''));
$can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && is_writeable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false;
$data = array();
if ($submit)
{
$delete = request_var('delete', '');
$data = array(
'uploadurl' => request_var('uploadurl', ''),
'remotelink' => request_var('remotelink', ''),
'width' => request_var('width', ''),
'height' => request_var('height', ''),
);
$error = validate_data($data, array(
'uploadurl' => array('string', true, 5, 255),
'remotelink' => array('string', true, 5, 255),
'width' => array('string', true, 1, 3),
'height' => array('string', true, 1, 3),
));
if (!sizeof($error))
if (avatar_process_user($error, $user_row))
{
$data['user_id'] = $user_id;
if ((!empty($_FILES['uploadfile']['name']) || $data['uploadurl']) && $can_upload && $config['allow_avatar_upload'])
{
list($type, $filename, $width, $height) = avatar_upload($data, $error);
}
else if ($data['remotelink'] && $config['allow_avatar_remote'])
{
list($type, $filename, $width, $height) = avatar_remote($data, $error);
}
else if ($avatar_select && $config['allow_avatar_local'])
{
$type = AVATAR_GALLERY;
$filename = $avatar_select;
// check avatar gallery
if (!is_dir($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category))
{
$type = $width = $height = 0;
$filename = '';
}
else
{
list($width, $height) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . $filename);
$filename = $category . '/' . $filename;
}
}
else if ($delete)
{
$filename = '';
$type = $width = $height = 0;
}
else
{
$data = array();
}
}
if (!sizeof($error))
{
// Do we actually have any data to update?
if (sizeof($data))
{
$sql_ary = array(
'user_avatar' => $filename,
'user_avatar_type' => $type,
'user_avatar_width' => $width,
'user_avatar_height' => $height,
);
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user_id;
$db->sql_query($sql);
// Delete old avatar if present
if ($user_row['user_avatar'] && $filename != $user_row['user_avatar'] && $user_row['user_avatar_type'] != AVATAR_GALLERY)
{
avatar_delete('user', $user_row);
}
}
trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));
trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&amp;u=' . $user_row['user_id']));
}
// Replace "error" strings with their real, localised form
@@ -1493,6 +1411,8 @@ class acp_users
}
$display_gallery = (isset($_POST['display_gallery'])) ? true : false;
$avatar_select = basename(request_var('avatar_select', ''));
$category = basename(request_var('category', ''));
if ($config['allow_avatar_local'] && $display_gallery)
{