]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/member/what-order.php
Rewritten to use filter and wrapper
[mailer.git] / inc / modules / member / what-order.php
index de7899c8f22587618be64879395ce65ce731a4d5..eedeef39b2e2c8c34c7f0d3ffb7d6e688bf783fd 100644 (file)
@@ -50,9 +50,6 @@ if ((!isExtensionActive('order')) && (!isAdmin())) {
 
 $url = ''; $id = '0';
 
-// Count unconfirmed mails
-$links = getTotalUnconfirmedMails(getMemberId());
-
 $ALLOWED = getUserData('receive_mails') - getUserData('mail_orders');
 if (getConfig('order_max_full') == 'MAX') $ALLOWED = getUserData('receive_mails');
 
@@ -66,7 +63,7 @@ if ((isExtensionInstalledAndNewer('holiday', '0.1.3')) && (isUserDataEnabled('ho
        // Continue with the frametester, we first need to store the data temporary in the pool
        //
        // First we would like to store the data and get it's pool position back...
-       $result = SQL_QUERY_ESC("SELECT `id`, `data_type`
+       $result = SQL_QUERY_ESC("SELECT `id`,`data_type`
 FROM
        `{?_MYSQL_PREFIX?}_pool`
 WHERE
@@ -95,7 +92,7 @@ LIMIT 1",
                $url = '';
                if (getConfig('allow_url_in_text') == 'Y') {
                        // Test submitted text against some filters (length, URLs in text etc.)
-                       if ((strpos(strtolower(postRequestParameter('text')), 'https://') > -1) || (strpos(strtolower(postRequestParameter('text')), 'http://') > -1) || (strpos(strtolower(postRequestParameter('text')), "www") > -1)) {
+                       if ((isInStringIgnoreCase('https://', postRequestParameter('text'))) || (isInStringIgnoreCase('http://', postRequestParameter('text'))) || (isInStringIgnoreCase('www', postRequestParameter('text')))) {
                                // URL found
                                $url = 'modules.php?module=login&what=order&code=' . getCode('URL_FOUND');
                        } // END - if
@@ -114,7 +111,7 @@ LIMIT 1",
                if (getConfig('allow_url_in_subject') == 'Y') {
                        // Check the subject line for issues
                        setPostRequestParameter('subject', str_replace("\\", '[nl]', substr(postRequestParameter('subject'), 0, 200)));
-                       if ((strpos(strtolower(postRequestParameter('subject')), 'http://') > -1) || (strpos(strtolower(postRequestParameter('subject')), "www") > -1)) {
+                       if ((isInStringIgnoreCase('https://', postRequestParameter('subject'))) || (isInStringIgnoreCase('http://', postRequestParameter('subject'))) || (isInStringIgnoreCase('www', postRequestParameter('subject')))) {
                                // URL in subject found
                                $url = 'modules.php?module=login&what=order&code=' . getCode('SUBJECT_URL');
                        } // END - if
@@ -460,7 +457,7 @@ LIMIT 1",
 } elseif (($ALLOWED == '0') && (getConfig('order_max_full') == 'ORDER')) {
        // No more mail orders allowed
        displayMessage('{--MEMBER_ORDER_ALLOWED_EXHAUSTED--}');
-} elseif ($links < getConfig('unconfirmed')) {
+} elseif (getTotalUnconfirmedMails(getMemberId()) < getConfig('unconfirmed')) {
        // Show only enabled categories to the user ...
        $whereStatement = " WHERE `visible`='Y'";
 
@@ -469,7 +466,7 @@ LIMIT 1",
 
        // Display order form
        $result_cats = SQL_QUERY("SELECT
-       `id`, `cat`
+       `id`,`cat`
 FROM
        `{?_MYSQL_PREFIX?}_cats`
 ".$whereStatement."
@@ -569,7 +566,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)) {
@@ -619,7 +616,7 @@ LIMIT 1",
 
                                // Check if we already have an order placed and make it editable
                                $result = SQL_QUERY_ESC("SELECT
-       `subject`, `text`, `payment_id`, `timestamp`, `url`, `target_send`, `cat_id`, `zip`
+       `subject`,`text`,`payment_id`,`timestamp`,`url`,`target_send`,`cat_id`,`zip`
 FROM
        `{?_MYSQL_PREFIX?}_pool`
 WHERE
@@ -735,7 +732,7 @@ LIMIT 1",
        }
 } else {
        // Please confirm some mails first
-       displayMessage('<span class="notice">{%message,MEMBER_ORDER_LINKS_LEFT=' . $links . '%}</span>', $links);
+       displayMessage('<span class="notice">{%message,MEMBER_ORDER_LINKS_LEFT=' . getTotalUnconfirmedMails(getMemberId()) . '%}</span>');
 }
 
 if (!empty($url)) {