X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-del_email.php;h=d87a5109640e64b96bf023bcb36e4c02cf054ea2;hb=eb301334eb0960dd060cc0d59e6021260a41f835;hp=0307be89ea1bd30c7ac321a3a772616aefa90a9d;hpb=971a60aaee17e6fc376b433f3f5763c85a512110;p=mailer.git
diff --git a/inc/modules/admin/what-del_email.php b/inc/modules/admin/what-del_email.php
index 0307be89ea..d87a510964 100644
--- a/inc/modules/admin/what-del_email.php
+++ b/inc/modules/admin/what-del_email.php
@@ -15,7 +15,7 @@
* web : http://mc-p.mcserver.de *
* *
* -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder *
+ * Copyright (c) 2003 - 2009 by Roland Haeder *
* For more information visit: http://www.mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -35,21 +35,20 @@
************************************************************************/
// Some security stuff...
-if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
- require($INC);
+if ((!defined('__SECURITY')) || (!isAdmin())) {
+ die();
}
// Add description as navigation point
-ADD_DESCR('admin', __FILE__);
+addMenuDescription('admin', __FILE__);
// Init counter for deleted mails
$cnt = 0;
-if (REQUEST_ISSET_GET('mid')) {
+if (isGetRequestElementSet('mid')) {
// Load email data
- $result = SQL_QUERY_ESC("SELECT `id`, `sender`, `subject`, `url`, `timestamp`, `payment_id` FROM `{!_MYSQL_PREFIX!}_pool` WHERE `id`=%s LIMIT 1",
- array(bigintval(REQUEST_GET('mid'))), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `id`, `sender`, `subject`, `url`, `timestamp`, `payment_id` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s LIMIT 1",
+ array(bigintval(getRequestElement('mid'))), __FILE__, __LINE__);
// Delete mail only once
if (SQL_NUMROWS($result) == 1) {
@@ -61,51 +60,51 @@ if (REQUEST_ISSET_GET('mid')) {
$price = getPaymentPoints($payId, 'price');
// Prepare data for the template
- define('__ID' , $id);
- define('__SENDER' , generateUserProfileLink($sender));
- define('__SUBJECT', $subject);
- define('__URL' , DEREFERER($url));
- define('__ORDERED', generateDateTime($timestamp, '0'));
+ $content['id'] = $id;
+ $content['sender'] = generateUserProfileLink($sender);
+ $content['subject'] = $subject;
+ $content['url'] = generateDerefererUrl($url);
+ $content['ordered'] = generateDateTime($timestamp, '0');
// Load template
- LOAD_TEMPLATE("admin_del_email_normal");
+ loadTemplate('admin_del_email_normal', false, $content);
// Transfer data to data array
$DATA = array('url' => $url, 'subject' => $subject);
// Load email template and send the email away
- $message_user = LOAD_EMAIL_TEMPLATE('order-deleted', array(), $sender);
+ $message_user = loadEmailTemplate('order-deleted', array(), $sender);
sendEmail($sender, getMessage('MEMBER_ORDER_DELETED'), $message_user);
// Fetch right stats_id from pool
$result_pool = SQL_QUERY_ESC("SELECT
s.id
FROM
- `{!_MYSQL_PREFIX!}_user_stats` AS s
+ `{?_MYSQL_PREFIX?}_user_stats` AS s
LEFT JOIN
- `{!_MYSQL_PREFIX!}_pool` AS p
+ `{?_MYSQL_PREFIX?}_pool` AS p
ON
s.pool_id=p.id
WHERE
s.pool_id=%s
LIMIT 1",
- array(bigintval(REQUEST_GET('mid'))), __FILE__, __LINE__);
+ array(bigintval(getRequestElement('mid'))), __FILE__, __LINE__);
if (SQL_NUMROWS($result_pool) == 1) {
// Fetch stats id
list($stats_id) = SQL_FETCHROW($result_pool);
// Get all user links
- $links = GET_TOTAL_DATA($stats_id, 'user_links', 'userid', 'stats_id', true);
+ $links = countSumTotalData($stats_id, 'user_links', 'userid', 'stats_id', true);
// Reset sent mails for recipient(s)
- reduceRecipientReceivedMails('stats_id', REQUEST_GET('mid'), $links);
+ reduceRecipientReceivedMails('stats_id', getRequestElement('mid'), $links);
// Calc total points and pay them back
$totalPoints = $links * $price;
// Shall we pay the points back to the user?
if (getConfig('repay_deleted_mails') != 'SHRED') {
- //* DEBUG: */ echo $stats_id.':'.$totalPoints.'/'.$links.'/'.$price."
\n";
+ //* DEBUG: */ outputHtml($stats_id.':'.$totalPoints.'/'.$links.'/'.$price."
");
if ($totalPoints > 0) {
// Shall we payback to user or jackpot?
if (getConfig('repay_deleted_mails') == 'JACKPOT') {
@@ -114,64 +113,64 @@ LIMIT 1",
} // END - if
// Pay back points
- //* DEBUG: */ echo "PAYBACK:".$sender."
\n";
- ADD_POINTS_REFSYSTEM('mail_deleted', $sender, $totalPoints, true, '0', false,'direct');
+ //* DEBUG: */ outputHtml("PAYBACK:".$sender."
");
+ addPointsThroughReferalSystem('mail_deleted', $sender, $totalPoints, true, '0', false,'direct');
// Output message
if (getConfig('repay_deleted_mails') == 'REPAY') {
// Repayed
- LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('ADMIN_POINTS_REPAYED'),
- translateComma($totalPoints)
+ loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_POINTS_REPAYED'),
+ translateComma($totalPoints)
));
} else {
// To jackpot
- LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('ADMIN_POINTS_TO_JACKPOT'),
- translateComma($totalPoints)
+ loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_POINTS_TO_JACKPOT'),
+ translateComma($totalPoints)
));
}
} else {
// No points repayed!
- LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_NO_POINTS_REPAYED'));
+ loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NO_POINTS_REPAYED'));
}
} else {
// Points shredded!
- LOAD_TEMPLATE('admin_settings_saved', false, sprintf(getMessage('ADMIN_POINTS_SHREDDED'), $totalPoints));
+ loadTemplate('admin_settings_saved', false, sprintf(getMessage('ADMIN_POINTS_SHREDDED'), $totalPoints));
}
// Remove links from DB
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `stats_id`=%s",
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `stats_id`=%s",
array(bigintval($stats_id)), __FILE__, __LINE__);
$cnt += SQL_AFFECTEDROWS();
// Load template for link
- LOAD_TEMPLATE('admin_settings_saved', false, "".ADMIN_REMOVE_STATS_ENTRY."");
+ loadTemplate('admin_settings_saved', false, "{--ADMIN_REMOVE_STATS_ENTRY--}");
} // END - if
// Free the result
SQL_FREERESULT($result_pool);
// Delete mail from queue
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_pool` WHERE `id`=%s LIMIT 1",
- array(bigintval(REQUEST_GET('mid'))), __FILE__, __LINE__);
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s LIMIT 1",
+ array(bigintval(getRequestElement('mid'))), __FILE__, __LINE__);
$cnt += SQL_AFFECTEDROWS();
// Output link for manually removing stats entry
- OUTPUT_HTML(sprintf(ADMIN_DELETED_MAILS_COUNT, $cnt));
+ outputHtml(sprintf(getMessage('ADMIN_DELETED_MAILS_COUNT'), $cnt));
} else {
// Mail already deleted!
- LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_NORMAL_MAIL_ALREADY_DELETED'));
+ loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NORMAL_MAIL_ALREADY_DELETED'));
}
-} elseif (REQUEST_ISSET_GET('pid')) {
+} elseif (isGetRequestElementSet('pid')) {
// Remove stats entries
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_stats` WHERE `pool_id`=%s LIMIT 1",
- array(bigintval(REQUEST_GET('pid'))), __FILE__, __LINE__);
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_stats` WHERE `pool_id`=%s LIMIT 1",
+ array(bigintval(getRequestElement('pid'))), __FILE__, __LINE__);
// Output message
- LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_USER_STATS_REMOVED'));
-} elseif ((REQUEST_ISSET_GET('bid')) && (EXT_IS_ACTIVE('bonus'))) {
+ loadTemplate('admin_settings_saved', false, getMessage('ADMIN_USER_STATS_REMOVED'));
+} elseif ((isGetRequestElementSet('bid')) && (isExtensionActive('bonus'))) {
// Load data from bonus mail
- $result = SQL_QUERY_ESC("SELECT `id`, `subject`, `url`, `timestamp`, `mails_sent` FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s",
- array(bigintval(REQUEST_GET('bid'))), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `id`, `subject`, `url`, `timestamp`, `mails_sent` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `id`=%s",
+ array(bigintval(getRequestElement('bid'))), __FILE__, __LINE__);
// Delete mail only once
if (SQL_NUMROWS($result) == 1) {
@@ -179,73 +178,75 @@ LIMIT 1",
list($id, $subject, $url, $timestamp, $sent) = SQL_FETCHROW($result);
// Reset sent mails for recipient(s)
- reduceRecipientReceivedMails('bonus_id', REQUEST_GET('bid'), $sent);
+ reduceRecipientReceivedMails('bonus_id', getRequestElement('bid'), $sent);
// Init counter for deleted mails
$cnt = 0;
// Delete bonus mail entirely from database
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1",
- array(bigintval(REQUEST_GET('bid'))), __FILE__, __LINE__);
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `id`=%s LIMIT 1",
+ array(bigintval(getRequestElement('bid'))), __FILE__, __LINE__);
$cnt += SQL_AFFECTEDROWS();
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `bonus_id`=%s",
- array(bigintval(REQUEST_GET('bid'))), __FILE__, __LINE__);
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `bonus_id`=%s",
+ array(bigintval(getRequestElement('bid'))), __FILE__, __LINE__);
$cnt += SQL_AFFECTEDROWS();
// Prepare data for the template
- define('__ID' , $id);
- define('__SUBJECT', $subject);
- define('__URL' , DEREFERER($url));
- define('__ORDERED', generateDateTime($timestamp, '0'));
- define('__CNT' , $cnt);
+ $content['id'] = $id;
+ $content['subject'] = $subject;
+ $content['url'] = generateDerefererUrl($url);
+ $content['ordered'] = generateDateTime($timestamp, '0');
+ $content['cnt'] = $cnt;
// Load template
- LOAD_TEMPLATE('admin_del_email_bonus');
+ loadTemplate('admin_del_email_bonus', false, $content);
} else {
// Mail already deleted!
- LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_BONUS_MAIL_ALREADY_DELETED'));
+ loadTemplate('admin_settings_saved', false, getMessage('ADMIN_BONUS_MAIL_ALREADY_DELETED'));
}
// Free result
SQL_FREERESULT($result);
-} elseif ((REQUEST_ISSET_GET('nid')) && (GET_EXT_VERSION('bonus') >= '0.8.7')) {
+} elseif ((isGetRequestElementSet('nid')) && (getExtensionVersion('bonus') >= '0.8.7')) {
// Load data from bonus mail
- $result = SQL_QUERY_ESC("SELECT `id`, `subject`, `url`, `timestamp` FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s",
- array(bigintval(REQUEST_GET('nid'))), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `id`, `subject`, `url`, `timestamp` FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `id`=%s",
+ array(bigintval(getRequestElement('nid'))), __FILE__, __LINE__);
// Delete mail only once
if (SQL_NUMROWS($result) == 1) {
// Load data
list ($id, $subject, $url, $timestamp) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
// Init counter for deleted mails
$cnt = 0;
// Delete bonus mail entirely from database
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_bonus` WHERE `id`=%s LIMIT 1",
- array(bigintval(REQUEST_GET('nid'))), __FILE__, __LINE__);
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_bonus` WHERE `id`=%s LIMIT 1",
+ array(bigintval(getRequestElement('nid'))), __FILE__, __LINE__);
$cnt += SQL_AFFECTEDROWS();
- SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_user_links` WHERE `bonus_id`=%s",
- array(bigintval(REQUEST_GET('nid'))), __FILE__, __LINE__);
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_user_links` WHERE `bonus_id`=%s",
+ array(bigintval(getRequestElement('nid'))), __FILE__, __LINE__);
$cnt += SQL_AFFECTEDROWS();
// Prepare data for the template
- define('__ID' , $id);
- define('__SUBJECT', $subject);
- define('__URL' , DEREFERER($url));
- define('__ORDERED', generateDateTime($timestamp, '0'));
- define('__CNT' , $cnt);
+ $content['id'] = $id;
+ $content['subject'] = $subject;
+ $content['url'] = generateDerefererUrl($url);
+ $content['ordered'] = generateDateTime($timestamp, '0');
+ $content['cnt'] = $cnt;
// Load template
- LOAD_TEMPLATE('admin_del_email_notify');
+ loadTemplate('admin_del_email_notify', false, $content);
} else {
// Mail already deleted!
- LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_NOTIFY_MAIL_ALREADY_DELETED'));
+ loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NOTIFY_MAIL_ALREADY_DELETED'));
}
+
+ // Free result
+ SQL_FREERESULT($result);
} else {
// No mail orders fond
- LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_WRONG_CALL'));
+ loadTemplate('admin_settings_saved', false, getMessage('ADMIN_WRONG_CALL'));
}
//