From: Roland Häder Date: Sun, 12 Oct 2008 00:50:37 +0000 (+0000) Subject: Min/max reback percents implemented X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0c258efccc63ed3bc7f3f91915c56005e131dda8;p=mailer.git Min/max reback percents implemented --- diff --git a/inc/databases.php b/inc/databases.php index f54c7a929f..b994f3e09b 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', "494"); +define('CURR_SVN_REVISION', "495"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/language/refback_de.php b/inc/language/refback_de.php index fece0bb0ec..c0a29361d7 100644 --- a/inc/language/refback_de.php +++ b/inc/language/refback_de.php @@ -72,6 +72,7 @@ define('MEMBER_REFBACK_ERROR_INVALID_ID_NUMBER', "Ungültige ID-Nummer ü define('MEMBER_REFBACK_ERROR_INVALID_PERCENTAGE', "Prozentsatz ungültig. 0 bis 100 sind gültige Werte."); define('MEMBER_REFBACK_ERROR_ID_MISMATCH', "Die ausgewählte Ref-Back ID gehört Ihnen nicht."); define('MEMBER_REFBACK_ERROR_NOT_UPDATED', "Ref-Back nicht aktualisiert."); +define('MEMBER_REFBACK_ERROR_OUT_OF_BOUNDS', "Sie können nur mindestens %s% und maximal %s% einstellen!"); define('MEMBER_REFBACK_DONE', "Ref-Back eingestellt. Dieser ist ab jetzt gültig."); // Subject lines diff --git a/inc/modules/member/what-refback.php b/inc/modules/member/what-refback.php index 5a965b6723..db6fdcd5d2 100644 --- a/inc/modules/member/what-refback.php +++ b/inc/modules/member/what-refback.php @@ -59,19 +59,25 @@ ADD_DESCR("member", __FILE__); if ((isset($_POST['edit'])) && (isset($_POST['id']))) { // Okay, has the user entered some values? if (isset($_POST['percents'])) { - // Change ref-back for this direct id - $status = REFBACK_CHANGE_MEMBER_PERCENTS($_POST['id'], $_POST['percents']); - - // Check status - if (isset($status['ok'])) { - // No message found - LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_REFBACK_DONE); - } elseif (isset($status['message'])) { - // Something went wrong with error message - LOAD_TEMPLATE("admin_settings_saved", false, sprintf(MEMBER_REFBACK_ERROR_MESSAGE, $status['message'])); + // Validate percents + if (($_POST['percents'] >= $_CONFIG['refback_min_percents']) || ($_POST['percents'] == 0)) && ($_POST['percents'] <= $_CONFIG['refback_max_percents'])) { + // Change ref-back for this direct id + $status = REFBACK_CHANGE_MEMBER_PERCENTS($_POST['id'], $_POST['percents']); + + // Check status + if (isset($status['ok'])) { + // No message found + LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_REFBACK_DONE); + } elseif (isset($status['message'])) { + // Something went wrong with error message + LOAD_TEMPLATE("admin_settings_saved", false, sprintf(MEMBER_REFBACK_ERROR_MESSAGE, $status['message'])); + } else { + // No message found + LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_REFBACK_ERROR_EMPTY_MESSAGE); + } } else { - // No message found - LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_REFBACK_ERROR_EMPTY_MESSAGE); + // Percents out-of-bounds ;-) + LOAD_TEMPLATE("admin_settings_saved", false, sprintf(MEMBER_REFBACK_ERROR_OUT_OF_BOUNDS, $_CONFIG['refback_min_percents'], $_CONFIG['refback_max_percents'])); } // Insert line @@ -132,7 +138,7 @@ if (SQL_NUMROWS($result) > 0) { // Remember the content $content['counter'] = TRANSLATE_COMMA($counter); - $content['percents'] = TRANSLATE_COMMA($content['percents']); + $content['percents'] = TRANSLATE_COMMA($content['percents'], true, 1); $content['rows'] = $rows; // Load level template