From dd7c9bf86a74049e3ca0c4df7dcddf48e33950d5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 18 Nov 2009 04:22:04 +0000 Subject: [PATCH] Fix for rewritting code #2 --- inc/modules/admin/what-admins_mails.php | 28 ++++++++++++------- .../admin/admin_admins_mails_edit_row.tpl | 4 +-- .../admin/admin_admins_mails_list_row.tpl | 4 +-- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/inc/modules/admin/what-admins_mails.php b/inc/modules/admin/what-admins_mails.php index 3f4159727d..21ad2e4bdb 100644 --- a/inc/modules/admin/what-admins_mails.php +++ b/inc/modules/admin/what-admins_mails.php @@ -52,7 +52,7 @@ if (isPostRequestElementSet('edit')) { $SW = 2; $rowNameS = ''; foreach (postRequestElement('sel') as $template => $sel) { // First of all load data from DB - $result = SQL_QUERY_ESC("SELECT `admin_id`, `id` FROM `{?_MYSQL_PREFIX?}_admins_mails` WHERE `mail_template`='%s' ORDER BY `id` ASC", + $result = SQL_QUERY_ESC("SELECT `admin_id`, `id`, `mail_template` FROM `{?_MYSQL_PREFIX?}_admins_mails` WHERE `mail_template`='%s' ORDER BY `id` ASC", array($template), __FILE__, __LINE__); $OUT = ''; $adminId2 = '0'; @@ -131,7 +131,7 @@ ORDER BY // Update entry addSql(SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_admins_mails` SET admin_id=%s WHERE `id`=%s ORDER BY `id` LIMIT 1", - array($content['admin_id'], $id), __FILE__, __LINE__, false)); + array($content['admin_id'], $id), __FILE__, __LINE__, false)); if (($content['admin_id'] < 1) && (isPostRequestElementSet('template', $id))) { // Remove any other admin entries @@ -150,19 +150,27 @@ ORDER BY runFilterChain('run_sqls'); // Query again... - $result = SQL_QUERY("SELECT m.id, m.admin_id, a.login, m.mail_template FROM `{?_MYSQL_PREFIX?}_admins_mails` AS m, `{?_MYSQL_PREFIX?}_admins` AS a WHERE m.admin_id=a.id OR m.admin_id < 1 ORDER BY m.admin_id", __FILE__, __LINE__); + $result = SQL_QUERY("SELECT + m.id, m.admin_id, a.login, m.mail_template +FROM + `{?_MYSQL_PREFIX?}_admins_mails` AS m +LEFT JOIN + `{?_MYSQL_PREFIX?}_admins` AS a +ON + m.admin_id=a.id +WHERE + (m.admin_id=a.id OR m.admin_id < 1) AND m.mail_template != '' +ORDER BY + m.admin_id ASC, + m.mail_template ASC", __FILE__, __LINE__); } // END - if // List found entries $OUT = ''; $SW = 2; - while ($data = SQL_FETCHARRAY($result)) { + while ($content = SQL_FETCHARRAY($result)) { // Prepare content - $content = array( - 'sw' => $SW, - 'id' => $data['id'], - 'tpl' => $data['mail_template'], - 'alnk' => generateAdminLink($data['admin_id']) - ); + $content['sw'] = $SW; + $content['alnk'] = generateAdminLink($content['admin_id']); // Load row template $OUT .= loadTemplate('admin_admins_mails_list_row', true, $content); diff --git a/templates/de/html/admin/admin_admins_mails_edit_row.tpl b/templates/de/html/admin/admin_admins_mails_edit_row.tpl index 2759d8134e..0bb276ffaa 100644 --- a/templates/de/html/admin/admin_admins_mails_edit_row.tpl +++ b/templates/de/html/admin/admin_admins_mails_edit_row.tpl @@ -1,7 +1,7 @@ - $content[tpl] + $content[mail_template] $content[content] diff --git a/templates/de/html/admin/admin_admins_mails_list_row.tpl b/templates/de/html/admin/admin_admins_mails_list_row.tpl index 3d129db860..5a8d805766 100644 --- a/templates/de/html/admin/admin_admins_mails_list_row.tpl +++ b/templates/de/html/admin/admin_admins_mails_list_row.tpl @@ -1,9 +1,9 @@ - + - $content[tpl] + $content[mail_template] $content[alnk] -- 2.39.5