示例#1
0
 function validate()
 {
     if ($_REQUEST[$this->form->table . '_sess_mode'] != 'insert') {
         return true;
     }
     parent::validate();
     if ($this->value != '' and $this->maxlength > 0) {
         $this->form->validator->length($this->field, '<=', $this->maxlength);
     }
     if ($this->alphanumeric) {
         $this->form->validator->alphaNumeric($this->field);
     } else {
         $this->form->validator->alpha($this->field);
     }
     if ($this->value != '') {
         global $_CAMILA;
         $query = 'select * from ' . $this->form->table . ' where ' . $this->field . '=' . $_CAMILA['db']->Quote($this->value);
         $result = $_CAMILA['db']->Execute($query);
         if ($result === false) {
             camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
         }
         if ($result->RecordCount() > 0) {
             $this->form->validator->setError($this->field, 907);
         }
     }
 }
示例#2
0
 function validate()
 {
     if (!$this->updatable || strpos(strtolower($this->validation), 'ignore') !== false) {
         return true;
     }
     parent::validate();
     if ($this->value != '' and $this->maxchars > 0) {
         $this->form->validator->length($this->field, '<=', $this->maxchars);
     }
 }
示例#3
0
 function validate()
 {
     parent::validate();
     $ar = explode('.', $this->value);
     $count = 0;
     foreach ($ar as $val) {
         $strlen = strlen($val);
         if ($strlen > 0) {
             if (!preg_match("/^[0-9]{" . $strlen . "}\$/", $val)) {
                 $this->form->validator->setError($this->field, 908);
             }
         }
         $count++;
     }
     if ($count > 2) {
         $this->form->validator->setError($this->field, 908);
     }
 }
 function validate()
 {
     parent::validate();
     if ($this->value != '') {
         global $_CAMILA;
         $query = 'select password from ' . CAMILA_TABLE_USERS . ' where id=' . $_CAMILA['db']->Quote($_CAMILA['user_id']);
         $result = $_CAMILA['db']->Execute($query);
         if ($result === false) {
             camila_error_page(camila_get_translation('camila.sqlerror') . ' ' . $_CAMILA['db']->ErrorMsg());
         }
         if ($result->RecordCount() == 1) {
             if ($result->fields['password'] != $_REQUEST[$this->key . '_old']) {
                 $this->form->validator->setError($this->field, 910);
             }
         } else {
             $this->form->validator->setError($this->field, 910);
         }
     }
     if ($_REQUEST[$this->key . '_confirm'] != $this->value) {
         $this->form->validator->setError($this->field, 911);
     }
 }
示例#5
0
 function validate()
 {
     if (!$this->updatable || strpos(strtolower($this->validation), 'ignore') !== false) {
         return true;
     }
     parent::validate();
     $found = false;
     reset($this->options);
     while ($tok = each($this->options)) {
         $curr = isUTF8($tok[1][0]) ? $tok[1][0] : utf8_encode($tok[1][0]);
         if ($curr == $this->value) {
             $found = true;
         }
     }
     if (!$found) {
         $this->form->validator->setError($this->field, 901);
     }
 }
示例#6
0
 function validate()
 {
     $fmt = '';
     $f = array();
     $m = camila_get_translation('camila.dateformat.monthpos');
     $d = camila_get_translation('camila.dateformat.daypos');
     $y = camila_get_translation('camila.dateformat.yearpos');
     $f[$m] = 'mm';
     $f[$d] = 'dd';
     $f[$y] = 'yyyy';
     ksort($f);
     reset($f);
     $count = 0;
     while (list($k, $v) = each($f)) {
         $fmt .= $v;
         if ($count < 2) {
             $fmt .= camila_get_translation('camila.dateformat.separator');
         }
         $count++;
     }
     if ($this->value != '') {
         if ($this->form->validator->date($this->field, $fmt)) {
             $mm = substr($this->value, camila_get_translation('camila.dateformat.monthpos'), 2);
             $dd = substr($this->value, camila_get_translation('camila.dateformat.daypos'), 2);
             $yyyy = substr($this->value, camila_get_translation('camila.dateformat.yearpos'), 4);
             $this->value = date('Y-m-d', mktime(0, 0, 0, $mm, $dd, $yyyy));
         }
     }
     parent::validate();
 }
示例#7
0
 function validate()
 {
     parent::validate();
     if (is_array($this->uploaderrors)) {
         foreach ($this->uploaderrors as $key => $value) {
             if ($this->uploaderrors[$key] == null) {
                 continue;
             }
             $this->form->validator->setError($this->field, $this->uploaderrors[$key]);
         }
     }
 }
示例#8
0
 function validate()
 {
     global $_CAMILA;
     $fmt = '';
     $f = array();
     $m = camila_get_translation('camila.dateformat.monthpos');
     $d = camila_get_translation('camila.dateformat.daypos');
     $y = camila_get_translation('camila.dateformat.yearpos');
     $f[$m] = 'mm';
     $f[$d] = 'dd';
     $f[$y] = 'yyyy';
     ksort($f);
     reset($f);
     $count = 0;
     while (list($k, $v) = each($f)) {
         $fmt .= $v;
         if ($count < 2) {
             $fmt .= camila_get_translation('camila.dateformat.separator');
         }
         $count++;
     }
     if ($this->value != '') {
         if ($this->form->validator->date($this->field, $fmt)) {
             $mm = substr($this->value, camila_get_translation('camila.dateformat.monthpos'), 2);
             $dd = substr($this->value, camila_get_translation('camila.dateformat.daypos'), 2);
             $yyyy = substr($this->value, camila_get_translation('camila.dateformat.yearpos'), 4);
             $this->value = $_CAMILA['db']->BindTimeStamp($yyyy . '-' . $mm . '-' . $dd . ' ' . $this->value_hour . ':' . $this->value_minute . ':00');
         }
     }
     parent::validate();
 }