Fix imageset editing for retaining and correctly setting dimensions for images, as well as displaying correct settings for first page load.

git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9360 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2009-03-07 16:02:17 +00:00
parent 77ca063131
commit 169a228899
2 changed files with 117 additions and 112 deletions

View file

@ -112,6 +112,7 @@
<li>[Fix] Correct mbstring regular expression for the allowable username characters, only affects <code>USERNAME_LETTER_NUM_SPACERS</code>. (Bug #42325)</li> <li>[Fix] Correct mbstring regular expression for the allowable username characters, only affects <code>USERNAME_LETTER_NUM_SPACERS</code>. (Bug #42325)</li>
<li>[Fix] Fix infinite loop in message handler if cache directory is not writable. (Bug #38675)</li> <li>[Fix] Fix infinite loop in message handler if cache directory is not writable. (Bug #38675)</li>
<li>[Fix] While post is awaiting approval it can still be edited even though it can not be seen (Bug #41435 - Patch by TerraFrost)</li> <li>[Fix] While post is awaiting approval it can still be edited even though it can not be seen (Bug #41435 - Patch by TerraFrost)</li>
<li>[Fix] Fix imageset editing for retaining and correctly setting dimensions for images, as well as displaying correct settings for first page load.</li>
<li>[Change] Allow download of conflicting file for later reference in automatic updater</li> <li>[Change] Allow download of conflicting file for later reference in automatic updater</li>
<li>[Change] Default difference view is now 'inline' instead of 'side by side'</li> <li>[Change] Default difference view is now 'inline' instead of 'side by side'</li>
<li>[Change] Added new option for merging differences to conflicting files in automatic updater</li> <li>[Change] Added new option for merging differences to conflicting files in automatic updater</li>

View file

@ -1275,19 +1275,17 @@ parse_css_file = {PARSE_CSS_FILE}
$this->page_title = 'EDIT_IMAGESET'; $this->page_title = 'EDIT_IMAGESET';
if (!$imageset_id)
{
trigger_error($user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$update = (isset($_POST['update'])) ? true : false; $update = (isset($_POST['update'])) ? true : false;
$imgname = request_var('imgname', ''); $imgname = request_var('imgname', 'site_logo');
$imgpath = request_var('imgpath', '');
$imgsize = request_var('imgsize', false);
$imgwidth = request_var('imgwidth', 0);
$imgheight = request_var('imgheight', 0);
$imgname = preg_replace('#[^a-z0-9\-+_]#i', '', $imgname); $imgname = preg_replace('#[^a-z0-9\-+_]#i', '', $imgname);
$imgpath = str_replace('..', '.', $imgpath); $sql_extra = $imgnamelang = '';
if ($imageset_id)
{
$sql = 'SELECT imageset_path, imageset_name $sql = 'SELECT imageset_path, imageset_name
FROM ' . STYLES_IMAGESET_TABLE . " FROM ' . STYLES_IMAGESET_TABLE . "
WHERE imageset_id = $imageset_id"; WHERE imageset_id = $imageset_id";
@ -1295,10 +1293,14 @@ parse_css_file = {PARSE_CSS_FILE}
$imageset_row = $db->sql_fetchrow($result); $imageset_row = $db->sql_fetchrow($result);
$db->sql_freeresult($result); $db->sql_freeresult($result);
if (!$imageset_row)
{
trigger_error($user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING);
}
$imageset_path = $imageset_row['imageset_path']; $imageset_path = $imageset_row['imageset_path'];
$imageset_name = $imageset_row['imageset_name']; $imageset_name = $imageset_row['imageset_name'];
$sql_extra = '';
if (strpos($imgname, '-') !== false) if (strpos($imgname, '-') !== false)
{ {
list($imgname, $imgnamelang) = explode('-', $imgname); list($imgname, $imgnamelang) = explode('-', $imgname);
@ -1318,11 +1320,7 @@ parse_css_file = {PARSE_CSS_FILE}
$image_height = $imageset_data_row['image_height']; $image_height = $imageset_data_row['image_height'];
$image_lang = $imageset_data_row['image_lang']; $image_lang = $imageset_data_row['image_lang'];
$image_id = $imageset_data_row['image_id']; $image_id = $imageset_data_row['image_id'];
$imgsize = ($imageset_data_row['image_width'] && $imageset_data_row['image_height']) ? 1 : 0;
if (!$imageset_row)
{
trigger_error($user->lang['NO_IMAGESET'] . adm_back_link($this->u_action), E_USER_WARNING);
}
// Check to see whether the selected image exists in the table // Check to see whether the selected image exists in the table
$valid_name = ($update) ? false : true; $valid_name = ($update) ? false : true;
@ -1336,14 +1334,22 @@ parse_css_file = {PARSE_CSS_FILE}
} }
} }
if ($update && isset($_POST['imgpath'])) if ($update && isset($_POST['imgpath']) && $valid_name)
{
if ($valid_name)
{ {
// If imgwidth and imgheight are non-zero grab the actual size // If imgwidth and imgheight are non-zero grab the actual size
// from the image itself ... we ignore width settings for the poll center image // from the image itself ... we ignore width settings for the poll center image
$imgwidth = request_var('imgwidth', 0); $imgwidth = request_var('imgwidth', 0);
$imgheight = request_var('imgheight', 0); $imgheight = request_var('imgheight', 0);
$imgsize = request_var('imgsize', 0);
$imgpath = request_var('imgpath', '');
$imgpath = str_replace('..', '.', $imgpath);
// If no dimensions selected, we reset width and height to 0 ;)
if (!$imgsize)
{
$imgwidth = $imgheight = 0;
}
$imglang = ''; $imglang = '';
if ($imgpath && !file_exists("{$phpbb_root_path}styles/$imageset_path/imageset/$imgpath")) if ($imgpath && !file_exists("{$phpbb_root_path}styles/$imageset_path/imageset/$imgpath"))
@ -1351,6 +1357,7 @@ parse_css_file = {PARSE_CSS_FILE}
trigger_error($user->lang['NO_IMAGE_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING); trigger_error($user->lang['NO_IMAGE_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING);
} }
// Determine width/height. If dimensions included and no width/height given, we detect them automatically...
if ($imgsize && $imgpath) if ($imgsize && $imgpath)
{ {
if (!$imgwidth || !$imgheight) if (!$imgwidth || !$imgheight)
@ -1363,7 +1370,6 @@ parse_css_file = {PARSE_CSS_FILE}
$imgheight = (int) $imgheight; $imgheight = (int) $imgheight;
} }
if (strpos($imgpath, '/') !== false) if (strpos($imgpath, '/') !== false)
{ {
list($imglang, $imgfilename) = explode('/', $imgpath); list($imglang, $imgfilename) = explode('/', $imgpath);
@ -1407,8 +1413,6 @@ parse_css_file = {PARSE_CSS_FILE}
$image_height = $imgheight; $image_height = $imgheight;
$image_lang = $imglang; $image_lang = $imglang;
} }
}
}
$imglang = ''; $imglang = '';
$imagesetlist = array('nolang' => array(), 'lang' => array()); $imagesetlist = array('nolang' => array(), 'lang' => array());