X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Flibs%2Fsponsor_functions.php;h=180086fc8c1832db9df087f895bf9978418c30a6;hb=e1a62db0c2a7a8b56e066aa3a2a032cfabf08267;hp=7606738e22c41b0ecc2f6e7eac8abc4ace5d0473;hpb=e5fe5afb17a5c8106f4c890234dfa39419e70f5d;p=mailer.git
diff --git a/inc/libs/sponsor_functions.php b/inc/libs/sponsor_functions.php
index 7606738e22..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
@@ -176,7 +177,7 @@ function handlSponsorRequest (&$postData, $update=false, $messageArray=array(),
foreach ($postData as $k => $v) {
// Do not add 'force' !
if ($k != 'force') {
- $OUT .= "\n";
+ $OUT .= '';
} // END - if
} // END - foreach
@@ -189,7 +190,7 @@ function handlSponsorRequest (&$postData, $update=false, $messageArray=array(),
return;
} else {
// Already added!
- $message = sprintf(getMessage('SPONSOR_ALREADY_FOUND'), $postData['email']);
+ $message = getMaskedMessage('SPONSOR_ALREADY_FOUND', $postData['email']);
$ret = 'already';
}
@@ -224,7 +225,7 @@ function sponsorTranslateUserStatus ($status) {
} else {
// Not found!
logDebugMessage(__FUNCTION__, __LINE__, sprintf("Unknown status %s detected.", $status));
- $ret = sprintf(getMessage('UNKNOWN_STATUS'), $status);
+ $ret = getMaskedMessage('UNKNOWN_STATUS', $status);
}
return $ret;
}
@@ -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(
@@ -343,7 +344,7 @@ function addSponsorContent ($what) {
loadIncludeOnce($INC);
} else {
// File not found!
- $OUT .= loadTemplate('admin_settings_saved', true, sprintf(getMessage('SPONSOR_CONTENT_404'), $what));
+ $OUT .= loadTemplate('admin_settings_saved', true, getMaskedMessage('SPONSOR_CONTENT_404', $what));
}
// Return content
@@ -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');
@@ -465,12 +465,14 @@ function saveSponsorData ($postData, $content) {
default: // Unknown sponsor what value!
logDebugMessage(__FUNCTION__, __LINE__, sprintf("Unknown sponsor module (what) %s detected.", getWhat()));
- $message = sprintf(getMessage('SPONSOR_UNKNOWN_WHAT'), getWhat());
+ $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