A lot while() conditions rewritten to SQL_FETCHARRAY(), see bug #107, @TODO tags...
[mailer.git] / inc / modules / admin / what-unlock_emails.php
index b47c51cf42c863998fbcaf26e84d4edb4481fd1b..00db3aaf66d0dddf8096805073a9d845c2499fa3 100644 (file)
@@ -49,21 +49,21 @@ FROM `{!_MYSQL_PREFIX!}_pool`
 WHERE `data_type`='ADMIN'
 ORDER BY `timestamp` ASC", __FILE__, __LINE__);
 
-if ((SQL_NUMROWS($result_main) > 0) || (isset($_POST['lock']))) {
+if ((SQL_NUMROWS($result_main) > 0) || (REQUEST_ISSET_POST(('lock')))) {
        // Count checked checkboxes
        $SEL = 0;
-       if (isset($_POST['sel'])) {
+       if (REQUEST_ISSET_POST('sel')) {
                // Are there checked boxes?
-               if (count($_POST['sel']) > 0) {
+               if (count(REQUEST_POST('sel')) > 0) {
                        // Count now... We use an own function for now
-                       $SEL = SELECTION_COUNT($_POST['sel']);
+                       $SEL = SELECTION_COUNT(REQUEST_POST('sel'));
                } // END - if
        } // END - if
 
-       if (isset($_POST['accept'])) {
+       if (REQUEST_ISSET_POST(('accept'))) {
                if ($SEL > 0) {
                        // Accept mail orders
-                       foreach ($_POST['sel'] as $id => $value) {
+                       foreach (REQUEST_POST('sel') as $id => $value) {
                                // Secure ID number
                                $id = bigintval($id);
 
@@ -121,11 +121,11 @@ LIMIT 1",
 
                // Mails unlocked for mail delivery
                LOAD_TEMPLATE("admin_settings_saved", false, $MSG);
-       } elseif (isset($_POST['reject'])) {
+       } elseif (REQUEST_ISSET_POST(('reject'))) {
                if ($SEL > 0) {
                        // Reject mail orders
-                       $SW = 2; $OUT = "";
-                       foreach ($_POST['sel'] as $id => $value) {
+                       $OUT = ""; $SW = 2;
+                       foreach (REQUEST_POST('sel') as $id => $value) {
                                // Secure ID number
                                $id = bigintval($id);
 
@@ -144,17 +144,17 @@ LIMIT 1",
                                SEND_EMAIL($DATA['sender'], MEMBER_ORDER_REJECTED, $msg_user);
 
                                // If you do not enter an URL to redirect to, your URL will be set!
-                               if ((empty($_POST['redirect'])) || ($_POST['redirect'] == "http://")) $_POST['redirect'] = constant('URL');
+                               if ((!REQUEST_ISSET_POST(('redirect'))) || (REQUEST_POST('redirect') == "http://")) REQUEST_SET_POST('redirect', constant('URL'));
 
                                // Redirect URL
                                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_pool` SET url='%s', data_type='NEW' WHERE id=%s LIMIT 1",
-                                       array($_POST['redirect'], $id),__FILE__, __LINE__);
+                                       array(REQUEST_POST('redirect'), $id),__FILE__, __LINE__);
 
                                // Prepare data for the row template
                                $content = array(
                                        'sw'  => $SW,
                                        'id'  => $id,
-                                       'url' => $_POST['url'][$id],
+                                       'url' => REQUEST_POST('url', $id),
                                );
 
                                // Load row template and switch colors
@@ -169,9 +169,9 @@ LIMIT 1",
                        // Nothing selected
                        LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_MAILS_NOTHING_CHECKED'));
                }
-       } elseif ((isset($_POST['lock'])) && ($SEL > 0) && (getConfig('url_blacklist') == "Y")) {
+       } elseif ((REQUEST_ISSET_POST(('lock'))) && ($SEL > 0) && (getConfig('url_blacklist') == "Y")) {
                // Lock URLs
-               foreach ($_POST['sel'] as $id => $url) {
+               foreach (REQUEST_POST('sel') as $id => $url) {
                        // Secure id number
                        $id = bigintval($id);
 
@@ -190,9 +190,9 @@ LIMIT 1",
 
                // Output message
                LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_URLS_BLOCKED'));
-       } elseif ((empty($_POST['lock'])) && (empty($_POST['accept'])) && (empty($_POST['reject'])) && (getConfig('url_blacklist') == "Y")) {
+       } elseif ((!REQUEST_ISSET_POST(('lock'))) && (!REQUEST_ISSET_POST(('accept'))) && (!REQUEST_ISSET_POST(('reject'))) && (getConfig('url_blacklist') == "Y")) {
                // Mail orders are in pool so we can display them
-               $SW = 2; $OUT = "";
+               $OUT = ""; $SW = 2;
                while ($content = SQL_FETCHARRAY($result_main)) {
                        // Prepare data for the template
                        $content = array(
@@ -227,7 +227,7 @@ LIMIT 1",
 
                // Load main template
                LOAD_TEMPLATE("admin_unlock_emails");
-       } elseif ((isset($_POST['lock'])) && (getConfig('url_blacklist') == "N")) {
+       } elseif ((REQUEST_ISSET_POST(('lock'))) && (getConfig('url_blacklist') != "Y")) {
                // URL blacklist not activated
                LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_URL_BLACKLIST_DISABLED'));
        } else {