]> git.mxchange.org Git - mailer.git/blobdiff - inc/functions.php
Installation page=welcome rewritten to use div
[mailer.git] / inc / functions.php
index 025f936e7db9d5948d3b07c773464e628173c5b4..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?
@@ -1101,7 +1103,7 @@ function array_pk_sort (&$array, $a_sort, $primary_key = 0, $order = -1, $nums =
 function ADD_SELECTION ($type, $DEFAULT, $prefix="", $id="0") {
        $OUT = '';
 
-       if ($type == "yn") {
+       if ($type == 'yn') {
                // This is a yes/no selection only!
                if ($id > 0) $prefix .= "[".$id."]";
                $OUT .= "    <select name=\"".$prefix."\" class=\"register_select\" size=\"1\">\n";
@@ -1117,7 +1119,7 @@ function ADD_SELECTION ($type, $DEFAULT, $prefix="", $id="0") {
        case "day": // Day
                for ($idx = 1; $idx < 32; $idx++) {
                        $OUT .= "<option value=\"".$idx."\"";
-                       if ($DEFAULT == $idx) $OUT .= " selected=\"selected\"";
+                       if ($DEFAULT == $idx) $OUT .= ' selected="selected"';
                        $OUT .= ">".$idx."</option>\n";
                } // END - for
                break;
@@ -1125,7 +1127,7 @@ function ADD_SELECTION ($type, $DEFAULT, $prefix="", $id="0") {
        case "month": // Month
                foreach ($GLOBALS['month_descr'] as $month => $descr) {
                        $OUT .= "<option value=\"".$month."\"";
-                       if ($DEFAULT == $month) $OUT .= " selected=\"selected\"";
+                       if ($DEFAULT == $month) $OUT .= ' selected="selected"';
                        $OUT .= ">".$descr."</option>\n";
                } // END - for
                break;
@@ -1150,7 +1152,7 @@ function ADD_SELECTION ($type, $DEFAULT, $prefix="", $id="0") {
                if (($DEFAULT > $minYear) && ($DEFAULT >= $YEAR)) {
                        for ($idx = $YEAR; $idx < ($YEAR + 11); $idx++) {
                                $OUT .= "<option value=\"".$idx."\"";
-                               if ($DEFAULT == $idx) $OUT .= " selected=\"selected\"";
+                               if ($DEFAULT == $idx) $OUT .= ' selected="selected"';
                                $OUT .= ">".$idx."</option>\n";
                        } // END - for
                } elseif ($DEFAULT == -1) {
@@ -1174,7 +1176,7 @@ function ADD_SELECTION ($type, $DEFAULT, $prefix="", $id="0") {
                        // Construct year selection list
                        for ($idx = $minYear; $idx <= $YEAR; $idx++) {
                                $OUT .= "<option value=\"".$idx."\"";
-                               if ($DEFAULT == $idx) $OUT .= " selected=\"selected\"";
+                               if ($DEFAULT == $idx) $OUT .= ' selected="selected"';
                                $OUT .= ">".$idx."</option>\n";
                        } // END - for
                }
@@ -1185,7 +1187,7 @@ function ADD_SELECTION ($type, $DEFAULT, $prefix="", $id="0") {
                for ($idx = 0; $idx < 60; $idx+=5) {
                        if (strlen($idx) == 1) $idx = "0".$idx;
                        $OUT .= "<option value=\"".$idx."\"";
-                       if ($DEFAULT == $idx) $OUT .= " selected=\"selected\"";
+                       if ($DEFAULT == $idx) $OUT .= ' selected="selected"';
                        $OUT .= ">".$idx."</option>\n";
                } // END - for
                break;
@@ -1194,16 +1196,16 @@ function ADD_SELECTION ($type, $DEFAULT, $prefix="", $id="0") {
                for ($idx = 0; $idx < 24; $idx++) {
                        if (strlen($idx) == 1) $idx = "0".$idx;
                        $OUT .= "<option value=\"".$idx."\"";
-                       if ($DEFAULT == $idx) $OUT .= " selected=\"selected\"";
+                       if ($DEFAULT == $idx) $OUT .= ' selected="selected"';
                        $OUT .= ">".$idx."</option>\n";
                } // END - for
                break;
 
-       case "yn":
+       case 'yn':
                $OUT .= "<option value=\"Y\"";
-               if ($DEFAULT == 'Y') $OUT .= " selected=\"selected\"";
+               if ($DEFAULT == 'Y') $OUT .= ' selected="selected"';
                $OUT .= ">{--YES--}</option>\n<option value=\"N\"";
-               if ($DEFAULT == 'N') $OUT .= " selected=\"selected\"";
+               if ($DEFAULT == 'N') $OUT .= ' selected="selected"';
                $OUT .= ">{--NO--}</option>\n";
                break;
        }
@@ -1454,7 +1456,7 @@ function CREATE_TIME_SELECTIONS ($timestamp, $prefix="", $display="", $align="ce
                        $OUT .= "  <td align=\"center\"><select class=\"mini_select\" name=\"".$prefix."_ye\" size=\"1\">\n";
                        for ($idx = 0; $idx <= 10; $idx++) {
                                $OUT .= "    <option class=\"mini_select\" value=\"".$idx."\"";
-                               if ($idx == $Y) $OUT .= " selected=\"selected\"";
+                               if ($idx == $Y) $OUT .= ' selected="selected"';
                                $OUT .= ">".$idx."</option>\n";
                        }
                        $OUT .= "  </select></td>\n";
@@ -1468,7 +1470,7 @@ function CREATE_TIME_SELECTIONS ($timestamp, $prefix="", $display="", $align="ce
                        for ($idx = 0; $idx <= 11; $idx++)
                        {
                                        $OUT .= "  <option class=\"mini_select\" value=\"".$idx."\"";
-                               if ($idx == $M) $OUT .= " selected=\"selected\"";
+                               if ($idx == $M) $OUT .= ' selected="selected"';
                                $OUT .= ">".$idx."</option>\n";
                        }
                        $OUT .= "  </select></td>\n";
@@ -1481,7 +1483,7 @@ function CREATE_TIME_SELECTIONS ($timestamp, $prefix="", $display="", $align="ce
                        $OUT .= "  <td align=\"center\"><select class=\"mini_select\" name=\"".$prefix."_we\" size=\"1\">\n";
                        for ($idx = 0; $idx <= 4; $idx++) {
                                $OUT .= "  <option class=\"mini_select\" value=\"".$idx."\"";
-                               if ($idx == $W) $OUT .= " selected=\"selected\"";
+                               if ($idx == $W) $OUT .= ' selected="selected"';
                                $OUT .= ">".$idx."</option>\n";
                        }
                        $OUT .= "  </select></td>\n";
@@ -1494,7 +1496,7 @@ function CREATE_TIME_SELECTIONS ($timestamp, $prefix="", $display="", $align="ce
                        $OUT .= "  <td align=\"center\"><select class=\"mini_select\" name=\"".$prefix."_da\" size=\"1\">\n";
                        for ($idx = 0; $idx <= 31; $idx++) {
                                $OUT .= "  <option class=\"mini_select\" value=\"".$idx."\"";
-                               if ($idx == $D) $OUT .= " selected=\"selected\"";
+                               if ($idx == $D) $OUT .= ' selected="selected"';
                                $OUT .= ">".$idx."</option>\n";
                        }
                        $OUT .= "  </select></td>\n";
@@ -1507,7 +1509,7 @@ function CREATE_TIME_SELECTIONS ($timestamp, $prefix="", $display="", $align="ce
                        $OUT .= "  <td align=\"center\"><select class=\"mini_select\" name=\"".$prefix."_ho\" size=\"1\">\n";
                        for ($idx = 0; $idx <= 23; $idx++)      {
                                $OUT .= "  <option class=\"mini_select\" value=\"".$idx."\"";
-                               if ($idx == $h) $OUT .= " selected=\"selected\"";
+                               if ($idx == $h) $OUT .= ' selected="selected"';
                                $OUT .= ">".$idx."</option>\n";
                        }
                        $OUT .= "  </select></td>\n";
@@ -1520,7 +1522,7 @@ function CREATE_TIME_SELECTIONS ($timestamp, $prefix="", $display="", $align="ce
                        $OUT .= "  <td align=\"center\"><select class=\"mini_select\" name=\"".$prefix."_mi\" size=\"1\">\n";
                        for ($idx = 0; $idx <= 59; $idx++) {
                                $OUT .= "  <option class=\"mini_select\" value=\"".$idx."\"";
-                               if ($idx == $m) $OUT .= " selected=\"selected\"";
+                               if ($idx == $m) $OUT .= ' selected="selected"';
                                $OUT .= ">".$idx."</option>\n";
                        }
                        $OUT .= "  </select></td>\n";
@@ -1533,7 +1535,7 @@ function CREATE_TIME_SELECTIONS ($timestamp, $prefix="", $display="", $align="ce
                        $OUT .= "  <td align=\"center\"><select class=\"mini_select\" name=\"".$prefix."_se\" size=\"1\">\n";
                        for ($idx = 0; $idx <= 59; $idx++) {
                                $OUT .= "  <option class=\"mini_select\" value=\"".$idx."\"";
-                               if ($idx == $s) $OUT .= " selected=\"selected\"";
+                               if ($idx == $s) $OUT .= ' selected="selected"';
                                $OUT .= ">".$idx."</option>\n";
                        }
                        $OUT .= "  </select></td>\n";
@@ -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')));
@@ -3316,7 +3318,7 @@ function CACHE_PURGE_ADMIN_MENU ($id=0, $action="", $what="", $str="") {
                // No cache instance!
                DEBUG_LOG(__FUNCTION__, __LINE__, " No cache instance found.");
                return false;
-       } elseif ((!isConfigEntrySet('cache_admin_menu')) || (getConfig('cache_admin_menu') != "Y")) {
+       } elseif ((!isConfigEntrySet('cache_admin_menu')) || (getConfig('cache_admin_menu') != 'Y')) {
                // Caching disabled (currently experiemental!)
                return false;
        }