private function _validatePackage() { if (!isset($this->request->files['package']['tmp_name']) || !isset($this->request->files['package']['name'])) { $this->_error['file']['common'] = tt('Uploaded package file is wrong!'); $this->security_log->write('Uploaded package file is wrong (tmp_name or name indexes is not exists)'); } else { if (!ValidatorUpload::fileValid($this->request->files['package'], $this->auth->getFileQuota() - ($this->storage->getUsedSpace($this->auth->getId()) - filesize($this->request->files['package']['tmp_name']) / 1000000), STORAGE_FILE_EXTENSION)) { $this->_error['file']['common'] = sprintf(tt('Package file is a not valid %s archive!'), mb_strtoupper(STORAGE_FILE_EXTENSION)); $this->security_log->write('Uploaded package file is not valid'); } } return !$this->_error; }
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; }
private function _validateVideo() { if (!isset($this->request->files['video']['tmp_name']) || !isset($this->request->files['video']['name'])) { $this->_error['video']['common'] = tt('Uploaded video file is wrong!'); $this->security_log->write('Uploaded video file is wrong'); } else { if (!ValidatorUpload::videoValid(array('name' => $this->request->files['video']['name'][$this->request->get['row']], 'tmp_name' => $this->request->files['video']['tmp_name'][$this->request->get['row']]), QUOTA_AUDIO_MAX_FILE_SIZE)) { $this->_error['video']['common'] = tt('Video is not valid!'); $this->security_log->write('Uploaded video file is not valid'); } } return !$this->_error; }