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