Ejemplo n.º 1
0
 /**
  * @class Q_Exception_Upload
  * @constructor
  * @extends Q_Exception
  * @param {array} [$param=array()]
  * @param {array} [$input_fields=array()]
  */
 function __construct($params = array(), $input_fields = array())
 {
     parent::__construct($params, $input_fields);
     if (!isset($params['code'])) {
         return;
     }
     switch ($params['code']) {
         case UPLOAD_ERR_INI_SIZE:
             $this->message = "the uploaded file exceeds the upload_max_filesize directive in php.ini.";
             break;
         case UPLOAD_ERR_FORM_SIZE:
             $this->message = "value: 2; The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.";
             break;
         case UPLOAD_ERR_PARTIAL:
             $this->message = "value: 3; The uploaded file was only partially uploaded.";
             break;
         case UPLOAD_ERR_NO_FILE:
             $this->message = "value: 4; No file was uploaded.";
             break;
         case UPLOAD_ERR_NO_TMP_DIR:
             $this->message = "value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3.";
             break;
         case UPLOAD_ERR_CANT_WRITE:
             $this->message = "value: 7; Failed to write file to disk. Introduced in PHP 5.1.0.";
             break;
         case UPLOAD_ERR_EXTENSION:
             $this->message = "a PHP extension stopped the file upload.";
             break;
     }
 }
Ejemplo n.º 2
0
 /**
  * @class Q_Exception_PhpError
  * @constructor
  * @param {array} $params
  *  The following values are expected:<br/>
  *  "errstr" => the error message to display<br/>
  *  "errfile" =><br/>
  *  "errline" =><br/>
  *  "fixTrace" => fixes the trace array to<br/>
  * @param {array} $input_fields
  *  Same as in Q_Exception.
  */
 function __construct($params, $input_fields)
 {
     parent::__construct($params, $input_fields);
     if (!empty($params['fixTrace'])) {
         $this->fixTrace = true;
         if (isset($params['errfile']) && isset($params['errline'])) {
             $this->file = $params['errfile'];
             $this->line = $params['errline'];
         }
     }
     $errstr = $params['errstr'];
     $this->message = "(PHP error) {$errstr}";
     switch ($params['errno']) {
         case E_USER_ERROR:
             $this->message = "(PHP error) {$errstr}";
             break;
         case E_USER_WARNING:
             $this->warning = "(PHP warning) {$errstr}";
             break;
         case E_USER_NOTICE:
             $this->message = "(PHP notice) {$errstr}";
             break;
     }
 }