Esempio n. 1
0
 private function _validateAvatar()
 {
     if (!isset($this->request->files['avatar']['tmp_name']) || !isset($this->request->files['avatar']['name'])) {
         $this->_error['common'] = tt('Image file is wrong!');
         $this->security_log->write('Uploaded image file is wrong (tmp_name or name indexes is not exists)');
     } else {
         if (!ValidatorUpload::imageValid(array('name' => $this->request->files['avatar']['name'], 'tmp_name' => $this->request->files['avatar']['tmp_name']), QUOTA_IMAGE_MAX_FILE_SIZE, USER_IMAGE_ORIGINAL_MIN_WIDTH, USER_IMAGE_ORIGINAL_MIN_HEIGHT, ALLOWED_IMAGE_EXTENSION)) {
             $this->_error['common'] = sprintf(tt('The image is not valid %s file!'), mb_strtoupper(ALLOWED_IMAGE_EXTENSION));
             $this->security_log->write('Uploaded image file is not valid');
         }
     }
     return !$this->_error;
 }
Esempio n. 2
0
 private function _validateImage()
 {
     if (!isset($this->request->get['row']) || empty($this->request->get['row'])) {
         $this->_error['image']['common'] = tt('Image row is wrong!');
         $this->security_log->write('Uploaded image row is wrong');
     } else {
         if (!isset($this->request->files['image']['tmp_name'][$this->request->get['row']]) || !isset($this->request->files['image']['name'][$this->request->get['row']])) {
             $this->_error['image']['common'] = tt('Image file is wrong!');
             $this->security_log->write('Uploaded image file is wrong (tmp_name or name indexes is not exists)');
         } else {
             if (!ValidatorUpload::imageValid(array('name' => $this->request->files['image']['name'][$this->request->get['row']], 'tmp_name' => $this->request->files['image']['tmp_name'][$this->request->get['row']]), QUOTA_IMAGE_MAX_FILE_SIZE, PRODUCT_IMAGE_ORIGINAL_MIN_WIDTH, PRODUCT_IMAGE_ORIGINAL_MIN_HEIGHT)) {
                 $this->_error['image']['common'] = tt('This is a not valid image file!');
                 $this->security_log->write('Uploaded image file is not valid');
             }
         }
     }
     return !$this->_error;
 }