]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/member/what-order.php
Extensions 'admins' and 'task' are now always active
[mailer.git] / inc / modules / member / what-order.php
index 7753510fa860a5ea7f1053b07e8f63f46be0c1d8..7af82df4464c7888d41a8b8c72ef202b72814c86 100644 (file)
@@ -59,13 +59,10 @@ if (IS_ADMIN()) $whereStatement = "";
 define('__MIN_VALUE', getConfig('order_min'));
 
 // Count unconfirmed mails
-$result_links = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_user_links WHERE userid=%s",
- array($GLOBALS['userid']), __FILE__, __LINE__);
-$links = SQL_NUMROWS($result_links);
-SQL_FREERESULT($result_links);
+$links = GET_TOTAL_DATA($GLOBALS['userid'], "user_links", "id", "userid", true);
 
 // Does the user has more than 0 mails per day set?
-$HOLIDAY="userid";
+$HOLIDAY = "userid";
 if (GET_EXT_VERSION("holiday") >= "0.1.3") {
        // Fetch also holiday activation data
        $HOLIDAY = "holiday_active";
@@ -74,7 +71,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($GLOBALS['userid']), __FILE__, __LINE__);
 
 $mmails = SQL_NUMROWS($result_mmails);
 list($DMY, $MAXI, $ORDERS, $HOLIDAY) = SQL_FETCHROW($result_mmails);
@@ -85,19 +82,10 @@ $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");
-
-if ($TOTAL > 0) {
-       // And subtract his used points...
-       $TOTAL -= GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points");
-
-       // Add (maybe) missing three zeros
-       if (!ereg(".", $TOTAL)) $TOTAL .= ".00000";
-} // END - if
+$TOTAL = GET_TOTAL_DATA($GLOBALS['userid'], "user_points", "points") - GET_TOTAL_DATA($GLOBALS['userid'], "user_data", "used_points");;
 
 if (($HOLIDAY == "Y") && (GET_EXT_VERSION("holiday") >= "0.1.3")) {
        // Holiday is active!
-       SQL_FREERESULT($result_p);
        LOAD_TEMPLATE("admin_settings_saved", false, HOLIDAY_ORDER_NOT_POSSIBLE);
 } elseif ((!empty($_POST['frametester'])) && ($ALLOWED > 0) && ($_POST['receiver'] > 0)) {
        // Continue with the frametester, we first need to store the data temporary in the pool
@@ -106,12 +94,13 @@ 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'], getConfig('url_tlock')), __FILE__, __LINE__);
+               array($GLOBALS['userid'], $_POST['url'], getConfig('url_tlock')), __FILE__, __LINE__);
 
        $type = "TEMP"; $id = 0;
        if (SQL_NUMROWS($result) == 1) {
+               // Load id and mail type
                list($id, $type) = SQL_FETCHROW($result);
-       }
+       } // END - if
 
        // Free result
        SQL_FREERESULT($result);