nouploadedmediaexception.php 851 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. if (!defined('GNUSOCIAL')) { exit(1); }
  3. /**
  4. * Parent class for an exception when a POST upload does not contain a file.
  5. *
  6. * @category Exception
  7. * @package GNUsocial
  8. * @author Mikael Nordfeldth <mmn@hethane.se>
  9. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPLv3
  10. * @link http://gnu.io/
  11. */
  12. class NoUploadedMediaException extends ClientException
  13. {
  14. public $fieldname = null;
  15. public function __construct($fieldname, $msg=null)
  16. {
  17. $this->fieldname = $fieldname;
  18. if ($msg === null) {
  19. // TRANS: Exception text shown when no uploaded media was provided in POST
  20. // TRANS: %s is the HTML input field name.
  21. $msg = sprintf(_('There is no uploaded media for input field "%s".'), $this->fieldname);
  22. }
  23. parent::__construct($msg, 400);
  24. }
  25. }