X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fimagefile.php;h=6bc8e599b3022f7aa29d9c80045157989f627293;hb=ca2a88545d353f0e887f48fe0e3bd43b505031ca;hp=52e4c4b2272d66e8a2b9e0de1612e0a73e7d308e;hpb=abd74673921cd119e05089d3cce2f0a37fdb49fe;p=quix0rs-gnu-social.git diff --git a/lib/imagefile.php b/lib/imagefile.php index 52e4c4b227..6bc8e599b3 100644 --- a/lib/imagefile.php +++ b/lib/imagefile.php @@ -1,6 +1,6 @@ . * * @category Image - * @package Laconica - * @author Evan Prodromou - * @author Zach Copley - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou + * @author Zach Copley + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -38,11 +38,11 @@ if (!defined('LACONICA')) { * Makes it slightly easier to accept an image file from upload. * * @category Image - * @package Laconica - * @author Evan Prodromou - * @author Zach Copley + * @package StatusNet + * @author Evan Prodromou + * @author Zach Copley * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class ImageFile @@ -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; }