'what','action','module' and 'output_mode' wrapped into functions (WARNUNG: Code...
[mailer.git] / inc / functions.php
index ab9fec7b50fa976d8310be6febcdc5958661ef98..16a7194b80aedc83954c4b70732b2e423fda8573 100644 (file)
@@ -114,7 +114,7 @@ function OUTPUT_HTML ($HTML, $newLine = true) {
                sendHeader('Connection: Close');
 
                // Extension 'rewrite' installed?
-               if ((EXT_IS_ACTIVE('rewrite')) && ($GLOBALS['output_mode'] != '1') && ($GLOBALS['output_mode'] != '-1')) {
+               if ((EXT_IS_ACTIVE('rewrite')) && (getOutputMode() != '1') && (getOutputMode() != '-1')) {
                        $OUTPUT = rewriteLinksInCode($OUTPUT);
                } // END - if
 
@@ -137,7 +137,7 @@ function OUTPUT_HTML ($HTML, $newLine = true) {
                outputRawCode($OUTPUT);
        } elseif ((getConfig('OUTPUT_MODE') == 'render') && (!empty($OUTPUT))) {
                // Rewrite links when rewrite extension is active
-               if ((EXT_IS_ACTIVE('rewrite')) && ($GLOBALS['output_mode'] != '1') && ($GLOBALS['output_mode'] != '-1')) {
+               if ((EXT_IS_ACTIVE('rewrite')) && (getOutputMode() != '1') && (getOutputMode() != '-1')) {
                        $OUTPUT = rewriteLinksInCode($OUTPUT);
                } // END - if
 
@@ -300,13 +300,13 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) {
        ////////////////////////
        $FQFN = $basePath . $mode . $template . '.tpl';
 
-       if ((!empty($GLOBALS['what'])) && ((strpos($template, '_header') > 0) || (strpos($template, '_footer') > 0)) && (($mode == 'guest/') || ($mode == 'member/') || ($mode == 'admin/'))) {
+       if ((isWhatSet()) && ((strpos($template, '_header') > 0) || (strpos($template, '_footer') > 0)) && (($mode == 'guest/') || ($mode == 'member/') || ($mode == 'admin/'))) {
                // Select what depended header/footer template file for admin/guest/member area
                $file2 = sprintf("%s%s%s_%s.tpl",
                        $basePath,
                        $mode,
                        $template,
-                       SQL_ESCAPE($GLOBALS['what'])
+                       getWhat()
                );
 
                // Probe for it...
@@ -1671,7 +1671,7 @@ function ADD_EMAIL_NAV ($PAGES, $offset, $show_form, $colspan, $return=false) {
                        $NAV .= "<strong>-";
                } else {
                        // Open anchor tag and add base URL
-                       $NAV .= "<a href=\"{!URL!}/modules.php?module=admin&amp;what=" . $GLOBALS['what']."&amp;page=" . $page."&amp;offset=" . $offset;
+                       $NAV .= "<a href=\"{!URL!}/modules.php?module=admin&amp;what=" . getWhat()."&amp;page=" . $page."&amp;offset=" . $offset;
 
                        // Add userid when we shall show all mails from a single member
                        if ((REQUEST_ISSET_GET('uid')) && (bigintval(REQUEST_GET('uid')) > 0)) $NAV .= "&amp;uid=".bigintval(REQUEST_GET('uid'));
@@ -2317,7 +2317,7 @@ function getCurrentTheme() {
                        // Fix it to default
                        $ret = 'default';
                } // END - if
-       } elseif ((!isInstalled()) && ((isInstalling()) || ($GLOBALS['output_mode'] == true)) && ((REQUEST_ISSET_GET('theme')) || (REQUEST_ISSET_POST('theme')))) {
+       } elseif ((!isInstalled()) && ((isInstalling()) || (getOutputMode() == true)) && ((REQUEST_ISSET_GET('theme')) || (REQUEST_ISSET_POST('theme')))) {
                // Prepare FQFN for checking
                $theme = sprintf("%stheme/%s/theme.php", constant('PATH'), REQUEST_GET('theme'));
 
@@ -2897,7 +2897,7 @@ function DEBUG_LOG ($funcFile, $line, $message, $force=true) {
 
                // Log this message away
                $fp = fopen(constant('PATH')."inc/cache/debug.log", 'a') or app_die(__FUNCTION__, __LINE__, "Cannot write logfile debug.log!");
-               fwrite($fp, date("d.m.Y|H:i:s", time())."|" . $GLOBALS['module']."|".basename($funcFile)."|" . $line."|".strip_tags($message)."\n");
+               fwrite($fp, date("d.m.Y|H:i:s", time())."|" . getModule()."|".basename($funcFile)."|" . $line."|".strip_tags($message)."\n");
                fclose($fp);
        } // END - if
 }