// Check for mails
$result_main = SQL_QUERY("SELECT
`id`,
- `sender`,
+ `url`,
`subject`,
- `payment_id`,
+ `text`,
+ `sender`,
`timestamp`,
- `url`,
`target_send`,
+ `payment_id`,
`cat_id`
FROM
`{?_MYSQL_PREFIX?}_pool`
// Secure id number
$id = bigintval($id);
- // Order placed in queue...
- $result = SQL_QUERY_ESC('SELECT
- `url`,
- `subject`,
- `sender`,
- `payment_id`
-FROM
- `{?_MYSQL_PREFIX?}_pool`
-WHERE
- `id`=%s
-LIMIT 1',
- array($id), __FILE__, __LINE__);
-
- // Update wents fine?
- if (SQL_NUMROWS($result) == 1) {
- // Load data
- $content = SQL_FETCHARRAY($result);
-
- // Get payment from getter to avoid JOIN
- $content['payment'] = getPaymentData($content['payment_id', 'payment');
+ // Get pool data from given id
+ $content = getPoolDataFromId($id);
+ // Found some data?
+ if (count($content) > 0) {
// Is the surfbar installed?
// @TODO Rewrite these if-blocks to a filter
if ((isExtensionActive('surfbar')) && (getConfig('surfbar_migrate_order') == 'Y')) {
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
// 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']);
} // 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(