- case "add_points": // Add points
- if (strval($_POST['points']) > 0) {
- // Replace german decimal comma with computer's decimal dot
- $POINTS = strval(REVERT_COMMA($_POST['points']));
-
- // Add points to account
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET points_amount=points_amount+%s WHERE id='%s' LIMIT 1",
- array($POINTS, bigintval($_GET['id'])), __FILE__, __LINE__);
-
- // Remember points /reason for the template
- define('__POINTS' , TRANSLATE_COMMA($POINTS));
- define('__REASON' , $_POST['reason']);
-
- // Send email
- $msg = LOAD_EMAIL_TEMPLATE("sponsor_add_points", $_POST['reason'], true);
- SEND_EMAIL(__EMAIL, SPONSOR_ADMIN_ADD_POINTS, $msg);
- $MSG = ADMIN_SPONSOR_POINTS_ADDED;
- } else {
- // No points entered to add!
- $MSG = ADMIN_SPONSPOR_NO_POINTS_TO_ADD;
- }
- break;
-
- case "sub_points": // Subtract points
- if (strval($_POST['points']) > 0) {
- // Replace german decimal comma with computer's decimal dot
- $POINTS = strval(REVERT_COMMA($_POST['points']));
-
- // Add points to account
- SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET points_used=points_used+%s WHERE id='%s' LIMIT 1",
- array($POINTS, bigintval($_GET['id'])), __FILE__, __LINE__);
-
- // Remember points /reason for the template
- define('__POINTS' , TRANSLATE_COMMA($POINTS));
- define('__REASON' , $_POST['reason']);
-
- // Send email
- $msg = LOAD_EMAIL_TEMPLATE("sponsor_sub_points", $_POST['reason'], true);
- SEND_EMAIL(__EMAIL, SPONSOR_ADMIN_SUB_POINTS, $msg);
- $MSG = ADMIN_SPONSOR_POINTS_SUBTRACTED;
- } else {
- // No points entered to add!
- $MSG = ADMIN_SPONSPOR_NO_POINTS_TO_SUBTRACT;
- }
- break;
-
- case "edit": // Edit sponsor account
- $PASS = true;
- if (($_POST['pass1'] != $_POST['pass2']) || ((empty($_POST['pass1'])) && (empty($_POST['pass1'])))) {
- // Remove passwords
- unset($_POST['pass1']);
- unset($_POST['pass2']);
- $PASS = false;
- }
-
- // Convert time selection
- $DATA = array(); $id = "warning_interval_ye"; $skip = false;
- CONVERT_SELECTIONS_TO_TIMESTAMP($_POST, $DATA, $id, $skip);
-
- // Save the sponsor
- SPONSOR_HANDLE_SPONSOR($_POST);
-
- // Convert some data for the email template
- $_POST['gender'] = TRANSLATE_GENDER($_POST['gender']);
- $_POST['warning_interval'] = CREATE_FANCY_TIME($_POST['warning_interval']);
- if (!$PASS) $_POST['pass1'] = SPONSOR_PASS_UNCHANGED;
-
- // Load email template and send the mail away
- $msg = LOAD_EMAIL_TEMPLATE("admin_sponsor_edit", $_POST, false);
- SEND_EMAIL($_POST['email'], SPONSOR_ADMIN_EDIT_SUBJECT, $msg);
- break;
-
- default: // Unknown mode
- DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown mode %s detected.", $_GET['mode']));
- $MSG = ADMIN_INVALID_MODE_1.SQL_ESCAPE($_GET['mode']).ADMIN_INVALID_MODE_2;
- break;
+ case "add_points": // Add points
+ if (strval(REQUEST_POST('points')) > 0) {
+ // Replace german decimal comma with computer's decimal dot
+ $POINTS = strval(convertCommaToDot(REQUEST_POST('points')));
+
+ // Add points to account
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET points_amount=points_amount+%s WHERE `id`='%s' LIMIT 1",
+ array($POINTS, bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
+
+ // Remember points /reason for the template
+ define('__POINTS' , translateComma($POINTS));
+ define('__REASON' , REQUEST_POST('reason'));
+
+ // Send email
+ $msg = LOAD_EMAIL_TEMPLATE("sponsor_add_points", REQUEST_POST('reason'), true);
+ sendEmail(__EMAIL, ADMIN_SPONSOR_ADD_POINTS_SUBJ, $msg);
+ $message = ADMIN_SPONSOR_POINTS_ADDED;
+ } else {
+ // No points entered to add!
+ $message = ADMIN_SPONSPOR_NO_POINTS_TO_ADD;
+ }
+ break;
+
+ case "sub_points": // Subtract points
+ if (strval(REQUEST_POST('points')) > 0) {
+ // Replace german decimal comma with computer's decimal dot
+ $POINTS = strval(convertCommaToDot(REQUEST_POST('points')));
+
+ // Add points to account
+ SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_sponsor_data` SET points_used=points_used+%s WHERE `id`='%s' LIMIT 1",
+ array($POINTS, bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
+
+ // Remember points /reason for the template
+ define('__POINTS' , translateComma($POINTS));
+ define('__REASON' , REQUEST_POST('reason'));
+
+ // Send email
+ $msg = LOAD_EMAIL_TEMPLATE("sponsor_sub_points", REQUEST_POST('reason'), true);
+ sendEmail(__EMAIL, ADMIN_SPONSOR_SUB_POINTS_SUBJ, $msg);
+ $message = ADMIN_SPONSOR_POINTS_SUBTRACTED;
+ } else {
+ // No points entered to add!
+ $message = ADMIN_SPONSPOR_NO_POINTS_TO_SUBTRACT;
+ }
+ break;
+
+ case 'edit': // Edit sponsor account
+ $PASS = true;
+ if ((REQUEST_POST('pass1') != REQUEST_POST('pass2')) || ((!REQUEST_ISSET_POST('pass1')) && (!REQUEST_ISSET_POST('pass1')))) {
+ // Remove passwords
+ REQUEST_UNSET_POST('pass1');
+ REQUEST_UNSET_POST('pass2');
+ $PASS = false;
+ }
+
+ // Convert time selection
+ $DATA = array(); $id = "warning_interval_ye"; $skip = false;
+ convertSelectionsToTimestamp(REQUEST_POST_ARRAY(), $DATA, $id, $skip);
+
+ // Save the sponsor
+ SPONSOR_HANDLE_SPONSOR(REQUEST_POST_ARRAY());
+
+ // Convert some data for the email template
+ REQUEST_POST('gender' , translateGender(REQUEST_POST('gender')));
+ REQUEST_POST('warning_interval', createFancyTime(REQUEST_POST('warning_interval')));
+
+ if (!$PASS) REQUEST_SET_POST('pass1', getMessage('SPONSOR_PASS_UNCHANGED'));
+
+ // Load email template and send the mail away
+ $msg = LOAD_EMAIL_TEMPLATE("admin_sponsor_edit", REQUEST_POST_ARRAY(), false);
+ sendEmail(REQUEST_POST('email'), getMessage('ADMIN_SPONSOR_EDIT_SUBJECT'), $msg);
+ break;
+
+ default: // Unknown mode
+ DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown mode %s detected.", REQUEST_GET('mode')));
+ $message = sprintf(getMessage('ADMIN_SPONSOR_INVALID_MODE'), REQUEST_GET('mode'));
+ break;