Changed important SERVER_URL which now points to the right URL
[mailer.git] / inc / template-functions.php
index bdb505d8fbd63be40be7494ebefdcf60eca102ca..597c5be9303f8e56b1b58dbb370208e7db1fc2be 100644 (file)
@@ -331,7 +331,7 @@ function loadTemplate ($template, $return = false, $content = array(), $compileC
        (' . $template . ')
 </div>
 <div class="para">
-       {--TEMPLATE_CONTENT--}
+       {--TEMPLATE_CONTENT--}:
        <pre>' . print_r($content, true) . '</pre>
 </div>';
                } else {
@@ -490,9 +490,9 @@ function loadEmailTemplate ($template, $content = array(), $userid = '0', $loadU
        {--TEMPLATE_404--}: ' . $template . '
 </div>
 <div class="para">
-       {--TEMPLATE_CONTENT--}
+       {--TEMPLATE_CONTENT--}:
        <pre>' . print_r($content, true) . '</pre>
-       {--TEMPLATE_DATA--}
+       {--TEMPLATE_DATA--}:
        <pre>' . print_r($DATA, true) . '</pre>
 </div>';
 
@@ -543,8 +543,8 @@ function getMenuCssClasses ($data) {
 }
 
 // Generate XHTML code for the CAPTCHA
-function generateCaptchaCode ($code, $type, $DATA, $userid) {
-       return '<img border="0" alt="Code ' . $code . '" src="{%url=mailid_top.php?userid=' . $userid . '&amp;' . $type . '=' . $DATA . '&amp;mode=img&amp;code=' . $code . '%}" />';
+function generateCaptchaCode ($code, $type, $type, $userid) {
+       return '<img border="0" alt="Code ' . $code . '" src="{%url=mailid_top.php?userid=' . $userid . '&amp;' . $type . '=' . $type . '&amp;mode=img&amp;code=' . $code . '%}" />';
 }
 
 // Compiles the given HTML/mail code
@@ -841,7 +841,9 @@ function createTimeSelections ($timestamp, $prefix = '', $display = '', $align =
        $M2 = getMonth(time() + $timestamp);
 
        // If so and if current time is before 02/29 and estimated time is after 02/29 then add 86400 seconds (one day)
-       if ((floor($TEST) == $TEST) && ($M1 == '02') && ($M2 > '02'))  $SWITCH = getOneDay();
+       if ((floor($TEST) == $TEST) && ($M1 == '02') && ($M2 > '02'))  {
+               $SWITCH = getOneDay();
+       } // END - switch
 
        // First of all years...
        $Y = abs(floor($timestamp / (31536000 + $SWITCH)));
@@ -1229,7 +1231,9 @@ function handleCodeMessage () {
                $ext = 'unknown';
 
                // Is extension given?
-               if (isGetRequestParameterSet('ext')) $ext = getRequestParameter('ext');
+               if (isGetRequestParameterSet('ext')) {
+                       $ext = getRequestParameter('ext');
+               } // END - if
 
                // Convert the 'code' parameter from URL to a human-readable message
                $message = getMessageFromErrorCode(getRequestParameter('code'));
@@ -1339,7 +1343,7 @@ function linenumberCode ($code)    {
                if ($count_lines == 1) {
                        $r .= 1;
                } else {
-                       $r .= ($line == ($count_lines - 1)) ? '' :  ($line+1);
+                       $r .= ($line == ($count_lines - 1)) ? '' : ($line+1);
                }
                $r .= '</span>|';
 
@@ -1462,7 +1466,7 @@ function escapeQuotes ($str, $single = false) {
                $str = addslashes($str);
        } else {
                // Remove escaping of single quotes
-               $str = str_replace("\'", "'", $str);
+               $str = str_replace("\\'", "'", $str);
 
                // Escape only double-quotes but prevent double-quoting
                $str = str_replace("\\\\", "\\", str_replace('"', "\\\"", $str));
@@ -1586,7 +1590,7 @@ function sendModeMails ($mod, $modes) {
        }
 
        // Load template
-       loadTemplate('admin_settings_saved', false, $content['message']);
+       displayMessage($content['message']);
 }
 
 // Generates a 'selection box' from given array
@@ -1703,6 +1707,12 @@ function translatePoolType ($type) {
        return sprintf("{--POOL_TYPE_%s--}", strtoupper($type));
 }
 
+// Displays given message in admin_settings_saved template
+function displayMessage ($message, $return = false) {
+       // Load the template
+       return loadTemplate('admin_settings_saved', $return, $message);
+}
+
 //-----------------------------------------------------------------------------
 //                      Template helper functions for EL
 //-----------------------------------------------------------------------------