First batch of removal of the headers needed for revision-functions.php
[mailer.git] / mailid.php
index ca7d9694bd7ba565966388282199f6e2945562f8..a1b85addaad04d28b3a00b67fdfea1f53e31fdf1 100644 (file)
@@ -55,10 +55,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 +80,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
+               loadIncludeOnce('inc/header.php');
+       } // 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 +113,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 +123,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 +138,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 +160,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));
+                                                       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` AS `payment` 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,14 +234,14 @@ 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);
+       sqlFreeResult($result_main);
 } else {
        // Not all variables are set
        $data['error_code'] = getCode('ERROR_MAILID');