Fix for missing array element 'userid', see ticket #205, thanks to piter01
[mailer.git] / inc / modules / admin / what-edit_emails.php
index a4d49bed3694f6a242d5dedc2985e6a09b58b598..fdfe3c8bc03dff42e81d8e043acbb0304ed65ac0 100644 (file)
 // Some security stuff...
 if ((!defined('__SECURITY')) || (!isAdmin())) {
        die();
-}
+} // END - if
 
 // Add description as navigation point
-addMenuDescription('admin', __FILE__);
+addYouAreHereLink('admin', __FILE__);
 
 if ((isFormSent()) && (!isPostRequestParameterSet('id'))) {
        unsetPostRequestParameter('ok');
@@ -51,7 +51,7 @@ if ((isFormSent()) && (!isPostRequestParameterSet('id'))) {
 
 // Query the pool
 $result = SQL_QUERY('SELECT
-       `id`, `sender`, `subject`, `payment_id`, `cat_id`
+       `id`, `sender` AS `userid`, `subject`, `payment_id`, `cat_id`
 FROM
        `{?_MYSQL_PREFIX?}_pool`
 ORDER BY
@@ -61,7 +61,7 @@ ORDER BY
 if (!SQL_HASZERONUMS($result)) {
        if (isFormSent()) {
                // Make mail editable...
-               $result = SQL_QUERY_ESC("SELECT `id`, `subject`, `text`, `url` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s LIMIT 1",
+               $result = SQL_QUERY_ESC("SELECT `id`, `sender` AS `userid`, `subject`, `text`, `url` FROM `{?_MYSQL_PREFIX?}_pool` WHERE `id`=%s LIMIT 1",
                        array(bigintval(postRequestParameter('id'))), __FILE__, __LINE__);
 
                // Fetch row
@@ -71,7 +71,7 @@ if (!SQL_HASZERONUMS($result)) {
                SQL_FREERESULT($result);
 
                // Load template
-               loadTemplate('form_submit_email', false, $content);
+               loadTemplate('admin_edit_email', false, $content);
        } elseif (isPostRequestParameterSet('save')) {
                // Save changes
                SQL_QUERY_ESC("UPDATE
@@ -90,7 +90,7 @@ LIMIT 1",
                                bigintval(postRequestParameter('id')),
                        ), __FILE__, __LINE__);
 
-               if (SQL_AFFECTEDROWS() == 1) {
+               if (!SQL_HASZEROAFFECTED()) {
                        $content = '{--SETTINGS_SAVED--}';
                } else {
                        $content = '<span class="notice">{--SETTINGS_NOT_SAVED--}</span>';
@@ -103,14 +103,14 @@ LIMIT 1",
                $OUT = '';
                while ($content = SQL_FETCHARRAY($result)) {
                        // Load row template and switch colors
-                       $OUT .= loadTemplate('form_submit_email_row', true, $content);
+                       $OUT .= loadTemplate('admin_edit_email_row', true, $content);
                } // END - while
 
                // Free memory
                SQL_FREERESULT($result);
 
                // Load email template
-               loadTemplate('form_submit_email_select', false, $OUT);
+               loadTemplate('admin_edit_email_select', false, $OUT);
        }
 } else {
        // No mail orders left in pool