} // END - if
// Form sent or anything else? ;-)
-if ((isFormSent()) && (isPostRequestElementSet('id')) && (isGetRequestElementSet('type')) && (postRequestElement('type') == 'normal')) {
- // Make mail editable...
- $result = SQL_QUERY_ESC('SELECT
- `id`,
- `sender` AS `userid`,
- `subject`,
- `text`,
- `url`
-FROM
- `{?_MYSQL_PREFIX?}_pool`
-WHERE
- `id`=%s
-LIMIT 1',
- array(bigintval(postRequestElement('id'))), __FILE__, __LINE__);
-
- // Fetch row
- $content = SQL_FETCHARRAY($result);
-
- // Free result
- SQL_FREERESULT($result);
-
- // Load template
- loadTemplate('admin_edit_email', FALSE, $content);
-} elseif ((isPostRequestElementSet('id')) && (isGetRequestElementSet('type')) && (postRequestElement('type') == 'normal')) {
- // Make also this email editable
- $result = SQL_QUERY_ESC('SELECT
- `id`,
- `sender` AS `userid`,
- `subject`,
- `text`,
- `url`
-FROM
- `{?_MYSQL_PREFIX?}_pool`
-WHERE
- `id`=%s
-LIMIT 1',
- array(bigintval(getRequestElement('id'))), __FILE__, __LINE__);
-
- // Fetch row
- $content = SQL_FETCHARRAY($result);
-
- // Free result
- SQL_FREERESULT($result);
+if ((isFormSent('edit')) && (isPostRequestElementSet('id')) && (isGetRequestElementSet('type')) && (postRequestElement('type') == 'normal')) {
+ // Get data
+ $content = getPoolDataFromId(postRequestElement('id'));
// Load template
loadTemplate('admin_edit_email', FALSE, $content);
// Save changes
if ((isPostRequestElementSet('id')) && (isGetRequestElementSet('type')) && (postRequestElement('type') == 'normal')) {
// Update pool
- SQL_QUERY_ESC("UPDATE
- `{?_MYSQL_PREFIX?}_pool`
-SET
- `subject`='%s',
- `text`='%s',
- `url`='%s'
-WHERE
- `id`=%s
-LIMIT 1",
- array(
- postRequestElement('subject'),
- postRequestElement('text'),
- postRequestElement('url'),
- bigintval(postRequestElement('id')),
- ), __FILE__, __LINE__);
-
- if (!SQL_HASZEROAFFECTED()) {
+ $isUpdated = updatePoolDataById(postRequestElement('id'), NULL, array('subject' => postRequestElement('subject'), 'text' => postRequestElement('text'), 'url' => postRequestElemenet('url')));
+ if ($isUpdated === TRUE) {
$content = '{--ADMIN_EMAIL_CHANGES_SAVED--}';
} else {
$content = '<span class="bad">{--ADMIN_EMAIL_CHANGES_NOT_SAVED--}</span>';
// Query the pool
$result = SQL_QUERY('SELECT
`id`,
- `sender` AS `userid`,
+ `sender`,
`subject`,
`payment_id`,
`cat_id`
FROM
`{?_MYSQL_PREFIX?}_pool`
ORDER BY
+ `sender` ASC,
`timestamp` ASC', __FILE__, __LINE__);
// Entries found?