adding missing file

This commit is contained in:
Dario Rekowski on RockPI 2020-01-17 19:03:31 +00:00
parent 5d3be5dd24
commit 884c37c399

View File

@ -0,0 +1,35 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
namespace App\Model\Validation;
class GenericValidation
{
public static function hexKey64($value, array $context) {
if(strlen($value) != 64) return false;
if(preg_match('/^[[:xdigit:]]*$/', $value)) {
return true;
}
return false;
}
public static function alphaNumeric($value, array $context) {
//if(preg_match('/^[a-zA-Z0-9äöüÄÖÜß _;:()-]\n\r*$/', $value)) {
if(preg_match('/([<>]|&gt;|&lt;|javascript:){1,}/', $value)) {
return false;
}
return true;
}
public static function email($value, array $context) {
if(preg_match('/^[a-zA-Z0-9.!#$%&*+\/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/', $value)) {
return true;
}
return false;
}
}