]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/member/what-order.php
Re-added, now the right ones
[mailer.git] / inc / modules / member / what-order.php
index 54c841fe089437da886e28d5956e6543cec2b95a..208c8a39ca9ed17a197f36e960f00e64758f8a6b 100644 (file)
@@ -11,9 +11,9 @@
  * Kurzbeschreibung  : Hier koennen Ihre Mitglieder Mails buchen        *
  * -------------------------------------------------------------------- *
  * $Revision:: 856                                                    $ *
- * $Date:: 2009-03-06 20:24:32 +0100 (Fr, 06. Mär 2009)              $ *
+ * $Date::                                                            $ *
  * $Tag:: 0.2.1-FINAL                                                 $ *
- * $Author:: stelzi                                                   $ *
+ * $Author::                                                          $ *
  * Needs to be in all Files and every File needs "svn propset           *
  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
@@ -64,7 +64,7 @@ if (IS_ADMIN()) $whereStatement = "";
 define('__MIN_VALUE', getConfig('order_min'));
 
 // Count unconfirmed mails
-$links = GET_TOTAL_DATA($GLOBALS['userid'], "user_links", "id", "userid", true);
+$links = GET_TOTAL_DATA(getUserId(), "user_links", "id", "userid", true);
 
 // Does the user has more than 0 mails per day set?
 $HOLIDAY = "userid";
@@ -76,7 +76,7 @@ if (GET_EXT_VERSION("holiday") >= "0.1.3") {
 $result_mmails = SQL_QUERY_ESC("SELECT userid, receive_mails, mail_orders, ".$HOLIDAY."
 FROM `{!_MYSQL_PREFIX!}_user_data`
 WHERE userid=%s AND max_mails > 0 LIMIT 1",
-       array($GLOBALS['userid']), __FILE__, __LINE__);
+       array(getUserId()), __FILE__, __LINE__);
 
 $mmails = SQL_NUMROWS($result_mmails);
 list($DMY, $MAXI, $ORDERS, $HOLIDAY) = SQL_FETCHROW($result_mmails);
@@ -87,7 +87,7 @@ $ALLOWED = $MAXI - $ORDERS;
 if (getConfig('order_max_full') == "MAX") $ALLOWED = $MAXI;
 
 // Now check his points amount
-$TOTAL = GET_TOTAL_DATA($GLOBALS['userid'], "user_points", "points") - GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points");;
+$TOTAL = GET_TOTAL_DATA(getUserId(), "user_points", "points") - GET_TOTAL_DATA(getUserId(), "user_data", "used_points");;
 
 if (($HOLIDAY == "Y") && (GET_EXT_VERSION("holiday") >= "0.1.3")) {
        // Holiday is active!
@@ -99,7 +99,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'], REQUEST_POST('url'), getConfig('url_tlock')), __FILE__, __LINE__);
+               array(getUserId(), REQUEST_POST('url'), getConfig('url_tlock')), __FILE__, __LINE__);
 
        $type = "TEMP"; $id = 0;
        if (SQL_NUMROWS($result) == 1) {
@@ -118,7 +118,7 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
                        // Test submitted text against some filters (length, URLs in text etc.)
                        if ((strpos(strtolower(REQUEST_POST('text')), "https://") > -1) || (strpos(strtolower(REQUEST_POST('text')), "http://") > -1) || (strpos(strtolower(REQUEST_POST('text')), "www") > -1)) {
                                // URL found!
-                               $URL = "modules.php?module=login&what=order&msg=".constant('CODE_URL_FOUND');
+                               $URL = "modules.php?module=login&what=order&msg=".getCode('URL_FOUND');
                        } // END - if
 
                        // Remove new-line and carriage-return characters
@@ -127,7 +127,7 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
                        // Text length within allowed length?
                        if (strlen($TEST) > getConfig('max_tlength')) {
                                // Text is too long!
-                               $URL = "modules.php?module=login&what=order&msg=".constant('CODE_OVERLENGTH');
+                               $URL = "modules.php?module=login&what=order&msg=".getCode('OVERLENGTH');
                        } // END - if
                } // END - if
 
@@ -137,7 +137,7 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
                        REQUEST_SET_POST('subject', str_replace("\\", "[nl]", substr(REQUEST_POST('subject'), 0, 200)));
                        if ((strpos(strtolower(REQUEST_POST('subject')), "http://") > -1) || (strpos(strtolower(REQUEST_POST('subject')), "www") > -1)) {
                                // URL in subject found
-                               $URL = "modules.php?module=login&what=order&msg=".constant('CODE_SUBJ_URL');
+                               $URL = "modules.php?module=login&what=order&msg=".getCode('SUBJ_URL');
                        } // END - if
                } // END - if
 
@@ -152,7 +152,7 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
                                list($blist) = SQL_FETCHROW($result);
 
                                // Create redirect-URL
