Beispiel #1
0
 public function init()
 {
     if ($this->enableIDN && !function_exists('idn_to_ascii')) {
         $this->addError($this->intlErrorMessage);
     }
     parent::init();
 }
Beispiel #2
0
 public function init()
 {
     if (!is_array($this->range)) {
         throw new \InvalidArgumentException($this->rangeErrorMessage);
     }
     parent::init();
 }
Beispiel #3
0
 public function init()
 {
     if ($this->message === null) {
         switch ($this->operator) {
             case '==':
                 $this->message = '{compareAttribute} must be repeated exactly.';
                 break;
             case '===':
                 $this->message = '{compareAttribute} must be repeated exactly.';
                 break;
             case '!=':
                 $this->message = '{compareAttribute} must not be equal to "{compareValue}".';
                 break;
             case '!==':
                 $this->message = '{compareAttribute} must not be equal to "{compareValue}".';
                 break;
             case '>':
                 $this->message = '{compareAttribute} must be greater than "{compareValue}".';
                 break;
             case '>=':
                 $this->message = '{compareAttribute} must be greater than or equal to "{compareValue}".';
                 break;
             case '<':
                 $this->message = '{compareAttribute} must be less than "{compareValue}".';
                 break;
             case '<=':
                 $this->message = '{compareAttribute} must be less than or equal to "{compareValue}".';
                 break;
             default:
                 $this->addError('Unknown operator: {operator}', ['{operator}' => $this->operator]);
         }
     }
     parent::init();
 }
Beispiel #4
0
 public function init()
 {
     if ($this->edsn) {
         $this->parseEDSN();
     }
     if (!$this->table || !$this->column) {
         throw new \UnexpectedValueException('Table and column must be specified');
     }
     if (!is_string($this->table) || !is_string($this->column)) {
         throw new \UnexpectedValueException('Table and column must be set as string');
     }
     mysqli_report(MYSQLI_REPORT_STRICT);
     $mysqli = new \mysqli($this->host, $this->user, $this->pass, $this->dbname);
     if ($mysqli->connect_errno) {
         throw new \mysqli_sql_exception(printf("Connection error: %s\n", $mysqli->connect_error));
     }
     $this->conn = $mysqli;
     parent::init();
 }
Beispiel #5
0
 public function init()
 {
     if (!is_array($this->extensions)) {
         $this->extensions = preg_split('/[\\s,]+/', strtolower($this->extensions), -1, PREG_SPLIT_NO_EMPTY);
     } else {
         $this->extensions = array_map('strtolower', $this->extensions);
     }
     if (!is_array($this->mimeTypes)) {
         $this->mimeTypes = preg_split('/[\\s,]+/', strtolower($this->mimeTypes), -1, PREG_SPLIT_NO_EMPTY);
     } else {
         $this->mimeTypes = array_map('strtolower', $this->mimeTypes);
     }
     $uploadMaxFileSize = $this->sizeToBytes(ini_get('upload_max_filesize'));
     if (isset($_POST['MAX_FILE_SIZE']) && $_POST['MAX_FILE_SIZE'] > 0 && $_POST['MAX_FILE_SIZE'] < $uploadMaxFileSize) {
         $uploadMaxFileSize = (int) $_POST['MAX_FILE_SIZE'];
     }
     if ($this->maxSize == null || $this->maxSize > $uploadMaxFileSize) {
         $this->maxSize = $uploadMaxFileSize;
     }
     parent::init();
 }