* $Author:: $ *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
- * Copyright (c) 2009, 2010 by Mailer Developer Team *
+ * Copyright (c) 2009 - 2011 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__);
+addYouAreHereLink('admin', __FILE__);
// Do we edit/delete/change main menus or sub menus?
$AND = "(`what` = '' OR `what` IS NULL)"; $subMenu = '';
$content['sub'] = $subMenu;
$content['chk'] = countPostSelection();
- $cnt = '0'; $OUT = '';
+ $count = '0'; $OUT = '';
foreach (postRequestParameter('sel') as $sel => $confirm) {
if ($confirm == 1) {
- $cnt++;
+ $count++;
$result = SQL_QUERY_ESC("SELECT `title`, `action`, `what` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE ".$AND." AND `id`=%s LIMIT 1",
array(bigintval($sel)), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Prepapre content
$DATA = array(
- 'cnt' => $cnt,
+ 'cnt' => $count,
'sel' => $sel,
'action' => adminAddMenuSelectionBox('guest', 'action', 'sel_action[' . $sel . ']', $DATA['action']),
'what' => adminAddMenuSelectionBox('guest', 'what' , 'sel_what[' . $sel . ']', $DATA['what']),
} // END - foreach
$content['rows'] = $OUT;
- $content['cnt'] = $cnt;
+ $content['cnt'] = $count;
// Load template
loadTemplate('admin_edit_guest_menu_form', false, $content);
$content['sub'] = $subMenu;
$content['chk'] = countPostSelection();
- $cnt = '0';
+ $count = '0';
$OUT = '';
foreach (postRequestParameter('sel') as $sel => $confirm) {
if ($confirm == 1) {
- $cnt++;
+ $count++;
$result = SQL_QUERY_ESC("SELECT `title` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE ".$AND." AND `id`=%s LIMIT 1",
array(bigintval($sel)), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Entry found so we load the stuff...
$DATA = SQL_FETCHARRAY($result);
$DATA = array(
- 'cnt' => $cnt,
+ 'cnt' => $count,
'menu' => $DATA['title'],
'sel' => $sel,
);
} // END - if
} // END - foreach
$content['rows'] = $OUT;
- $content['cnt'] = $cnt;
+ $content['cnt'] = $count;
// Load template
loadTemplate('admin_delete_guest_menu', false, $content);
$content['chk'] = countPostSelection();
// Load template
- $cnt = '0'; $OUT = '';
+ $count = '0'; $OUT = '';
foreach (postRequestParameter('sel') as $sel => $confirm) {
if ($confirm == 1) {
- $cnt++;
+ $count++;
$result = SQL_QUERY_ESC("SELECT `title`, `visible`, `locked` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE ".$AND." AND `id`=%s LIMIT 1",
array(bigintval($sel)), __FILE__, __LINE__);
if (SQL_NUMROWS($result) == 1) {
// Entry found so we load the stuff...
$data = SQL_FETCHARRAY($result);
$data = array(
- 'cnt' => $cnt,
+ 'cnt' => $count,
'menu' => $data['title'],
'sel' => $sel,
'visible' => addSelectionBox('yn', $data['visible'], 'visible', $sel),
SQL_FREERESULT($result);
} // END - if
} // END - foreach
- $content['cnt'] = $cnt;
+ $content['cnt'] = $count;
$content['rows'] = $OUT;
// Load template
adminProcessMenuEditForm('guest', $subMenu);
} else {
// Handle weightning
- doAdminProcessMenuWeightning('guest');
+ doAdminProcessMenuWeightning('guest', $AND);
// By default list menus
if (empty($subMenu)) {
// List only main menus
- $result = SQL_QUERY("SELECT `id`,`action`,`what`,`title`,`sort` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort` ASC", __FILE__, __LINE__);
+ $result = SQL_QUERY("SELECT `id`, `action`, `what`, `title`, `sort` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort` ASC", __FILE__, __LINE__);
} else {
// List sub menus
- $result = SQL_QUERY_ESC("SELECT `id`,`action`,`what`,`title`,`sort` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort` ASC",
+ $result = SQL_QUERY_ESC("SELECT `id`, `action`, `what`, `title`, `sort` FROM `{?_MYSQL_PREFIX?}_guest_menu` WHERE `action`='%s' AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort` ASC",
array($subMenu), __FILE__, __LINE__);
}
// Do we have entries?
- if (SQL_NUMROWS($result) > 0) {
+ if (!SQL_HASZERONUMS($result)) {
// Set sub value
$content['sub'] = $subMenu;
// Init variables
- $cnt = '0';
+ $count = '0';
$OUT = '';
// Process all menu entries
while ($data = SQL_FETCHARRAY($result)) {
- $cnt++;
+ $count++;
if (($data['sort'] == '0') || (($data['sort'] == 1) && (!empty($subMenu)))) {
// Is highest position
$NAVI = '<a href="{%url=modules.php?module=admin&what=guestedit&sub=' . $content['sub'] . '&act=' . $data['action'] . '&w=' . $data['what'] . '&tid=' . ($data['sort']+1) . '&fid=' . $data['sort'] . '%}">{--LOWER--}</a>';
- } elseif ($cnt == SQL_NUMROWS($result)) {
+ } elseif ($count == SQL_NUMROWS($result)) {
// Is lowest position
$NAVI = '<a href="{%url=modules.php?module=admin&what=guestedit&sub=' . $content['sub'] . '&act=' . $data['action'] . '&w=' . $data['what'] . '&tid=' . ($data['sort']-1) . '&fid=' . $data['sort'] . '%}">{--HIGHER--}</a>';
} elseif ($data['sort'] > 0) {
// Anything else between highest and lowest
- $NAVI = '<a href="{%url=modules.php?module=admin&what=guestedit&sub=' . $content['sub'] . '&act=' . $data['action'] . '&w=' . $data['what'] . '&tid=' . ($data['sort']-1) . '&fid=' . $data['sort'] . '%}">{--HIGHER--}</a>/<a href=\"{%url=modules.php?module=admin&what=guestedit&sub=' . $content['sub'] . '&act=' . $data['action'] . '&w=' . $data['what'] . '&tid=' . ($data['sort']+1) . '&fid=' . $data['sort'] . '%}">{--LOWER--}</a>';
+ $NAVI = '<a href="{%url=modules.php?module=admin&what=guestedit&sub=' . $content['sub'] . '&act=' . $data['action'] . '&w=' . $data['what'] . '&tid=' . ($data['sort']-1) . '&fid=' . $data['sort'] . '%}">{--HIGHER--}</a>|<a href=\"{%url=modules.php?module=admin&what=guestedit&sub=' . $content['sub'] . '&act=' . $data['action'] . '&w=' . $data['what'] . '&tid=' . ($data['sort']+1) . '&fid=' . $data['sort'] . '%}">{--LOWER--}</a>';
}
- if (empty($data['action'])) $data['action'] = ' ';
- if (empty($data['what'])) $data['what'] = ' ';
- if (empty($data['title'])) $data['title'] = ' ';
-
// Prepapre content
$row = array(
'id' => $data['id'],
loadTemplate('admin_edit_guest_menu', false, $content);
} else {
// Menu entries are missing... (???)
- loadTemplate('admin_settings_saved', false, '{--ADMIN_NO_MENUS_FOUND--}');
+ displayMessage('{--ADMIN_NO_MENUS_FOUND--}');
}
}