]> git.mxchange.org Git - mailer.git/blobdiff - inc/pool/pool-user.php
Added ability to allow empty passwords, if the user does so, a random password will...
[mailer.git] / inc / pool / pool-user.php
index 85388e456af990a41a4b0665566a3ff4dc8506de..953e9733f9244cee4b86704159841e675ac5b911 100644 (file)
@@ -14,8 +14,6 @@
  * $Date::                                                            $ *
  * $Tag:: 0.2.1-FINAL                                                 $ *
  * $Author::                                                          $ *
- * Needs to be in all Files and every File needs "svn propset           *
- * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
  * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
@@ -40,7 +38,7 @@
 // Some security stuff...
 if (!defined('__SECURITY')) {
        die();
-}
+} // END - if
 
 // Don't run on daily reset
 if (isResetModeEnabled()) {
@@ -62,8 +60,8 @@ if (isExtensionActive('html_mail')) {
 }
 
 // Reset variables
-$cnt2 = '0'; $lastSentId = '0'; $cnt_back = array(0); $pointsBack = array(0);
-if (SQL_NUMROWS($result_main) > 0) {
+$count2 = '0'; $lastSentId = '0'; $count_back = array(0); $pointsBack = array(0);
+if (!SQL_HASZERONUMS($result_main)) {
        // Parse all mails
        while ($DATA = SQL_FETCHARRAY($result_main, 0, false)) {
                // Set mail order as 'active'. That means it will be sent out
@@ -75,7 +73,7 @@ if (SQL_NUMROWS($result_main) > 0) {
                if (isset($DATA['html_msg'])) $HTML = $DATA['html_msg'];
 
                // Entry updated?
-               if (SQL_AFFECTEDROWS() == 1) {
+               if (!SQL_HASZEROAFFECTED()) {
                        // "Explode" all receivers into an array
                        if (isInString(';', $DATA['receivers'])) {
                                // There's more than one receiver in the list...
@@ -101,7 +99,7 @@ if (SQL_NUMROWS($result_main) > 0) {
 
                                        // If there's no stats entry add it!
                                        //* DEBUG: */ debugOutput('!L:'.__LINE__.'/'.SQL_NUMROWS($result_stats).'!');
-                                       if (SQL_NUMROWS($result_stats) == 0) {
+                                       if (SQL_HASZERONUMS($result_stats)) {
                                                // No entry was found, so we add him!
                                                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_stats` (`pool_id` , `userid`, `cat_id`, `payment_id`, `subject`, `url` , `max_rec` , `timestamp_ordered`, `timestamp_sstart`) VALUES ('%s','%s','%s','%s','%s','%s','%s','%s' , UNIX_TIMESTAMP())",
                                                        array(bigintval($DATA['id']), bigintval($DATA['sender']), bigintval($DATA['cat_id']), bigintval($DATA['payment_id']), $DATA['subject'], $DATA['url'], $DATA['target_send'], bigintval($DATA['timestamp'])), __FILE__, __LINE__);
@@ -174,14 +172,14 @@ if (SQL_NUMROWS($result_main) > 0) {
                                                // Prepare content
                                                $content = array(
                                                        'sender_userid' => $DATA['sender'],
-                                                       'category'      => getCategory($DATA['cat_id']),
+                                                       'cat_id'        => $DATA['cat_id'],
                                                        'text'          => $DATA['text'],
                                                        'url'           => $DATA['url'],
-                                                       'expiration'    => createFancyTime(getPaymentPoints($DATA['payment_id'], "time"))
+                                                       'expiration'    => '{%pipe,createFancyTime=' . getPaymentPoints($DATA['payment_id'], 'time') . '%}'
                                                );
 
                                                // Yes we do, so we notify admin and sender about fully sent mail!
-                                               sendAdminNotification(getMessage('ADMIN_SUBJ_SEND_DONE'), 'done-admin', $content, $userid);
+                                               sendAdminNotification('{--ADMIN_SEND_DONE_SUBJECT--}', 'done-admin', $content, $userid);
 
                                                // Get sender's data
                                                if (fetchUserData($DATA['sender'])) {
@@ -189,7 +187,7 @@ if (SQL_NUMROWS($result_main) > 0) {
                                                        $mailText = loadEmailTemplate('done-member', $content, $DATA['sender']);
 
                                                        // Send it also waway
-                                                       sendEmail(getUserData('email'), '{--MEMBER_SUBJ_SEND_DONE--}', $mailText);
+                                                       sendEmail(getUserData('email'), '{--MEMBER_SEND_DONE_SUBJECT--}', $mailText);
                                                } // END - if
 
                                                // Set status to SEND because we completely send it away
@@ -201,7 +199,7 @@ if (SQL_NUMROWS($result_main) > 0) {
                                                        array(bigintval($DATA['id'])), __FILE__, __LINE__);
 
                                                $lastSentId = $DATA['id']; $GLOBALS['pool_cnt'] = '0';
-                                               $cnt2 += $GLOBALS['pool_cnt'];
+                                               $count2 += $GLOBALS['pool_cnt'];
 
                                                // Update mediadata if version is 0.0.4 or higher
                                                if (isExtensionInstalledAndNewer('mediadata', '0.0.4')) {
@@ -214,7 +212,7 @@ if (SQL_NUMROWS($result_main) > 0) {
                                                break;
                                        }
                                        // Do we have send maximum mails?
-                                       elseif (($GLOBALS['pool_cnt'] >= getConfig('max_send')) || ($cnt2 >= getConfig('max_send'))) {
+                                       elseif (($GLOBALS['pool_cnt'] >= getConfig('max_send')) || ($count2 >= getConfig('max_send'))) {
                                                // There are some mails left to send for next round, so we reset the status back to NEW (=still not fully delivered)
                                                $add = '';
                                                if ($GLOBALS['pool_cnt'] <= $DATA['target_send']) $add = ", target_send=target_send-".$GLOBALS['pool_cnt'];
@@ -238,7 +236,7 @@ if (SQL_NUMROWS($result_main) > 0) {
                                                        array(bigintval($DATA['id'])), __FILE__, __LINE__);
                                        } else {
                                                // Is the userid set?
-                                               if ($userid > 0) {
+                                               if (isValidUserId($userid)) {
                                                        // User does not exists, pay points back
                                                        $points = getPaymentPoints($DATA['payment_id']);
                                                        addPointsDirectly('pool_payback', $DATA['sender'], $points);
@@ -248,7 +246,7 @@ if (SQL_NUMROWS($result_main) > 0) {
                                                } // END - if
 
                                                // Count up
-                                               $cnt_back[$DATA['sender']]++;
+                                               $count_back[$DATA['sender']]++;
                                        }
 
                                        // Remove entry from list
@@ -267,7 +265,7 @@ if (SQL_NUMROWS($result_main) > 0) {
                // Walk through all points
                foreach ($pointsBack as $userid => $PB) {
                        // Add points only when we have points left to add and a valid user id
-                       if (($PB > 0) && ($userid > 0)) {
+                       if (($PB > 0) && (isValidUserId($userid))) {
                                // Prepare content
                                $content = array(
                                        'points' => $PB
@@ -285,7 +283,7 @@ if (SQL_NUMROWS($result_main) > 0) {
                                        addPointsToJackpot($PB);
 
                                        // Send mail out to admin
-                                       sendAdminNotification(getMessage('ADMIN_BACK_JACKPOT') . ' (' . $userid . ')', 'back-admin', $content, 'admin');
+                                       sendAdminNotification('{--ADMIN_BACK_JACKPOT--}' . ' (' . $userid . ')', 'back-admin', $content, 'admin');
                                }
                        } // END - if
                } // END - foreach