]> git.mxchange.org Git - mailer.git/commitdiff
The usual asset of bugfixes/improvements:
authorRoland Häder <roland@mxchange.org>
Tue, 21 Dec 2010 22:48:08 +0000 (22:48 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 21 Dec 2010 22:48:08 +0000 (22:48 +0000)
- Variable $bonus renamed in function to make clear it is boolean type
- Counting of sent mails (column mails_sent) added
- No longer needed header comments removed (it is heavily rewritten anyway)
- A lot missing/wrong array elements fixed in templates and PHP scripts
- New wrapper added (used several times in pool-user.php)
- CSS classes fixed in several 'order' templates
- Several other minor improvements/fixes
- TODOs.txt updated

19 files changed:
DOCS/TODOs.txt
inc/extensions/ext-bonus.php
inc/extensions/ext-sql_patches.php
inc/functions.php
inc/language/de.php
inc/modules/admin/what-add_points.php
inc/modules/admin/what-del_email.php
inc/modules/admin/what-email_details.php
inc/mysql-manager.php
inc/pool/pool-
inc/pool/pool-bonus.php
inc/pool/pool-user.php
inc/wrapper-functions.php
templates/de/emails/order-deleted.tpl
templates/de/html/admin/admin_list_unconfirmed_list.tpl
templates/de/html/admin/admin_unlock_emails.tpl
templates/de/html/member/member_order-html_ext.tpl
templates/de/html/member/member_order-zip1.tpl
templates/de/html/member/member_order_page1.tpl

index 6bb20a927bc2a2968da8c9babbc7fefc002398cc..b99f1752a8fa0437e020c5642d2ea59057fc6a30 100644 (file)
@@ -46,7 +46,7 @@
 ./inc/functions.php:1593:                      // @TODO Are these convertions still required?
 ./inc/functions.php:1611:// @TODO Rewrite this function to use readFromFile() and writeToFile()
 ./inc/functions.php:181:// @TODO Rewrite this to an extension 'smtp'
-./inc/functions.php:2269:      // @TODO This is still very static, rewrite it somehow
+./inc/functions.php:2272:      // @TODO This is still very static, rewrite it somehow
 ./inc/gen_sql_patches.php:95:// @TODO Rewrite this to a filter
 ./inc/install-functions.php:57:        // @TODO DEACTIVATED: changeDataInInclude(getCachePath() . 'config-local.php', 'OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestParameter('omode'), 0);
 ./inc/language/de.php:1085:// @TODO Rewrite these two constants
@@ -61,8 +61,8 @@
 ./inc/language/sponsor_de.php:117:// @TODO Rewrite these four constants to one and use sprintf()
 ./inc/libs/admins_functions.php:435:           // @TODO This can be, somehow, rewritten
 ./inc/libs/beg_functions.php:55:               // @TODO Try to rewrite the following unset()
-./inc/libs/bonus_functions.php:199:            // @TODO Move this HTML to a template
-./inc/libs/bonus_functions.php:287:            // @TODO This query isn't right, it will only update if the user was for a longer time away!
+./inc/libs/bonus_functions.php:201:            // @TODO Move this HTML to a template
+./inc/libs/bonus_functions.php:293:            // @TODO This query isn't right, it will only update if the user was for a longer time away!
 ./inc/libs/cache_functions.php:78:             // @TODO This should be rewritten not to load the cache file for just checking if it is there for save removal.
 ./inc/libs/doubler_functions.php:44:// @TODO Lame description
 ./inc/libs/doubler_functions.php:91:                   // @TODO Can't this be moved into EL?
 ./inc/modules/admin/what-config_points.php:111:                        // @TODO Rewrite this to a filter
 ./inc/modules/admin/what-config_rallye_prices.php:195:                 // @TODO Rewrite these two constants
 ./inc/modules/admin/what-config_register.php:75:       // @TODO Move this HTML code into a template
-./inc/modules/admin/what-del_email.php:60:             // @TODO Unused: $price = getPaymentPoints($content['payment_id'], 'price');
 ./inc/modules/admin/what-del_email.php:61:             // @TODO Unused: cat_id, payment_id
 ./inc/modules/admin/what-edit_user.php:18: * @TODO Add support for ext-country                                    *
 ./inc/modules/admin/what-email_stats.php:46:// @TODO Unused at the moment
 ./inc/modules/member/what-unconfirmed.php:206:                         // @TODO This 'userid' cannot be saved because of encapsulated EL code
 ./inc/modules/order.php:74:            // @TODO Unused: 2,4
 ./inc/monthly/monthly_bonus.php:67:    // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1183:  // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1441:                  // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
-./inc/mysql-manager.php:1547:  // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1918:                  // @TODO Rewrite this to a filter
-./inc/mysql-manager.php:1962:// @TODO Fix inconsistency between last_module and getWhat()
+./inc/mysql-manager.php:1195:  // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1453:                  // @TODO Try to rewrite this to $content = SQL_FETCHARRAY()
+./inc/mysql-manager.php:1559:  // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1933:                  // @TODO Rewrite this to a filter
+./inc/mysql-manager.php:1977:// @TODO Fix inconsistency between last_module and getWhat()
 ./inc/mysql-manager.php:368:   // @TODO Try to rewrite this to one or more functions
 ./inc/mysql-manager.php:44:// @TODO Can we cache this?
 ./inc/reset/reset_beg.php:52:// @TODO This should be converted in a daily beg rallye
index c1e40a09aac428e3353cf6a360d4e1600f6d6056..6a948845a34d59b3224ec79c5a18fba8be7edb7d 100644 (file)
@@ -119,7 +119,7 @@ PRIMARY KEY  (`id`)
                                addExtensionSql("UPDATE `{?_MYSQL_PREFIX?}_bonus` SET `target_send`=`mails_sent` WHERE `target_send`=0 AND `mails_sent`>0 AND `receivers` != ''");
 
                                // Update notes (these will be set as task text!)
-                               setExtensionUpdateNotes("Behebt ein Versand-Problem mit den Bonus-Mails. Es wurde die Spalte target_send nicht beim Einf&uuml;gen der Buchung gessetzt. Bitte laden Sie sich dazu - wenn nicht bereits geschehen - alle Patches bis mindestens Patch 240 unter <strike>Updates pr&uuml;fen</strike> herunter.");
+                               setExtensionUpdateNotes("Behebt ein Versand-Problem mit den Bonus-Mails. Es wurde die Spalte target_send nicht beim Einf&uuml;gen der Buchung gessetzt.");
                                break;
 
                        case '0.2.1': // SQL queries for v0.2.1
index bc2a715b92ad9af4bd9f58127b0427388853608f..7d8d591bfa3cff1770ea3364c2689a7c3914ff83 100644 (file)
@@ -41,10 +41,10 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Version number
-setThisExtensionVersion('0.7.3');
+setThisExtensionVersion('0.7.4');
 
 // Version history array (add more with , '0.1.0' and so on)
-setExtensionVersionHistory(array('0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0', '0.6.1', '0.6.2', '0.6.3', '0.6.4', '0.6.4', '0.6.5', '0.6.6', '0.6.7', '0.6.8', '0.6.9', '0.7.0', '0.7.1', '0.7.2', '0.7.3'));
+setExtensionVersionHistory(array('0.0', '0.0.1', '0.0.2', '0.0.3', '0.0.4', '0.0.5', '0.0.6', '0.0.7', '0.0.8', '0.0.9', '0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.1.4', '0.1.5', '0.1.6', '0.1.7', '0.1.8', '0.1.9', '0.2.0', '0.2.1', '0.2.2', '0.2.3', '0.2.4', '0.2.5', '0.2.6', '0.2.7', '0.2.8', '0.2.9', '0.3.0', '0.3.1', '0.3.2', '0.3.3', '0.3.4', '0.3.5', '0.3.6', '0.3.7', '0.3.8', '0.3.9', '0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6', '0.4.7', '0.4.8', '0.4.9', '0.5.0', '0.5.1', '0.5.2', '0.5.3', '0.5.4', '0.5.5', '0.5.6', '0.5.7', '0.5.8', '0.5.9', '0.6.0', '0.6.1', '0.6.2', '0.6.3', '0.6.4', '0.6.4', '0.6.5', '0.6.6', '0.6.7', '0.6.8', '0.6.9', '0.7.0', '0.7.1', '0.7.2', '0.7.3', '0.7.4'));
 
 // Keep this extension always active!
 setExtensionAlwaysActive('Y');
@@ -751,6 +751,13 @@ INDEX (`ip`)
                                addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_filters` CHANGE `filter_name` `filter_name` VARCHAR(50) NOT NULL DEFAULT ''");
                                addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_filters` CHANGE `filter_function` `filter_function` VARCHAR(100) NOT NULL DEFAULT ''");
 
+                               // Update notes (these will be set as task text!)
+                               setExtensionUpdateNotes("Spalten in Filtertabelle gek&uuml;rzt (SQL-Fehler wegen zu grossem Schl&uuml;ssel).");
+                               break;
+
+                       case '0.7.4': // SQL queries for v0.7.4
+                               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_pool` ADD `mails_sent` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0");
+
                                // Update notes (these will be set as task text!)
                                setExtensionUpdateNotes("Spalten in Filtertabelle gek&uuml;rzt (SQL-Fehler wegen zu grossem Schl&uuml;ssel).");
                                break;
index aa59a596b26b71640170e537a8431c9f67ba4d85..f045a8c5a92f0230d3d6ec4f45f907fb77a7d39c 100644 (file)
@@ -1685,13 +1685,16 @@ function changeDataInFile ($FQFN, $comment, $prefix, $suffix, $DATA, $seek=0) {
        // An error was detected!
        return false;
 }
+
 // Send notification to admin
-function sendAdminNotification ($subject, $templateName, $content=array(), $userid = '0') {
+function sendAdminNotification ($subject, $templateName, $content = array(), $userid = '0') {
        if ((isExtensionInstalledAndNewer('admins', '0.4.1')) && (function_exists('sendAdminsEmails'))) {
                // Send new way
+               /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'admins=Y,subject=' . $subject . ',templateName=' . $templateName);
                sendAdminsEmails($subject, $templateName, $content, $userid);
        } else {
-               // Send out out-dated way
+               // Send out-dated way
+               /* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'admins=N,subject=' . $subject . ',templateName=' . $templateName);
                $message = loadEmailTemplate($templateName, $content, $userid);
                sendAdminEmails($subject, $message);
        }
index 69a19905a73ef41c1122327a678857d3f9e78e53..95be0696ab878a4e7d4e32ddfb9e11aa08c1ef61 100644 (file)
@@ -985,7 +985,7 @@ addMessages(array(
        'ADMIN_CONFIG_POINTS_TITLE' => "Einstellungen f&uuml;r {?POINTS?}",
        'APP_DIE_TITLE' => "Bug im Script erkannt!",
        'ADMIN_CONTACT_LINK_TITLE' => "Kontakt zum Administrator",
-       'ADMIN_MAIL_NOTHING_DELETED' => "Die Mail mit der Id <span class=\"data\">%s</span weisst keine Mitglieder auf.",
+       'ADMIN_MAIL_NOTHING_DELETED' => "Die Mail mit der Id <span class=\"data\">%s</span> weisst keine Mitglieder auf.",
 
        'ADMIN_SEND_RESET_LINK_TITLE' => "1/4: Administratorkennwort zur&uuml;cksetzen",
        'ADMIN_VALIDATE_HASH_TITLE' => "2/4: Validierung Iher Logindaten",
index e1b3d1a5184c4966f806f17df3e2d03562ec69a8..93a1923a90de2050e126e932a05666810e3d35e4 100644 (file)
@@ -55,6 +55,9 @@ if (getRequestParameter('userid') == 'all') {
 
                // Process all entries
                while ($row = SQL_FETCHARRAY($result_main)) {
+                       // Merge $row into $content
+                       $content = merge_array($content, $row);
+
                        // Remove depth to prevent booking errors. This is a bad coding
                        // practice, thats also why we need to write this project from
                        // scratch...
@@ -66,7 +69,8 @@ if (getRequestParameter('userid') == 'all') {
                        // Prepare content
                        $content = array(
                                'reason' => SQL_ESCAPE(postRequestParameter('reason')),
-                               'points' => bigintval(postRequestParameter('points'))
+                               'points' => bigintval(postRequestParameter('points')),
+                               'userid' => $row['userid']
                        );
 
                        // Load email template and send email away
index 5ebc2b96db36ded4bdf84bd07ac9bd467105d73b..f90e1abd31f634a93e06021037b643ea88875d30 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Bonus- / Normal-Mail loeschen                    *
  * -------------------------------------------------------------------- *
- *                                                                      *
- *  Module by Robert Niedziela, Megacomputing                           *
- *          web : http://mc-p.mcserver.de                               *
- *                                                                      *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
  * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
@@ -57,7 +57,7 @@ if (isGetRequestParameterSet('mid')) {
                $content = SQL_FETCHARRAY($result);
 
                // Get points we shall pay back per mail
-               // @TODO Unused: $price = getPaymentPoints($content['payment_id'], 'price');
+               $content['price'] = getPaymentPoints($content['payment_id'], 'price');
                // @TODO Unused: cat_id, payment_id
 
                // Prepare data for the template
@@ -67,8 +67,8 @@ if (isGetRequestParameterSet('mid')) {
                loadTemplate('admin_delete_email_normal', false, $content);
 
                // Load email template and send the email away
-               $message_user = loadEmailTemplate('order-deleted', $content, $sender);
-               sendEmail($sender, '{--MEMBER_ORDER_DELETED--}', $message_user);
+               $message_user = loadEmailTemplate('order-deleted', $content, $content['sender']);
+               sendEmail($content['sender'], '{--MEMBER_ORDER_DELETED--}', $message_user);
 
                // Fetch right stats_id from pool
                $result_pool = SQL_QUERY_ESC("SELECT
@@ -94,23 +94,23 @@ LIMIT 1",
                        reduceRecipientReceivedMails('stats_id', getRequestParameter('mid'), $links);
 
                        // Calc total points and pay them back
-                       $totalPoints = $links * $price;
+                       $totalPoints = $links * $content['price'];
 
                        // Shall we pay the points back to the user?
                        if ($totalPoints == 0) {
                                // No points repayed!
                                loadTemplate('admin_settings_saved', false, '{--ADMIN_NO_POINTS_REPAYED--}');
                        } elseif (getConfig('repay_deleted_mails') != 'SHRED') {
-                               //* DEBUG: */ debugOutput($stats_id.':'.$totalPoints.'/'.$links.'/'.$price);
+                               //* DEBUG: */ debugOutput($stats_id.':'.$totalPoints.'/'.$links.'/'.$content['price']);
                                // Shall we payback to user or jackpot?
                                if (getConfig('repay_deleted_mails') == 'JACKPOT') {
                                        // Set jackpot
-                                       $sender = '0';
+                                       $content['sender'] = '0';
                                } // END - if
 
                                // Pay back points
-                               //* DEBUG: */ debugOutput('PAYBACK:'.$sender);
-                               addPointsDirectly('mail_deleted', $sender, $totalPoints);
+                               //* DEBUG: */ debugOutput('PAYBACK:'.$content['sender']);
+                               addPointsDirectly('mail_deleted', $content['sender'], $totalPoints);
 
                                // Output message
                                if (getConfig('repay_deleted_mails') == 'REPAY') {
index a35844f01ca28903a527db5e43ddadf31e238588..52775b3073764a97a286d79923077020d76f0973 100644 (file)
  * along with this program; if not, write to the Free Software          *
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
  * MA  02110-1301  USA                                                  *
- * -------------------------------------------------------------------- *
- *           Moded What-email_details.php   / also Editet !             *
- * Auf langsammen Servern (wie mein z.B Dauert das Laden)               *
- * enorm hoch zu lang. Jetzt werden nur auftraege aufgelistet die       *
- * NEU sind ( DB NEW) oder ADMIN freischalten muss (DB ADMIN )          *
- * oder noch als TEMP gespecihert sind                                  *
- * der rest der schon als SEND sich melden darf wird per                *
- * what-email_archiv .php aufgerufen                                    *
- * beste gruesse Robert Niedziela / www.personal-webserver.de           *
- * oder auch www.mc-p.org                                               *
  ************************************************************************/
 
 // Some security stuff...
@@ -55,7 +45,7 @@ addYouAreHereLink('admin', __FILE__);
 
 // Normal mails ordered by your members
 $sql = "SELECT
-       `id`, `sender`, `subject`, `text`, `receivers`, `payment_id`, `data_type`, `timestamp`, `url`, `target_send`, `cat_id`
+       `id`, `sender`, `subject`, `text`, `receivers`, `payment_id`, `data_type`, `timestamp`, `url`, `target_send`, `mails_sent`, `cat_id`
 FROM
        `{?_MYSQL_PREFIX?}_pool`
 WHERE
index bf1a9baec9951c6dd7b5528255c0501bcaa1cf7e..981d6f65a75a91f1f0bb1e6cda071d0ea0014a5b 100644 (file)
@@ -809,6 +809,8 @@ function getPaymentTitlePrice ($pid, $full=false) {
        // Load payment data
        $result = SQL_QUERY_ESC("SELECT `mail_title`, `price` FROM `{?_MYSQL_PREFIX?}_payments` WHERE `id`=%s LIMIT 1",
                array(bigintval($pid)), __FUNCTION__, __LINE__);
+
+       // Do we have an entry?
        if (SQL_NUMROWS($result) == 1) {
                // Payment type found... :-)
                $data = SQL_FETCHARRAY($result);
@@ -819,7 +821,7 @@ function getPaymentTitlePrice ($pid, $full=false) {
                } else {
                        $ret = $data['mail_title'] . ' / {%pipe,translateComma=' . $data['price'] . '%} {?POINTS?}';
                }
-       }
+       } // END - if
 
        // Free result
        SQL_FREERESULT($result);
@@ -851,7 +853,7 @@ function getPaymentPoints ($pid, $lookFor = 'price') {
 }
 
 // Remove a receiver's id from $receivers and add a link for him to confirm
-function removeReceiver (&$receivers, $key, $userid, $pool_id, $stats_id = '', $bonus = false) {
+function removeReceiver (&$receivers, $key, $userid, $pool_id, $stats_id = 0, $isBonusMail = false) {
        // Default is not removed
        $ret = 'failed';
 
@@ -862,9 +864,12 @@ function removeReceiver (&$receivers, $key, $userid, $pool_id, $stats_id = '', $
 
                // Is there already a line for this user available?
                if ($stats_id > 0) {
+                       // Default is 'normal' mail
+                       $type = 'NORMAL';
+                       $rowName = 'stats_id';
+
                        // Only when we got a real stats id continue searching for the entry
-                       $type = 'NORMAL'; $rowName = 'stats_id';
-                       if ($bonus) {
+                       if ($isBonusMail === true) {
                                $type = 'BONUS';
                                $rowName = 'bonus_id';
                        } // END - if
@@ -878,6 +883,13 @@ function removeReceiver (&$receivers, $key, $userid, $pool_id, $stats_id = '', $
                                // So we add one!
                                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_links` (`%s`, `userid`, `link_type`) VALUES ('%s','%s','%s')",
                                        array($rowName, $stats_id, bigintval($userid), $type), __FUNCTION__, __LINE__);
