Fixed displaying of correct values in surfbar
authorRoland Häder <roland@mxchange.org>
Mon, 5 Jul 2010 12:15:19 +0000 (12:15 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 5 Jul 2010 12:15:19 +0000 (12:15 +0000)
inc/databases.php
inc/expression-functions.php
inc/filters.php
inc/functions.php
inc/wrapper-functions.php
templates/de/html/member/member_surfbar_start_dynamic.tpl

index 82f7ebb0b8f8e60726503d58e589c60323f2f558..8dd31b8864620767d7bdf4147d499a3c08761bae 100644 (file)
@@ -49,7 +49,7 @@ addCode('ACCOUNT_LOCKED'     , 0x003);
 addCode('ACCOUNT_UNCONFIRMED', 0x004);
 addCode('UNKNOWN_STATUS'     , 0x005);
 addCode('NO_MAIL_TYPE'       , 0x006);
-addCode('CNTR_FAILED'        , 0x008);
+addCode('CNTR_FAILED'        , 0x007);
 addCode('LOGOUT_DONE'        , 0x008);
 addCode('LOGOUT_FAILED'      , 0x009);
 addCode('URL_TLOCK'          , 0x00a);
@@ -63,21 +63,21 @@ addCode('MORE_POINTS'        , 0x011);
 addCode('COOKIES_DISABLED'   , 0x012);
 addCode('DATA_INVALID'       , 0x013);
 addCode('POSSIBLE_INVALID'   , 0x014);
-addCode('USER_404'           , 0x016);
-addCode('STATS_404'          , 0x017);
-addCode('ALREADY_CONFIRMED'  , 0x018);
-addCode('ERROR_MAILID'       , 0x019);
-addCode('EXTENSION_PROBLEM'  , 0x01a);
-addCode('MORE_RECEIVERS1'    , 0x01b);
-addCode('MORE_RECEIVERS2'    , 0x01c);
-addCode('MORE_RECEIVERS3'    , 0x01d);
-addCode('INVALID_URL'        , 0x01e);
-addCode('MENU_NOT_VALID'     , 0x01f);
-addCode('LOGIN_FAILED'       , 0x020);
-addCode('BEG_SAME_AS_OWN'    , 0x021);
-addCode('UNHANDLED_STATUS'   , 0x022);
-addCode('MODULE_MEMBER_ONLY' , 0x023);
-addCode('UNKNOWN_ERROR'      , 0x024);
+addCode('USER_404'           , 0x015);
+addCode('STATS_404'          , 0x016);
+addCode('ALREADY_CONFIRMED'  , 0x017);
+addCode('ERROR_MAILID'       , 0x018);
+addCode('EXTENSION_PROBLEM'  , 0x019);
+addCode('MORE_RECEIVERS1'    , 0x01a);
+addCode('MORE_RECEIVERS2'    , 0x01b);
+addCode('MORE_RECEIVERS3'    , 0x01c);
+addCode('INVALID_URL'        , 0x01d);
+addCode('MENU_NOT_VALID'     , 0x01e);
+addCode('LOGIN_FAILED'       , 0x01f);
+addCode('BEG_SAME_AS_OWN'    , 0x020);
+addCode('UNHANDLED_STATUS'   , 0x021);
+addCode('MODULE_MEMBER_ONLY' , 0x022);
+addCode('UNKNOWN_ERROR'      , 0x023);
 
 // Full version
 setConfigEntry('FULL_VERSION', '0.2.1-FINAL');
index 29d412872442de503769cb4e0bdc05c5a0856290..b5f92fc07d316dc7501709d4595ecc50fa0b2d00 100644 (file)
@@ -222,16 +222,17 @@ function doExpressionPipe ($data) {
        // We need callback and extra_func: callback is really the call-back function, extra_func is our value
        $replacer = $data['extra_func'];
 
-       // Is the extra_func empty and value set?
-       if ((empty($replacer)) && (isset($data['value']))) {
-               // Then use this
-               $replacer = $data['value'];
-       } // END - if
-
        // Do we have a call-back? Should always be there!
        if (!empty($data['callback'])) {
-               // Parse it through this function
-               $replacer = '{DQUOTE} . ' . $data['extra_func'] . '(' . $data['callback'] . "('" . $replacer . "')) . {DQUOTE}";
+               //if ($data['callback'] == 'getMemberId') die('<pre>'.encodeEntities(print_r($data, true)).'</pre>');
+               // If the value is empty, we don't add it
+               if (empty($data['value'])) {
+                       // No value is set
+                       $replacer = '{DQUOTE} . ' . $data['extra_func2'] . '(' . $data['extra_func'] . '(' . $data['callback'] . '())) . {DQUOTE}';
+               } else {
+                       // Some value is set
+                       $replacer = '{DQUOTE} . ' . $data['extra_func2'] . '(' . $data['extra_func'] . '(' . $data['callback'] . "('" . $data['value'] . "'))) . {DQUOTE}";
+               }
        } // END - if
 
        // Replace the config entry
index 5dd7d6999025ddec270572adfccaf23db5ca54d3..197d33ce46cbb19d62a115d094f161fa425aab9c 100644 (file)
@@ -459,10 +459,11 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) {
                // Replace all matches
                foreach ($matches[2] as $key => $cmd) {
                        // Init replacer/call-back variable
-                       $replacer      = '';
-                       $callback      = '';
-                       $extraFunction = '';
-                       $value         = '';
+                       $replacer       = '';
+                       $callback       = '';
+                       $extraFunction  = '';
+                       $extraFunction2 = '';
+                       $value          = '';
 
                        // Extract command and call-back
                        $cmdArray = explode(',', $cmd);
@@ -478,10 +479,19 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) {
                        if (isset($cmdArray[2])) {
                                // Also detected
                                $extraFunction = $cmdArray[2];
-                       } elseif (isset($matches[4][$key])) {
+                       } // END - if
+
+                       // Detect extra function 2
+                       if (isset($cmdArray[3])) {
+                               // Also detected
+                               $extraFunction2 = $cmdArray[3];
+                       } // END - if
+
+                       // And value
+                       if (isset($matches[4][$key])) {
                                // Use this as value
                                $value = $matches[4][$key];
-                       }
+                       } // END - if
 
                        // Construct call-back function name for the command
                        $commandFunction = 'doExpression' . ucfirst(strtolower($cmd));
@@ -490,13 +500,14 @@ function FILTER_COMPILE_EXPRESSION_CODE ($code) {
                        if (function_exists($commandFunction)) {
                                // Prepare $matches, $key, $outputMode, etc.
                                $data = array(
-                                       'matches'    => $matches,
-                                       'key'        => $key,
-                                       'mode'       => $outputMode,
-                                       'code'       => $code,
-                                       'callback'   => $callback,
-                                       'extra_func' => $extraFunction,
-                                       'value'      => $value
+                                       'matches'     => $matches,
+                                       'key'         => $key,
+                                       'mode'        => $outputMode,
+                                       'code'        => $code,
+                                       'callback'    => $callback,
+                                       'extra_func'  => $extraFunction,
+                                       'extra_func2' => $extraFunction2,
+                                       'value'       => $value
                                );
 
                                // Call it
index 69bdcc37d4ae3dbe48186def8aa002f2c620b2de..427c31205ccf3f23ec849c6015c5176bf53afd28 100644 (file)
@@ -376,25 +376,26 @@ function translateComma ($dotted, $cut = true, $max = '0') {
                if (count($com) < 2) {
                        // Don't display commatas even if there are none... ;-)
                        $maxComma = '0';
-               }
+               } // END - if
        } // END - if
 
        // Debug log
-       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, "dotted={$dotted},maxComma={$maxComma}");
 
        // Translate it now
+       $translated = $dotted;
        switch (getLanguage()) {
                case 'de': // German language
-                       $dotted = number_format($dotted, $maxComma, ',', '.');
+                       $translated = number_format($dotted, $maxComma, ',', '.');
                        break;
 
                default: // All others
-                       $dotted = number_format($dotted, $maxComma, '.', ',');
+                       $translated = number_format($dotted, $maxComma, '.', ',');
                        break;
        } // END - switch
 
        // Return translated value
-       return $dotted;
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'dotted=' . $dotted . ',translated=' . $translated . ',maxComma=' . $maxComma);
+       return $translated;
 }
 
 // Translate Uni*-like gender to human-readable