-                               $URL = "modules.php?module=login&what=order&msg=".constant('CODE_BLIST_URL')."&blist=".$blist;
+                               $URL = "modules.php?module=login&what=order&msg=".getCode('BLIST_URL')."&blist=".$blist;
                        } // END - if
 
                        // Free result
@@ -162,13 +162,13 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
                // Enougth receivers entered?
                if ((REQUEST_POST('receiver') < getConfig('order_min')) && (!IS_ADMIN())) {
                        // Less than allowed receivers entered!
-                       $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_MORE_RECEIVERS3');
+                       $URL = "modules.php?module=login&amp;what=order&amp;msg=".getCode('MORE_RECEIVERS3');
                } // END - if
 
                // Validate URL
                if (!VALIDATE_URL(REQUEST_POST('url'))) {
                        // URL is invalid!
-                       $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_INVALID_URL');
+                       $URL = "modules.php?module=login&amp;what=order&amp;msg=".getCode('INVALID_URL');
                } // END - if
 
                // Probe for HTML extension
@@ -179,7 +179,7 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
                                REQUEST_SET_POST('text', HTML_CHECK_TAGS(REQUEST_POST('text')));
 
                                // Maybe invalid tags found?
-                               if (!REQUEST_ISSET_POST(('text'))) $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_INVALID_TAGS')."&amp;id=".$id;
+                               if (!REQUEST_ISSET_POST(('text'))) $URL = "modules.php?module=login&amp;what=order&amp;msg=".getCode('INVALID_TAGS')."&amp;id=".$id;
                        } else {
                                // Remove any HTML code
                                REQUEST_SET_POST('text', str_replace("<", "{OPEN_HTML}", str_replace(">", "{CLOSE_HTML}", REQUEST_POST('text'))));
@@ -187,7 +187,7 @@ WHERE sender=%s AND url='%s' AND timestamp > (UNIX_TIMESTAMP() - %s) LIMIT 1",
                }
        } elseif (!IS_ADMIN()) {
                // He has already sent a mail within a specific time
-               $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_URL_TLOCK')."&amp;id=".$id;
+               $URL = "modules.php?module=login&amp;what=order&amp;msg=".getCode('URL_TLOCK')."&amp;id=".$id;
        }
 
        // Still no error?
@@ -207,7 +207,7 @@ WHERE c.cat_id=%s AND c.userid != '%s' AND d.`status`='CONFIRMED' AND d.receive_
 ORDER BY d.%s %s",
  array(
        bigintval(REQUEST_POST('cat')),
-       $GLOBALS['userid'],
+       getUserId(),
        getConfig('order_select'),
        getConfig('order_mode'),
  ), __FILE__, __LINE__);
