X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-unlock_emails.php;h=848c797aaf538c72bfb6db90bb053c510373a3a8;hp=f23946d3ba9bbe86d83f29359d03378b159251f0;hb=49acdb7a7adbcf25a8e8683b5581bfcec72b23bd;hpb=5ab0d021f3e96722af5d96d2b9036430200c06cb diff --git a/inc/modules/admin/what-unlock_emails.php b/inc/modules/admin/what-unlock_emails.php index f23946d3ba..848c797aaf 100644 --- a/inc/modules/admin/what-unlock_emails.php +++ b/inc/modules/admin/what-unlock_emails.php @@ -16,7 +16,7 @@ * $Author:: $ * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2012 by Mailer Developer Team * + * Copyright (c) 2009 - 2015 by Mailer Developer Team * * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -44,14 +44,15 @@ if ((!defined('__SECURITY')) || (!isAdmin())) { addYouAreHereLink('admin', __FILE__); // Check for mails -$result_main = SQL_QUERY("SELECT +$result_main = sqlQuery("SELECT `id`, - `sender`, + `url`, `subject`, - `payment_id`, + `text`, + `sender`, `timestamp`, - `url`, `target_send`, + `payment_id`, `cat_id` FROM `{?_MYSQL_PREFIX?}_pool` @@ -60,7 +61,7 @@ WHERE ORDER BY `timestamp` ASC", __FILE__, __LINE__); -if ((!SQL_HASZERONUMS($result_main)) || (isFormSent('lock'))) { +if ((!ifSqlHasZeroNumRows($result_main)) || (isFormSent('lock'))) { if (isFormSent('accept')) { if (ifPostContainsSelections()) { // Accept mail orders @@ -68,29 +69,11 @@ if ((!SQL_HASZERONUMS($result_main)) || (isFormSent('lock'))) { // 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` -FROM - `{?_MYSQL_PREFIX?}_pool` AS `po` -INNER JOIN - `{?_MYSQL_PREFIX?}_payments` AS `pay` -ON - po.`payment_id`=pay.`id` -WHERE - po.`id`=%s -LIMIT 1', - array($id), __FILE__, __LINE__); - - // Update wents fine? - if (SQL_NUMROWS($result) == 1) { - // Load data - $content = SQL_FETCHARRAY($result); + // Get pool data from given id + $content = getPoolDataFromId($id); + // Found some data? + if (isFilledArray($content)) { // Is the surfbar installed? // @TODO Rewrite these if-blocks to a filter if ((isExtensionActive('surfbar')) && (getConfig('surfbar_migrate_order') == 'Y')) { @@ -101,7 +84,7 @@ LIMIT 1', // Check for bonus extension version >= 0.4.4 for the order bonus 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", + sqlQueryEscaped("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 @@ -115,12 +98,8 @@ LIMIT 1', 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__); + updatePoolDataById($id, 'data_type', 'NEW', NULL, " AND `data_type`='ADMIN'"); } // END - if - - // Free result - SQL_FREERESULT($result); } // END - foreach // Set message @@ -140,15 +119,8 @@ LIMIT 1', // 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", - array($id), __FILE__, __LINE__); - - // Load data - $content = SQL_FETCHARRAY($result); - - // Free result - SQL_FREERESULT($result); + // Get pool data from given id + $content = getPoolDataFromId($id); // Load email template and send it away $message_user = loadEmailTemplate('member_order_rejected', $content, $content['sender']); @@ -160,8 +132,7 @@ LIMIT 1', } // END - if // Redirect URL - SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_pool` SET `url`='%s',`data_type`='NEW' WHERE `id`=%s LIMIT 1", - array(postRequestElement('redirect'), $id),__FILE__, __LINE__); + updatePoolDataById($id, NULL, array('url' => postRequestElement('redirect'), 'data_type' => 'NEW')); // Prepare data for the row template $content = array( @@ -194,7 +165,7 @@ LIMIT 1', } elseif ((!isFormSent('lock')) && (!isFormSent('accept')) && (!isFormSent('reject'))) { // Mail orders are in pool so we can display them $OUT = ''; - while ($content = SQL_FETCHARRAY($result_main)) { + while ($content = sqlFetchArray($result_main)) { // Prepare data for the template $content['timestamp'] = generateDateTime($content['timestamp'], 2); @@ -203,7 +174,7 @@ LIMIT 1', } // END - while // Free memory - SQL_FREERESULT($result_main); + sqlFreeResult($result_main); // Remember in array $content['rows'] = $OUT;