X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=inline;f=inc%2Fmodules%2Fadmin%2Fwhat-edit_sponsor.php;h=0603a9dea73d4ad691d67a53e0870fa4f447250a;hb=eefb72c90c4d30b82b9277acd42754dca014302b;hp=9362e793ffbd304659ab10c47cc9adf413d7bffb;hpb=971a60aaee17e6fc376b433f3f5763c85a512110;p=mailer.git
diff --git a/inc/modules/admin/what-edit_sponsor.php b/inc/modules/admin/what-edit_sponsor.php
index 9362e793ff..0603a9dea7 100644
--- a/inc/modules/admin/what-edit_sponsor.php
+++ b/inc/modules/admin/what-edit_sponsor.php
@@ -1,7 +1,7 @@
0) {
+ if (bigintval(postRequestElement('points')) > 0) {
// Replace german decimal comma with computer's decimal dot
- $POINTS = strval(convertCommaToDot(REQUEST_POST('points')));
+ $points = bigintval(convertCommaToDot(postRequestElement('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__);
+ SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_sponsor_data` SET `points_amount`=`points_amount`+%s WHERE `id`=%s LIMIT 1",
+ array($points, bigintval(getRequestElement('id'))), __FILE__, __LINE__);
// Remember points /reason for the template
- define('__POINTS' , translateComma($POINTS));
- define('__REASON' , REQUEST_POST('reason'));
+ $content['points'] = $points;
+ $content['reason'] = postRequestElement('reason');
// Send email
- $message = LOAD_EMAIL_TEMPLATE('sponsor_add_points', REQUEST_POST('reason'), true);
- sendEmail(constant('__EMAIL'), getMessage('ADMIN_SPONSOR_ADD_POINTS_SUBJ'), $message);
- $message = getMessage('ADMIN_SPONSOR_POINTS_ADDED');
+ $message = loadEmailTemplate('sponsor_add_points', $content);
+ sendEmail($content['email'], '{--ADMIN_SPONSOR_ADD_POINTS_SUBJECT--}', $message);
+ $message = '{--ADMIN_SPONSOR_POINTS_ADDED--}';
} else {
// No points entered to add!
- $message = getMessage('ADMIN_SPONSPOR_NO_POINTS_TO_ADD');
+ $message = '{--ADMIN_SPONSOR_NO_POINTS_TO_ADD--}';
}
break;
case 'sub_points': // Subtract points
- if (strval(REQUEST_POST('points')) > 0) {
+ if (bigintval(postRequestElement('points')) > 0) {
// Replace german decimal comma with computer's decimal dot
- $POINTS = strval(convertCommaToDot(REQUEST_POST('points')));
+ $points = bigintval(convertCommaToDot(postRequestElement('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__);
+ SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_sponsor_data` SET `points_used`=`points_used`+%s WHERE `id`=%s LIMIT 1",
+ array($points, bigintval(getRequestElement('id'))), __FILE__, __LINE__);
// Remember points /reason for the template
- define('__POINTS' , translateComma($POINTS));
- define('__REASON' , REQUEST_POST('reason'));
+ $content['points'] = $points;
+ $content['reason'] = postRequestElement('reason');
// Send email
- $message = LOAD_EMAIL_TEMPLATE('sponsor_sub_points', REQUEST_POST('reason'), true);
- sendEmail(constant('__EMAIL'), getMessage('ADMIN_SPONSOR_SUB_POINTS_SUBJ'), $message);
- $message = getMessage('ADMIN_SPONSOR_POINTS_SUBTRACTED');
+ $message = loadEmailTemplate('sponsor_sub_points', $content);
+ sendEmail($content['email'], '{--ADMIN_SPONSOR_SUB_POINTS_SUBJECT--}', $message);
+ $message = '{--ADMIN_SPONSOR_POINTS_SUBTRACTED--}';
} else {
// No points entered to add!
- $message = getMessage('ADMIN_SPONSPOR_NO_POINTS_TO_SUBTRACT');
+ $message = '{--ADMIN_SPONSOR_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')))) {
+ if ((postRequestElement('pass1') != postRequestElement('pass2')) || ((!isPostRequestElementSet('pass1')) && (!isPostRequestElementSet('pass1')))) {
// Remove passwords
- REQUEST_UNSET_POST('pass1');
- REQUEST_UNSET_POST('pass2');
+ unsetPostRequestElement('pass1');
+ unsetPostRequestElement('pass2');
$PASS = false;
} // END - if
// Convert time selection
- $DATA = array(); $id = 'warning_interval_ye'; $skip = false;
- convertSelectionsToTimestamp(REQUEST_POST_ARRAY(), $DATA, $id, $skip);
+ $content = array(); $id = 'warning_interval_ye'; $skip = false;
+ convertSelectionsToEpocheTime(postRequestArray(), $content, $id, $skip);
// Save the sponsor
- SPONSOR_HANDLE_SPONSOR(REQUEST_POST_ARRAY());
+ handleSponsorRequest(postRequestArray());
// Convert some data for the email template
- REQUEST_POST('gender' , translateGender(REQUEST_POST('gender')));
- REQUEST_POST('warning_interval', createFancyTime(REQUEST_POST('warning_interval')));
+ postRequestElement('gender' , '{%pipe,translateGender=' . postRequestElement('gender') . '%}');
+ postRequestElement('warning_interval', '{%pipe,createFancyTime=' . postRequestElement('warning_interval') . '%}');
- if ($PASS === false) REQUEST_SET_POST('pass1', getMessage('SPONSOR_PASS_UNCHANGED'));
+ if ($PASS === false) setPostRequestElement('pass1', '{--SPONSOR_PASS_UNCHANGED--}');
// Load email template and send the mail away
- $message = LOAD_EMAIL_TEMPLATE('admin_sponsor_edit', REQUEST_POST_ARRAY(), false);
- sendEmail(REQUEST_POST('email'), getMessage('ADMIN_SPONSOR_EDIT_SUBJECT'), $message);
+ $message = loadEmailTemplate('admin_sponsor_edit', postRequestArray(), false);
+ sendEmail(postRequestElement('email'), '{--ADMIN_SPONSOR_EDIT_SUBJECT--}', $message);
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'));
+ logDebugMessage(__FILE__, __LINE__, sprintf("Unknown mode %s detected.", getRequestElement('mode')));
+ $message = '{%message,ADMIN_SPONSOR_INVALID_MODE=' . getRequestElement('mode') . '%}';
break;
}
if (!empty($message)) {
// Output message
- LOAD_TEMPLATE('admin_settings_saved', false, $message);
+ displayMessage($message);
} // END - if
- } elseif (isFileReadable(sprintf("%stemplates/%s/html/admin/%s.tpl", constant('PATH'), getLanguage(), $TPL))) {
+ } elseif (isFileReadable(sprintf("%stemplates/%s/html/admin/%s.tpl", getPath(), getLanguage(), $TPL))) {
// Create mailto link
- define('__SPONSOR_VALUE', "{!__SURNAME!} {!__FAMILY!}");
+ $content['contact'] = '' . $content['surname'] . ' ' . $content['family'] . '';
// Load mode template
- LOAD_TEMPLATE($TPL);
+ loadTemplate($TPL, false, $content);
} else {
- // Template not found!
- LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('ADMIN_SPONSOR_MODUS_TPL_404'), REQUEST_GET('mode')));
+ // Template not found
+ displayMessage('{%message,ADMIN_SPONSOR_MODUS_TPL_404', getRequestElement('mode') . '%}');
}
} else {
- // Sponsor not found!
- LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('ADMIN_SPONSOR_404'), bigintval(REQUEST_GET('id'))));
+ // Sponsor not found
+ displayMessage('{%message,ADMIN_SPONSOR_404=' . bigintval(getRequestElement('id')) . '%}');
}
// Free result
SQL_FREERESULT($result_main);
} else {
// Not called by what-list_sponsor.php
- LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_CALL_NOT_DIRECTLY'));
+ displayMessage('{--ADMIN_CALL_NOT_DIRECTLY--}');
}
-//
+// [EOF]
?>