A-tag fixed.
[mailer.git] / mailid.php
index 557231ce70e3531e5ab16a623602bcd8a76d31ee..90a2210fad852c7bfab2b8a7f2010c78bd29cf6e 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Bestaetigung von Mails                           *
  * -------------------------------------------------------------------- *
- * $Revision::                                                        $ *
- * $Date::                                                            $ *
- * $Tag:: 0.2.1-FINAL                                                 $ *
- * $Author::                                                          $ *
- * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2013 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
@@ -55,10 +50,10 @@ require('inc/config-global.php');
 setContentType('text/html');
 setHttpStatus('404 Not Found');
 
-// Is the extension mailid active?
+// Is ext-mailid active?
 redirectOnUninstalledExtension('mailid');
 
-// Is the extension other active?
+// Is ext-other active?
 redirectOnUninstalledExtension('other');
 
 // Init data
@@ -80,30 +75,30 @@ if (isGetRequestElementSet('type'))   $data['type']   = getRequestElement('type'
 
 // @TODO Improve check on $data['type'], empty() is not very much ...
 if ((isValidId($data['userid'])) && (isValidId($data['id'])) && (!empty($data['type'])) && (!ifFatalErrorsDetected())) {
-       // No image?
-       if ($data['do'] != 'img') {
-               // ... then output header
-               loadIncludeOnce('inc/header.php');
-       } // END - fi
-
        // Is 'do' still "frames"?
        if ($data['do'] == 'frames') {
                // This is a frameset module
                $GLOBALS['frameset_mode'] = TRUE;
        } // END - if
 
-       // Init result for below SQL_NUMROWS() function
+       // No image?
+       if ($data['do'] != 'img') {
+               // ... then output header
+               loadPageHeader();
+       } // END - fi
+
+       // Init result for below sqlNumRows() function
        $result_main = FALSE;
 
        // Maybe he wants to confirm an email?
        switch ($data['type']) {
                case 'normal':
-                       $result_main = SQL_QUERY_ESC("SELECT `id` AS `link_id`, `link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `stats_id`=%s AND `userid`=%s LIMIT 1",
+                       $result_main = sqlQueryEscaped("SELECT `id` AS `link_id`, `link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `stats_id`=%s AND `userid`=%s LIMIT 1",
                                array($data['id'], $data['userid']), __FILE__, __LINE__);
                        break;
 
                case 'bonus':
-                       $result_main = SQL_QUERY_ESC("SELECT `id` AS `link_id`, `link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `bonus_id`=%s AND `userid`=%s LIMIT 1",
+                       $result_main = sqlQueryEscaped("SELECT `id` AS `link_id`, `link_type` FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `bonus_id`=%s AND `userid`=%s LIMIT 1",
                                array($data['id'], $data['userid']), __FILE__, __LINE__);
                        break;
 
@@ -113,9 +108,9 @@ if ((isValidId($data['userid'])) && (isValidId($data['id'])) && (!empty($data['t
        } // END - switch
 
        // Is an entry found?
-       if (SQL_NUMROWS($result_main) == 1) {
+       if (sqlNumRows($result_main) == 1) {
                // Is the stats id valid?
-               $data = merge_array($data, SQL_FETCHARRAY($result_main));
+               $data = merge_array($data, sqlFetchArray($result_main));
 
                // Init result here with invalid to avoid possible missing variable
                $result_mailid = FALSE;
@@ -123,12 +118,12 @@ if ((isValidId($data['userid'])) && (isValidId($data['id'])) && (!empty($data['t
                // @TODO Rewrite this to a filter/function
                switch ($data['link_type']) {
                        case 'NORMAL':
-                               $result_mailid = SQL_QUERY_ESC("SELECT `pool_id`, `userid` AS `sender` FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `id`=%s LIMIT 1",
+                               $result_mailid = sqlQueryEscaped("SELECT `pool_id`, `userid` AS `sender`, `url` FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `id`=%s LIMIT 1",
                                        array($data['id']), __FILE__, __LINE__);
                                break;
 
                        case 'BONUS':
-                               $result_mailid = SQL_QUERY_ESC("SELECT `id` AS `pool_id`, `is_notify` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `id`=%s LIMIT 1",
+                               $result_mailid = sqlQueryEscaped("SELECT `id` AS `pool_id`, `is_notify`, `url` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `id`=%s LIMIT 1",
                                        array($data['id']), __FILE__, __LINE__);
                                break;
 
@@ -138,9 +133,9 @@ if ((isValidId($data['userid'])) && (isValidId($data['id'])) && (!empty($data['t
                } // END - switch
 
                // Entry found?
-               if (SQL_NUMROWS($result_mailid) == 1) {
+               if (sqlNumRows($result_mailid) == 1) {
                        // Load data
-                       $data = merge_array($data, SQL_FETCHARRAY($result_mailid));
+                       $data = merge_array($data, sqlFetchArray($result_mailid));
 
                        // Correct notification switch in non-bonus mails
                        if ((!isset($data['is_notify'])) || (!in_array($data['is_notify'], array('Y', 'N')))) {
@@ -160,33 +155,33 @@ if ((isValidId($data['userid'])) && (isValidId($data['id'])) && (!empty($data['t
                                        // @TODO Rewrite this to a filter
                                        switch ($data['link_type']) {
                                                case 'NORMAL':
-                                                       $result = SQL_QUERY_ESC("SELECT `payment_id` FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `pool_id`=%s LIMIT 1",
+                                                       $result = sqlQueryEscaped("SELECT `payment_id` FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `pool_id`=%s LIMIT 1",
                                                                array(bigintval($data['pool_id'])), __FILE__, __LINE__);
 
                                                        // Entry found?
-                                                       if (SQL_NUMROWS($result) == 1) {
-                                                               $data = merge_array($data, SQL_FETCHARRAY($result));
-                                                               $data['time']    = getPaymentData($data['payment_id'], 'time');
-                                                               $data['payment'] = getPaymentData($data['payment_id'], 'payment');
+                                                       if (sqlNumRows($result) == 1) {
+                                                               $data = merge_array($data, sqlFetchArray($result));
+                                                               $data['time']    = getPaymentTime($data['payment_id']);
+                                                               $data['payment'] = getPaymentPayment($data['payment_id']);
                                                                $isValid   = TRUE;
                                                        } // END - if
 
                                                        // Free memory...
-                                                       SQL_FREERESULT($result);
+                                                       sqlFreeResult($result);
                                                        break;
 
                                                case 'BONUS':
-                                                       $result = SQL_QUERY_ESC("SELECT `time`, `points` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `id`=%s LIMIT 1",
+                                                       $result = sqlQueryEscaped("SELECT `time`, `points` AS `payment` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `id`=%s LIMIT 1",
                                                                array(bigintval($data['pool_id'])), __FILE__, __LINE__);
 
                                                        // Entry found?
-                                                       if (SQL_NUMROWS($result) == 1) {
-                                                               $data = merge_array($data, SQL_FETCHARRAY($result));
+                                                       if (sqlNumRows($result) == 1) {
+                                                               $data = merge_array($data, sqlFetchArray($result));
                                                                $isValid = TRUE;
                                                        } // END - if
 
                                                        // Free memory...
-                                                       SQL_FREERESULT($result);
+                                                       sqlFreeResult($result);
                                                        break;
 
                                                default: // Unknown type
@@ -234,28 +229,29 @@ if ((isValidId($data['userid'])) && (isValidId($data['id'])) && (!empty($data['t
                }
 
                // Free result
-               SQL_FREERESULT($result_mailid);
+               sqlFreeResult($result_mailid);
        } else {
                $data['error_code'] = getCode('ALREADY_CONFIRMED');
                $data['do'] = 'failed';
        }
 
        // Free result
-       SQL_FREERESULT($result_main);
-
-       // Insert footer if no image
-       if ($data['do'] != 'img') {
-               // Write footer
-               loadIncludeOnce('inc/footer.php');
-       } // END - if
+       sqlFreeResult($result_main);
 } else {
        // Not all variables are set
        $data['error_code'] = getCode('ERROR_MAILID');
+       $data['do'] = 'failed';
 }
 
 // Error code is set?
 handleMailIdErrorCode($data['error_code']);
 
+// Insert footer if no image
+if ($data['do'] != 'img') {
+       // Write footer
+       loadPageFooter();
+} // END - if
+
 // Really all done here... ;-)
 doShutdown();