diff options
author | Richard Foote <dicky@phpbb.com> | 2011-12-29 16:27:48 -0500 |
---|---|---|
committer | Richard Foote <dicky@phpbb.com> | 2011-12-29 16:27:48 -0500 |
commit | d5dc70cbe3be0f18666a0dc7e972b9d6766291af (patch) | |
tree | 1628a08c187b5c031acfcb3e6452ba0d5be41e90 /phpBB/includes | |
parent | 51f8f642de537ee826a1da07b6b06374df9fc236 (diff) | |
download | forums-d5dc70cbe3be0f18666a0dc7e972b9d6766291af.tar forums-d5dc70cbe3be0f18666a0dc7e972b9d6766291af.tar.gz forums-d5dc70cbe3be0f18666a0dc7e972b9d6766291af.tar.bz2 forums-d5dc70cbe3be0f18666a0dc7e972b9d6766291af.tar.xz forums-d5dc70cbe3be0f18666a0dc7e972b9d6766291af.zip |
[ticket/10407] Fix check for empty image paths in convertor
This applies to avatar_path,avatar_gallery_path,smilies_path and
upload_path.
Currently, the convertor gets each path from the config table and adds a
trailing slash. If there is no entry in the config table for the path, the
path can never be empty because of the added trailing slash. This patch
will temporarily remove the trailing slash, then check if the path is
empty.
PHPBB3-10407
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/functions_convert.php | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 4a359dcade..4663fe46cc 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -424,7 +424,10 @@ function import_avatar_gallery($gallery_name = '', $subdirs_as_galleries = false $relative_path = empty($convert->convertor['source_path_absolute']); - if (empty($convert->convertor['avatar_gallery_path'])) + // strip trailing slash + $trimmed_avatar_gallery_path = rtrim($convert->convertor['avatar_gallery_path'], '/'); + + if (empty($trimmed_avatar_gallery_path)) { $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_GALLERY_PATH'], 'import_avatar_gallery()'), __LINE__, __FILE__); } @@ -588,7 +591,10 @@ function import_attachment($source, $use_target = false) global $convert, $phpbb_root_path, $config, $user; - if (empty($convert->convertor['upload_path'])) + // strip trailing slash + $trimmed_upload_path = rtrim($convert->convertor['upload_path'], '/'); + + if (empty($trimmed_upload_path)) { $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_UPLOAD_DIR'], 'import_attachment()'), __LINE__, __FILE__); } @@ -647,7 +653,10 @@ function import_smiley($source, $use_target = false) global $convert, $phpbb_root_path, $config, $user; - if (!isset($convert->convertor['smilies_path'])) + // strip trailing slash + $trimmed_smilies_path = rtrim($convert->convertor['smilies_path'], '/'); + + if (empty($trimmed_smilies_path)) { $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_SMILIES_PATH'], 'import_smiley()'), __LINE__, __FILE__); } @@ -667,7 +676,10 @@ function import_avatar($source, $use_target = false, $user_id = false) global $convert, $phpbb_root_path, $config, $user; - if (!isset($convert->convertor['avatar_path'])) + // strip trailing slash + $trimmed_avatar_path = rtrim($convert->convertor['avatar_path'], '/'); + + if (empty($trimmed_avatar_path)) { $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_AVATAR_PATH'], 'import_avatar()'), __LINE__, __FILE__); } |