]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/member/what-order.php
Mailer project continued:
[mailer.git] / inc / modules / member / what-order.php
index a44255e8acd9c33f61eadf0d3560a1fa403ad89d..8914ad5202f5f25d3ccdba8785d88a8507a966ac 100644 (file)
@@ -120,21 +120,9 @@ LIMIT 1",
                } // END - if
 
                // And shall I check that his URL is not in the black list?
-               if (isUrlBlacklistEnabled()) {
-                       // Ok, I do that for you know...
-                       $result = SQL_QUERY_ESC("SELECT UNIX_TIMESTAMP(`timestamp`) AS tstamp FROM `{?_MYSQL_PREFIX?}_url_blacklist` WHERE `url`='%s' LIMIT 1",
-                               array(postRequestElement('url')), __FILE__, __LINE__);
-
-                       if (SQL_NUMROWS($result) == 1) {
-                               // Jupp, we got one listed
-                               list($blist) = SQL_FETCHROW($result);
-
-                               // Create redirect-URL
-                               $url = 'modules.php?module=login&what=order&code=' . getCode('BLIST_URL') . '&blist=' . $blist;
-                       } // END - if
-
-                       // Free result
-                       SQL_FREERESULT($result);
+               if (isUrlBlacklisted(postRequestElement('url'))) {
+                       // Create redirect-URL
+                       $url = 'modules.php?module=login&what=order&code=' . getCode('BLIST_URL') . '&blist=' . $GLOBALS['blacklist_data'][postRequestElement('url')]['timestamp'];
                } // END - if
 
                // Enougth receivers entered?
@@ -198,7 +186,7 @@ ORDER BY
                                getMemberId()
                        ), __FILE__, __LINE__);
 
-               // Do we enougth receivers left?
+               // Are there still receivers left?
                if (SQL_NUMROWS($result) >= postRequestElement('receiver')) {
                        // Load receivers from database
                        $TEST = array(); $count = '0';
@@ -253,7 +241,7 @@ LIMIT 1",
                        } // END - if
 
                        // Calculate used points
-                       $usedPoints = $content['target_send'] * getPaymentPoints(bigintval(postRequestElement('mail_type')));
+                       $usedPoints = $content['target_send'] * getPaymentData(bigintval(postRequestElement('mail_type')));
 
                        // Fix empty zip code
                        if (!isPostRequestElementSet('zip')) {
@@ -350,6 +338,9 @@ LIMIT 1",
                                                                bigintval(postRequestElement('zip'), true, false),
                                                        ), __FILE__, __LINE__);
                                        }
+
+                                       // Get insert id
+                                       $id = SQL_INSERTID();
                                } else {
                                        // Change current order
                                        if (isExtensionActive('html_mail')) {
@@ -413,24 +404,10 @@ LIMIT 1",
                                        }
                                }
 
-                               // Do we need to get the id number?
-                               if ($id == '0') {
-                                       // Order is placed as temporary. We need to get it's id for the frametester
-                                       $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `sender`=%s AND `subject`='%s' AND `payment_id`=%s AND `data_type`='TEMP' AND `timestamp`=UNIX_TIMESTAMP() LIMIT 1",
-                                               array(
-                                                       getMemberId(),
-                                                       postRequestElement('subject'),
-                                                       bigintval(postRequestElement('mail_type'))
-                                               ), __FILE__, __LINE__);
-
-                                       // Get pool id
-                                       list($id) = SQL_FETCHROW($result);
-
-                                       // Free result
-                                       SQL_FREERESULT($result);
-                               } // END - if
+                               // Make sure only valid id numbers can pass
+                               assert((!is_bool($id)) && ($id > 0));
 
-                               // id is received so we can redirect the user, used points will be added when he send's out the mail
+                               // Id is received so we can redirect the user, used points will be added when he send's out the mail
                                $url = 'modules.php?module=frametester&order=' . $id;
                        } elseif ($content['target_send'] == '0') {
                                // Not enougth receivers found which can receive mails
@@ -563,7 +540,7 @@ LIMIT 1",
                        SQL_FREERESULT($result_cats);
 
                        // Now we need to load the mail types...
-                       $result = SQL_QUERY("SELECT `id`,`price`,`payment`,`mail_title` FROM `{?_MYSQL_PREFIX?}_payments` ORDER BY `payment` ASC", __FILE__, __LINE__);
+                       $result = SQL_QUERY("SELECT `id`, `price`, `payment`, `mail_title` FROM `{?_MYSQL_PREFIX?}_payments` ORDER BY `payment` ASC", __FILE__, __LINE__);
 
                        $types = array();
                        if (!SQL_HASZERONUMS($result)) {