From 5d724b137ed3673edefa17b75d3c24d4cfdb0f39 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 20 Jun 2010 17:34:58 +0000 Subject: [PATCH] New function handleMailId introduced, you need to delete inc/cache/extensions.cache to make mail confirmation working again --- inc/libs/mailid_functions.php | 74 +++++++++++++++++++++++++++++++++++ mailid.php | 30 ++------------ mailid_top.php | 21 +++++----- 3 files changed, 88 insertions(+), 37 deletions(-) create mode 100644 inc/libs/mailid_functions.php diff --git a/inc/libs/mailid_functions.php b/inc/libs/mailid_functions.php new file mode 100644 index 0000000000..1fb046c1dd --- /dev/null +++ b/inc/libs/mailid_functions.php @@ -0,0 +1,74 @@ + diff --git a/mailid.php b/mailid.php index 79e308753b..eff588330e 100644 --- a/mailid.php +++ b/mailid.php @@ -59,15 +59,15 @@ redirectOnUninstalledExtension('mailid'); // Init $url_userid = '0'; -$url_bid = '0'; -$url_mid = '0'; +$url_bid = '0'; +$url_mid = '0'; // Secure all data if (isGetRequestParameterSet('userid')) $url_userid = bigintval(getRequestParameter('userid')); if (isGetRequestParameterSet('mailid')) $url_mid = bigintval(getRequestParameter('mailid')); if (isGetRequestParameterSet('bonusid')) $url_bid = bigintval(getRequestParameter('bonusid')); -// 01 1 12 2 2 21 1 22 10 +// 01 1 12 2 2 21 1 2210 if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (!ifFatalErrorsDetected())) { // Init result $result_link = false; @@ -211,29 +211,7 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (!ifFatalErrorsDe } // Error code is set? -if (!empty($errorCode)) { - // @TODO Rewrite this to a dynamic include or so - switch (getConfig('mailid_error_redirect')) { - case 'INDEX': // Redirect to index page - redirectToUrl('modules.php?module=index&code=' . $errorCode . '&ext=mailid'); - break; - - case 'REJECT': // Redirect to rejection page - if (isExtensionActive('other')) { - // Redirect to configured URL - redirectToConfiguredUrl('reject_url'); - } else { - // Redirect to index - redirectToUrl('modules.php?module=index'); - } - break; - - default: - logDebugMessage(__FILE__, __LINE__, sprintf("Unknown status %s detected in mailid_error_redirect.", getConfig('mailid_error_redirect'))); - redirectToUrl('modules.php?module=index&code=' . getCode('UNKNOWN_STATUS') . '&ext=mailid'); - break; - } // END - switch -} // END - if +handleMailIdErrorCode($errorCode); // Include footer loadIncludeOnce('inc/footer.php'); diff --git a/mailid_top.php b/mailid_top.php index ec0417eafc..0ea9125b67 100644 --- a/mailid_top.php +++ b/mailid_top.php @@ -80,19 +80,18 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (!ifFatalErrorsDe // Maybe he wants to confirm an email? if ($url_mid > 0) { - $result = SQL_QUERY_ESC("SELECT `id`, `link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `stats_id`=%s AND `userid`=%s LIMIT 1", + $result_main = SQL_QUERY_ESC("SELECT `id`, `link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `stats_id`=%s AND `userid`=%s LIMIT 1", array($url_mid, $url_userid), __FILE__, __LINE__); $type = 'mailid'; $urlId = $url_mid; } elseif ($url_bid > 0) { - $result = SQL_QUERY_ESC("SELECT `id`, `link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `bonus_id`=%s AND `userid`=%s LIMIT 1", + $result_main = SQL_QUERY_ESC("SELECT `id`, `link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `bonus_id`=%s AND `userid`=%s LIMIT 1", array($url_bid, $url_userid), __FILE__, __LINE__); $type = 'bonusid'; $urlId = $url_bid; } - if (SQL_NUMROWS($result) == 1) { + if (SQL_NUMROWS($result_main) == 1) { // Is the stats id valid? - list($lid, $ltype) = SQL_FETCHROW($result); - SQL_FREERESULT($result); + list($lid, $ltype) = SQL_FETCHROW($result_main); // Init result here with invalid to avoid possible missing variable $result_mailid = false; @@ -122,9 +121,6 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (!ifFatalErrorsDe // Correct notification switch in non-bonus mails if (($notify != 'Y') && ($notify != 'N')) $notify = 'N'; - // Free some memory - SQL_FREERESULT($result_mailid); - // Set sender to 0 when we have a bonus mail if ($ltype == 'BONUS') $sender = '0'; @@ -364,21 +360,24 @@ if (($url_userid) > 0 && (($url_mid > 0) || ($url_bid > 0)) && (!ifFatalErrorsDe $mode = 'failed'; } } else { - SQL_FREERESULT($result); loadTemplate('admin_settings_saved', false, '
{--MAIL_ALREADY_CONFIRMED--} (3)
'); $mode = 'failed'; } } else { - SQL_FREERESULT($result); loadTemplate('admin_settings_saved', false, '
{--MAIL_ALREADY_CONFIRMED--} (2)
'); $mode = 'failed'; } + + // Free result + SQL_FREERESULT($result_mailid); } else { - SQL_FREERESULT($result); loadTemplate('admin_settings_saved', false, '
{--MAIL_ALREADY_CONFIRMED--} (1)
'); $mode = 'failed'; } + // Free result + SQL_FREERESULT($result_main); + // Insert footer if no image if ($mode != 'img') { // Write footer -- 2.39.5