X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-unlock_emails.php;h=63affb3672e111feae1b9b1e394dd161559f489a;hb=d0dfa5c5907273f7afa601407ee3d86bd369b3cd;hp=83eb8c0cd2c07aa7fc584d933a3f2e6df2b8974c;hpb=04b69ac9f33369cbf654396c4a42cb1fff710ff4;p=mailer.git diff --git a/inc/modules/admin/what-unlock_emails.php b/inc/modules/admin/what-unlock_emails.php index 83eb8c0cd2..63affb3672 100644 --- a/inc/modules/admin/what-unlock_emails.php +++ b/inc/modules/admin/what-unlock_emails.php @@ -55,9 +55,9 @@ WHERE ORDER BY `timestamp` ASC", __FILE__, __LINE__); -if ((SQL_NUMROWS($result_main) > 0) || (isFormSent('lock'))) { +if ((!SQL_HASZERONUMS($result_main)) || (isFormSent('lock'))) { if (isFormSent('accept')) { - if (countPostSelection() > 0) { + if (ifPostContainsSelections()) { // Accept mail orders foreach (postRequestParameter('sel') as $id => $value) { // Secure id number @@ -82,9 +82,6 @@ LIMIT 1", // Load data $content = SQL_FETCHARRAY($result); - // Free result - SQL_FREERESULT($result); - // Is the surfbar installed? // @TODO Rewrite these if-blocks to a filter if ((isExtensionActive('surfbar')) && (getConfig('surfbar_migrate_order') == 'Y')) { @@ -93,7 +90,7 @@ LIMIT 1", } // END - if // Check for bonus extension version >= 0.4.4 for the order bonus - if ((isExtensionInstalledAndNewer('bonus', '0.4.4')) && (getConfig('bonus_active') == 'Y')) { + if ((isExtensionInstalledAndNewer('bonus', '0.4.4')) && (isBonusRallyeActive())) { // Add points directly SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data` SET `bonus_order`=`bonus_order`+{?bonus_order?} WHERE `userid`=%s LIMIT 1", array(bigintval($content['sender'])), __FILE__, __LINE__); @@ -106,27 +103,30 @@ LIMIT 1", $message_user = loadEmailTemplate('order-accept', $content, $content['sender']); // Send email - sendEmail($content['sender'], getMessage('MEMBER_ORDER_ACCEPTED'), $message_user); + sendEmail($content['sender'], '{--MEMBER_ORDER_ACCEPTED--}', $message_user); // Unlock selected email SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `data_type`='NEW' WHERE `id`=%s AND `data_type`='ADMIN' LIMIT 1", array($id), __FILE__, __LINE__); } // END - if + + // Free result + SQL_FREERESULT($result); } // END - foreach // Set message - $message = getMessage('ADMIN_MAILS_ACTIVATED'); + $message = '{--ADMIN_MAILS_ACTIVATED--}'; } else { // Nothing checked! - $message = getMessage('ADMIN_MAILS_NOTHING_CHECKED'); + $message = '{--ADMIN_MAILS_NOTHING_CHECKED--}'; } // Mails unlocked for mail delivery loadTemplate('admin_settings_saved', false, $message); - } elseif (isPostRequestParameterSet(('reject'))) { - if (countPostSelection() > 0) { + } elseif (isPostRequestParameterSet('reject')) { + if (ifPostContainsSelections()) { // Reject mail orders - $OUT = ''; $SW = 2; + $OUT = ''; foreach (postRequestParameter('sel') as $id => $value) { // Secure id number $id = bigintval($id); @@ -143,10 +143,10 @@ LIMIT 1", // Load email template and send it away $message_user = loadEmailTemplate('order-reject', $content, $content['sender']); - sendEmail($content['sender'], getMessage('MEMBER_ORDER_REJECTED'), $message_user); + 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', getConfig('URL')); + if ((!isPostRequestParameterSet('redirect')) || (postRequestParameter('redirect') == 'http://')) setPostRequestParameter('redirect', getUrl()); // Redirect URL SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET url='%s', `data_type`='NEW' WHERE `id`=%s LIMIT 1", @@ -154,15 +154,13 @@ LIMIT 1", // Prepare data for the row template $content = array( - 'sw' => $SW, 'id' => $id, 'url' => postRequestParameter('url', $id), ); // Load row template and switch colors $OUT .= loadTemplate('admin_unlock_emails_redir_row', true, $content); - $SW = 3 - $SW; - } + } // END - foreach // Load main template loadTemplate('admin_unlock_emails_redir', false, $OUT); @@ -170,7 +168,7 @@ LIMIT 1", // Nothing selected loadTemplate('admin_settings_saved', false, '{--ADMIN_MAILS_NOTHING_CHECKED--}'); } - } elseif ((isFormSent('lock')) && (countPostSelection() > 0) && (getConfig('url_blacklist') == 'Y')) { + } elseif ((isFormSent('lock')) && (ifPostContainsSelections()) && (isUrlBlaskEnabled())) { // Lock URLs foreach (postRequestParameter('sel') as $id => $url) { // Secure id number @@ -193,15 +191,13 @@ LIMIT 1", loadTemplate('admin_settings_saved', false, '{--ADMIN_URLS_BLOCKED--}'); } elseif ((!isFormSent('lock')) && (!isFormSent('accept')) && (!isFormSent('reject'))) { // Mail orders are in pool so we can display them - $OUT = ''; $SW = 2; + $OUT = ''; while ($content = SQL_FETCHARRAY($result_main)) { // Prepare data for the template - $content['sw'] = $SW; $content['timestamp'] = generateDateTime($content['timestamp'], 2); // Load row template and switch colors $OUT .= loadTemplate('admin_unlock_emails_row', true, $content); - $SW = 3 - $SW; } // END - while // Free memory @@ -212,12 +208,12 @@ LIMIT 1", // Load main template loadTemplate('admin_unlock_emails', false, $content); - } elseif ((isFormSent('lock')) && (getConfig('url_blacklist') != 'Y')) { + } elseif ((isFormSent('lock')) && (!isUrlBlaskEnabled())) { // URL blacklist not activated loadTemplate('admin_settings_saved', false, '{--ADMIN_URL_BLACKLIST_DISABLED--}'); } else { // Wrong call! - loadTemplate('admin_settings_saved', false, '{--ADMIN_WRONG_CALL--}')); + loadTemplate('admin_settings_saved', false, '{--ADMIN_WRONG_CALL--}'); } } else { // No mail orders fond