X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-unlock_emails.php;h=c91c068a33879625412055905dbaa3ea80ed5df4;hp=f371aed3bd6ce0eac34824254e2c2795a55bc964;hb=e3934352dffa6eb9da59a137ae1a9414e5b4d80b;hpb=c3f2beb3f1d47c9593d262d7f5dac47640b4aa52 diff --git a/inc/modules/admin/what-unlock_emails.php b/inc/modules/admin/what-unlock_emails.php index f371aed3bd..c91c068a33 100644 --- a/inc/modules/admin/what-unlock_emails.php +++ b/inc/modules/admin/what-unlock_emails.php @@ -14,11 +14,10 @@ * $Date:: $ * * $Tag:: 0.2.1-FINAL $ * * $Author:: $ * - * Needs to be in all Files and every File needs "svn propset * - * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * For more information visit: http://www.mxchange.org * + * Copyright (c) 2009 - 2011 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 * @@ -42,11 +41,11 @@ 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` AS `payment`,`timestamp`,`url`,`target_send`,`cat_id` AS category + `id`,`sender`,`subject`,`payment_id`,`timestamp`,`url`,`target_send`,`cat_id` FROM `{?_MYSQL_PREFIX?}_pool` WHERE @@ -54,25 +53,25 @@ WHERE ORDER BY `timestamp` ASC", __FILE__, __LINE__); -if ((SQL_NUMROWS($result_main) > 0) || (isPostRequestParameterSet('lock'))) { - if (isPostRequestParameterSet('accept')) { - if (countPostSelection() > 0) { +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 + 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 + po.`id`=%s LIMIT 1", array($id), __FILE__, __LINE__); @@ -81,9 +80,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')) { @@ -92,46 +88,49 @@ LIMIT 1", } // END - if // Check for bonus extension version >= 0.4.4 for the order bonus - if ((getExtensionVersion('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`+".getConfig('bonus_order')." WHERE `userid`=%s LIMIT 1", + 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__); // 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'], 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) { + displayMessage($message); + } elseif (isPostRequestElementSet('reject')) { + if (ifPostContainsSelections()) { // Reject mail orders - $OUT = ''; $SW = 2; - foreach (postRequestParameter('sel') as $id => $value) { + $OUT = ''; + foreach (postRequestElement('sel') as $id => $value) { // Secure id number $id = bigintval($id); // Load URL and subject from pool - $result = SQL_QUERY_ESC("SELECT `url`, `subject`, `sender` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s LIMIT 1", + $result = SQL_QUERY_ESC("SELECT `url`,`subject`,`sender` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s LIMIT 1", array($id), __FILE__, __LINE__); // Load data @@ -141,44 +140,44 @@ LIMIT 1", SQL_FREERESULT($result); // Load email template and send it away - $message_user = loadEmailTemplate('order-reject', $content, $content['sender']); - sendEmail($content['sender'], getMessage('MEMBER_ORDER_REJECTED'), $message_user); + $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', getConfig('URL')); + 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( - 'sw' => $SW, 'id' => $id, - 'url' => postRequestParameter('url', $id), + 'url' => postRequestElement('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); } else { // Nothing selected - loadTemplate('admin_settings_saved', false, getMessage('ADMIN_MAILS_NOTHING_CHECKED')); + displayMessage('{--ADMIN_MAILS_NOTHING_CHECKED--}'); } - } elseif ((isPostRequestParameterSet('lock')) && (countPostSelection() > 0) && (getConfig('url_blacklist') == 'Y')) { + } 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); // Lookup in blacklist $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_url_blacklist` WHERE `url`='%s' LIMIT 1", array($url), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == '0') { + 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)", array($url, $id), __FILE__, __LINE__); @@ -189,31 +188,16 @@ LIMIT 1", } // END - foreach // Output message - loadTemplate('admin_settings_saved', false, getMessage('ADMIN_URLS_BLOCKED')); - } elseif ((!isPostRequestParameterSet('lock')) && (!isPostRequestParameterSet('accept')) && (!isPostRequestParameterSet('reject'))) { + displayMessage('{--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 = array( - 'sw' => $SW, - 'id' => $content['id'], - 'sender' => $content['sender'], - 'u_link' => generateUserProfileLink($content['sender']), - 'subject' => $content['subject'], - 'tester' => generateFrametesterUrl($content['url']), - 'url' => $content['url'], - 'cat_title' => str_replace("\"", '"', getCategory($content['category'])), - 'cat_link' => $content['category'], - 'pay_title' => str_replace("\"", '"', getPaymentTitlePrice($content['payment'], true)), - 'pay_link' => $content['payment'], - 'timestamp' => generateDateTime($content['timestamp'], 2), - 'target_send' => $content['target_send'], - ); + $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 @@ -224,16 +208,16 @@ LIMIT 1", // Load main template loadTemplate('admin_unlock_emails', false, $content); - } elseif ((isPostRequestParameterSet('lock')) && (getConfig('url_blacklist') != 'Y')) { + } elseif ((isFormSent('lock')) && (!isUrlBlacklistEnabled())) { // URL blacklist not activated - loadTemplate('admin_settings_saved', false, getMessage('ADMIN_URL_BLACKLIST_DISABLED')); + displayMessage('{--ADMIN_URL_BLACKLIST_DISABLED--}'); } else { // Wrong call! - loadTemplate('admin_settings_saved', false, getMessage('ADMIN_WRONG_CALL')); + displayMessage('{--ADMIN_WRONG_CALL--}'); } } else { // No mail orders fond - loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NO_MAILS_IN_POOL')); + displayMessage('{--ADMIN_NO_MAILS_IN_POOL--}'); } // [EOF]