nouploadedmediaexception.php 896 B

1234567891011121314151617181920212223242526272829303132333435
  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 $widgetOpts;
  15. public $scoped;
  16. public $fieldname = null;
  17. public function __construct($fieldname, $msg=null)
  18. {
  19. $this->fieldname = $fieldname;
  20. if ($msg === null) {
  21. // TRANS: Exception text shown when no uploaded media was provided in POST
  22. // TRANS: %s is the HTML input field name.
  23. $msg = sprintf(_('There is no uploaded media for input field "%s".'), $this->fieldname);
  24. }
  25. parent::__construct($msg, 400);
  26. }
  27. }