From b47f7363125a751ecd04146fc82b11bb7b050d00 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 23 Jul 2010 03:36:57 +0000 Subject: [PATCH] Made mails debugable without messing the output, fixes for forced sponsor registration by admin --- inc/functions.php | 8 +++---- inc/libs/sponsor_functions.php | 23 +++++++++++-------- inc/modules/admin/what-add_sponsor.php | 2 +- inc/wrapper-functions.php | 12 ++++++++++ .../html/admin/admin_add_sponsor_already.tpl | 3 ++- 5 files changed, 33 insertions(+), 15 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 0bff2a6abc..df6bbe1ab0 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -151,10 +151,10 @@ function sendEmail ($toEmail, $subject, $message, $isHtml = 'N', $mailHeader = ' if (isDebugModeEnabled()) { // In debug mode we want to display the mail instead of sending it away so we can debug this part outputHtml('
-Headers : ' . encodeEntities(utf8_decode(trim($mailHeader))) . '
-To      : ' . encodeEntities(utf8_decode($toEmail)) . '
-Subject : ' . encodeEntities(utf8_decode($subject)) . '
-Message : ' . encodeEntities(utf8_decode($message)) . '
+Headers : ' . htmlentities(utf8_decode(trim($mailHeader))) . '
+To      : ' . htmlentities(utf8_decode($toEmail)) . '
+Subject : ' . htmlentities(utf8_decode($subject)) . '
+Message : ' . htmlentities(utf8_decode($message)) . '
 
'); // This is always fine diff --git a/inc/libs/sponsor_functions.php b/inc/libs/sponsor_functions.php index 1d883513c0..a0260fd742 100644 --- a/inc/libs/sponsor_functions.php +++ b/inc/libs/sponsor_functions.php @@ -40,7 +40,7 @@ // Some security stuff... if (!defined('__SECURITY')) { die(); -} +} // END - if // function handleSponsorRequest ($postData, $update=false, $messageArray=array(), $RET_STATUS=false) { @@ -49,7 +49,7 @@ function handleSponsorRequest ($postData, $update=false, $messageArray=array(), $UPDATE = false; $skip = false; $ALREADY = false; - $ret = "unused"; + $ret = 'unused'; // Skip these entries $SKIPPED = array( @@ -161,6 +161,13 @@ function handleSponsorRequest ($postData, $update=false, $messageArray=array(), $DATA['values'][] = detectRemoteAddr(); } + // Search the entry + $key = array_search('force', $DATA['keys']); + + // Remove force from both arrays + unset($DATA['keys'][$key]); + unset($DATA['values'][$key]); + // Implode all data into strings $keyArray = implode('`, `' , $DATA['keys']); $valueArray = str_repeat("%s', '", count($DATA['values']) - 1); @@ -198,19 +205,14 @@ function handleSponsorRequest ($postData, $update=false, $messageArray=array(), // Run SQL command $result = SQL_QUERY_ESC($sql, $DATA['values'], __FUNCTION__, __LINE__); } // END - if - - // Output message - if (($update === true) && (isAdmin())) { - loadTemplate('admin_settings_saved', false, $message); - } // END - if } else { // Error found! $message = getMessageFromIndexedArray('{--SPONSOR_DATA_NOT_SAVED--}', 'failed', $messageArray); loadTemplate('admin_settings_saved', false, $message); } - // Shall we return the status? - if ($RET_STATUS === true) return $ret; + // Always return the status + return $ret; } // @@ -224,9 +226,12 @@ function sponsorTranslateUserStatus ($status) { $ret = getMessage($constantName); } else { // Not found! + /* DEBUG: */ debug_report_bug(__FUNCTION__, __LINE__, sprintf("Unknown status %s detected.", $status)); logDebugMessage(__FUNCTION__, __LINE__, sprintf("Unknown status %s detected.", $status)); $ret = getMaskedMessage('ACCOUNT_STATUS_UNKNOWN_STATUS', $status); } + + // Return status return $ret; } diff --git a/inc/modules/admin/what-add_sponsor.php b/inc/modules/admin/what-add_sponsor.php index 9c60770993..4cb26dd0bb 100644 --- a/inc/modules/admin/what-add_sponsor.php +++ b/inc/modules/admin/what-add_sponsor.php @@ -47,7 +47,7 @@ addMenuDescription('admin', __FILE__); if (isFormSent()) { // Save sponsor in database - doProcessSponsorFormRequest(); + loadTemplate('admin_settings_saved', false, doProcessSponsorFormRequest()); } else { // Output form loadTemplate('admin_add_sponsor'); diff --git a/inc/wrapper-functions.php b/inc/wrapper-functions.php index d8e0a2dcf8..a4fc62e3bb 100644 --- a/inc/wrapper-functions.php +++ b/inc/wrapper-functions.php @@ -1814,6 +1814,18 @@ function getIndexHome () { return $GLOBALS['index_home']; } +// "Getter" for one_day +function getOneDay () { + // Do we have cache? + if (!isset($GLOBALS['one_day'])) { + // Determine it + $GLOBALS['one_day'] = getConfig('ONE_DAY'); + } // END - if + + // Return cache + return $GLOBALS['one_day']; +} + // Checks wether proxy configuration is used function isProxyUsed () { // Do we have cache? diff --git a/templates/de/html/admin/admin_add_sponsor_already.tpl b/templates/de/html/admin/admin_add_sponsor_already.tpl index 2b3d9cd5cc..815a69c58c 100644 --- a/templates/de/html/admin/admin_add_sponsor_already.tpl +++ b/templates/de/html/admin/admin_add_sponsor_already.tpl @@ -1,5 +1,5 @@
-
+ -- 2.39.5
@@ -15,6 +15,7 @@