]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/member/what-order.php
Mahor rewrite:
[mailer.git] / inc / modules / member / what-order.php
index 0ef9854cb32ba3fafa3440de3d04e2324e7497da..eace0213cbae9e80d58104fab8836a8cd6b47a9a 100644 (file)
@@ -56,7 +56,7 @@ if (empty($_POST['receiver'])) $_POST['receiver'] = "";
 if (IS_ADMIN()) $whereStatement = "";
 
 // Minimum mails / order
-define('__MIN_VALUE', $_CONFIG['order_min']);
+define('__MIN_VALUE', getConfig('order_min'));
 
 // Count unconfirmed mails
 $result_links = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_links WHERE userid=%s",
@@ -82,7 +82,7 @@ SQL_FREERESULT($result_mmails);
 if ($HOLIDAY == $DMY) $HOLIDAY='N';
 
 $ALLOWED = $MAXI - $ORDERS;
-if ($_CONFIG['order_max_full'] == "MAX") $ALLOWED = $MAXI;
+if (getConfig('order_max_full') == "MAX") $ALLOWED = $MAXI;
 
 // Check HTML extension
 $HTML_EXT = EXT_IS_ACTIVE("html_mail");
@@ -109,7 +109,7 @@ if (($HOLIDAY == "Y") && (GET_EXT_VERSION("holiday") >= "0.1.3")) {
        $result = SQL_QUERY_ESC("SELECT id, data_type
 FROM "._MYSQL_PREFIX."_pool
 WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
-        array($GLOBALS['userid'], $_POST['url'], $_CONFIG['url_tlock']), __FILE__, __LINE__);
+        array($GLOBALS['userid'], $_POST['url'], getConfig('url_tlock')), __FILE__, __LINE__);
 
        $type = "TEMP"; $id = 0;
        if (SQL_NUMROWS($result) == 1) {
@@ -123,7 +123,7 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
                // No entry found, so we need to check out the stats table as well... :)
                // We have to add that suff here, now we continue WITHOUT checking and check the text and subject against some filters
                $URL = "";
-               if ($_CONFIG['test_text'] == "Y") {
+               if (getConfig('test_text') == "Y") {
                        // Test submitted text against some filters (length, URLs in text etc.)
                        if ((strpos(strtolower($_POST['text']), "https://") > -1) || (strpos(strtolower($_POST['text']), "http://") > -1) || (strpos(strtolower($_POST['text']), "www") > -1)) {
                                // URL found!
@@ -134,14 +134,14 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
                        $TEST = str_replace("\n", "", str_replace("\r", "", $_POST['text']));
 
                        // Text length within allowed length?
-                       if (strlen($TEST) > $_CONFIG['max_tlength']) {
+                       if (strlen($TEST) > getConfig('max_tlength')) {
                                // Text is too long!
                                $URL = URL."/modules.php?module=login&what=order&msg=".CODE_OVERLENGTH;
                        } // END - if
                } // END - if
 
                // Shall I test the subject line against URLs?
-               if ($_CONFIG['test_subj'] == "Y") {
+               if (getConfig('test_subj') == "Y") {
                        // Check the subject line for issues
                        $_POST['subject'] = str_replace("\\", "[nl]", substr($_POST['subject'], 0, 200));
                        if ((strpos(strtolower($_POST['subject']), "http://") > -1) || (strpos(strtolower($_POST['subject']), "www") > -1)) {
@@ -151,7 +151,7 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
                } // END - if
 
                // And shall I check that his URL is not in the black list?
-               if ($_CONFIG['url_blacklist'] == "Y") {
+               if (getConfig('url_blacklist') == "Y") {
                        // Ok, I do that for you know...
                        $result = SQL_QUERY_ESC("SELECT timestamp FROM "._MYSQL_PREFIX."_url_blist WHERE url='%s' LIMIT 1",
                                array($_POST['url']), __FILE__, __LINE__);
@@ -165,7 +165,7 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
                } // END - if
 
                // Enougth receivers entered?
-               if (($_POST['receiver'] < $_CONFIG['order_min']) && (!IS_ADMIN())) {
+               if (($_POST['receiver'] < getConfig('order_min')) && (!IS_ADMIN())) {
                        // Less than allowed receivers entered!
                        $URL = URL."/modules.php?module=login&amp;what=order&amp;msg=".CODE_MORE_RECEIVERS3;
                } // END - if
@@ -199,7 +199,7 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
        if (empty($URL)) {
                // Check if category and number of receivers is okay
                $ADD = "";
-               if (($_CONFIG['order_multi_page'] == "Y") && (!empty($_POST['zip']))) {
+               if ((getConfig('order_multi_page') == "Y") && (!empty($_POST['zip']))) {
                        // Choose recipients by ZIP code
                        $ADD = " AND d.zip LIKE '".bigintval($_POST['zip'])."{PER}'";
                } // END - if
@@ -213,8 +213,8 @@ ORDER BY d.%s %s",
  array(
        bigintval($_POST['cat']),
        $GLOBALS['userid'],
-       $_CONFIG['order_select'],
-       $_CONFIG['order_mode'],
+       getConfig('order_select'),
+       getConfig('order_mode'),
  ), __FILE__, __LINE__);
 
                // Do we enougth receivers left?
@@ -397,10 +397,10 @@ array(
 } elseif ($_POST['receiver'] == "0") {
        // Not enougth receivers selected
        $URL = URL."/modules.php?module=login&amp;what=order&amp;msg=".CODE_MORE_RECEIVERS1;
-} elseif (($ALLOWED == 0) && ($_CONFIG['order_max_full'] == "ORDER")) {
+} elseif (($ALLOWED == 0) && (getConfig('order_max_full') == "ORDER")) {
        // No more mail orders allowed
        LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_ORDER_ALLOWED_EXHAUSTED);
-} elseif (($links < $_CONFIG['unconfirmed']) && ($mmails == "1")) {
+} elseif (($links < getConfig('unconfirmed')) && ($mmails == "1")) {
        // Display order form
        $result_cats = SQL_QUERY("SELECT id, cat FROM "._MYSQL_PREFIX."_cats".$whereStatement." ORDER BY sort", __FILE__, __LINE__);
        if (SQL_NUMROWS($result_cats) > 0) {
@@ -455,7 +455,7 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
                                                $result_ver = SQL_QUERY_ESC("SELECT zip FROM `"._MYSQL_PREFIX."_user_data` WHERE userid=%s".$HTML." AND receive_mails > 0 AND status='CONFIRMED' LIMIT 1",
                                                 array(bigintval($ucat)), __FILE__, __LINE__);
 
-                                               if ((SQL_NUMROWS($result_ver) == 1) && (!empty($_POST['zip'])) && ($_CONFIG['order_multi_page'] == "Y")) {
+                                               if ((SQL_NUMROWS($result_ver) == 1) && (!empty($_POST['zip'])) && (getConfig('order_multi_page') == "Y")) {
                                                        list($zip) = SQL_FETCHROW($result_ver);
                                                        SQL_FREERESULT($result_ver);
                                                        if (substr($zip, 0, strlen($_POST['zip'])) == $_POST['zip']) {
@@ -498,13 +498,13 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
                                        SQL_FREERESULT($result);
 
                                        // Calculate hours...
-                                       $STD = round($_CONFIG['url_tlock'] / 60 / 60);
+                                       $STD = round(getConfig('url_tlock') / 60 / 60);
 
                                        // Minutes...
-                                       $MIN = round(($_CONFIG['url_tlock'] - $STD * 60 * 60) / 60);
+                                       $MIN = round((getConfig('url_tlock') - $STD * 60 * 60) / 60);
 
                                        // And seconds
-                                       $SEC = $_CONFIG['url_tlock'] - $STD * 60 * 60 - $MIN * 60;
+                                       $SEC = getConfig('url_tlock') - $STD * 60 * 60 - $MIN * 60;
 
                                        // Finally contruct the message
                                        $MSG = MEMBER_URL_TIME_LOCK."<br />".CONFIG_URL_TLOCK." ".$STD." ".
@@ -549,7 +549,7 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
                                        break;
 
                                case CODE_MORE_RECEIVERS3:
-                                       $MSG = MEMBER_ENTER_MORE_MIN_RECEIVERS_1.$_CONFIG['order_min'].MEMBER_ENTER_MORE_MIN_RECEIVERS_2;
+                                       $MSG = MEMBER_ENTER_MORE_MIN_RECEIVERS_1.getConfig('order_min').MEMBER_ENTER_MORE_MIN_RECEIVERS_2;
                                        break;
 
                                case CODE_INVALID_URL:
@@ -582,7 +582,7 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
                                $TOTAL = TRANSLATE_COMMA($TOTAL);
 
                                // Check how many mail orders he has placed today and how many he's allowed to send
-                               switch ($_CONFIG['order_max_full'])
+                               switch (getConfig('order_max_full'))
                                {
                                case "MAX": // He is allowed to send as much as possible
                                        define('ORDER_MAX_VALUE', ORDER_ALLOED_MAX);
@@ -593,7 +593,7 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
                                        break;
 
                                default: // Unknown/invalid
-                                       DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown order_mas_full config detected.", $_CONFIG['order_max_full']));
+                                       DEBUG_LOG(__FILE__, __LINE__, sprintf("Unknown order_mas_full config detected.", getConfig('order_max_full')));
                                        define('ORDER_MAX_VALUE', ORDER_ALLOED_UNKNOWN);
                                        break;
                                }
@@ -624,7 +624,7 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
                                }
 
                                // 01      2              21    12                                   2    23         443    3          3210
-                               if ((!empty($_POST['data'])) || (($_CONFIG['order_multi_page'] == "N") && ((!IS_ADMIN()) && (!$HTML_EXT)))) {
+                               if ((!empty($_POST['data'])) || ((getConfig('order_multi_page') == "N") && ((!IS_ADMIN()) && (!$HTML_EXT)))) {
                                        // Pre-output categories
                                        $CAT = "";
                                        foreach ($CATS['id'] as $key => $value) {
@@ -676,7 +676,7 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
                                        $ADD = "";
                                        if ($HTML_EXT) {
                                                // Add some content when html extension is active
-                                               if (($_CONFIG['order_multi_page'] == "Y") || (IS_ADMIN())) $ADD = "<TR><TD colspan=\"2\" class=\"seperator bottom2\" height=\"5\">&nbsp;</TD></TR>\n";
+                                               if ((getConfig('order_multi_page') == "Y") || (IS_ADMIN())) $ADD = "<TR><TD colspan=\"2\" class=\"seperator bottom2\" height=\"5\">&nbsp;</TD></TR>\n";
                                                define('MEMBER_HTML_EXTENSION', LOAD_TEMPLATE("member_order-html_intro", true));
                                        } else {
                                                // No HTML extension installed
@@ -684,10 +684,10 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
                                        }
 
                                        // Do we want ZIP code or not?
-                                       if (($_CONFIG['order_multi_page'] == "Y") || (IS_ADMIN())) {
+                                       if ((getConfig('order_multi_page') == "Y") || (IS_ADMIN())) {
                                                // Yes
                                                $content = array(
-                                                       'zip' => $_POST['zip'],
+                                                       'zip' => bigintval($_POST['zip']),
                                                        'add' => $ADD
                                                );
                                                define('MEMBER_ZIP_CONTENT', LOAD_TEMPLATE("member_order-zip1", true, $content));
@@ -716,7 +716,7 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
        LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_HAS_ZERO_MMAILS);
 } else {
        // Please confirm some mails first!
-       LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_LINKS_LEFT_1.$links.MEMBER_LINKS_LEFT_2.$_CONFIG['unconfirmed'].MEMBER_LINKS_LEFT_3);
+       LOAD_TEMPLATE("admin_settings_saved", false, MEMBER_LINKS_LEFT_1.$links.MEMBER_LINKS_LEFT_2.getConfig('unconfirmed').MEMBER_LINKS_LEFT_3);
 }
 
 if (!empty($URL)) {