+
+                               // Update 'mails_sent' if sql_patches is updated
+                               if (isExtensionInstalledAndNewer('sql_patches', '0.7.4')) {
+                                       // Update the pool
+                                       SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `mails_sent`=`mails_sent`+1 WHERE `id`=%s LIMIT 1",
+                                               array(bigintval($pool_id)), __FUNCTION__, __LINE__);
+                               } // END - if
                                $ret = 'done';
                        } else {
                                // Already found
@@ -1719,7 +1731,10 @@ function addBonusMailToQueue ($subject, $text, $receiverList, $points, $seconds,
                $HTML = 'N';
 
                // HTML mode?
-               if ($mode == 'html') $HTML = 'Y';
+               if ($mode == 'html') {
+                       // Yes, please
+                       $HTML = 'Y';
+               } // END - if
 
                // Add HTML mail
                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_bonus`
index a881964a658665ed8d647a49220d158e1b5dd919..741abdd1bbe44bfe6e11976041507eeb62319185 100644 (file)
@@ -41,7 +41,7 @@ if (!defined('__SECURITY')) {
 }
 
 // Don't run on daily reset
-if (isResetModeEnabled()) {
+if ((isResetModeEnabled()) || (!isHtmlOutputMode())) {
        // Skip here
        return false;
 } elseif (!isExtensionActive('foo')) {
index dc07cfdb2a28733f79c636b9252ffeab54a30287..5e9c743b8a7a32cbd421fe00f8c1ee5356e9a5d1 100644 (file)
@@ -41,7 +41,7 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Don't run on daily reset
-if (isResetModeEnabled()) {
+if ((isResetModeEnabled()) || (!isHtmlOutputMode())) {
        // Skip here
        return false;
 } elseif (!isExtensionActive('bonus')) {
@@ -51,7 +51,7 @@ if (isResetModeEnabled()) {
 
 // Need this here
 // Only send bonus mail when bonus extension is active and maximum send-mails is not reached
-if ($GLOBALS['pool_cnt'] < getConfig('max_send')) {
+if ($GLOBALS['pool_cnt'] < getMaxSend()) {
        // Do we need to send out bonus mails?
        if (isExtensionActive('html_mail')) {
                //                                 0        1        2          3          4        5          6            7         8        9            10           11
@@ -72,54 +72,63 @@ if ($GLOBALS['pool_cnt'] < getConfig('max_send')) {
                        // "Explode" all receivers into an array
                        if (isInString(';', $DATA['receivers'])) {
                                // There's more than one receiver in the list...
-                               $receiverS = explode(';', $DATA['receivers']);
+                               $receivers = explode(';', $DATA['receivers']);
                        } elseif (!empty($DATA['points'])) {
                                // Only one user left
-                               $receiverS = array($DATA['receivers']);
+                               $receivers = array($DATA['receivers']);
                        } else {
                                // No users left
-                               $receiverS = array(0);
+                               $receivers = array(0);
                        }
-                       $dummy = $receiverS;
+                       $dummy = $receivers;
 
                        // Now, if we are good little boys and girls Santa Claus left us some user-ids.
                        // We can now send mails to them...
-                       foreach ($receiverS as $key => $userid) {
+                       foreach ($receivers as $key => $userid) {
                                // Load personal data
                                if (fetchUserData($userid)) {
                                        // The final receiver does exists so we can continue...
                                        //* DEBUG: */ debugOutput('OK!/L:'.__LINE__);
 
-                                       // Mark this user as "spammed" ;-) And place a line for him...
-                                       if (removeReceiver($dummy, $key, $userid, $DATA['id'], $DATA['id'], true) == 'done') {
-                                               // Prepare the mail
-                                               $mailText = loadEmailTemplate('bonus-mail', $DATA, $userid);
-
-                                               // Send mail away
-                                               if (isset($DATA['html_msg'])) {
-                                                       // Send HTML?
-                                                       sendEmail(getUserData('email'), $DATA['subject'], $mailText, $DATA['html_msg']);
-                                               } else {
-                                                       // No HTML mail!
-                                                       sendEmail(getUserData('email'), $DATA['subject'], $mailText);
-                                               }
-
-                                               // Count one up and remove entry from dummy array
-                                               $GLOBALS['pool_cnt']++; unset($dummy[$key]);
-
-                                               if (isExtensionInstalledAndNewer('user', '0.1.4')) {
-                                                       // Update mails received for receiver
-                                                       SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `emails_received`=`emails_received`+1 WHERE `userid`=%s LIMIT 1",
-                                                       array(bigintval($userid)), __FILE__, __LINE__);
-                                               } // END - if
-
-                                               // Do we have send maximum mails?
-                                               if (($GLOBALS['pool_cnt'] >= getConfig('max_send')) || (countSelection($dummy) == 0)) {
-                                                       // Yes, we have
-                                                       //* DEBUG: */ debugOutput('*EXIT/L:'.__LINE__);
+                                       // Remove receiver from list
+                                       $status = removeReceiver($dummy, $key, $userid, $DATA['id'], $DATA['id'], true);
+
+                                       // Did it work?
+                                       switch ($status) {
+                                               case 'done': // Done!
+                                                       // Prepare the mail
+                                                       $mailText = loadEmailTemplate('bonus-mail', $DATA, $userid);
+
+                                                       // Send mail away
+                                                       if (isset($DATA['html_msg'])) {
+                                                               // Send HTML?
+                                                               sendEmail(getUserData('email'), $DATA['subject'], $mailText, $DATA['html_msg']);
+                                                       } else {
+                                                               // No HTML mail!
+                                                               sendEmail(getUserData('email'), $DATA['subject'], $mailText);
+                                                       }
+
+                                                       // Count one up and remove entry from dummy array
+                                                       $GLOBALS['pool_cnt']++; unset($dummy[$key]);
+
+                                                       if (isExtensionInstalledAndNewer('user', '0.1.4')) {
+                                                               // Update mails received for receiver
+                                                               SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `emails_received`=`emails_received`+1 WHERE `userid`=%s LIMIT 1",
+                                                               array(bigintval($userid)), __FILE__, __LINE__);
+                                                       } // END - if
+
+                                                       // Do we have send maximum mails?
+                                                       if (($GLOBALS['pool_cnt'] >= getMaxSend()) || (countSelection($dummy) == 0)) {
+                                                               // Yes, we have
+                                                               //* DEBUG: */ debugOutput('*EXIT/L:'.__LINE__);
+                                                               break;
+                                                       } // END - if
                                                        break;
-                                               } // END - if
-                                       } // END - if
+
+                                               default: // Unknown return type
+                                                       logDebugMessage(__FILE__, __LINE__, 'Unknown status ' . $status . ' detected. pool_id=' . $DATA['id'] . ',sender=' . $DATA['sender'] . ',stats_id=' . $stats_id);
+                                                       break;
+                                       } // END - switch
                                } // END - if
                        } // END - foreach
 
@@ -154,7 +163,7 @@ LIMIT 1",
                                        //* DEBUG: */ debugOutput('*MEDIA/L:'.__LINE__.'*');
                                        updateMediadataEntry(array('total_orders', 'bonus_orders'), 'add', 1);
                                } // END - if
-                       } elseif ($GLOBALS['pool_cnt'] >= getConfig('max_send')) {
+                       } elseif ($GLOBALS['pool_cnt'] >= getMaxSend()) {
                                // Update bonus pool
                                SQL_QUERY_ESC("UPDATE
        `{?_MYSQL_PREFIX?}_bonus`
index 5293a5b28a1ae8b0fe4e44a8d255acbe951b2164..c2bcfda3f85eae8af779daebd452b75c79176ecf 100644 (file)
@@ -41,7 +41,7 @@ if (!defined('__SECURITY')) {
 } // END - if
 
 // Don't run on daily reset
-if (isResetModeEnabled()) {
+if ((isResetModeEnabled()) || (!isHtmlOutputMode())) {
        // Skip here
        return false;
 } elseif (!isExtensionActive('user')) {
@@ -49,18 +49,33 @@ if (isResetModeEnabled()) {
        return false;
 }
 
-// Need this here
+// No HTML is default
+$HTML = '';
+
 // Check for freed mail orders to send out
 if (isExtensionActive('html_mail')) {
-       //                                0     1        2      3       4          5            6      7        8          9       10
-       $result_main = SQL_QUERY("SELECT id, sender, subject, text, receivers, payment_id, timestamp, url, target_send, cat_id, html_msg FROM `{?_MYSQL_PREFIX?}_pool` WHERE `data_type`='NEW' ORDER BY timestamp DESC", __FILE__, __LINE__);
-} else {
-       //                                0     1        2      3       4          5            6      7        8          9    10
-       $result_main = SQL_QUERY("SELECT id, sender, subject, text, receivers, payment_id, timestamp, url, target_send, cat_id, id FROM `{?_MYSQL_PREFIX?}_pool` WHERE `data_type`='NEW' ORDER BY timestamp DESC", __FILE__, __LINE__);
-}
+       // With HTML mails
+       $HTML = ', `html_msg`';
+} // END - if
+
+// Main query
+$result_main = SQL_QUERY("SELECT
+       `id`, `sender` AS `sender_userid`, `subject`, `text`, `receivers`,
+       `payment_id`, `timestamp`, `url`, `target_send`, `cat_id`
+       ".$HTML."
+FROM
+       `{?_MYSQL_PREFIX?}_pool`
+WHERE
+       `data_type`='NEW'
+ORDER BY
+       `timestamp` DESC", __FILE__, __LINE__);
 
 // Reset variables
-$count2 = '0'; $lastSentId = '0'; $count_back = array(0); $pointsBack = array(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)) {
@@ -69,44 +84,44 @@ if (!SQL_HASZERONUMS($result_main)) {
                        array($DATA['id']), __FILE__, __LINE__);
 
                // Check fetched data for HTML
-               $HTML = 'N';
-               if (isset($DATA['html_msg'])) $HTML = $DATA['html_msg'];
+               $isHtml = 'N';
+               if (isset($DATA['html_msg'])) $isHtml = $DATA['html_msg'];
 
                // Entry updated?
                if (!SQL_HASZEROAFFECTED()) {
                        // "Explode" all receivers into an array
                        if (isInString(';', $DATA['receivers'])) {
                                // There's more than one receiver in the list...
-                               $receiverS = explode(';', $DATA['receivers']);
+                               $receivers = explode(';', $DATA['receivers']);
                        } elseif (!empty($DATA['receivers'])) {
                                // Only one user left
-                               $receiverS = array($DATA['receivers']);
+                               $receivers = array($DATA['receivers']);
                        } else {
                                // No users left
-                               $receiverS = array(0);
+                               $receivers = array(0);
                        }
-                       $dummy = $receiverS;
+                       $dummy = $receivers;
 
                        // Now, if we are good little boys and girls Santa Claus left us some user-ids.
                        // We can now send mails to them...
-                       foreach ($receiverS as $key => $userid) {
+                       foreach ($receivers as $key => $userid) {
                                // Lookup user id
                                //* DEBUG: */ debugOutput('*L:'.__LINE__.'/'.SQL_NUMROWS($result_user).'*');
                                if (fetchUserData($userid)) {
                                        // Do we have a stats entry?
                                        $result_stats = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `pool_id`=%s AND `userid`=%s AND timestamp_ordered='%s' LIMIT 1",
-                                               array($DATA['id'], $DATA['sender'], $DATA['timestamp']), __FILE__, __LINE__);
+                                               array($DATA['id'], $DATA['sender_userid'], $DATA['timestamp']), __FILE__, __LINE__);
 
                                        // If there's no stats entry add it!
                                        //* DEBUG: */ debugOutput('!L:'.__LINE__.'/'.SQL_NUMROWS($result_stats).'!');
                                        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__);
+                                                       array(bigintval($DATA['id']), bigintval($DATA['sender_userid']), bigintval($DATA['cat_id']), bigintval($DATA['payment_id']), $DATA['subject'], $DATA['url'], $DATA['target_send'], bigintval($DATA['timestamp'])), __FILE__, __LINE__);
 
                                                // Receive it's id for the links table
                                                $result_stats = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `pool_id`=%s AND `userid`=%s AND timestamp_ordered='%s' LIMIT 1",
-                                                       array(bigintval($DATA['id']), bigintval($DATA['sender']), bigintval($DATA['timestamp'])), __FILE__, __LINE__);
+                                                       array(bigintval($DATA['id']), bigintval($DATA['sender_userid']), bigintval($DATA['timestamp'])), __FILE__, __LINE__);
                                        } // END - if
 
                                        //* DEBUG: */ debugOutput('!L:'.__LINE__.'/'.SQL_NUMROWS($result_stats).'!');
@@ -114,9 +129,11 @@ if (!SQL_HASZERONUMS($result_main)) {
                                                // We got one!
                                                list($stats_id) = SQL_FETCHROW($result_stats);
 
-                                               // Mark this user as "spammed" ;-) And place a line for him...
-                                               //* DEBUG: */ debugOutput('?L:'.__LINE__.'/'.$dummy.'/'.$key.'/'.$userid.'('.['sender'].')/'.$DATA['id'].'/'.$stats_id.'?');
-                                               switch (removeReceiver($dummy, $key, bigintval($userid), bigintval($DATA['id']), bigintval($stats_id))) {
+                                               // Remove receiver from list
+                                               $status = removeReceiver($dummy, $key, bigintval($userid), bigintval($DATA['id']), bigintval($stats_id));
+
+                                               //* DEBUG: */ debugOutput('?L:'.__LINE__.'/'.$dummy.'/'.$key.'/'.$userid.'('.['sender_userid'].')/'.$DATA['id'].'/'.$stats_id.'?');
+                                               switch ($status) {
                                                        case 'done':
                                                                // Prepare the mail
                                                                $DATA['stats_id'] = bigintval($stats_id);
@@ -129,11 +146,11 @@ if (!SQL_HASZERONUMS($result_main)) {
                                                                $mailText = loadEmailTemplate('normal-mail', $DATA, bigintval($userid));
 
                                                                // Send mail away
-                                                               sendEmail(getUserData('email'), $DATA['subject'], $mailText, $HTML);
+                                                               sendEmail(getUserData('email'), $DATA['subject'], $mailText, $isHtml);
 
                                                                // Count sent mails...
-                                                               SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET emails_sent=emails_sent+1 WHERE `userid`=%s LIMIT 1",
-                                                                       array(bigintval($DATA['sender'])), __FILE__, __LINE__);
+                                                               SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `emails_sent`=`emails_sent`+1 WHERE `userid`=%s LIMIT 1",
+                                                                       array(bigintval($DATA['sender_userid'])), __FILE__, __LINE__);
 
                                                                if (isExtensionInstalledAndNewer('user', '0.1.4')) {
                                                                        // Update mails received for receiver
@@ -158,15 +175,19 @@ if (!SQL_HASZERONUMS($result_main)) {
                                                                $GLOBALS['pool_cnt']++;
                                                                //* DEBUG: */ debugOutput('*EXIT/L:'.__LINE__.'/'.$GLOBALS['pool_cnt']);
                                                                break;
-                                               }
-                                       }
+
+                                                       default: // Unknown return type
+                                                               logDebugMessage(__FILE__, __LINE__, 'Unknown status ' . $status . ' detected. pool_id=' . $DATA['id'] . ',sender=' . $DATA['sender_userid'] . ',stats_id=' . $stats_id);
+                                                               break;
+                                               } // END - switch
+                                       } // END - if
 
                                        // Do we have reached the maximum to send mails? || (getConfig('max_send') >= $GLOBALS['pool_cnt'])
                                        //* DEBUG: */ debugOutput('*L:'.__LINE__.'/'.$GLOBALS['pool_cnt'].'>='.$DATA['target_send'].'/'.getConfig('max_send').'>='.$GLOBALS['pool_cnt'].'/'.$lastSentId.'!='.$DATA['id'].'*');
                                        if ((($GLOBALS['pool_cnt'] >= $DATA['target_send'])) && ($lastSentId != $DATA['id'])) {
                                                // Prepare content
                                                $content = array(
-                                                       'sender_userid' => $DATA['sender'],
+                                                       'sender_userid' => $DATA['sender_userid'],
                                                        'cat_id'        => $DATA['cat_id'],
                                                        'text'          => $DATA['text'],
                                                        'url'           => $DATA['url'],
@@ -177,9 +198,9 @@ if (!SQL_HASZERONUMS($result_main)) {
                                                sendAdminNotification('{--ADMIN_SEND_DONE_SUBJECT--}', 'done-admin', $content, $userid);
 
                                                // Get sender's data
-                                               if (fetchUserData($DATA['sender'])) {
+                                               if (fetchUserData($DATA['sender_userid'])) {
                                                        // Load email template
-                                                       $mailText = loadEmailTemplate('done-member', $content, $DATA['sender']);
+                                                       $mailText = loadEmailTemplate('done-member', $content, $DATA['sender_userid']);
 
                                                        // Send it also waway
                                                        sendEmail(getUserData('email'), '{--MEMBER_SEND_DONE_SUBJECT--}', $mailText);
@@ -225,7 +246,7 @@ if (!SQL_HASZERONUMS($result_main)) {
                                        SQL_FREERESULT($result_stats);
                                } else {
                                        // User does not exists so we have add the sender's points back to sender's account
-                                       if (($receiverS['id'] == '0') || (empty($receiverS['id']))) {
+                                       if (($receivers['id'] == '0') || (empty($receivers['id']))) {
                                                // List was empty
                                                SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `data_type`='SEND' WHERE `id`=%s LIMIT 1",
                                                        array(bigintval($DATA['id'])), __FILE__, __LINE__);
@@ -234,14 +255,14 @@ if (!SQL_HASZERONUMS($result_main)) {
                                                if (isValidUserId($userid)) {
                                                        // User does not exists, pay points back
                                                        $points = getPaymentPoints($DATA['payment_id']);
-                                                       addPointsDirectly('pool_payback', $DATA['sender'], $points);
+                                                       addPointsDirectly('pool_payback', $DATA['sender_userid'], $points);
 
                                                        // Add points together and remove user
-                                                       $pointsBack[$DATA['sender']] += $points;
+                                                       $pointsBack[$DATA['sender_userid']] += $points;
                                                } // END - if
 
                                                // Count up
-                                               $count_back[$DATA['sender']]++;
+                                               $count_back[$DATA['sender_userid']]++;
                                        }
 
                                        // Remove entry from list
index 4a6e0e0dc9f01ea38ffd6727128eff575e8c1318..80a4236061b0257e1eb83ee3eda39b7fa487eb0d 100644 (file)
@@ -2009,6 +2009,18 @@ function getLastMonth () {
        return $GLOBALS[__FUNCTION__];
 }
 
+// "Getter" for max_send
+function getMaxSend () {
+       // Do we have cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getConfig('max_send');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS[__FUNCTION__];
+}
+
 // "Getter" for __DB_NAME
 function getDbName () {
        // Do we have cache?
index dde7ca66fd74877203166e2aba69f561d81002f8..9a0b6d332e3fca17a63f2fb2bc7bd2d2f0de616b 100644 (file)
@@ -3,7 +3,7 @@ Hallo {%user,gender,translateGender=$userid%} {%user,surname=$userid%} {%user,fa
 Einer unserer Administratoren hat soeben Ihre Mailbuchung gel&ouml;scht. Hier sind nochmals Ihre URL und Betreff Ihrer Mailbuchung:
 
 ---------------
-Beworbene URL: $content[url_raw]
+Beworbene URL: $content[url]
 ---------------
 Betreffzeile: $content[subject]
 ---------------
index d4daba540e1e915321557a84dadffee4aed33b89..7b11e7c3daa1c3fd822826e6d73f6566c91a3b2d 100644 (file)
@@ -2,10 +2,10 @@
 <table border="0" cellspacing="0" cellpadding="0" class="table dashed">
 <!-- @TODO Shouldn't we add a title here? //-->
 <tr>
-       <td width="10%" align="center" class="header_column bottom top right" height="26"><strong>{--ID_SELECT--}</strong></td>
-       <td width="10%" align="center" class="header_column bottom top right"><strong>{--MAILID_LINK--}</strong></td>
-       <td width="45%" align="center" class="header_column bottom top right"><strong>{--SURNAME_FAMILY--}</strong></td>
-       <td width="35%" align="center" class="header_column bottom top"><strong>{--ACCOUNT_STATUS--}</strong></td>
+       <td width="20%" align="center" class="header_column bottom top right" height="26"><strong>{--ID_SELECT--}</strong></td>
+       <td width="20%" align="center" class="header_column bottom top right"><strong>{--MAILID_LINK--}</strong></td>
+       <td width="40%" align="center" class="header_column bottom top right"><strong>{--SURNAME_FAMILY--}</strong></td>
+       <td width="20%" align="center" class="header_column bottom top"><strong>{--ACCOUNT_STATUS--}</strong></td>
 </tr>
 $content
 </table>
index 418f469d5a453ccdd1beea0153d569208dab174f..7b1bbec8e27f3d8ff3c51a256131d634d71389e7 100644 (file)
@@ -1,3 +1,4 @@
+<div align="center">
 <form accept-charset="utf-8" actiom="{%url=modules.php?module=admin&amp;what=unlock_emails%}" method="post">
 <table border="0" cellspacing="0" cellpadding="0" class="table dashed" width="99%">
        <tr>
@@ -31,3 +32,4 @@
        </tr>
 </table>
 </form>
+</div>
index e875d96afebe985af20946b8ce09fd7c796f43c2..7691111d41c5cab422351591f24183dc3a271d1a 100644 (file)
@@ -1,5 +1,5 @@
 <tr>
-       <td class="top bottom" colspan="2" align="center">
+       <td class="bottom" colspan="2" align="center">
                <strong>{--MEMBER_HTML_VALID_TAGS--}:</strong><br />
                $content <input type="hidden" name="html" value="Y" />
        </td>
index b29023c22435429eae1cf0c5cf24940997acb9cc..677a17026c04a30a83753464470feede06a56703 100644 (file)
@@ -25,8 +25,8 @@
        </td>
 </tr>
 <tr>
-       <td align="right">{--MEMBER_ENTER_ZIP_CODE--}:</td>
-       <td>
+       <td class="bottom" align="right">{--MEMBER_ENTER_ZIP_CODE--}:</td>
+       <td class="bottom">
                <input type="text" class="form_field" name="zip" size="5" maxlength="6" value="$content[zip]" />
        </td>
 </tr>
index bfd76d3d1780873d371185dc2729b0384ce04d91..961cfe5b90b0187f47d5baf7b7061342caa07f62 100644 (file)
@@ -4,7 +4,7 @@
        $content[zip_content]
        $content[html_extension]
        <tr>
-               <td colspan="2" align="center" class="table_footer top">
+               <td colspan="2" align="center" class="table_footer">
                        <input type="reset" class="form_reset" value="{--CLEAR_FORM--}" />
                        <input type="submit" name="data" class="form_submit" value="{--ORDER_PAGE_2--}" />
                </td>