From: Roland Häder Date: Wed, 17 Sep 2008 19:29:02 +0000 (+0000) Subject: Dynamic payment added to surfbar X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=cb30b8c591b92189065565d67063c7512b0eeb76;p=mailer.git Dynamic payment added to surfbar --- diff --git a/.gitattributes b/.gitattributes index 9fb971a6f3..5211aa362c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1299,6 +1299,7 @@ templates/de/html/member/member_support_form.tpl -text templates/de/html/member/member_surfbar_book_dynamic.tpl -text templates/de/html/member/member_surfbar_book_static.tpl -text templates/de/html/member/member_surfbar_link.tpl -text +templates/de/html/member/member_surfbar_start_dynamic.tpl -text templates/de/html/member/member_surfbar_start_static.tpl -text templates/de/html/member/member_themes.tpl -text templates/de/html/member/member_transfer_list.tpl -text diff --git a/inc/databases.php b/inc/databases.php index e4e9589db2..99964d830b 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -113,7 +113,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // This current patch level -define('CURR_SVN_REVISION', "352"); +define('CURR_SVN_REVISION', "353"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/functions.php b/inc/functions.php index 533e824c60..75a0e57240 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -1260,8 +1260,8 @@ function GENERATE_IMAGE($img_code, $header=true) { } // Create selection box or array of splitted timestamp function CREATE_TIME_SELECTIONS($timestamp, $prefix="", $display="", $align="center", $return_array=false) { - // Calculate 15-seconds timestamp (15-seconds-steps shall be fine ;) ) - $stamp = round($timestamp / 15) * 15; + // Calculate 2-seconds timestamp + $stamp = round($timestamp / 2) * 2; // Do we have a leap year? $SWITCH = 0; @@ -1290,7 +1290,7 @@ function CREATE_TIME_SELECTIONS($timestamp, $prefix="", $display="", $align="cen // Is seconds zero and time is < 60 seconds? if (($s == 0) && ($stamp < 60)) { // Fix seconds - $s = $timestamp; + $s = round($timestamp); } // END - if // @@ -1537,8 +1537,14 @@ function CREATE_FANCY_TIME($stamp) { } // END - if } // END - foreach - // Remove leading commata and space - $ret = substr($ret, 2); + // Do we have something there? + if (strlen($ret) > 0) { + // Remove leading commata and space + $ret = substr($ret, 2); + } else { + // Zero seconds + $ret = "0 "._SECONDS; + } // Return fancy time string return $ret; diff --git a/inc/language/surfbar_de.php b/inc/language/surfbar_de.php index 9ba208a397..87c06086f3 100644 --- a/inc/language/surfbar_de.php +++ b/inc/language/surfbar_de.php @@ -46,7 +46,7 @@ define('ADMIN_CONFIG_SURFBAR_STATIC_LOCK', "Statische Reload-Sperre (oberes Fram define('ADMIN_CONFIG_SURFBAR_PAYMENT_MODEL', "Vergütungsmodel auswählen:"); define('ADMIN_CONFIG_SURFBAR_PAYMENT_MODEL_STATIC', "Statische Werte verwenden."); define('ADMIN_CONFIG_SURFBAR_PAYMENT_MODEL_DYNAMIC', "Dynamische Werte errechnen."); -define('ADMIN_CONFIG_SURFBAR_DYNAMIC_PERCENT', "Prozent auf dynamische Vergütung:"); +define('ADMIN_CONFIG_SURFBAR_DYNAMIC_PERCENT', "Prozent auf dynamische Vergütung/ Verweildauer/Reload-Sperre:"); define('ADMIN_CONFIG_SURFBAR_MAX_ORDER', "Maximal durch Mitglied in Surfbar buchbare URLs:"); define('ADMIN_CONFIG_SURFBAR_RESTART_TIME', "Ruhezeit der Surfbar, wenn alle URLs in Reload-Lock sind: (*)"); define('ADMIN_CONFIG_SURFBAR_AUTOSTART', "Surfbar soll nach Ruhezeit automatisch starten?"); @@ -96,8 +96,8 @@ define('ADMIN_SURFBAR_NOTIFY_URL_REG_SUBJECT', "Mitglied hat URL in Surfbar gebu define('ADMIN_SURFBAR_NOTIFY_URL_CONFIRMED_SUBJECT', "URL in Surfbar freigegeben"); // Auto-generated admin subject lines -define('ADMIN_DEL_SURFBAR_URLS_SUBJECT', "[Surfbar:] - URL entfernt"); -define('ADMIN_EDIT_SURFBAR_URLS_SUBJECT', "[Surfbar:] - URL geändert"); +define('ADMIN_DEL_SURFBAR_URLS_SUBJECT', "[Surfbar:] URL entfernt"); +define('ADMIN_EDIT_SURFBAR_URLS_SUBJECT', "[Surfbar:] URL geändert"); define('ADMIN_CONFIRMED_SURFBAR_URLS_SUBJECT', "[Surfbar:] Freigabe einer URL"); define('ADMIN_LOCKED_SURFBAR_URLS_SUBJECT', "[Surfbar:] Sperrung einer URL"); diff --git a/inc/libs/surfbar_functions.php b/inc/libs/surfbar_functions.php index ec045622f3..f2b006ccda 100644 --- a/inc/libs/surfbar_functions.php +++ b/inc/libs/surfbar_functions.php @@ -725,6 +725,81 @@ function SURFBAR_CHANGE_STATUS ($id, $prevStatus, $newStatus) { // All done! return true; } +// Calculate minimum value for dynamic payment model +function SURFBAR_CALCULATE_DYNAMIC_MIN_VALUE () { + global $_CONFIG; + + // Addon is zero by default + $addon = 0; + + // Percentage part + $percent = abs(log($_CONFIG['surfbar_dynamic_percent'] / 100 + 1)); + + // Get total users + $totalUsers = GET_TOTAL_DATA("CONFIRMED", "user_data", "userid", "status", true); + + // Get online users + $onlineUsers = SURFBAR_DETERMINE_TOTAL_ONLINE(); + + // Calculate addon + $addon += abs(log($onlineUsers / $totalUsers + 1) * $percent * $totalUsers); + + // Get total URLs + $totalUrls = SURFBAR_GET_TOTAL_URLS(); + + // Get user's total URLs + $userUrls = SURFBAR_GET_TOTAL_USER_URLS(); + + // Calculate addon + $addon += abs(log($userUrls / $totalUrls + 1) * $percent * $totalUrls); + + // Return addon + return $addon; +} +// Calculate maximum value for dynamic payment model +function SURFBAR_CALCULATE_DYNAMIC_MAX_VALUE () { + global $_CONFIG; + + // Addon is zero by default + $addon = 0; + + // Maximum value + $max = log(2); + + // Percentage part + $percent = abs(log($_CONFIG['surfbar_dynamic_percent'] / 100 + 1)); + + // Get total users + $totalUsers = GET_TOTAL_DATA("CONFIRMED", "user_data", "userid", "status", true); + + // Calculate addon + $addon += abs($max * $percent * $totalUsers); + + // Get total URLs + $totalUrls = SURFBAR_GET_TOTAL_URLS(); + + // Calculate addon + $addon += abs($max * $percent * $totalUrls); + + // Return addon + return $addon; +} +// Calculate dynamic lock +function SURFBAR_CALCULATE_DYNAMIC_LOCK () { + global $_CONFIG; + + // Default lock is 30 seconds + $addon = 30; + + // Get online users + $onlineUsers = SURFBAR_DETERMINE_TOTAL_ONLINE(); + + // Calculate lock + $addon = abs(log($onlineUsers / $addon +1)); + + // Return value + return $addon; +} // "Getter" for lock ids array function SURFBAR_GET_LOCK_IDS () { // Prepare some arrays diff --git a/inc/modules/member/what-surfbar_start.php b/inc/modules/member/what-surfbar_start.php index 2308f2a275..a5f81030d0 100644 --- a/inc/modules/member/what-surfbar_start.php +++ b/inc/modules/member/what-surfbar_start.php @@ -49,12 +49,30 @@ ADD_DESCR("member", basename(__FILE__)); // Prepare content for output $content = array( - 'surfbar_static_reward' => TRANSLATE_COMMA($_CONFIG['surfbar_static_reward']), - 'surfbar_static_time' => CREATE_FANCY_TIME($_CONFIG['surfbar_static_time']), - 'surfbar_static_lock' => CREATE_FANCY_TIME($_CONFIG['surfbar_static_lock']), - 'surfbar_dynamic_percent' => TRANSLATE_COMMA($_CONFIG['surfbar_dynamic_percent']) + 'surfbar_static_reward' => TRANSLATE_COMMA($_CONFIG['surfbar_static_reward']), + 'surfbar_static_time' => CREATE_FANCY_TIME($_CONFIG['surfbar_static_time']), + 'surfbar_static_lock' => CREATE_FANCY_TIME($_CONFIG['surfbar_static_lock']), ); +// In dynamic mode we need some more data +if ($_CONFIG['surfbar_pay_model'] == "DYNAMIC") { + // Total URLs + $content = array( + 'surfbar_dynamic_percent' => TRANSLATE_COMMA($_CONFIG['surfbar_dynamic_percent']), + 'surfbar_total_urls' => SURFBAR_GET_TOTAL_URLS("CONFIRMED", "0"), + 'surfbar_user_urls' => SURFBAR_GET_TOTAL_USER_URLS(), + 'surfbar_total_online' => SURFBAR_DETERMINE_TOTAL_ONLINE(), + 'surfbar_total_users' => TRANSLATE_COMMA(GET_TOTAL_DATA("CONFIRMED", "user_data", "userid", "status", true)), + 'surfbar_min_reward' => TRANSLATE_COMMA(SURFBAR_CALCULATE_DYNAMIC_MIN_VALUE()), + 'surfbar_max_reward' => TRANSLATE_COMMA(SURFBAR_CALCULATE_DYNAMIC_MAX_VALUE()), + 'surfbar_min_time' => CREATE_FANCY_TIME(SURFBAR_CALCULATE_DYNAMIC_MIN_VALUE()), + 'surfbar_max_time' => CREATE_FANCY_TIME(SURFBAR_CALCULATE_DYNAMIC_MAX_VALUE()), + 'surfbar_dynamic_lock' => CREATE_FANCY_TIME(SURFBAR_CALCULATE_DYNAMIC_LOCK()), + 'surfbar_static_reward' => TRANSLATE_COMMA($_CONFIG['surfbar_static_reward']), + 'surfbar_static_time' => CREATE_FANCY_TIME($_CONFIG['surfbar_static_time']) + ); +} // END - if + // Load the template LOAD_TEMPLATE("member_surfbar_start_".strtolower($_CONFIG['surfbar_pay_model']), false, $content); diff --git a/templates/de/html/admin/admin_contct_user_form.tpl b/templates/de/html/admin/admin_contct_user_form.tpl index 19d1a82703..7767ab362a 100644 --- a/templates/de/html/admin/admin_contct_user_form.tpl +++ b/templates/de/html/admin/admin_contct_user_form.tpl @@ -1,12 +1,10 @@ -
- + +
- +
{--ADMIN_CONTACT_USER--}:
- $content[surname] $content[family] <$content[email]>
+ {--ADMIN_CONTACT_USER--}:
+ $content[surname] $content[family] <$content[email]>
+