* $Author:: $ *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team *
+ * Copyright (c) 2009 - 2016 by Mailer Developer Team *
* For more information visit: http://mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
// Some security stuff...
if ((!defined('__SECURITY')) || (!isAdmin())) {
- die();
+ exit();
} // END - if
// Add description as navigation point
if ((isGetRequestElementSet('id')) && (isGetRequestElementSet('do'))) {
// Check for selected sponsor
- $result_main = SQL_QUERY_ESC("SELECT
- `id`,`company`,`position`,`gender`,`surname`,`family`,
- `street_nr1`,`street_nr2`,`zip`,`city`,`country`,
- `phone`,`fax`,`cell`,`email`,`url`,`tax_ident`,
- `receive_warnings`,`warning_interval`
+ $result_main = sqlQueryEscaped("SELECT
+ `id`, `company`, `position`, `sex`, `surname`, `family`,
+ `street_nr1`, `street_nr2`, `zip`, `city`, `country`,
+ `phone`, `fax`, `cell`, `email`, `url`, `tax_ident`,
+ `receive_warnings`, `warning_interval`
FROM
`{?_MYSQL_PREFIX?}_sponsor_data`
WHERE
`id`=%s
LIMIT 1",
array(bigintval(getRequestElement('id'))), __FILE__, __LINE__);
- if (SQL_NUMROWS($result_main) == 1) {
+ if (sqlNumRows($result_main) == 1) {
// Load sponsor details
- $content = SQL_FETCHARRAY($result_main);
+ $content = sqlFetchArray($result_main);
// Warning because low points
$content['receive_warnings'] = addSelectionBox('yn', $content['receive_warnings'], 'receive_warning');
$content['warning_interval'] = createTimeSelections($content['warning_interval'], 'warning_interval', 'MWDh');
// Init variables here
- $TPL = sprintf("admin_edit_sponsor_%s", getRequestElement('do'));
+ $TPL = sprintf('admin_edit_sponsor_%s', getRequestElement('do'));
initSqls();
// Sponsor was found
$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(getRequestElement('id'))), __FILE__, __LINE__);
+ sqlQueryEscaped("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
$content['points'] = $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",
+ sqlQueryEscaped("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
break;
case 'edit': // Edit sponsor account
- $PASS = true;
- if ((postRequestElement('pass1') != postRequestElement('pass2')) || ((!isPostRequestElementSet('pass1')) && (!isPostRequestElementSet('pass1')))) {
+ $PASS = TRUE;
+ if ((postRequestElement('password1') != postRequestElement('password2')) || ((!isPostRequestElementSet('password1')) && (!isPostRequestElementSet('password1')))) {
// Remove passwords
- unsetPostRequestElement('pass1');
- unsetPostRequestElement('pass2');
- $PASS = false;
+ unsetPostRequestElement('password1');
+ unsetPostRequestElement('password2');
+ $PASS = FALSE;
} // END - if
// Convert time selection
- $content = array(); $id = 'warning_interval_ye'; $skip = false;
- convertSelectionsToEpocheTime(postRequestArray(), $content, $id, $skip);
+ convertSelectionsToEpocheTimeInPostData('warning_interval_ye');
// Save the sponsor
handleSponsorRequest(postRequestArray());
// Convert some data for the email template
- postRequestElement('gender' , '{%pipe,translateGender=' . postRequestElement('gender') . '%}');
+ postRequestElement('sex' , '{%pipe,translateSex=' . postRequestElement('sex') . '%}');
postRequestElement('warning_interval', '{%pipe,createFancyTime=' . postRequestElement('warning_interval') . '%}');
- if ($PASS === false) setPostRequestElement('pass1', '{--SPONSOR_PASS_UNCHANGED--}');
+ if ($PASS === FALSE) setPostRequestElement('password1', '{--SPONSOR_PASS_UNCHANGED--}');
// Load email template and send the mail away
- $message = loadEmailTemplate('admin_sponsor_edit', postRequestArray(), false);
+ $message = loadEmailTemplate('admin_sponsor_edit', postRequestArray(), FALSE);
sendEmail(postRequestElement('email'), '{--ADMIN_SPONSOR_EDIT_SUBJECT--}', $message);
break;
default: // Unknown mode
- logDebugMessage(__FILE__, __LINE__, sprintf("Unknown mode %s detected.", getRequestElement('do')));
+ logDebugMessage(__FILE__, __LINE__, sprintf('Unknown mode %s detected.', getRequestElement('do')));
$message = '{%message,ADMIN_SPONSOR_INVALID_MODE=' . getRequestElement('do') . '%}';
break;
- }
+ } // END - switch
if (!empty($message)) {
// Output message
displayMessage($message);
} // END - if
- } elseif (isFileReadable(sprintf("%stemplates/%s/html/admin/%s.tpl", getPath(), getLanguage(), $TPL))) {
+ } elseif (isFileReadable(sprintf('%s/admin/%s.tpl', getTemplateBasePath('html'), $TPL))) {
// Create mailto link
$content['contact'] = '<a href="' . generateSponsorEmailLink($content['email'], 'sponsor_data') . '">' . $content['surname'] . ' ' . $content['family'] . '</a>';
// Load mode template
- loadTemplate($TPL, false, $content);
+ loadTemplate($TPL, FALSE, $content);
} else {
// Template not found
displayMessage('{%message,ADMIN_SPONSOR_MODUS_TPL_404', getRequestElement('do') . '%}');
}
// Free result
- SQL_FREERESULT($result_main);
+ sqlFreeResult($result_main);
} else {
// Not called by what-list_sponsor.php
displayMessage('{--ADMIN_CALL_NOT_DIRECTLY--}');