]> git.mxchange.org Git - mailer.git/blobdiff - inc/functions.php
Continued a bit:
[mailer.git] / inc / functions.php
index d5d9226e38b4b6980eefed23818ef2d9daa41882..0d6c9889ec38148166358b4b6eb37e57ce176566 100644 (file)
@@ -224,12 +224,7 @@ function translateActivationStatus ($status) {
 // OPPOMENT: convertCommaToDot()
 function translateComma ($dotted, $cut = TRUE, $max = '0') {
        // First, cast all to double, due to PHP changes
-       $dotted = (double) $dotted;
-
-       // Default is 3 you can change this in admin area "Settings -> Misc Options"
-       if (!isConfigEntrySet('max_comma')) {
-               setConfigEntry('max_comma', 3);
-       } // END - if
+       $double = (double) $dotted;
 
        // Use from config is default
        $maxComma = getConfig('max_comma');
@@ -242,7 +237,7 @@ function translateComma ($dotted, $cut = TRUE, $max = '0') {
        // Cut zeros off?
        if (($cut === TRUE) && ($max == '0')) {
                // Test for commata if in cut-mode
-               $com = explode('.', $dotted);
+               $com = explode('.', $double);
                if (count($com) < 2) {
                        // Don't display commatas even if there are none... ;-)
                        $maxComma = '0';
@@ -252,19 +247,19 @@ function translateComma ($dotted, $cut = TRUE, $max = '0') {
        // Debug log
 
        // Translate it now
-       $translated = $dotted;
+       $translated = $double;
        switch (getLanguage()) {
                case 'de': // German language
-                       $translated = number_format($dotted, $maxComma, ',', '.');
+                       $translated = number_format($double, $maxComma, ',', '.');
                        break;
 
                default: // All others
-                       $translated = number_format($dotted, $maxComma, '.', ',');
+                       $translated = number_format($double, $maxComma, '.', ',');
                        break;
        } // END - switch
 
        // Return translated value
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'dotted=' . $dotted . ',translated=' . $translated . ',maxComma=' . $maxComma);
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'double=' . $double . ',translated=' . $translated . ',maxComma=' . $maxComma);
        return $translated;
 }
 
@@ -322,6 +317,9 @@ function translateUserStatus ($status) {
 
 // "Translates" 'visible' and 'locked' to a CSS class
 function translateMenuVisibleLocked ($content, $prefix = '') {
+       // 1st parameter should be an array
+       assert(is_array($content));
+
        // Default is 'menu_unknown'
        $content['visible_css'] = $prefix . 'menu_unknown';
 
@@ -373,7 +371,12 @@ function generateDereferrerUrl ($url) {
                //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'url=' . $url . ',hash=' . $hash . '(' . strlen($hash) . ')');
 
                // De-refer this URL
-               $url = '{%url=modules.php?module=loader&amp;url=' . $encodedUrl . '&amp;hash=' . encodeHashForCookie($hash) . '&amp;salt=' . substr($hash, 0, getSaltLength()) . '%}';
+               $url = sprintf(
+                               '{%%url=modules.php?module=loader&amp;url=%s&amp;hash=%s&amp;salt=%s%%}',
+                               $encodedUrl,
+                               encodeHashForCookie($hash),
+                               substr($hash, 0, getSaltLength())
+               );
        } // END - if
 
        // Return link
@@ -403,7 +406,7 @@ function countSelection ($array) {
        $ret = '0';
 
        // Count all entries
-       foreach ($array as $key => $selected) {
+       foreach ($array as $selected) {
                // Is it checked?
                if (!empty($selected)) {
                        // Yes, then count it
@@ -434,6 +437,7 @@ function makeTime ($hours, $minutes, $seconds, $stamp) {
 }
 
 // Redirects to an URL and if neccessarry extends it with own base URL
+// @TODO $allowSpider is unused
 function redirectToUrl ($url, $allowSpider = TRUE, $compileCode = TRUE) {
        // Is the output mode -2?
        if (isAjaxOutputMode()) {
@@ -521,7 +525,7 @@ function array_pk_sort (&$array, $a_sort, $primary_key = '0', $order = -1, $nums
                                if ($match) {
                                        // We have found two different values, so let's sort whole array
                                        foreach ($temporaryArray as $sort_key => $sort_val) {
-                                               $t                       = $temporaryArray[$sort_key][$key];
+                                               $t = $temporaryArray[$sort_key][$key];
                                                $temporaryArray[$sort_key][$key]  = $temporaryArray[$sort_key][$key2];
                                                $temporaryArray[$sort_key][$key2] = $t;
                                                unset($t);