]> git.mxchange.org Git - mailer.git/blobdiff - inc/functions.php
Installation page=welcome rewritten to use div
[mailer.git] / inc / functions.php
index a04e852dad9b564f858186f52dee27e6c79bedd6..8c8d7e15bdba31c04a8f5f8a73e2b16f948daea6 100644 (file)
@@ -263,47 +263,47 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) {
        $date_time = MAKE_DATETIME(time(), "1");
 
        // Base directory
-       $BASE = sprintf("%stemplates/%s/html/", constant('PATH'), GET_LANGUAGE());
-       $MODE = '';
+       $basePath = sprintf("%stemplates/%s/html/", constant('PATH'), GET_LANGUAGE());
+       $mode = '';
 
        // Check for admin/guest/member templates
        if (strpos($template, "admin_") > -1) {
                // Admin template found
-               $MODE = "admin/";
+               $mode = "admin/";
        } elseif (strpos($template, "guest_") > -1) {
                // Guest template found
-               $MODE = "guest/";
+               $mode = "guest/";
        } elseif (strpos($template, "member_") > -1) {
                // Member template found
-               $MODE = "member/";
+               $mode = "member/";
        } elseif (strpos($template, "install_") > -1) {
                // Installation template found
-               $MODE = "install/";
+               $mode = "install/";
        } elseif (strpos($template, "ext_") > -1) {
                // Extension template found
-               $MODE = "ext/";
+               $mode = "ext/";
        } elseif (strpos($template, "la_") > -1) {
                // "Logical-area" template found
-               $MODE = "la/";
+               $mode = "la/";
        } else {
                // Test for extension
                $test = substr($template, 0, strpos($template, "_"));
                if (EXT_IS_ACTIVE($test)) {
                        // Set extra path to extension's name
-                       $MODE = $test."/";
+                       $mode = $test."/";
                }
        }
 
        ////////////////////////
        // Generate file name //
        ////////////////////////
-       $FQFN = $BASE.$MODE.$template.".tpl";
+       $FQFN = $basePath.$mode.$template.".tpl";
 
-       if ((!empty($GLOBALS['what'])) && ((strpos($template, "_header") > 0) || (strpos($template, "_footer") > 0)) && (($MODE == "guest/") || ($MODE == "member/") || ($MODE == "admin/"))) {
+       if ((!empty($GLOBALS['what'])) && ((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",
-                       $BASE,
-                       $MODE,
+                       $basePath,
+                       $mode,
                        $template,
                        SQL_ESCAPE($GLOBALS['what'])
                );
@@ -318,7 +318,7 @@ function LOAD_TEMPLATE ($template, $return=false, $content=array()) {
        // Does the special template exists?
        if (!FILE_READABLE($FQFN)) {
                // Reset to default template
-               $FQFN = $BASE.$template.".tpl";
+               $FQFN = $basePath.$template.".tpl";
        } // END - if
 
        // Now does the final template exists?
@@ -621,7 +621,7 @@ function DEREFERER ($URL) {
        // Don't de-refer our own links!
        if (substr($URL, 0, strlen(URL)) != URL) {
                // De-refer this link
-               $URL = "modules.php?module=loader&url=".encodeString(compileUriCode($URL));
+               $URL = 'modules.php?module=loader&url=' . encodeString(compileUriCode($URL));
        } // END - if
 
        // Return link
@@ -631,13 +631,13 @@ function DEREFERER ($URL) {
 // Translate Uni*-like gender to human-readable
 function TRANSLATE_GENDER ($gender) {
        // Default
-       $ret = "!{$gender}!";
+       $ret = '!' . $gender . '!';
 
        // Male/female or company?
        switch ($gender) {
-               case "M": $ret = getMessage('GENDER_M'); break;
-               case "F": $ret = getMessage('GENDER_F'); break;
-               case "C": $ret = getMessage('GENDER_C'); break;
+               case 'M': $ret = getMessage('GENDER_M'); break;
+               case 'F': $ret = getMessage('GENDER_F'); break;
+               case 'C': $ret = getMessage('GENDER_C'); break;
                default:
                        // Log unknown gender
                        DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Unknown gender %s detected.", $gender));
@@ -667,21 +667,23 @@ function SELECTION_COUNT ($array) {
        }
        return $ret;
 }
+
 //
 function IMG_CODE ($code, $type, $DATA, $uid) {
-       return "<IMG border=\"0\" alt=\"Code\" src=\"{!URL!}/mailid_top.php?uid=".$uid."&amp;".$type."=".$DATA."&amp;mode=img&amp;code=".$code."\">";
+       return '<IMG border="0" alt="Code" src="{!URL!}/mailid_top.php?uid=' . $uid . '&amp;' . $type . '=' . $DATA . '&amp;mode=img&amp;code=' . $code . '" />';
 }
+
 //
 function TRANSLATE_STATUS ($status) {
        switch ($status)
        {
-       case "UNCONFIRMED":
-       case "CONFIRMED":
-       case "LOCKED":
+       case 'UNCONFIRMED':
+       case 'CONFIRMED':
+       case 'LOCKED':
                $ret = getMessage(sprintf("ACCOUNT_%s", $status));
                break;
 
-       case "":
+       case '':
        case null:
                $ret = getMessage('ACCOUNT_DELETED');
                break;
@@ -712,7 +714,7 @@ function GET_LANGUAGE() {
                $ret = $GLOBALS['cache_array']['language'];
        } elseif (!empty($lang)) {
                // Check if main language file does exist
-               if (FILE_READABLE(constant('PATH')."inc/language/".$lang.".php")) {
+               if (FILE_READABLE(constant('PATH').'inc/language/'.$lang.'.php')) {
                        // Okay found, so let's update cookies
                        SET_LANGUAGE($lang);
                }
@@ -739,14 +741,14 @@ function SET_LANGUAGE ($lang) {
        set_session('mx_lang', $lang);
 }
 //
-function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID="0") {
+function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID='0') {
        global $DATA, $_CONFIG;
 
        // Make sure all template names are lowercase!
        $template = strtolower($template);
 
        // Default 'nickname' if extension is not installed
-       $nick = "---";
+       $nick = '---';
 
        // Prepare IP number and User Agent
        $REMOTE_ADDR     = GET_REMOTE_ADDR();
@@ -817,34 +819,34 @@ function LOAD_EMAIL_TEMPLATE($template, $content=array(), $UID="0") {
        $DATA['email'] = $email;
 
        // Base directory
-       $BASE = sprintf("%stemplates/%s/emails/", constant('PATH'), GET_LANGUAGE());
+       $basePath = sprintf("%stemplates/%s/emails/", constant('PATH'), GET_LANGUAGE());
 
        // Check for admin/guest/member templates
        if (strpos($template, "admin_") > -1) {
                // Admin template found
-               $FQFN = $BASE."admin/".$template.".tpl";
+               $FQFN = $basePath."admin/".$template.".tpl";
        } elseif (strpos($template, "guest_") > -1) {
                // Guest template found
-               $FQFN = $BASE."guest/".$template.".tpl";
+               $FQFN = $basePath."guest/".$template.".tpl";
        } elseif (strpos($template, "member_") > -1) {
                // Member template found
-               $FQFN = $BASE."member/".$template.".tpl";
+               $FQFN = $basePath."member/".$template.".tpl";
        } else {
                // Test for extension
                $test = substr($template, 0, strpos($template, "_"));
                if (EXT_IS_ACTIVE($test)) {
                        // Set extra path to extension's name
-                       $FQFN = $BASE.$test."/".$template.".tpl";
+                       $FQFN = $basePath.$test."/".$template.".tpl";
                } else {
                        // No special filename
-                       $FQFN = $BASE.$template.".tpl";
+                       $FQFN = $basePath.$template.".tpl";
                }
        }
 
        // Does the special template exists?
        if (!FILE_READABLE($FQFN)) {
                // Reset to default template
-               $FQFN = $BASE.$template.".tpl";
+               $FQFN = $basePath.$template.".tpl";
        } // END - if
 
        // Now does the final template exists?
@@ -2368,14 +2370,14 @@ function GET_CURR_THEME() {
                        // 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()) || ($GLOBALS['output_mode'] == true)) && ((REQUEST_ISSET_GET('theme')) || (REQUEST_ISSET_POST('theme')))) {
                // Prepare FQFN for checking
-               $theme = sprintf("%stheme/%s/theme.php", constant('PATH'), REQUEST_GET(('theme')));
+               $theme = sprintf("%stheme/%s/theme.php", constant('PATH'), REQUEST_GET('theme'));
 
                // Installation mode active
-               if ((REQUEST_ISSET_GET(('theme'))) && (FILE_READABLE($theme))) {
+               if ((REQUEST_ISSET_GET('theme')) && (FILE_READABLE($theme))) {
                        // Set cookie from URL data
-                       set_session('mxchange_theme', REQUEST_GET(('theme')));
+                       set_session('mxchange_theme', REQUEST_GET('theme'));
                } elseif (FILE_READABLE(sprintf("%stheme/%s/theme.php", constant('PATH'), SQL_ESCAPE(REQUEST_POST('theme'))))) {
                        // Set cookie from posted data
                        set_session('mxchange_theme', SQL_ESCAPE(REQUEST_POST('theme')));