]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-admins_mails.php
Bad things are now 'classified' as bad (CSS class 'bad' is being used instead of...
[mailer.git] / inc / modules / admin / what-admins_mails.php
index 0f4057362294f4c21ba97e3fec6c83a4ebad94bc..39d7f99b38b05d000f2ccaf7f68d2d60002c7dd4 100644 (file)
@@ -16,8 +16,8 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009, 2010 by Mailer Developer Team                    *
- * For more information visit: http://www.mxchange.org                  *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
+ * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
  * it under the terms of the GNU General Public License as published by *
@@ -41,17 +41,16 @@ if ((!defined('__SECURITY')) || (!isAdmin())) {
 } // END - if
 
 // Add description as navigation point
-addMenuDescription('admin', __FILE__);
+addYouAreHereLink('admin', __FILE__);
 
 if (isFormSent('edit')) {
        // Check if entires are checked
        if (ifPostContainsSelections()) {
                // Add option for events
-               $adminsList = generateOptionList('admins', 'id', 'login', '', 'email');
                $rows = '';
-               foreach (postRequestParameter('sel') as $template => $sel) {
+               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` FROM `{?_MYSQL_PREFIX?}_admins_mails` WHERE `mail_template`='%s' ORDER BY `id` ASC",
                                array($template), __FILE__, __LINE__);
                        $OUT = '';
                        $adminId2 = '0'; $id = '0';
@@ -59,13 +58,19 @@ if (isFormSent('edit')) {
                                // @TODO Can this be rewritten to an API function?
                                $OUT .= '<select name="admin_id[' . $content['id'] . ']" size="1" class="form_select">
 <option value="0"';
-                               if ($content['admin_id'] == '0') $OUT .= ' selected="selected"';
-                               $OUT .= '>{--ADMINS_ALL_ADMINS--}</option>';
+                               if (is_null($content['admin_id'])) {
+                                       $OUT .= ' selected="selected"';
+                               } // END - if
+                               $OUT .= '>{--ADMIN_TO_ALL_ADMINS--}</option>';
+
                                if (isExtensionActive('events')) {
                                        $OUT .= '<option value="-1"';
-                                       if ($content['admin_id'] == '-1') $OUT .= ' selected="selected"';
-                                       $OUT .= '>{--ADMINS_TO_USER_EVENTS--}</option>';
-                               }
+                                       if ($content['admin_id'] == '-1') {
+                                               $OUT .= ' selected="selected"';
+                                       } // END - if
+                                       $OUT .= '>{--ADMIN_ADMINS_TO_USER_EVENTS--}</option>';
+                               } // END - if
+
                                $OUT .= generateOptionList('admins', 'id', 'login', $content['admin_id'], 'email');
                                $OUT .= '</select>';
 
@@ -80,7 +85,7 @@ if (isFormSent('edit')) {
                        // Prepare content
                        $content['id']            = $id;
                        $content['mail_template'] = $template;
-                       $content['admins']        = $adminsList;
+                       $content['admins']        = generateOptionList('admins', 'id', 'login', '', 'email');;
 
                        if ($adminId2 > 0) {
                                // Add form for an additional admin
@@ -98,7 +103,7 @@ if (isFormSent('edit')) {
                loadTemplate('admin_admins_mails_edit', false, $rows);
        } else {
                // Nothing selected
-               loadTemplate('admin_settings_saved', false, '{--ADMINS_NO_MAIL_CHECKED--}');
+               displayMessage('{--ADMINS_NO_MAIL_CHECKED--}');
        }
 } else {
        // Load all assigned mails
@@ -118,30 +123,30 @@ ORDER BY
 
        if (!SQL_HASZERONUMS($result)) {
                // Shall I change entries?
-               if (isFormSent('change')) {
+               if (isFormSent('do_edit')) {
                        // Init SQLs
                        initSqls();
 
                        // Ok, update database
-                       foreach (postRequestParameter('admin_id') as $id => $content['admin_id']) {
+                       foreach (postRequestElement('admin_id') as $id => $content['admin_id']) {
                                // Secure ids
                                $id  = bigintval($id);
                                $content['admin_id'] = bigintval($content['admin_id']);
 
                                // Update entry
-                               addSql(SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_admins_mails` SET admin_id=%s WHERE `id`=%s ORDER BY `id` LIMIT 1",
+                               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));
 
-                               if (($content['admin_id'] < 1) && (isPostRequestParameterSet('template', $id))) {
+                               if (($content['admin_id'] < 1) && (isPostRequestElementSet('template', $id))) {
                                        // Remove any other admin entries
                                        addSql(SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_admins_mails` WHERE mail_template='%s' AND id != '%s'",
-                                       array(postRequestParameter('template', $id), $id), __FILE__, __LINE__, false));
+                                       array(postRequestElement('template', $id), $id), __FILE__, __LINE__, false));
                                } // END - if
 
-                               if (postRequestParameter('admin_new', postRequestParameter('template', $id)) > 0) {
+                               if (postRequestElement('admin_new', postRequestElement('template', $id)) > 0) {
                                        // Add new admin
                                        addSql(SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admins_mails` (admin_id, mail_template) VALUES ('%s','%s')",
-                                       array($content['admin_id'], postRequestParameter('template', $id)), __FILE__, __LINE__, false));
+                                       array($content['admin_id'], postRequestElement('template', $id)), __FILE__, __LINE__, false));
                                } // END - if
                        } // END - foreach
 
@@ -178,7 +183,7 @@ ORDER BY
                loadTemplate('admin_admins_mails_list', false, $OUT);
        } else {
                // No entries found
-               loadTemplate('admin_settings_saved', false, '{--ADMINS_MAILS_NO_ENTRIES--}');
+               displayMessage('{--ADMIN_ADMINS_MAILS_NO_ENTRIES--}');
        }
 }