From: Roland Häder Date: Mon, 5 Jul 2010 12:15:19 +0000 (+0000) Subject: Fixed displaying of correct values in surfbar X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c479909b28b58c8d3ade7b46c1343d07d77b3f8d;p=mailer.git Fixed displaying of correct values in surfbar --- diff --git a/inc/databases.php b/inc/databases.php index 82f7ebb0b8..8dd31b8864 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -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'); diff --git a/inc/expression-functions.php b/inc/expression-functions.php index 29d4128724..b5f92fc07d 100644 --- a/inc/expression-functions.php +++ b/inc/expression-functions.php @@ -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('
'.encodeEntities(print_r($data, true)).'
'); + // 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 diff --git a/inc/filters.php b/inc/filters.php index 5dd7d69990..197d33ce46 100644 --- a/inc/filters.php +++ b/inc/filters.php @@ -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 diff --git a/inc/functions.php b/inc/functions.php index 69bdcc37d4..427c31205c 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -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 diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index 770c266eba..a8277d6255 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -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? diff --git a/templates/de/html/member/member_surfbar_start_dynamic.tpl b/templates/de/html/member/member_surfbar_start_dynamic.tpl index 82522e8fc3..a12e2beb62 100644 --- a/templates/de/html/member/member_surfbar_start_dynamic.tpl +++ b/templates/de/html/member/member_surfbar_start_dynamic.tpl @@ -24,9 +24,9 @@ derzeit die Surfbar nutzenden {%pipe,SURFBAR_DETERMINE_TOTAL_ONLINE%} Mitglieder, die gesamt in der Surfbar gebuchten - {%pipe,translateComma=$content[surfbar_total_urls]%} + {%pipe,SURFBAR_GET_TOTAL_URLS,translateComma%} URLs (ohne von unseren Sponsoren), sowie Ihre gebuchten - {%pipe,SURFBAR_GET_TOTAL_USER_URLS%} URLs werden als + {%pipe,getMemberId,SURFBAR_GET_TOTAL_USER_URLS,translateComma%} URLs werden als Berechnungsgrundlage verwendet. Sie erhalten allerdings nur einen reduzierten Anteil von {%config,translateComma=surfbar_dynamic_percent%}%.