@@ -276,7 +276,7 @@ WHERE userid=%s AND holiday_start < UNIX_TIMESTAMP() AND holiday_end > UNIX_TIME
                                                SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_pool` (sender, subject, text, receivers, payment_id, data_type, timestamp, url, cat_id, target_send, zip, html_msg)
  VALUES ('%s','%s','%s','%s','%s','TEMP','%s','%s','%s','%s','%s','%s')",
 array(
-       $GLOBALS['userid'],
+       getUserId(),
        REQUEST_POST('subject'),
        REQUEST_POST('text'),
        $RECEIVER,
@@ -293,7 +293,7 @@ array(
                                                SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_pool` (sender, subject, text, receivers, payment_id, data_type, timestamp, url, cat_id, target_send, zip)
  VALUES ('%s','%s','%s','%s','%s','TEMP','%s','%s','%s','%s','%s')",
 array(
-       $GLOBALS['userid'],
+       getUserId(),
        REQUEST_POST('subject'),
        REQUEST_POST('text'),
        $RECEIVER,
@@ -365,7 +365,7 @@ array(
                                        // 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=%s LIMIT 1",
                                        array(
-                                               $GLOBALS['userid'],
+                                               getUserId(),
                                                REQUEST_POST('subject'),
                                                bigintval(REQUEST_POST('type')),
                                                $TIME
@@ -379,19 +379,19 @@ array(
                                $URL = "modules.php?module=frametester&amp;order=".$id."";
                        } elseif ($MAX_SEND == 0) {
                                // Not enougth receivers found which can receive mails
-                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_MORE_RECEIVERS2');
+                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".getCode('MORE_RECEIVERS2');
                        } else {
                                // No enougth points left!
-                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_MORE_POINTS');
+                               $URL = "modules.php?module=login&amp;what=order&amp;msg=".getCode('MORE_POINTS');
                        }
                } else  {
                        // Ordered more mails than he can send in this category
-                       $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_NO_RECS_LEFT');
+                       $URL = "modules.php?module=login&amp;what=order&amp;msg=".getCode('NO_RECS_LEFT');
                }
        }
 } elseif (REQUEST_POST('receiver') == "0") {
        // Not enougth receivers selected
-       $URL = "modules.php?module=login&amp;what=order&amp;msg=".constant('CODE_MORE_RECEIVERS1');
+       $URL = "modules.php?module=login&amp;what=order&amp;msg=".getCode('MORE_RECEIVERS1');
 } elseif (($ALLOWED == 0) && (getConfig('order_max_full') == "ORDER")) {
        // No more mail orders allowed
        LOAD_TEMPLATE("admin_settings_saved", false, getMessage('MEMBER_ORDER_ALLOWED_EXHAUSTED'));
@@ -422,7 +422,7 @@ array(
 
                                // Select users in current category
                                $result_uids = SQL_QUERY_ESC("SELECT userid FROM `{!_MYSQL_PREFIX!}_user_cats` WHERE cat_id=%s AND userid != '%s' ORDER BY userid",
-                                       array(bigintval($content['id']), $GLOBALS['userid']), __FILE__, __LINE__);
+                                       array(bigintval($content['id']), getUserId()), __FILE__, __LINE__);
 
                                $uid_cnt = 0;
                                while (list($ucat) = SQL_FETCHROW($result_uids)) {
@@ -481,7 +481,7 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
                                $MSG = "";
                                switch (REQUEST_GET('msg'))
                                {
-                               case constant('CODE_URL_TLOCK'):
+                               case getCode('URL_TLOCK'):
                                        $result = SQL_QUERY_ESC("SELECT timestamp FROM `{!_MYSQL_PREFIX!}_pool` WHERE id=%s LIMIT 1",
                                         array(bigintval(REQUEST_GET('id'))), __FILE__, __LINE__);
 
@@ -508,47 +508,47 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
                                                {--MEMBER_LAST_TLOCK--}: ".$LORDER;
                                        break;
 
-                               case constant('CODE_OVERLENGTH'):
+                               case getCode('OVERLENGTH'):
                                        $MSG = getMessage('MEMBER_TEXT_OVERLENGTH');
                                        break;
 
-                               case constant('CODE_URL_FOUND'):
+                               case getCode('URL_FOUND'):
                                        $MSG = getMessage('MEMBER_TEXT_CONTAINS_URL');
                                        break;
 
-                               case constant('CODE_SUBJ_URL'):
+                               case getCode('SUBJ_URL'):
                                        $MSG = getMessage('MEMBER_SUBJ_CONTAINS_URL');
                                        break;
 
-                               case constant('CODE_BLIST_URL'):
+                               case getCode('BLIST_URL'):
                                        $MSG = "{--MEMBER_URL_BLACK_LISTED--}<br />\n{--MEMBER_BLIST_TIME--}: ".MAKE_DATETIME(REQUEST_GET('blist'), "0");
                                        break;
 
-                               case constant('CODE_NO_RECS_LEFT'):
+                               case getCode('NO_RECS_LEFT'):
                                        $MSG = getMessage('MEMBER_SELECTED_MORE_RECS');
                                        break;
 
-                               case constant('CODE_INVALID_TAGS'):
+                               case getCode('INVALID_TAGS'):
                                        $MSG = getMessage('MEMBER_HTML_INVALID_TAGS');
                                        break;
 
-                               case constant('CODE_MORE_POINTS'):
+                               case getCode('MORE_POINTS'):
                                        $MSG = getMessage('MEMBER_MORE_POINTS_NEEDED');
                                        break;
 
-                               case constant('CODE_MORE_RECEIVERS1'):
+                               case getCode('MORE_RECEIVERS1'):
                                        $MSG = getMessage('MEMBER_ENTER_MORE_RECEIVERS');
                                        break;
 
-                               case constant('CODE_MORE_RECEIVERS2'):
+                               case getCode('MORE_RECEIVERS2'):
                                        $MSG = getMessage('MEMBER_NO_MORE_RECEIVERS_FOUND');
                                        break;
 
-                               case constant('CODE_MORE_RECEIVERS3'):
+                               case getCode('MORE_RECEIVERS3'):
                                        $MSG = sprintf(getMessage('MEMBER_ENTER_MORE_MIN_RECEIVERS'), getConfig('order_min'));
                                        break;
 
-                               case constant('CODE_INVALID_URL'):
+                               case getCode('INVALID_URL'):
                                        $MSG = getMessage('MEMBER_ENTER_INVALID_URL');
                                        break;
 
@@ -602,7 +602,7 @@ LIMIT 1", array(bigintval($ucat)), __FILE__, __LINE__);
 
                                // 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 FROM `{!_MYSQL_PREFIX!}_pool` WHERE sender=%s AND data_type='TEMP' LIMIT 1",
-                                array($GLOBALS['userid']), __FILE__, __LINE__);
+                                array(getUserId()), __FILE__, __LINE__);
 
                                if (SQL_NUMROWS($result) == 1) {
                                        // Old order found