]> git.p6c8.net - form-email.git/blobdiff - form-email/mailer.php
Dieses htmlspecialchars() macht dann doch keinen Sinn
[form-email.git] / form-email / mailer.php
index bed4207d6b2bf30b326f0f6a403084e0735e8f31..ff431129b89265199abe1236fb219d987436d8c7 100644 (file)
@@ -7,7 +7,7 @@
 # geschrieben wurde.\r
 #\r
 # Autor:            Patrick Canterino <patrick@patshaping.de>\r
-# Letzte Aenderung: 3.12.2011\r
+# Letzte Aenderung: 12.12.2011\r
 #\r
 # Copyright (C) 2002-2011 Patrick Canterino\r
 #\r
 #  Hauptteil\r
 # ===========\r
 \r
+$VERSION = '3.5-dev';\r
+\r
 require('config.php');\r
 require('functions.php');\r
 require('class.Template.php');\r
 \r
-if($only_post && $_SERVER['REQUEST_METHOD'] != 'POST') show_fatal($err_only_post);\r
+if($_SERVER['REQUEST_METHOD'] != 'POST') show_fatal($err_only_post);\r
 \r
 # Wenn Captchas aktiviert sind, Session starten\r
 \r
@@ -110,11 +112,40 @@ while(list($user_field,$user_field_data) = each($user_fields)) {
         continue;\r
     }\r
     \r
+    # Laengen-Pruefung\r
+    \r
+    if(isset($user_field_data['min']) && $user_field_data['min']) {\r
+        if(strlen($user_field_content) < $user_field_data['min']) {\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
+            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
     # Pruefung gegen frei definierbare Pruef-Funktion\r
 \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
@@ -122,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
@@ -230,7 +266,7 @@ if($add_header) {
     $header .= 'Content-Type: text/plain; charset="'.$charset.'"'."\n";\r
     $header .= 'Content-Transfer-Encoding: 8bit'."\n";\r
     $header .= 'MIME-Version: 1.0'."\n";\r
-    $header .= 'X-Mailer: Form E-Mail 3.4.1'."\n";\r
+    $header .= 'X-Mailer: Form E-Mail '.$VERSION."\n";\r
     $header .= 'X-Sender-IP: ['.$_SERVER['REMOTE_ADDR'].']';\r
 }\r
 else $header .= "Reply-To: $email";\r

patrick-canterino.de