* svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
+ * Copyright (c) 2009, 2010 by Mailer Developer Team *
* For more information visit: http://www.mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
// Some security stuff...
if ((!defined('__SECURITY')) || (!isAdmin())) {
die();
-}
+} // END - if
// Add description as navigation point
addMenuDescription('admin', __FILE__);
-if (isPostRequestElementSet('edit')) {
+if (isFormSent('edit')) {
// Check if entires are checked
- if (countPostSelection() > 0) {
+ if (ifPostContainsSelections()) {
// Add option for events
$adminsList = generateOptionList('admins', 'id', 'login', '', 'email');
- $SW = 2; $rowNameS = '';
- foreach (postRequestElement('sel') as $template => $sel) {
+ $rows = '';
+ foreach (postRequestParameter('sel') as $template => $sel) {
// First of all load data from DB
- $result = SQL_QUERY_ESC("SELECT `admin_id`, `id`, `mail_template` 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';
+ $adminId2 = '0'; $id = '0';
while ($content = SQL_FETCHARRAY($result)) {
- // @TODO Can this be rewritten???
- $OUT .= "<select name=\"admin_id[".$content['id']."]\" size=\"1\" class=\"admin_select\">
-<option value=\"0\"";
+ // @TODO Can this be rewritten to an API function?
+ $OUT .= '<select name="admin_id[' . $content['id'] . ']" size="1" class="admin_select">
+<option value="0"';
if ($content['admin_id'] == '0') $OUT .= ' selected="selected"';
- $OUT .=">{--ADMINS_ALL_ADMINS--}</option>\n";
+ $OUT .= '>{--ADMINS_ALL_ADMINS--}</option>';
if (isExtensionActive('events')) {
- $OUT .= "<option value=\"-1\"";
+ $OUT .= '<option value="-1"';
if ($content['admin_id'] == '-1') $OUT .= ' selected="selected"';
- $OUT .= ">{--ADMINS_TO_USER_EVENTS--}</option>\n";
+ $OUT .= '>{--ADMINS_TO_USER_EVENTS--}</option>';
}
$OUT .= generateOptionList('admins', 'id', 'login', $content['admin_id'], 'email');
- $OUT .= "</select>\n<br />\n";
+ $OUT .= '</select>';
// Transfer ids
$adminId2 = $content['admin_id'];
- $id2 = $content['id'];
+ $id = $content['id'];
} // END - while
// Free memory
SQL_FREERESULT($result);
// Prepare content
- $content['sw'] = $SW;
- $content['admins'] = $adminsList;
+ $content['id'] = $id;
+ $content['mail_template'] = $template;
+ $content['admins'] = $adminsList;
if ($adminId2 > 0) {
// Add form for an additional admin
$content['content'] = $OUT;
// Start outputing line
- $rowNameS .= loadTemplate('admin_admins_mails_edit_row', true, $content);
- $SW = 3 - $SW;
- }
+ $rows .= loadTemplate('admin_admins_mails_edit_row', true, $content);
+ } // END - foreach
// Edit checked entries
- loadTemplate('admin_admins_mails_edit', false, $rowNameS);
+ loadTemplate('admin_admins_mails_edit', false, $rows);
} else {
// Nothing selected
- loadTemplate('admin_settings_saved', false, getMessage('ADMINS_NO_MAIL_CHECKED'));
+ loadTemplate('admin_settings_saved', false, '{--ADMINS_NO_MAIL_CHECKED--}');
}
} else {
// Load all assigned mails
m.admin_id ASC,
m.mail_template ASC", __FILE__, __LINE__);
- if (SQL_NUMROWS($result) > 0) {
+ if (!SQL_HASZERONUMS($result)) {
// Shall I change entries?
- if (isPostRequestElementSet('change')) {
+ if (isFormSent('change')) {
// Init SQLs
initSqls();
// Ok, update database
- foreach (postRequestElement('admin_id') as $id => $content['admin_id']) {
+ foreach (postRequestParameter('admin_id') as $id => $content['admin_id']) {
// Secure ids
$id = bigintval($id);
$content['admin_id'] = bigintval($content['admin_id']);
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) && (isPostRequestElementSet('template', $id))) {
+ if (($content['admin_id'] < 1) && (isPostRequestParameterSet('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(postRequestElement('template', $id), $id), __FILE__, __LINE__, false));
+ array(postRequestParameter('template', $id), $id), __FILE__, __LINE__, false));
} // END - if
- if (postRequestElement('admin_new', postRequestElement('template', $id)) > 0) {
+ if (postRequestParameter('admin_new', postRequestParameter('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'], postRequestElement('template', $id)), __FILE__, __LINE__, false));
+ array($content['admin_id'], postRequestParameter('template', $id)), __FILE__, __LINE__, false));
} // END - if
} // END - foreach
} // END - if
// List found entries
- $OUT = ''; $SW = 2;
+ $OUT = '';
while ($content = SQL_FETCHARRAY($result)) {
- // Prepare content
- $content['sw'] = $SW;
- $content['alnk'] = generateAdminLink($content['admin_id']);
-
// Load row template
$OUT .= loadTemplate('admin_admins_mails_list_row', true, $content);
- $SW = 3 - $SW;
} // END - while
// Free result
loadTemplate('admin_admins_mails_list', false, $OUT);
} else {
// No entries found
- loadTemplate('admin_settings_saved', false, getMessage('ADMINS_MAILS_NO_ENTRIES'));
+ loadTemplate('admin_settings_saved', false, '{--ADMINS_MAILS_NO_ENTRIES--}');
}
}