]> git.mxchange.org Git - mailer.git/blobdiff - inc/email-functions.php
Swapped all
[mailer.git] / inc / email-functions.php
index e0cf2a251e3889e9ddeb2fcb8ba1c0ac42245c37..a793b45e7859eaa437e887fc9269292b85fade2a 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Mailversand bezogene Funktionen                  *
  * -------------------------------------------------------------------- *
- * $Revision:: 2773                                                   $ *
- * $Date:: 2012-06-26 01:02:44 +0200 (Tue, 26 Jun 2012)               $ *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
  * $Tag:: 0.2.1-FINAL                                                 $ *
- * $Author:: quix0r                                                   $ *
+ * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
  * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
@@ -81,14 +81,18 @@ function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = '
        } // END - if
 
        // Debug mode enabled?
-       if (isDebugModeEnabled()) {
-               // In debug mode we want to display the mail instead of sending it away so we can debug this part
-               outputHtml('<pre>
-<strong>Headers</strong> : ' . htmlentities(trim($mailHeader)) . '
-<strong>To</strong>      : ' . htmlentities($toEmail) . '
-<strong>Subject</strong> : ' . htmlentities($subject) . '
-<strong>Message(' . strlen($message) . ')</strong> : ' . htmlentities($message) . '
-</pre>');
+       if ((isDebugModeEnabled()) && (!isAjaxOutputMode())) {
+               // Init content array
+               $content = array(
+                       'headers' => htmlentities(trim($mailHeader)),
+                       'to'      => htmlentities($toEmail),
+                       'subject' => htmlentities($subject),
+                       'message' => htmlentities($message),
+                       'length'  => strlen($message)
+               );
+
+               // In debug mode display the mail instead of sending it away so it can be debugged
+               loadTemplate('display_email', FALSE, $content);
 
                // This is always fine
                return TRUE;
@@ -201,28 +205,6 @@ function sendAdminNotification ($subject, $templateName, $content = array(), $us
        }
 }
 
-// ----------------------------------------------------------------------------
-//                           Template helper functions
-// ----------------------------------------------------------------------------
-
-// Helper function to add extra headers to text mails
-function doTemplateAddExtraTextMailHeaders ($templateName, $clear, $extraHeaders = '') {
-       // Run the header through the filter
-       $extraHeaders = runFilterChain('add_extra_text_mail_headers', $extraHeaders);
-
-       // And return it
-       return $extraHeaders;
-}
-
-// Helper function to add extra headers to HTML mails
-function doTemplateAddExtraHtmlMailHeaders ($templateName, $clear, $extraHeaders = '') {
-       // Run the header through the filter
-       $extraHeaders = runFilterChain('add_extra_html_mail_headers', $extraHeaders);
-
-       // And return it
-       return $extraHeaders;
-}
-
 // Send mails for del/edit/lock build modes
 // @TODO $rawUserId is currently unused
 function sendGenericBuildMails ($mode, $tableName, $content, $id, $subjectPart = '', $userIdColumn = array('userid'), $rawUserId = array('userid')) {
@@ -245,7 +227,10 @@ function sendGenericBuildMails ($mode, $tableName, $content, $id, $subjectPart =
        } // END - if
 
        // Is the raw userid set?
-       if (postRequestElement($userIdColumn[0], $id) > 0) {
+       if (isValidId(postRequestElement($userIdColumn[0], $id))) {
+               // Set it in content
+               $content[$userIdColumn[0]] = bigintval(postRequestElement($userIdColumn[0], $id));
+
                // Load email template
                if (!empty($subjectPart)) {
                        $mail = loadEmailTemplate('member_' . $mode . '_' . strtolower($subjectPart) . '_' . $tableName[0], $content);
@@ -268,5 +253,27 @@ function sendGenericBuildMails ($mode, $tableName, $content, $id, $subjectPart =
        }
 }
 
+// ----------------------------------------------------------------------------
+//                           Template helper functions
+// ----------------------------------------------------------------------------
+
+// Helper function to add extra headers to text mails
+function doTemplateAddExtraTextMailHeaders ($templateName, $clear, $extraHeaders = '') {
+       // Run the header through the filter
+       $extraHeaders = runFilterChain('add_extra_text_mail_headers', $extraHeaders);
+
+       // And return it
+       return $extraHeaders;
+}
+
+// Helper function to add extra headers to HTML mails
+function doTemplateAddExtraHtmlMailHeaders ($templateName, $clear, $extraHeaders = '') {
+       // Run the header through the filter
+       $extraHeaders = runFilterChain('add_extra_html_mail_headers', $extraHeaders);
+
+       // And return it
+       return $extraHeaders;
+}
+
 // [EOF]
 ?>