index 770c266ebafeadc11b491abe1ff4fdddf9c16410..a8277d6255d0d1eee25d24acd807062ec4461fd2 100644 (file)
@@ -1730,6 +1730,66 @@ function getPointsRef () {
        return $GLOBALS['points_ref'];
 }
 
+// "Getter" for ref_payout
+function getRefPayout () {
+       // Do we have cache?
+       if (!isset($GLOBALS['ref_payout'])) {
+               // Determine it
+               $GLOBALS['ref_payout'] = getConfig('ref_payout');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['ref_payout'];
+}
+
+// "Getter" for surfbar_dynamic_percent
+function getSurfbarDynamicPercent () {
+       // Do we have cache?
+       if (!isset($GLOBALS['surfbar_dynamic_percent'])) {
+               // Determine it
+               $GLOBALS['surfbar_dynamic_percent'] = getConfig('surfbar_dynamic_percent');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['surfbar_dynamic_percent'];
+}
+
+// "Getter" for surfbar_static_reward
+function getSurfbarStaticReward () {
+       // Do we have cache?
+       if (!isset($GLOBALS['surfbar_static_reward'])) {
+               // Determine it
+               $GLOBALS['surfbar_static_reward'] = getConfig('surfbar_static_reward');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['surfbar_static_reward'];
+}
+
+// "Getter" for surfbar_static_time
+function getSurfbarStaticTime () {
+       // Do we have cache?
+       if (!isset($GLOBALS['surfbar_static_time'])) {
+               // Determine it
+               $GLOBALS['surfbar_static_time'] = getConfig('surfbar_static_time');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['surfbar_static_time'];
+}
+
+// "Getter" for online_timeout
+function getOnlineTimeout () {
+       // Do we have cache?
+       if (!isset($GLOBALS['online_timeout'])) {
+               // Determine it
+               $GLOBALS['online_timeout'] = getConfig('online_timeout');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['online_timeout'];
+}
+
 // Checks wether proxy configuration is used
 function isProxyUsed () {
        // Do we have cache?
index 82522e8fc37717c33ea2b7bfd4a7b1b261a770c3..a12e2beb62ce5653a4abc9d9e9baee3d00309325 100644 (file)
@@ -24,9 +24,9 @@
                derzeit die Surfbar nutzenden
                <strong>{%pipe,SURFBAR_DETERMINE_TOTAL_ONLINE%}</strong> Mitglieder, die
                gesamt in der Surfbar gebuchten
-               <strong>{%pipe,translateComma=$content[surfbar_total_urls]%}</strong>
+               <strong>{%pipe,SURFBAR_GET_TOTAL_URLS,translateComma%}</strong>
                URLs (ohne von unseren Sponsoren), sowie Ihre gebuchten
-               <strong>{%pipe,SURFBAR_GET_TOTAL_USER_URLS%}</strong> URLs werden als
+               <strong>{%pipe,getMemberId,SURFBAR_GET_TOTAL_USER_URLS,translateComma%}</strong> URLs werden als
                Berechnungsgrundlage verwendet. Sie erhalten allerdings nur einen
                reduzierten Anteil von
                <strong>{%config,translateComma=surfbar_dynamic_percent%}%</strong>.