Cleanup comments. Small bugfixes. Third run
[fa-stable.git] / inventory / manage / items.php
index 54df94bf68969db2202871c05bdb4734385f68a9..3725aca9e84b5d5fa783c142d3be74c05ebced4b 100644 (file)
@@ -64,13 +64,22 @@ if (isset($_FILES['pic']) && $_FILES['pic']['name'] != '')
                mkdir($filename);
        }       
        $filename .= "/".item_img_name($stock_id).".jpg";
+
+  if ($_FILES['pic']['error'] == UPLOAD_ERR_INI_SIZE) {
+    display_error(_('The file size is over the maximum allowed.'));
+               $upload_file ='No';
+  }
+  elseif ($_FILES['pic']['error'] > 0) {
+               display_error(_('Error uploading file.'));
+               $upload_file ='No';
+  }
        
        //But check for the worst 
        if ((list($width, $height, $type, $attr) = getimagesize($_FILES['pic']['tmp_name'])) !== false)
                $imagetype = $type;
        else
                $imagetype = false;
-       //$imagetype = exif_imagetype($_FILES['pic']['tmp_name']);
+
        if ($imagetype != IMAGETYPE_GIF && $imagetype != IMAGETYPE_JPEG && $imagetype != IMAGETYPE_PNG)
        {       //File type Check
                display_warning( _('Only graphics files can be uploaded'));
@@ -89,7 +98,7 @@ if (isset($_FILES['pic']) && $_FILES['pic']['name'] != '')
        elseif ( $_FILES['pic']['type'] == "text/plain" ) 
        {  //File type Check
                display_warning( _('Only graphics files can be uploaded'));
-               $upload_file ='No';
+        $upload_file ='No';
        } 
        elseif (file_exists($filename))
        {
@@ -262,7 +271,7 @@ function item_settings(&$stock_id, $new_item)
 
        table_section(1);
 
-       table_section_title(_("Item"));
+       table_section_title(_("General Settings"));
 
        //------------------------------------------------------------------------------------
        if ($new_item) 
@@ -393,7 +402,7 @@ function item_settings(&$stock_id, $new_item)
        if (isset($_POST['NewStockID']) && file_exists(company_path().'/images/'
                .item_img_name($_POST['NewStockID']).".jpg")) 
        {
-        // 31/08/08 - rand() call is necessary here to avoid caching problems. Thanks to Peter D.
+        // 31/08/08 - rand() call is necessary here to avoid caching problems.
                $stock_img_link .= "<img id='item_img' alt = '[".$_POST['NewStockID'].".jpg".
                        "]' src='".company_path().'/images/'.item_img_name($_POST['NewStockID']).
                        ".jpg?nocache=".rand()."'"." height='".$SysPrefs->pic_height."' border='0'>";