X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Ffunctions.php;h=66324337f68d134e09d79940aba79f6620e04568;hb=d415b463513a32fe02e4b9c0b2cfb07256f67b5d;hp=bf8b9b907b8d54041be49c64ff27013248d58243;hpb=feda50ff73c05935417ed33164d30caf966ba854;p=mailer.git
diff --git a/inc/functions.php b/inc/functions.php
index bf8b9b907b..66324337f6 100644
--- a/inc/functions.php
+++ b/inc/functions.php
@@ -132,7 +132,7 @@ function OUTPUT_HTML($HTML, $NEW_LINE = true) {
default:
// Huh, something goes wrong or maybe you have edited config.php ???
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Invalid renderer %s detected.", OUTPUT_MODE));
+ DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Invalid renderer %s detected.", OUTPUT_MODE));
MXCHANGE_DIE("".FATAL_ERROR.": ".LANG_NO_RENDER_DIRECT);
break;
}
@@ -240,11 +240,11 @@ function LOAD_TEMPLATE($template, $return=false, $content=array()) {
$ret = "";
if (empty($GLOBALS['refid'])) $GLOBALS['refid'] = 0;
- // @DEPRECATED Try to remove this if() block
+ // @DEPRECATED Try to rewrite the if() condition
if ($template == "member_support_form") {
// Support request of a member
- $result = SQL_QUERY_ESC("SELECT gender, surname, family, email FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
- array($GLOBALS['userid']), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT userid, gender, surname, family, email FROM "._MYSQL_PREFIX."_user_data WHERE userid=%s LIMIT 1",
+ array($GLOBALS['userid']), __FILE__, __LINE__);
// Is content an array?
if (is_array($content)) {
@@ -259,6 +259,7 @@ function LOAD_TEMPLATE($template, $return=false, $content=array()) {
// Translate gender
$gender = TRANSLATE_GENDER($gender);
+ DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("DEPRECATION-WARNING: content is not array (%s).", gettype($content)));
}
// Free result
@@ -569,7 +570,7 @@ function MAKE_DATETIME ($time, $mode="0")
case "2": $ret = date("d.m.Y|H:i", $time); break;
case "3": $ret = date("d.m.Y", $time); break;
default:
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Invalid date mode %s detected.", $mode));
+ DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Invalid date mode %s detected.", $mode));
break;
}
break;
@@ -581,7 +582,7 @@ function MAKE_DATETIME ($time, $mode="0")
case "2": $ret = date("y-m-d|H:i", $time); break;
case "3": $ret = date("y-m-d", $time); break;
default:
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Invalid date mode %s detected.", $mode));
+ DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Invalid date mode %s detected.", $mode));
break;
}
}
@@ -602,23 +603,17 @@ function TRANSLATE_COMMA ($dotted, $cut=true, $max=0) {
if ($max > 0) $maxComma = $max;
// Cut zeros off?
- if ($cut) {
+ if (($cut) && ($max == 0)) {
// Test for commata if in cut-mode
$com = explode(".", $dotted);
- if (count($com) > 1) {
- // Commata found, so only zeros?
- if ($com[1] == str_repeat("0", strlen($com[1]))) {
- // Only zeros, so display only one
- $maxComma = 1;
- } // END - if
- } else {
+ if (count($com) < 2) {
// Don't display commatas even if there are none... ;-)
$maxComma = 0;
}
} // END - if
// Debug log
- //DEBUG_LOG(__FUNCTION__, __LINE__, "dotted={$dotted},maxComma={$maxComma}");
+ //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "dotted={$dotted},maxComma={$maxComma}");
// Translate it now
switch (GET_LANGUAGE()) {
@@ -703,7 +698,7 @@ function TRANSLATE_STATUS($status) {
break;
default:
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown status %s detected.", $status));
+ DEBUG_LOG(__FUNCTION__, __LINE__, sprintf("Unknown status %s detected.", $status));
$ret = UNKNOWN_STATUS_1.$status.UNKNOWN_STATUS_2;
break;
}
@@ -711,19 +706,22 @@ function TRANSLATE_STATUS($status) {
}
//
function GET_LANGUAGE() {
- if (!empty($_GET['mx_lang'])) {
- // Accept only first 2 chars
- $lang = substr($_GET['mx_lang'], 0, 2);
- } else {
- // Do nothing
- $lang = "";
- }
+ global $cacheArray;
// Set default return value to default language from config
$ret = DEFAULT_LANG;
- // Check GET variable and cookie
- if (!empty($lang)) {
+ // Init variable
+ $lang = "";
+
+ // Is the variable set
+ if (!empty($_GET['mx_lang'])) {
+ // Accept only first 2 chars
+ $lang = substr($_GET['mx_lang'], 0, 2);
+ } elseif (isset($cacheArray['language'])) {
+ // Use cached
+ $ret = $cacheArray['language'];
+ } elseif (!empty($lang)) {
// Check if main language file does exist
if (FILE_READABLE(PATH."inc/language/".$lang.".php")) {
// Okay found, so let's update cookies
@@ -736,6 +734,11 @@ function GET_LANGUAGE() {
// Fixes a warning before the session has the mx_lang constant
if (empty($ret)) $ret = DEFAULT_LANG;
}
+
+ // Cache entry
+ $cacheArray['language'] = $ret;
+
+ // Return value
return $ret;
}
//
@@ -920,15 +923,15 @@ function MAKE_TIME($H, $M, $S, $stamp) {
function LOAD_URL($URL, $addUrlData=true) {
global $CSS, $_CONFIG, $footer;
+ // Compile out URI codes
+ $URL = COMPILE_CODE($URL);
+
// Check if http(s):// is there
if ((substr($URL, 0, 7) != "http://") && (substr($URL, 0, 8) != "https://")) {
// Make all URLs full-qualified
$URL = URL."/".$URL;
}
- // Compile out URI codes
- $URL = COMPILE_CODE($URL);
-
// Get output buffer
$OUTPUT = ob_get_contents();
@@ -1099,41 +1102,37 @@ function array_pk_sort(&$array, $a_sort, $primary_key = 0, $order = -1, $nums =
$array = $dummy;
}
//
-function ADD_SELECTION($type, $DEFAULT, $prefix="", $id="0")
-{
- global $MONTH_DESCR; $OUT = "";
- if ($type == "yn")
- {
+function ADD_SELECTION($type, $DEFAULT, $prefix="", $id="0") {
+ global $MONTH_DESCR, $_CONFIG;
+ $OUT = "";
+
+ if ($type == "yn") {
// This is a yes/no selection only!
if ($id > 0) $prefix .= "[".$id."]";
$OUT .= "