]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/imagefile.php
Merge branch 'diskcache' into 0.9.x
[quix0rs-gnu-social.git] / lib / imagefile.php
index 2619fd9d3bed9bca2a8e536dd76f195f81260941..6bc8e599b3022f7aa29d9c80045157989f627293 100644 (file)
@@ -28,7 +28,7 @@
  * @link      http://status.net/
  */
 
-if (!defined('STATUSNET')) {
+if (!defined('STATUSNET') && !defined('LACONICA')) {
     exit(1);
 }
 
@@ -72,14 +72,19 @@ class ImageFile
             break;
          case UPLOAD_ERR_INI_SIZE:
          case UPLOAD_ERR_FORM_SIZE:
-            throw new Exception(sprintf(_('That file is too big. The maximum file size is %d.'),
+            throw new Exception(sprintf(_('That file is too big. The maximum file size is %s.'),
                 ImageFile::maxFileSize()));
             return;
          case UPLOAD_ERR_PARTIAL:
             @unlink($_FILES[$param]['tmp_name']);
             throw new Exception(_('Partial upload.'));
             return;
+         case UPLOAD_ERR_NO_FILE:
+            // No file; probably just a non-AJAX submission.
+            return;
          default:
+            common_log(LOG_ERR, __METHOD__ . ": Unknown upload error " .
+                $_FILES[$param]['error']);
             throw new Exception(_('System error uploading file.'));
             return;
         }
@@ -209,9 +214,9 @@ class ImageFile
         $value = ImageFile::maxFileSizeInt();
 
         if ($value > 1024 * 1024) {
-            return ($value/(1024*1024)).'Mb';
+            return ($value/(1024*1024)) . _('MB');
         } else if ($value > 1024) {
-            return ($value/(1024)).'kB';
+            return ($value/(1024)) . _('kB');
         } else {
             return $value;
         }