| | |
| | | } |
| | | break; |
| | | case 'ISEMAIL': |
| | | if(!preg_match("/^\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-zA-Z0-9\-]{2,30}$/i", $field_value)) { |
| | | if(function_exists('filter_var')) { |
| | | if(!filter_var($field_value, FILTER_VALIDATE_EMAIL)) { |
| | | $errmsg = $validator['errmsg']; |
| | | if(isset($this->wordbook[$errmsg])) { |
| | | $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n"; |
| | | } else { |
| | | $this->errorMessage .= $errmsg."<br />\r\n"; |
| | | } |
| | | } |
| | | } else { |
| | | if(!preg_match("/^\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-zA-Z0-9\-]{2,30}$/i", $field_value)) { |
| | | $errmsg = $validator['errmsg']; |
| | | if(isset($this->wordbook[$errmsg])) { |
| | | $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n"; |
| | |
| | | $this->errorMessage .= $errmsg."<br />\r\n"; |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case 'ISINT': |
| | | if(function_exists('filter_var')) { |
| | | if(!filter_var($field_value, FILTER_VALIDATE_INT)) { |
| | | $errmsg = $validator['errmsg']; |
| | | if(isset($this->wordbook[$errmsg])) { |
| | | $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n"; |
| | | } else { |
| | | $this->errorMessage .= $errmsg."<br />\r\n"; |
| | | } |
| | | } |
| | | } else { |
| | | $tmpval = intval($field_value); |
| | | if($tmpval === 0 and !empty($field_value)) { |
| | | $errmsg = $validator['errmsg']; |
| | |
| | | $this->errorMessage .= $errmsg."<br />\r\n"; |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case 'ISPOSITIVE': |
| | | if(!is_numeric($field_value) || $field_value <= 0){ |
| | |
| | | $sql_insert_val .= "'".$record[$key]."', "; |
| | | } |
| | | } else { |
| | | |
| | | if($field['formtype'] == 'PASSWORD') { |
| | | if($field['encryption'] == 'CRYPT') { |
| | | if(isset($field['encryption']) && $field['encryption'] == 'CRYPT') { |
| | | $record[$key] = $app->auth->crypt_password(stripslashes($record[$key])); |
| | | } elseif ($field['encryption'] == 'MYSQL') { |
| | | $sql_insert_val .= "PASSWORD('".$app->db->quote($record[$key])."'), "; |
| | | } elseif ($field['encryption'] == 'CLEARTEXT') { |
| | | $sql_insert_val .= "'".$app->db->quote($record[$key])."', "; |
| | | $sql_update .= "`$key` = '".$app->db->quote($record[$key])."', "; |
| | | } elseif (isset($field['encryption']) && $field['encryption'] == 'MYSQL') { |
| | | $sql_update .= "`$key` = PASSWORD('".$app->db->quote($record[$key])."'), "; |
| | | } elseif (isset($field['encryption']) && $field['encryption'] == 'CLEARTEXT') { |
| | | $sql_update .= "`$key` = '".$app->db->quote($record[$key])."', "; |
| | | } else { |
| | | $record[$key] = md5($record[$key]); |
| | | $record[$key] = md5(stripslashes($record[$key])); |
| | | $sql_update .= "`$key` = '".$app->db->quote($record[$key])."', "; |
| | | } |
| | | $sql_update .= "`$key` = '".$record[$key]."', "; |
| | | } elseif ($field['formtype'] == 'CHECKBOX') { |
| | | if($record[$key] == '') { |
| | | // if a checkbox is not set, we set it to the unchecked value |