log($message . ' in ' . $file . ' at line ' . $line, $priority); } else { $logger_system->log($message . ' in ' . $file . ' at line ' . $line, $priority); } if ($priority == PEAR_LOG_ERR) { echo ("error occured
"); } } set_error_handler('errorHandler'); //trigger_error('This is an information log message.', E_USER_NOTICE); ?> Toolone
cauta
filename = $datamap_file; } else{ exit("Datamap file missing: ".$datamap_file); } $this->language_code = $lang_code; } /* * @param un array cu toate campurile din form care trebuie verificate * @return true in caz in care valorile trimise au trecut testul * false in caz contrar */ function validate($fields) { unset($this->errors); include($this->filename); $returnValue = true; foreach ($fields as $field=>$fieldValue) { // $fieldValue = $HTTP_GET_VARS["title"];// numele unui camp din form $numeArray = "_".$field; $arrayName = $$numeArray;//numele unui sir din fiserul care este inclu putin mai sus if(isset($arrayName)) { foreach ($arrayName as $key=>$value){ $this->errors[$field] = array($fieldValue); switch ($key) { case "isnull": if (strcmp($value, "true") == 0 && (strlen($fieldValue) == 0)){ array_push($this->errors[$field], "Camp obligatoriu"); $returnValue = false; continue(3); // echo "error in isnull"; // return $fields;; } break; case "minLength": if (strlen($fieldValue) < $value){ array_push($this->errors[$field], "Valoarea trebuie sa contine cel putin ".$value." caractere"); $returnValue = false; continue(3); } break; case "maxLength": if (strlen($fieldValue) > $value){ array_push($this->errors[$field], "Valoarea poate sa aiba maximum ".$value." caractere"); $returnValue = false; continue(3); } break; case "regexp": if (!eregi($value, $fieldValue)){ // echo preg_match($value, $fieldValue); // echo "$field $value $fieldValue
"; if ( array_key_exists("isnull", $arrayName) && (strcmp($arrayName["isnull"], "false") == 0 ) && (strlen($fieldValue) <= 0) ) {} else { array_push($this->errors[$field], "Format invalid"); $returnValue = false; } continue(3); // echo "error in regexp
"; // return $fields; } break; case "regexplist": $array_elements = explode(",", $fieldValue); foreach ($array_elements as $fieldValue) { if (!eregi($value, $fieldValue)){ array_push($this->errors[$field], "Format invalid"); $returnValue = false; continue(4); } } break; } // continue(2); } } else { // return $fields; } } return $returnValue; } /* * */ function getErrors() { // echo $this->errors["team2_score"][1]."qqq
"; return $this->errors; } /* * */ function getLabel($field, $language = "") { if (strcmp($language, "") == 0) { $language = $this->language_code; } include($this->filename); $field_array_name = "_".$field; $field_array = $$field_array_name; return $field_array["label_".$language]; } function getKey($field, $language = "", $key = "label") { if (strcmp($language, "") == 0) { $language = $this->language_code; } include($this->filename); $field_array_name = "_".$field; $field_array = $$field_array_name; return $field_array[$key."_".$language]; } /* * */ function getDefault($field) { include($this->filename); $field_array_name = "_".$field; $field_array = $$field_array_name; return $field_array["default"]; } /* * */ function getExample($field) { include($this->filename); $field_array_name = "_".$field; $field_array = $$field_array_name; return $field_array["example"]; } /* * */ function getValues($field) { include($this->filename); $field_array_name = "_".$field; $field_array = $$field_array_name; return $field_array["values"]; } /* * Retrieves the values of a select input as "; $selected = ""; } return $retval; } /* * */ function getDefaultValue($field) { include($this->filename); $field_array_name = "_".$field; $field_array = $$field_array_name; return $field_array["default"]; } } ?>