1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 04:38:27 +01:00

Bugtracker #4827 - handle case of no image with news item

This commit is contained in:
e107steved 2009-09-28 21:22:16 +00:00
parent 259d3a3708
commit dad81e479a

View File

@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/submitnews.php,v $ | $Source: /cvs_backup/e107_0.8/submitnews.php,v $
| $Revision: 1.14 $ | $Revision: 1.15 $
| $Date: 2009-09-27 21:45:09 $ | $Date: 2009-09-28 21:22:16 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@ -63,24 +63,6 @@ if (isset($_POST['submitnews_submit']) && $_POST['submitnews_title'] && $_POST['
require_once(e_HANDLER.'upload_handler.php'); require_once(e_HANDLER.'upload_handler.php');
$uploaded = process_uploaded_files(e_IMAGE . 'newspost_images/', FALSE, array('file_mask' => 'jpg,gif,png', 'max_file_count' => 1)); $uploaded = process_uploaded_files(e_IMAGE . 'newspost_images/', FALSE, array('file_mask' => 'jpg,gif,png', 'max_file_count' => 1));
/*
if ($filename && $fileext != "jpg" && $fileext != "gif" && $fileext != "png")
{
$message = SUBNEWSLAN_3;
$submitnews_error = TRUE;
}
if (!$pref['upload_maxfilesize'])
{
$pref['upload_maxfilesize'] = ini_get('upload_max_filesize') * 1048576;
}
if ($filesize > $pref['upload_maxfilesize'])
{
$message = SUBNEWSLAN_4;
$submitnews_error = TRUE;
}
*/
if (($uploaded === FALSE) || !is_array($uploaded)) if (($uploaded === FALSE) || !is_array($uploaded))
{ // Non-specific error { // Non-specific error
$submitnews_error = TRUE; $submitnews_error = TRUE;
@ -92,6 +74,8 @@ if (isset($_POST['submitnews_submit']) && $_POST['submitnews_title'] && $_POST['
$message = handle_upload_messages($uploaded); $message = handle_upload_messages($uploaded);
} }
else else
{
if (isset($uploaded[0]['name']) && isset($uploaded[0]['type']) && isset($uploaded[0]['size']))
{ {
$filename = $uploaded[0]['name']; $filename = $uploaded[0]['name'];
$filetype = $uploaded[0]['type']; $filetype = $uploaded[0]['type'];
@ -113,6 +97,7 @@ if (isset($_POST['submitnews_submit']) && $_POST['submitnews_title'] && $_POST['
rename(e_IMAGE.'newspost_images/'.$filename, e_IMAGE.'newspost_images/'.$submitnews_file); rename(e_IMAGE.'newspost_images/'.$filename, e_IMAGE.'newspost_images/'.$submitnews_file);
} }
} }
}
if ($filename && !file_exists(e_IMAGE."newspost_images/".$submitnews_file)) if ($filename && !file_exists(e_IMAGE."newspost_images/".$submitnews_file))
{ {