mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-15 09:19:57 +09:00
merge from 1.5.3.2 (~r11225)
git-svn-id: http://xe-core.googlecode.com/svn/trunk@11226 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
54e3a72065
commit
77f5aa2671
313 changed files with 8058 additions and 14251 deletions
|
|
@ -71,7 +71,7 @@ class Validator
|
|||
|
||||
// predefined rules
|
||||
$this->addRule(array(
|
||||
'email' => '/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/',
|
||||
'email' => '/^[\w-]+((?:\.|\+|\~)[\w-]+)*@[\w-]+(\.[\w-]+)+$/',
|
||||
'userid' => '/^[a-z]+[\w-]*[a-z0-9_]+$/i',
|
||||
'url' => '/^(https?|ftp|mms):\/\/[0-9a-z-]+(\.[_0-9a-z-]+)+(:\d+)?/',
|
||||
'alpha' => '/^[a-z]*$/i',
|
||||
|
|
@ -199,7 +199,7 @@ class Validator
|
|||
$fields = array_map(array($this, 'arrayTrim'), $fields);
|
||||
$field_names = array_keys($fields);
|
||||
|
||||
$filters = $this->_filters;
|
||||
$filters = array();
|
||||
|
||||
// get field names matching patterns
|
||||
foreach($this->_filters as $key=>$filter) {
|
||||
|
|
@ -210,6 +210,10 @@ class Validator
|
|||
$filters[substr($key,0,-2)] = $filter;
|
||||
unset($filters[$key]);
|
||||
}
|
||||
else
|
||||
{
|
||||
$filters[$key] = $filter;
|
||||
}
|
||||
|
||||
if(!count($names)) continue;
|
||||
|
||||
|
|
@ -222,9 +226,18 @@ class Validator
|
|||
|
||||
foreach($filters as $key=>$filter) {
|
||||
$fname = preg_replace('/\[\]$/', '', $key);
|
||||
$exists = array_key_exists($key, $fields);
|
||||
$filter = array_merge($filter_default, $filter);
|
||||
$value = $exists ? $fields[$fname] : null;
|
||||
|
||||
if(preg_match("/(^[a-z_]*)[\[](?:\'|\")?([a-z_]*)(?:\'|\")?[\]]$/i", $key, $matches))
|
||||
{
|
||||
$exists = array_key_exists($matches[1], $fields);
|
||||
$value = $exists ? $fields[$matches[1]][$matches[2]] : null;
|
||||
}
|
||||
else
|
||||
{
|
||||
$exists = array_key_exists($key, $fields);
|
||||
$value = $exists ? $fields[$fname] : null;
|
||||
}
|
||||
|
||||
if(is_array($value)) $value = implode('', $value);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue