]> git.mxchange.org Git - mailer.git/blobdiff - 0.2.1/inc/functions.php
- obsolete templates/scripts removed
[mailer.git] / 0.2.1 / inc / functions.php
index 6bc73d52d580545f67a7a42af3ae2634fdbff03a..dc1aa2f0ea28d77707d36aed5f5eb1b033328287 100644 (file)
@@ -381,10 +381,19 @@ function SEND_EMAIL($TO, $SUBJECT, $MSG, $HTML="N", $FROM="")
        if (!CHECK_PHPMAILER_USAGE()) {\r
                if (empty($FROM)) {\r
                        // Load email header template\r
-                       if (!DEBUG_MODE) $FROM = LOAD_EMAIL_TEMPLATE("header");\r
-               } else {\r
-                       if (!DEBUG_MODE) $FROM .= LOAD_EMAIL_TEMPLATE("header");\r
+                       $FROM = LOAD_EMAIL_TEMPLATE("header");\r
+               } else {
+                       // Append header\r
+                       $FROM .= LOAD_EMAIL_TEMPLATE("header");\r
                }\r
+       } elseif (DEBUG_MODE) {
+               if (empty($FROM)) {
+                       // Load email header template
+                       $FROM = LOAD_EMAIL_TEMPLATE("header");
+               } else {
+                       // Append header
+                       $FROM .= LOAD_EMAIL_TEMPLATE("header");
+               }
        }\r
 \r
        // Fix HTML parameter (default is no!)\r
@@ -392,10 +401,11 @@ function SEND_EMAIL($TO, $SUBJECT, $MSG, $HTML="N", $FROM="")
        if (DEBUG_MODE)\r
        {\r
                // In debug mode we want to display the mail instead of sending it away so we can debug this part\r
-               echo "<PRE>\r
-  ".$TO."\r
-  ".$SUBJECT."\r
-  ".$MSG."\r
+               echo "<PRE>
+".htmlentities(trim($FROM))."\r
+To      : ".$TO."\r
+Subject : ".$SUBJECT."\r
+Message : ".$MSG."\r
 </PRE>\n";\r
        }\r
         elseif (($HTML == "Y") && (EXT_IS_ACTIVE("html_mail", true)))\r
@@ -933,7 +943,7 @@ function LOAD_EMAIL_TEMPLATE($template, $content="", $UID="0")
        }\r
 \r
        // Now does the final template exists?\r
-       if (@file_exists($file))\r
+       if ((@file_exists($file)) && (is_readable($file)))\r
        {\r
                // The local file does exists so we load it. :)\r
                $tmpl_file = @implode("", @file($file));\r
@@ -952,7 +962,15 @@ function LOAD_EMAIL_TEMPLATE($template, $content="", $UID="0")
         elseif (!empty($template))\r
        {\r
                // Template file not found!\r
-               $content = TEMPLATE_404.": ".$template;\r
+               $content = TEMPLATE_404.": ".$template."<BR>
+".TEMPLATE_CONTENT."
+<PRE>".print_r($content, true)."</PRE>
+".TEMPLATE_DATA."
+<PRE>".print_r($DATA, true)."</PRE>
+<BR><BR>";\r
+
+               // Debug mode not active? Then remove the HTML tags
+               if (!DEBUG_MODE) $content = strip_tags($content);
        }\r
         else\r
        {\r