Added new field and fixes for check components

This commit is contained in:
Antonio de la Rosa 2015-11-16 04:16:23 +01:00
parent 3054f272da
commit b0b3292539
3 changed files with 32 additions and 1 deletions

View file

@ -0,0 +1,30 @@
<?php
namespace PhangoApp\PhaModels\CoreFields;
use PhangoApp\PhaModels\CoreFields\CharField;
use PhangoApp\PhaUtils\Utils;
class IpField extends CharField {
public function check($value)
{
//Delete Javascript tags and simple quotes.
if(filter_var($value, FILTER_VALIDATE_IP))
{
return $value;
}
else
{
return false;
}
}
}
?>

View file

@ -317,7 +317,7 @@ class ModelForm {
{
$form=$arr_form[$key_form];
$post[$key_form]=$form->field->check($post[$key_form]);
if($post[$key_form]=='' && $form->required==1)

View file

@ -2030,6 +2030,7 @@ class Webmodel {
$this->forms[$component_name]->default_value=$component->default_value;
$this->forms[$component_name]->required=$component->required;
$this->forms[$component_name]->label=$component->label;
$this->forms[$component_name]->field=&$this->components[$component_name];
$this->check_enctype+=$this->forms[$component_name]->enctype;