./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
./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
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ügen der Buchung gessetzt. Bitte laden Sie sich dazu - wenn nicht bereits geschehen - alle Patches bis mindestens Patch 240 unter <strike>Updates prüfen</strike> herunter.");
+ setExtensionUpdateNotes("Behebt ein Versand-Problem mit den Bonus-Mails. Es wurde die Spalte target_send nicht beim Einfügen der Buchung gessetzt.");
break;
case '0.2.1': // SQL queries for v0.2.1
} // 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');
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ürzt (SQL-Fehler wegen zu grossem Schlü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ürzt (SQL-Fehler wegen zu grossem Schlüssel).");
break;
// 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);
}
'ADMIN_CONFIG_POINTS_TITLE' => "Einstellungen fü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ücksetzen",
'ADMIN_VALIDATE_HASH_TITLE' => "2/4: Validierung Iher Logindaten",
// 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...
// 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
* -------------------------------------------------------------------- *
* 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 *
$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
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
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') {
* 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...
// 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
// 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);
} else {
$ret = $data['mail_title'] . ' / {%pipe,translateComma=' . $data['price'] . '%} {?POINTS?}';
}
- }
+ } // END - if
// Free result
SQL_FREERESULT($result);
}
// 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';
// 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
// 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
$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`
}
// Don't run on daily reset
-if (isResetModeEnabled()) {
+if ((isResetModeEnabled()) || (!isHtmlOutputMode())) {
// Skip here
return false;
} elseif (!isExtensionActive('foo')) {
} // END - if
// Don't run on daily reset
-if (isResetModeEnabled()) {
+if ((isResetModeEnabled()) || (!isHtmlOutputMode())) {
// Skip here
return false;
} elseif (!isExtensionActive('bonus')) {
// 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
// "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
//* 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`
} // END - if
// Don't run on daily reset
-if (isResetModeEnabled()) {
+if ((isResetModeEnabled()) || (!isHtmlOutputMode())) {
// Skip here
return false;
} elseif (!isExtensionActive('user')) {
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)) {
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).'!');
// 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);
$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
$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'],
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);
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__);
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
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?
Einer unserer Administratoren hat soeben Ihre Mailbuchung gelöscht. Hier sind nochmals Ihre URL und Betreff Ihrer Mailbuchung:
---------------
-Beworbene URL: $content[url_raw]
+Beworbene URL: $content[url]
---------------
Betreffzeile: $content[subject]
---------------
<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>
+<div align="center">
<form accept-charset="utf-8" actiom="{%url=modules.php?module=admin&what=unlock_emails%}" method="post">
<table border="0" cellspacing="0" cellpadding="0" class="table dashed" width="99%">
<tr>
</tr>
</table>
</form>
+</div>
<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>
</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>
$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>