Mailer project continued:
[mailer.git] / inc / modules / admin / what-unlock_emails.php
index 7b23649d3e6c76572ced7451c7a758cbe7a00981..0cf0c8583fe4111124e33cf9895093f05c6c4849 100644 (file)
@@ -16,8 +16,8 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
- * For more information visit: http://www.mxchange.org                  *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
  * it under the terms of the GNU General Public License as published by *
@@ -41,11 +41,18 @@ if ((!defined('__SECURITY')) || (!isAdmin())) {
 } // END - if
 
 // Add description as navigation point
-addMenuDescription('admin', __FILE__);
+addYouAreHereLink('admin', __FILE__);
 
 // Check for mails
 $result_main = SQL_QUERY("SELECT
-       `id`, `sender`, `subject`, `payment_id`, `timestamp`, `url`, `target_send`, `cat_id`
+       `id`,
+       `sender`,
+       `subject`,
+       `payment_id`,
+       `timestamp`,
+       `url`,
+       `target_send`,
+       `cat_id`
 FROM
        `{?_MYSQL_PREFIX?}_pool`
 WHERE
@@ -57,22 +64,26 @@ if ((!SQL_HASZERONUMS($result_main)) || (isFormSent('lock'))) {
        if (isFormSent('accept')) {
                if (ifPostContainsSelections()) {
                        // Accept mail orders
-                       foreach (postRequestParameter('sel') as $id => $value) {
+                       foreach (postRequestElement('sel') as $id => $value) {
                                // Secure id number
                                $id = bigintval($id);
 
                                // Order placed in queue...
-                               $result = SQL_QUERY_ESC("SELECT
-       po.url, po.subject, po.sender, pay.payment, po.payment_id
+                               $result = SQL_QUERY_ESC('SELECT
+       po.`url`,
+       po.`subject`,
+       po.`sender`,
+       pay.`payment`,
+       po.`payment_id`
 FROM
-       `{?_MYSQL_PREFIX?}_pool` AS po
+       `{?_MYSQL_PREFIX?}_pool` AS `po`
 INNER JOIN
-       `{?_MYSQL_PREFIX?}_payments` AS pay
+       `{?_MYSQL_PREFIX?}_payments` AS `pay`
 ON
-       po.payment_id=pay.id
+       po.`payment_id`=pay.`id`
 WHERE
-       po.id=%s
-LIMIT 1",
+       po.`id`=%s
+LIMIT 1',
                                        array($id), __FILE__, __LINE__);
 
                                // Update wents fine?
@@ -84,7 +95,7 @@ LIMIT 1",
                                        // @TODO Rewrite these if-blocks to a filter
                                        if ((isExtensionActive('surfbar')) && (getConfig('surfbar_migrate_order') == 'Y')) {
                                                // Then "migrate" the URL to the surfbar
-                                               SURFBAR_ADMIN_MIGRATE_URL($content['url'], $content['sender']);
+                                               doSurfbarAdminMigrateUrl($content['url'], $content['sender']);
                                        } // END - if
 
                                        // Check for bonus extension version >= 0.4.4 for the order bonus
@@ -94,11 +105,11 @@ LIMIT 1",
                                                        array(bigintval($content['sender'])), __FILE__, __LINE__);
 
                                                // Subtract bonus points from system
-                                               handleBonusPoints(getConfig('bonus_order'));
+                                               handleBonusPoints(getConfig('bonus_order'), $content['sender']);
                                        } // END - if
 
                                        // Load email template
-                                       $message_user = loadEmailTemplate('order-accept', $content, $content['sender']);
+                                       $message_user = loadEmailTemplate('member_order_accepted', $content, $content['sender']);
 
                                        // Send email
                                        sendEmail($content['sender'], '{--MEMBER_ORDER_ACCEPTED--}', $message_user);
@@ -120,12 +131,12 @@ LIMIT 1",
                }
 
                // Mails unlocked for mail delivery
-               loadTemplate('admin_settings_saved', false, $message);
-       } elseif (isPostRequestParameterSet('reject')) {
+               displayMessage($message);
+       } elseif (isPostRequestElementSet('reject')) {
                if (ifPostContainsSelections()) {
                        // Reject mail orders
                        $OUT = '';
-                       foreach (postRequestParameter('sel') as $id => $value) {
+                       foreach (postRequestElement('sel') as $id => $value) {
                                // Secure id number
                                $id = bigintval($id);
 
@@ -140,20 +151,22 @@ LIMIT 1",
                                SQL_FREERESULT($result);
 
                                // Load email template and send it away
-                               $message_user = loadEmailTemplate('order-reject', $content, $content['sender']);
+                               $message_user = loadEmailTemplate('member_order_rejected', $content, $content['sender']);
                                sendEmail($content['sender'], '{--MEMBER_ORDER_REJECTED--}', $message_user);
 
                                // If you do not enter an URL to redirect to, your URL will be set!
-                               if ((!isPostRequestParameterSet('redirect')) || (postRequestParameter('redirect') == 'http://')) setPostRequestParameter('redirect', getUrl());
+                               if ((!isPostRequestElementSet('redirect')) || (postRequestElement('redirect') == 'http://')) {
+                                       setPostRequestElement('redirect', getUrl());
+                               } // END - if
 
                                // Redirect URL
-                               SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET url='%s', `data_type`='NEW' WHERE `id`=%s LIMIT 1",
-                                       array(postRequestParameter('redirect'), $id),__FILE__, __LINE__);
+                               SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `url`='%s',`data_type`='NEW' WHERE `id`=%s LIMIT 1",
+                                       array(postRequestElement('redirect'), $id),__FILE__, __LINE__);
 
                                // Prepare data for the row template
                                $content = array(
                                        'id'  => $id,
-                                       'url' => postRequestParameter('url', $id),
+                                       'url' => postRequestElement('url', $id),
                                );
 
                                // Load row template and switch colors
@@ -164,11 +177,11 @@ LIMIT 1",
                        loadTemplate('admin_unlock_emails_redir', false, $OUT);
                } else {
                        // Nothing selected
-                       loadTemplate('admin_settings_saved', false, '{--ADMIN_MAILS_NOTHING_CHECKED--}');
+                       displayMessage('{--ADMIN_MAILS_NOTHING_CHECKED--}');
                }
-       } elseif ((isFormSent('lock')) && (ifPostContainsSelections()) && (isUrlBlaskEnabled())) {
+       } elseif ((isFormSent('lock')) && (ifPostContainsSelections()) && (isUrlBlacklistEnabled())) {
                // Lock URLs
-               foreach (postRequestParameter('sel') as $id => $url) {
+               foreach (postRequestElement('sel') as $id => $url) {
                        // Secure id number
                        $id = bigintval($id);
 
@@ -177,7 +190,7 @@ LIMIT 1",
                                array($url), __FILE__, __LINE__);
                        if (SQL_HASZERONUMS($result)) {
                                // Did not find a record so we can add it... :)
-                               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_url_blacklist` (`url`,`pool_id`) VALUES ('%s',%s)",
+                               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_url_blacklist` (`url`, `pool_id`) VALUES ('%s',%s)",
                                        array($url, $id), __FILE__, __LINE__);
                        } // END - if
 
@@ -186,7 +199,7 @@ LIMIT 1",
                } // END - foreach
 
                // Output message
-               loadTemplate('admin_settings_saved', false, '{--ADMIN_URLS_BLOCKED--}');
+               displayMessage('{--ADMIN_URLS_BLOCKED--}');
        } elseif ((!isFormSent('lock')) && (!isFormSent('accept')) && (!isFormSent('reject'))) {
                // Mail orders are in pool so we can display them
                $OUT = '';
@@ -206,16 +219,16 @@ LIMIT 1",
 
                // Load main template
                loadTemplate('admin_unlock_emails', false, $content);
-       } elseif ((isFormSent('lock')) && (!isUrlBlaskEnabled())) {
+       } elseif ((isFormSent('lock')) && (!isUrlBlacklistEnabled())) {
                // URL blacklist not activated
-               loadTemplate('admin_settings_saved', false, '{--ADMIN_URL_BLACKLIST_DISABLED--}');
+               displayMessage('{--ADMIN_URL_BLACKLIST_DISABLED--}');
        } else {
                // Wrong call!
-               loadTemplate('admin_settings_saved', false, '{--ADMIN_WRONG_CALL--}');
+               displayMessage('{--ADMIN_WRONG_CALL--}');
        }
 } else {
        // No mail orders fond
-       loadTemplate('admin_settings_saved', false, '{--ADMIN_NO_MAILS_IN_POOL--}');
+       displayMessage('{--ADMIN_NO_MAILS_IN_POOL--}');
 }
 
 // [EOF]