X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Flibs%2Fsponsor_functions.php;h=180086fc8c1832db9df087f895bf9978418c30a6;hb=e1a62db0c2a7a8b56e066aa3a2a032cfabf08267;hp=7ef4e61a3067ac0bd876e60f9b99c13aa073d390;hpb=06d179ae45f3f049003e6fe213249842b2a630fe;p=mailer.git
diff --git a/inc/libs/sponsor_functions.php b/inc/libs/sponsor_functions.php
index 7ef4e61a30..180086fc8c 100644
--- a/inc/libs/sponsor_functions.php
+++ b/inc/libs/sponsor_functions.php
@@ -18,6 +18,7 @@
* svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team *
* For more information visit: http://www.mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -137,7 +138,7 @@ function handlSponsorRequest (&$postData, $update=false, $messageArray=array(),
// Remove last ", " from SQL string
$sql = substr($sql, 0, -2)." WHERE `id`='%s' LIMIT 1";
- $DATA['values'][] = bigintval(getRequestElement('id'));
+ $DATA['values'][] = bigintval(getRequestParameter('id'));
// Generate message
$message = getMessageFromIndexedArray(getMessage('ADMIN_SPONSOR_UPDATED'), 'updated', $messageArray);
@@ -161,14 +162,14 @@ function handlSponsorRequest (&$postData, $update=false, $messageArray=array(),
}
// Implode all data into strings
- $KEYS = implode("`, `" , $DATA['keys']);
- $valueS = str_repeat("%s', '", count($DATA['values']) - 1);
+ $keyArray = implode("`, `" , $DATA['keys']);
+ $valueArray = str_repeat("%s', '", count($DATA['values']) - 1);
// Generate string
- $sql = "INSERT INTO `{?_MYSQL_PREFIX?}_sponsor_data` (`".$KEYS."`) VALUES ('".$valueS."%s')";
+ $sql = "INSERT INTO `{?_MYSQL_PREFIX?}_sponsor_data` (`" . $keyArray . "`) VALUES ('" . $valueArray . "%s')";
// Generate message
- $message = getMessageFromIndexedArray(getMessage('ADMIN_SPONSOR_ADDED'), "added", $messageArray);
+ $message = getMessageFromIndexedArray(getMessage('ADMIN_SPONSOR_ADDED'), 'added', $messageArray);
$ret = 'added';
} elseif (($update === true) && (isAdmin())) {
// Add all data as hidden data
@@ -294,7 +295,7 @@ ORDER BY `sort`",
$content = merge_array($content, $content2);
// Check if current selected menu is matching the loaded one
- if ($current == $content['sub_what']) $content['sub_title'] = "".$content['sub_title']."";
+ if ($current == $content['sub_what']) $content['sub_title'] = '' . $content['sub_title'] . '';
// Prepare data for the sub template
$content = array(
@@ -433,13 +434,12 @@ function saveSponsorData ($postData, $content) {
$sql = substr($sql, 0, -1);
// Add SQL tail data
- $sql .= " WHERE `id`='%s' AND password='%s' LIMIT 1";
+ $sql .= " WHERE `id`=%s AND password='%s' LIMIT 1";
$DATA[] = bigintval(getSession('sponsorid'));
$DATA[] = getSession('sponsorpass');
// Saving data was completed... ufff...
- switch (getWhat())
- {
+ switch (getWhat()) {
case 'account': // Change account data
if ($EMAIL === true) {
$message = getMessage('SPONSOR_ACCOUNT_EMAIL_CHANGED');
@@ -468,9 +468,11 @@ function saveSponsorData ($postData, $content) {
$message = getMaskedMessage('SPONSOR_UNKNOWN_WHAT', getWhat());
$templ = ''; $subj = '';
break;
- }
+ } // END - switch
+ // Has an entry updated?
if (SQL_AFFECTEDROWS() == 1) {
+ // Template and subject are set?
if (!empty($templ) && !empty($subj)) {
// Run SQL command and check for success
$result = SQL_QUERY_ESC($sql, $DATA, __FUNCTION__, __LINE__);
@@ -478,23 +480,24 @@ function saveSponsorData ($postData, $content) {
// Add all data to content
$content['new_data'] = $postData;
- // Change some data
- if (isset($content['gender'])) $content['gender'] = translateGender($content['gender']);
- if (isset($content['new_data']['gender'])) $content['new_data']['gender'] = translateGender($content['new_data']['gender']);
- if (isset($content['receive_warnings'])) $content['new_data']['receive'] = translateYesNo($content['new_data']['receive_warnings']);
- if (isset($content['warning_interval'])) $content['new_data']['interval'] = createFancyTime($content['new_data']['warning_interval']);
+ // Translate some data
+ if (isset($content['gender'])) $content['gender'] = translateGender($content['gender']);
+ if (isset($content['new_data']['gender'])) $content['new_data']['gender'] = translateGender($content['new_data']['gender']);
+ if (isset($content['receive_warnings'])) $content['new_data']['receive'] = translateYesNo($content['new_data']['receive_warnings']);
+ if (isset($content['warning_interval'])) $content['new_data']['interval'] = createFancyTime($content['new_data']['warning_interval']);
// Send email to admins
sendAdminNotification($subj, $templ, $content);
// Shall we send mail to the sponsor's new email address?
if ($content['receive_warnings'] == 'Y') {
- // Okay send email with confirmation link to new address and with no confirmation link
- // to the old address
+ /*
+ * Okay send email with confirmation link to new address and with no confirmation link
+ * to the old address.
+ */
// First to old address
- switch (getWhat())
- {
+ switch (getWhat()) {
case 'account': // Change account data
$email_msg = loadEmailTemplate('sponsor_change_data', $content);
sendEmail($content['email'], getMessage('SPONSOR_ACC_DATA_SUBJ'), $email_msg);
@@ -506,7 +509,7 @@ function saveSponsorData ($postData, $content) {
// Second mail goes to the new address
$email_msg = loadEmailTemplate('sponsor_change_email', $content);
sendEmail($content['email'], getMessage('SPONSOR_ACC_EMAIL_SUBJ'), $email_msg);
- }
+ } // END - if
break;
case 'settings': // Change settings
@@ -514,7 +517,7 @@ function saveSponsorData ($postData, $content) {
$email_msg = loadEmailTemplate('sponsor_settings', $content);
sendEmail($content['email'], getMessage('SPONSOR_SETTINGS_SUBJ'), $email_msg);
break;
- }
+ } // END - switch
} // END - if
} // END - if
} // END - if