Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
ncphp
/
mcClasses
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 067de31b
authored
Apr 12, 2012
by
meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mcValidator um password regExp ergänzt
1 parent
ccada8aa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
13 deletions
service/qrcode/.htaccess
service/qrcode/.htaccess
validation/class_mcValidator.inc.php
service/qrcode/.htaccess
deleted
120000 → 0
View file @
ccada8a
_htaccess
\ No newline at end of file
service/qrcode/.htaccess
0 → 100755
View file @
067de31
RewriteEngine
on
RewriteCond
%{REQUEST_FILENAME} !-f
RewriteRule
^(.*?)$ index.php?qrcode=$1 [QSA,L]
validation/class_mcValidator.inc.php
View file @
067de31
...
@@ -11,42 +11,54 @@ class mcValidator {
...
@@ -11,42 +11,54 @@ class mcValidator {
const
VALIDATOR_TYPE_EMAIL
=
'email'
;
const
VALIDATOR_TYPE_EMAIL
=
'email'
;
const
VALIDATOR_TYPE_URL
=
'url'
;
const
VALIDATOR_TYPE_URL
=
'url'
;
const
VALIDATOR_TYPE_SINGELTONNAME
=
'singeltonName'
;
const
VALIDATOR_TYPE_SINGELTONNAME
=
'singeltonName'
;
const
VALIDATOR_TYPE_PHONE
=
'
singeltonNam
e'
;
const
VALIDATOR_TYPE_PHONE
=
'
phon
e'
;
const
VALIDATOR_TYPE_GERPLZ
=
'gerPlz'
;
const
VALIDATOR_TYPE_GERPLZ
=
'gerPlz'
;
const
VALIDATOR_TYPE_YOUTUBEID
=
'youtubeID'
;
const
VALIDATOR_TYPE_YOUTUBEID
=
'youtubeID'
;
const
VALIDATOR_TYPE_VIMEOID
=
'vimeoID'
;
const
VALIDATOR_TYPE_VIMEOID
=
'vimeoID'
;
const
VALIDATOR_TYPE_PASSWORD
=
'password'
;
private
static
$regExpArray
=
array
(
private
static
$regExpArray
=
array
(
self
::
VALIDATOR_TYPE_URL
=>
array
(
self
::
VALIDATOR_TYPE_URL
=>
array
(
'regExp'
=>
'
/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
'
,
'regExp'
=>
'
(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?
'
,
'match'
=>
true
'match'
=>
true
),
),
self
::
VALIDATOR_TYPE_SINGELTONNAME
=>
array
(
self
::
VALIDATOR_TYPE_SINGELTONNAME
=>
array
(
'regExp'
=>
'
/[^A-Za-z0-9\-]/
'
,
'regExp'
=>
'
[^A-Za-z0-9\-]
'
,
'match'
=>
false
'match'
=>
false
),
),
self
::
VALIDATOR_TYPE_PHONE
=>
array
(
self
::
VALIDATOR_TYPE_PHONE
=>
array
(
'regExp'
=>
'
/[^-\s\d.\(\)\/+]/
'
,
'regExp'
=>
'
[^-\s\d.\(\)\/+]
'
,
'match'
=>
false
'match'
=>
false
),
),
self
::
VALIDATOR_TYPE_GERPLZ
=>
array
(
self
::
VALIDATOR_TYPE_GERPLZ
=>
array
(
'regExp'
=>
'
/\d{5}$/
'
,
'regExp'
=>
'
\d{5}$
'
,
'match'
=>
true
'match'
=>
true
),
),
self
::
VALIDATOR_TYPE_YOUTUBEID
=>
array
(
self
::
VALIDATOR_TYPE_YOUTUBEID
=>
array
(
'regExp'
=>
'
/[^A-Za-z0-9\-\_]/
'
,
'regExp'
=>
'
[^A-Za-z0-9\-\_]
'
,
'match'
=>
false
'match'
=>
false
),
),
self
::
VALIDATOR_TYPE_VIMEOID
=>
array
(
self
::
VALIDATOR_TYPE_VIMEOID
=>
array
(
'regExp'
=>
'
/[\D]/
'
,
'regExp'
=>
'
[\D]
'
,
'match'
=>
false
'match'
=>
false
),
self
::
VALIDATOR_TYPE_PASSWORD
=>
array
(
'regExp'
=>
'^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}'
,
'match'
=>
true
)
)
);
);
public
static
function
getRegExp
(
$param_type
){
if
(
array_key_exists
(
$param_type
,
self
::
$regExpArray
)){
return
self
::
$regExpArray
[
$param_type
];
}
else
{
return
null
;
}
}
/**
/**
* Attention: function
returns true
if $param_type is not const of VALIDATOR_TYPE_*
* Attention: function
only checks value exists
if $param_type is not const of VALIDATOR_TYPE_*
*
*
* @param String $param_value
* @param String $param_value
* @param String $param_type - the regexpression-type which should be used
* @param String $param_type - the regexpression-type which should be used
...
@@ -74,7 +86,7 @@ class mcValidator {
...
@@ -74,7 +86,7 @@ class mcValidator {
case
self
::
VALIDATOR_TYPE_EMAIL
:
return
self
::
checkEmail
(
$param_value
,
$param_allowNoValue
);
case
self
::
VALIDATOR_TYPE_EMAIL
:
return
self
::
checkEmail
(
$param_value
,
$param_allowNoValue
);
default
:
default
:
if
(
array_key_exists
(
$param_type
,
self
::
$regExpArray
)){
if
(
array_key_exists
(
$param_type
,
self
::
$regExpArray
)){
$var_regExp
=
self
::
$regExpArray
[
$param_type
][
'regExp'
]
;
$var_regExp
=
'/'
+
self
::
$regExpArray
[
$param_type
][
'regExp'
]
+
'/'
;
$var_match
=
self
::
$regExpArray
[
$param_type
][
'match'
];
$var_match
=
self
::
$regExpArray
[
$param_type
][
'match'
];
}
}
else
{
else
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment