/** * The link that can be send in an e-mail as download link. * * @return string */ public function getEmailDownloadURL($html = true, $newExpireTime = false, $deleteWhenExpired = false) { if ($newExpireTime) { $this->random_code = \GO\Base\Util\String::randomPassword(11, 'a-z,A-Z,0-9'); $this->expire_time = $newExpireTime; $this->delete_when_expired = $deleteWhenExpired; $this->save(); } if (!empty($this->expire_time) && !empty($this->random_code)) { return \GO::url('files/file/download', array('id' => $this->id, 'random_code' => $this->random_code, 'inline' => 'false'), false, $html); } }
public function validate() { if ($this->max_rows_list > 250) { $this->setValidationError('max_rows_list', GO::t('maxRowslistTooHigh')); } if ($this->isModified('password') && isset($this->passwordConfirm) && $this->passwordConfirm != $this->password) { $this->setValidationError('passwordConfirm', GO::t('passwordMatchError')); } if ($this->isModified('disk_quota') && !GO::$ignoreAclPermissions && GO::user()->getModulePermissionLevel('users') < Acl::MANAGE_PERMISSION) { $this->setValidationError('disk_quota', 'Only managers of the "users" module may modify disk quota'); } if (GO::config()->password_validate && $this->isModified('password')) { if (!\GO\Base\Util\Validate::strongPassword($this->password)) { $this->setValidationError('password', \GO\Base\Util\Validate::getPasswordErrorString($this->password)); } } if ($this->isNew && $this->_maxUsersReached()) { $this->setValidationError('form', GO::t('max_users_reached', 'users')); } if (!GO::config()->allow_duplicate_email) { $existing = $this->findSingleByAttribute('email', $this->email); if ($this->isNew && $existing || $existing && $existing->id != $this->id) { $this->setValidationError('email', GO::t('error_email_exists', 'users')); } } $existing = $this->findSingleByAttribute('username', $this->username); if ($this->isNew && $existing || $existing && $existing->id != $this->id) { $this->setValidationError('username', GO::t('error_username_exists', 'users')); } if (empty($this->password) && $this->isNew) { $this->password = \GO\Base\Util\String::randomPassword(); $this->generatedRandomPassword = true; } return parent::validate(); }