X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Ffunctions.php;h=d5a4f20347509cd0f2b2833ad90ad51290228827;hp=5c69d92b29035759c1871c3202bc4c8ed23a0689;hb=6586600d8020147192e5f28ca2a3a0153f774d3c;hpb=c14a130863bb037b00fceabd099a202eb4a5b2d8 diff --git a/inc/functions.php b/inc/functions.php index 5c69d92b29..d5a4f20347 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -603,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()) { @@ -712,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 @@ -737,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; } // @@ -921,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(); @@ -1100,76 +1102,86 @@ 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 .= " \n"; } - switch ($type) - { + + switch ($type) { case "day": // Day - for ($idx = 1; $idx < 32; $idx++) - { + for ($idx = 1; $idx < 32; $idx++) { $OUT .= "\n"; } - } - else - { - // Get current year and subtract 16 (for erotic content) - $OUT .= "\n"; - $YEAR = date('Y', time()) - 16; - for ($idx = 1930; $idx <= $YEAR; $idx++) - { + } else { + // Get current year and subtract the configured minimum age + $OUT .= "\n"; + // Calculate earliest year depending on extension version + if (GET_EXT_VERSION("other") >= "0.2.1") { + // Use configured minimum age + $YEAR = date('Y', time()) - $_CONFIG['min_age']; + } else { + // Use fixed 16 years age + $YEAR = date('Y', time()) - 16; + } + + // Construct year selection list + for ($idx = $minYear; $idx <= $YEAR; $idx++) { $OUT .= "