New function handleMailId introduced, you need to delete inc/cache/extensions.cache...
authorRoland Häder <roland@mxchange.org>
Sun, 20 Jun 2010 17:34:58 +0000 (17:34 +0000)
committerRoland Häder <roland@mxchange.org>
Sun, 20 Jun 2010 17:34:58 +0000 (17:34 +0000)
inc/libs/mailid_functions.php [new file with mode: 0644]
mailid.php
mailid_top.php

diff --git a/inc/libs/mailid_functions.php b/inc/libs/mailid_functions.php
new file mode 100644 (file)
index 0000000..1fb046c
--- /dev/null
@@ -0,0 +1,74 @@
+<?php
+/************************************************************************
+ * Mailer v0.2.1-FINAL                                Start: 06/20/2010 *
+ * ===================                          Last change: 06/20/2010 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : mailid_functions.php                             *
+ * -------------------------------------------------------------------- *
+ * Short description : Functions for ext-                               *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Funktionen fuer ext-                             *
+ * -------------------------------------------------------------------- *
+ * $Revision:: 1793                                                   $ *
+ * $Date:: 2010-05-28 18:58:31 +0200 (Fri, 28 May 2010)               $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author:: quix0r                                                   $ *
+ * Needs to be in all Files and every File needs "svn propset           *
+ * 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 *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or    *
+ * (at your option) any later version.                                  *
+ *                                                                      *
+ * This program is distributed in the hope that it will be useful,      *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
+ * GNU General Public License for more details.                         *
+ *                                                                      *
+ * You should have received a copy of the GNU General Public License    *
+ * along with this program; if not, write to the Free Software          *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
+ * MA  02110-1301  USA                                                  *
+ ************************************************************************/
+
+// Some security stuff...
+if (!defined('__SECURITY')) {
+       die();
+} // END - if
+
+// Handles the error code from mail confirmation
+function handleMailIdErrorCode ($errorCode) {
+       // Is an error 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&amp;code=' . $errorCode . '&amp;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&amp;code=' . getCode('UNKNOWN_STATUS') . '&amp;ext=mailid');
+                               break;
+               } // END - switch
+       } // END - if
+}
+
+// [EOF]
+?>
index 79e3087..eff5883 100644 (file)
@@ -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&amp;code=' . $errorCode . '&amp;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&amp;code=' . getCode('UNKNOWN_STATUS') . '&amp;ext=mailid');
-                       break;
-       } // END - switch
-} // END - if
+handleMailIdErrorCode($errorCode);
 
 // Include footer
 loadIncludeOnce('inc/footer.php');
index ec0417e..0ea9125 100644 (file)
@@ -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, '<div class="member_failed">{--MAIL_ALREADY_CONFIRMED--} (3)</div>');
                                $mode = 'failed';
                        }
                } else {
-                       SQL_FREERESULT($result);
                        loadTemplate('admin_settings_saved', false, '<div class="member_failed">{--MAIL_ALREADY_CONFIRMED--} (2)</div>');
                        $mode = 'failed';
                }
+
+               // Free result
+               SQL_FREERESULT($result_mailid);
        } else {
-               SQL_FREERESULT($result);
                loadTemplate('admin_settings_saved', false, '<div class="member_failed">{--MAIL_ALREADY_CONFIRMED--} (1)</div>');
                $mode = 'failed';
        }
 
+       // Free result
+       SQL_FREERESULT($result_main);
+
        // Insert footer if no image
        if ($mode != 'img') {
                // Write footer