]> git.p6c8.net - form-email.git/blobdiff - form-email/mailer.php
Wenn in der Konfiguration kein Name fuer die Template-Variable eines indiv.
[form-email.git] / form-email / mailer.php
index 11061d40f811254fd25681393b470f7ac454ba65..3adbaadf3816ad55e7264cdff8efc9358b7a980e 100644 (file)
@@ -7,7 +7,7 @@
 # geschrieben wurde.\r
 #\r
 # Autor:            Patrick Canterino <patrick@patshaping.de>\r
-# Letzte Aenderung: 4.12.2011\r
+# Letzte Aenderung: 12.12.2011\r
 #\r
 # Copyright (C) 2002-2011 Patrick Canterino\r
 #\r
@@ -116,13 +116,23 @@ while(list($user_field,$user_field_data) = each($user_fields)) {
     \r
     if(isset($user_field_data['min']) && $user_field_data['min']) {\r
         if(strlen($user_field_content) < $user_field_data['min']) {\r
-            show_user_error($user_field_data['errors']['too_short']);\r
+            if(isset($user_field_data['errors']['too_short'])) {\r
+                show_user_error($user_field_data['errors']['too_short']);\r
+            }\r
+            else {\r
+                show_fatal($err_indiv_errmsg_miss,array('ERRMSG' => 'too_short', 'INDIVIDUAL' => $user_field));\r
+            }\r
         }\r
     }\r
     \r
     if(isset($user_field_data['min']) && $user_field_data['max']) {\r
         if(strlen($user_field_content) > $user_field_data['max']) {\r
-            show_user_error($user_field_data['errors']['too_long']);\r
+            if(isset($user_field_data['errors']['too_long'])) {\r
+                show_user_error($user_field_data['errors']['too_long']);\r
+            }\r
+            else {\r
+                show_fatal($err_indiv_errmsg_miss,array('ERRMSG' => 'too_long', 'INDIVIDUAL' => $user_field));\r
+            }\r
         }\r
     }\r
     \r
@@ -130,7 +140,12 @@ while(list($user_field,$user_field_data) = each($user_fields)) {
 \r
     if(isset($user_field_data['check']) && $user_field_data['check'] != '') {\r
         if(function_exists($user_field_data['check']) && call_user_func($user_field_data['check'],$user_field_content) === false) {\r
-            show_user_error($user_field_data['errors']['check_fail']);\r
+            if(isset($user_field_data['errors']['check_fail'])) {\r
+                show_user_error($user_field_data['errors']['check_fail']);\r
+            }\r
+            else {\r
+                show_fatal($err_indiv_errmsg_miss,array('ERRMSG' => 'check_fail', 'INDIVIDUAL' => $user_field));\r
+            }\r
         }\r
     }\r
     \r
@@ -138,7 +153,12 @@ while(list($user_field,$user_field_data) = each($user_fields)) {
 \r
     if(isset($user_field_data['regex']) && $user_field_data['regex'] != '') {\r
         if(!preg_match($user_field_data['regex'],$user_field_content)) {\r
-            show_user_error($user_field_data['errors']['match_fail']);\r
+            if(isset($user_field_data['errors']['match_fail'])) {\r
+                show_user_error($user_field_data['errors']['match_fail']);\r
+            }\r
+            else {\r
+                show_fatal($err_indiv_errmsg_miss,array('ERRMSG' => 'match_fail', 'INDIVIDUAL' => $user_field));\r
+            }\r
         }\r
     }\r
     \r
@@ -150,9 +170,18 @@ while(list($user_field,$user_field_data) = each($user_fields)) {
         }\r
     }\r
     \r
+    # Name der Template-Variable ermitteln\r
+\r
+    if(isset($user_field_data['tpl_var']) && $user_field_data['tpl_var'] != '') {\r
+        $tpl_var = $user_field_data['tpl_var'];\r
+    }\r
+    else {\r
+        $tpl_var = 'USER_'.$user_field;\r
+    }\r
+    \r
     # Fertige Formulardaten wegkopieren und fuer spaeter zur Verfuegung stellen\r
 \r
-    $prepared_user_fields[$user_field_data['tpl_var']] = $user_field_content;\r
+    $prepared_user_fields[$tpl_var] = $user_field_content;\r
 }\r
 \r
 # Captcha ueberpruefen\r

patrick-canterino.de