fantu
2008-12-11 baac49e1be0d7189da7c28f02efc8be05806c364
interface/lib/classes/tform.inc.php
@@ -247,7 +247,7 @@
                                $app->uses($datasource_class);
                                $values = $app->$datasource_class->$datasource_function($field, $record);
                        } else {
                                $this->errorMessage .= "Custom datasource class or function is empty<br>\r\n";
                                $this->errorMessage .= "Custom datasource class or function is empty<br />\r\n";
                        }
                }
@@ -527,7 +527,7 @@
                                        $field['regex'] .= 's';
                                        if(!preg_match($field['regex'], $record[$key])) {
                                                $errmsg = $field['errmsg'];
                                                $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
                                                $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
                                        }
                                }
@@ -561,9 +561,9 @@
                                        if(!preg_match($validator['regex'], $field_value)) {
                                                $errmsg = $validator['errmsg'];
                                                if(isset($this->wordbook[$errmsg])) {
                                                   $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
                                                   $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
                                    } else {
                                       $this->errorMessage .= $errmsg."<br>\r\n";
                                       $this->errorMessage .= $errmsg."<br />\r\n";
                                    }
                                        }
                                break;
@@ -573,9 +573,9 @@
                                                if($num_rec["number"] > 0) {
                                                        $errmsg = $validator['errmsg'];
                                          if(isset($this->wordbook[$errmsg])) {
                                                           $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
                                                           $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
                                          } else {
                                             $this->errorMessage .= $errmsg."<br>\r\n";
                                             $this->errorMessage .= $errmsg."<br />\r\n";
                                          }
                                                }
                                        } else {
@@ -583,9 +583,9 @@
                                                if($num_rec["number"] > 0) {
                                                        $errmsg = $validator['errmsg'];
                                                        if(isset($this->wordbook[$errmsg])) {
                                                           $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
                                                           $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
                                          } else {
                                             $this->errorMessage .= $errmsg."<br>\r\n";
                                             $this->errorMessage .= $errmsg."<br />\r\n";
                                          }
                                                }
                                        }
@@ -594,9 +594,9 @@
                                        if(empty($field_value)) {
                                                $errmsg = $validator['errmsg'];
                                                if(isset($this->wordbook[$errmsg])) {
                                                    $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
                                                    $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
                                    } else {
                                       $this->errorMessage .= $errmsg."<br>\r\n";
                                       $this->errorMessage .= $errmsg."<br />\r\n";
                                    }
                                        }
                                break;
@@ -604,9 +604,9 @@
                                        if(!preg_match("/^\w+[\w.-]*\w+@\w+[\w.-]*\w+\.[a-z]{2,10}$/i", $field_value)) {
                                                $errmsg = $validator['errmsg'];
                                                if(isset($this->wordbook[$errmsg])) {
                                                    $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
                                                    $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
                                    } else {
                                       $this->errorMessage .= $errmsg."<br>\r\n";
                                       $this->errorMessage .= $errmsg."<br />\r\n";
                                    }
                                        }
                                break;
@@ -615,9 +615,9 @@
                                        if($tmpval === 0 and !empty($field_value)) {
                                                $errmsg = $validator['errmsg'];
                                                if(isset($this->wordbook[$errmsg])) {
                                                    $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
                                                    $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
                                    } else {
                                       $this->errorMessage .= $errmsg."<br>\r\n";
                                       $this->errorMessage .= $errmsg."<br />\r\n";
                                    }
                                        }
                                break;
@@ -625,9 +625,9 @@
                                        if(!is_numeric($field_value) || $field_value <= 0){
                                          $errmsg = $validator['errmsg'];
                                          if(isset($this->wordbook[$errmsg])) {
                                             $this->errorMessage .= $this->wordbook[$errmsg]."<br>\r\n";
                                             $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
                                } else {
                                  $this->errorMessage .= $errmsg."<br>\r\n";
                                  $this->errorMessage .= $errmsg."<br />\r\n";
                                }
                                        }
                                break;
@@ -639,7 +639,7 @@
                                                $app->uses($validator_class);
                                                $this->errorMessage .= $app->$validator_class->$validator_function($field_name, $field_value, $validator);
                                        } else {
                                                $this->errorMessage .= "Custom validator class or function is empty<br>\r\n";
                                                $this->errorMessage .= "Custom validator class or function is empty<br />\r\n";
                                        }
                                break;
                        default:
@@ -671,9 +671,9 @@
                // checking permissions
                if($this->formDef['auth'] == 'yes' && $_SESSION["s"]["user"]["typ"] != 'admin') {
                        if($action == "INSERT") {
                                if(!$this->checkPerm($primary_id,'i')) $this->errorMessage .= "Insert denied.<br>\r\n";
                                if(!$this->checkPerm($primary_id,'i')) $this->errorMessage .= "Insert denied.<br />\r\n";
                        } else {
                                if(!$this->checkPerm($primary_id,'u')) $this->errorMessage .= "Update denied.<br>\r\n";
                                if(!$this->checkPerm($primary_id,'u')) $this->errorMessage .= "Update denied.<br />\r\n";
                        }
                }