Commit 9c637a3a authored by Tino Goratsch's avatar Tino Goratsch

removed some now obsolete validation rules

parent fe2f2b4c
......@@ -2,6 +2,7 @@
namespace ACP3\Core\Helpers\Formatter;
use ACP3\Core;
use ACP3\Modules\ACP3\Seo\Validator\ValidationRules\UriAliasValidationRule;
/**
* Class RewriteInternalUri
......@@ -22,27 +23,27 @@ class RewriteInternalUri
*/
protected $router;
/**
* @var \ACP3\Core\Validator\Rules\Router\Aliases
* @var \ACP3\Modules\ACP3\Seo\Validator\ValidationRules\UriAliasValidationRule
*/
protected $aliasesValidator;
protected $uriAliasValidationRule;
/**
* @param \ACP3\Core\Modules\Helper\ControllerActionExists $controllerActionExists
* @param \ACP3\Core\Http\Request $request
* @param \ACP3\Core\Router $router
* @param \ACP3\Core\Validator\Rules\Router\Aliases $aliasValidator
* @param \ACP3\Core\Modules\Helper\ControllerActionExists $controllerActionExists
* @param \ACP3\Core\Http\Request $request
* @param \ACP3\Core\Router $router
* @param \ACP3\Modules\ACP3\Seo\Validator\ValidationRules\UriAliasValidationRule $uriAliasValidationRule
*/
public function __construct(
Core\Modules\Helper\ControllerActionExists $controllerActionExists,
Core\Http\Request $request,
Core\Router $router,
Core\Validator\Rules\Router\Aliases $aliasValidator
UriAliasValidationRule $uriAliasValidationRule
)
{
$this->controllerActionExists = $controllerActionExists;
$this->request = $request;
$this->router = $router;
$this->aliasesValidator = $aliasValidator;
$this->uriAliasValidationRule = $uriAliasValidationRule;
}
/**
......@@ -72,7 +73,7 @@ class RewriteInternalUri
*/
private function _rewriteInternalUriCallback($matches)
{
if ($this->aliasesValidator->uriAliasExists($matches[7]) === true) {
if ($this->uriAliasValidationRule->isValid($matches[7]) === true) {
return $matches[0];
} else {
$uriArray = explode('/', $matches[7]);
......
<?php
namespace ACP3\Core\Validator\Rules;
use ACP3\Core;
use ACP3\Modules\ACP3\Captcha\Validator\ValidationRules\CaptchaValidationRule;
/**
* Class Captcha
* @package ACP3\Core\Validator\Rules
*
* @deprecated
*/
class Captcha
{
/**
* @var \ACP3\Modules\ACP3\Captcha\Validator\ValidationRules\CaptchaValidationRule
*/
protected $captchaValidationRule;
/**
* Captcha constructor.
*
* @param \ACP3\Modules\ACP3\Captcha\Validator\ValidationRules\CaptchaValidationRule $captchaValidationRule
*/
public function __construct(CaptchaValidationRule $captchaValidationRule)
{
$this->captchaValidationRule = $captchaValidationRule;
}
/**
* @param string $input
* @param string $path
*
* @return boolean
*
* @deprecated
*/
public function captcha($input, $path = '')
{
return $this->captchaValidationRule->isValid($input, '', ['path' => $path]);
}
}
<?php
namespace ACP3\Core\Validator\Rules;
use ACP3\Core;
/**
* Class Mime
* @package ACP3\Core\Validator\Rules
*
* @deprecated
*/
class Mime
{
/**
* @var \ACP3\Core\Validator\ValidationRules\PictureValidationRule
*/
protected $pictureValidationRule;
/**
* Mime constructor.
*
* @param \ACP3\Core\Validator\ValidationRules\PictureValidationRule $pictureValidationRule
*/
public function __construct(Core\Validator\ValidationRules\PictureValidationRule $pictureValidationRule)
{
$this->pictureValidationRule = $pictureValidationRule;
}
/**
* Überprüfen, ob es ein unterstütztes Bildformat ist
*
* @param string $file
* Zu überprüfendes Bild
* @param string $width
* @param string $height
* @param string $filesize
*
* @return boolean
*
* @deprecated
*/
public function isPicture($file, $width = '', $height = '', $filesize = '')
{
return $this->pictureValidationRule->isValid($file, [], [
'width' => $width,
'height' => $height,
'filesize' => $filesize
]);
}
/**
* Gibt in Abhängigkeit des Parameters $mimetype entweder
* den gefundenen MIMETYPE aus oder ob der gefundene MIMETYPE
* mit dem erwarteten übereinstimmt
*
* @param string $file
* Die zu überprüfende Datei
* @param string $mimeType
* Der zu vergleichende MIMETYPE
*
* @return mixed
*
* @deprecated
*/
public function mimeType($file, $mimeType = '')
{
$return = '';
if (is_file($file) === true) {
if (function_exists('finfo_open') === true && $fp = finfo_open(FILEINFO_MIME)) {
$return = finfo_file($fp, $file);
finfo_close($fp);
} elseif (function_exists('mime_content_type') === true) {
$return = mime_content_type($file);
}
if (!empty($mimeType)) {
return $return == $mimeType ? true : false;
}
}
return $return;
}
}
<?php
namespace ACP3\Core\Validator\Rules;
use ACP3\Core\Validator\ValidationRules\InternalUriValidationRule;
use ACP3\Core\Validator\ValidationRules\UriSafeValidationRule;
/**
* Class Router
* @package ACP3\Core\Validator\Rules
*
* @deprecated
*/
class Router
{
/**
* @var \ACP3\Core\Validator\ValidationRules\UriSafeValidationRule
*/
protected $uriSafeValidationRule;
/**
* @var \ACP3\Core\Validator\ValidationRules\InternalUriValidationRule
*/
protected $internalUriValidationRule;
/**
* Router constructor.
*
* @param \ACP3\Core\Validator\ValidationRules\UriSafeValidationRule $uriSafeValidationRule
* @param \ACP3\Core\Validator\ValidationRules\InternalUriValidationRule $internalUriValidationRule
*/
public function __construct(
UriSafeValidationRule $uriSafeValidationRule,
InternalUriValidationRule $internalUriValidationRule
)
{
$this->uriSafeValidationRule = $uriSafeValidationRule;
$this->internalUriValidationRule = $internalUriValidationRule;
}
/**
* Überprüft, ob der eingegebene URI-Alias sicher ist, d.h. es dürfen nur
* die Kleinbuchstaben von a-z, Zahlen, der Bindestrich und das Slash eingegeben werden
*
* @param string $var
*
* @return boolean
*
* @deprecated
*/
public function isUriSafe($var)
{
return $this->uriSafeValidationRule->isValid($var);
}
/**
* Überprüft, ob die übergebene URI dem Format des ACP3 entspricht
*
* @param mixed $var
*
* @return boolean
*
* @deprecated
*/
public function isInternalURI($var)
{
return $this->internalUriValidationRule->isValid($var);
}
}
<?php
namespace ACP3\Core\Validator\Rules\Router;
use ACP3\Core;
use ACP3\Modules\ACP3\Seo;
/**
* Class Aliases
* @package ACP3\Core\Validator\Rules\Router
*
* @deprecated
*/
class Aliases
{
/**
* @var \ACP3\Modules\ACP3\Seo\Validator\ValidationRules\UriAliasValidationRule
*/
protected $uriAliasValidationRule;
/**
* Aliases constructor.
*
* @param \ACP3\Modules\ACP3\Seo\Validator\ValidationRules\UriAliasValidationRule $uriAliasValidationRule
*/
public function __construct(Seo\Validator\ValidationRules\UriAliasValidationRule $uriAliasValidationRule)
{
$this->uriAliasValidationRule = $uriAliasValidationRule;
}
/**
* Überprüft, ob ein URI-Alias bereits existiert
*
* @param string $alias
* @param string $path
*
* @return boolean
*
* @deprecated
*/
public function uriAliasExists($alias, $path = '')
{
return $this->uriAliasValidationRule->isValid($alias, '', ['path' => $path]);
}
}
......@@ -58,4 +58,4 @@ services:
core.helpers.formatter.rewriteInternalUri:
class: ACP3\Core\Helpers\Formatter\RewriteInternalUri
arguments: [@core.modules.helper.controllerActionExists, @core.request, '@core.router', '@core.validator.rules.router.aliases']
arguments: [@core.modules.helper.controllerActionExists, @core.request, '@core.router', @seo.validator.validation_rules.uri_alias_validation_rule]
......@@ -104,26 +104,10 @@ services:
class: ACP3\Core\Validator\Rules\ACL
arguments: [@permissions.validator.validation_rules.privileges_exist_validation_rule, @permissions.validator.validation_rules.roles_exist_validation_rule]
core.validator.rules.captcha:
class: ACP3\Core\Validator\Rules\Captcha
arguments: [@captcha.validator.validation_rules.captcha_validation_rule]
core.validator.rules.date:
class: ACP3\Core\Validator\Rules\Date
arguments: [@core.validator.validation_rules.date_validation_rule, @core.validator.validation_rules.time_zone_exists_validation_rule, @core.validator.validation_rules.birthday_validation_rule]
core.validator.rules.mime:
class: ACP3\Core\Validator\Rules\Mime
arguments: [@core.validator.validation_rules.picture_validation_rule]
core.validator.rules.misc:
class: ACP3\Core\Validator\Rules\Misc
arguments: [@core.validator.validation_rules.email_validation_rule, @core.validator.validation_rules.form_token_validation_rule, @core.validator.validation_rules.integer_validation_rule]
core.validator.rules.router:
class: ACP3\Core\Validator\Rules\Router
arguments: [@core.validator.validation_rules.uri_safe_validation_rule, @core.validator.validation_rules.internal_uri_validation_rule]
core.validator.rules.router.aliases:
class: ACP3\Core\Validator\Rules\Router\Aliases
arguments: [@seo.validator.validation_rules.uri_alias_validation_rule]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment