X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-guestedit.php;h=94b1147629524e4abcc9919fd87f001cb2f032e8;hb=a090e351c49fe021fb3064325694da03402332e0;hp=ad43c6961a00096d4d43299c9d1bd8de8d97eb0e;hpb=d8148e3f1f3a6762b2e786dbe99ada269dcf2ea0;p=mailer.git
diff --git a/inc/modules/admin/what-guestedit.php b/inc/modules/admin/what-guestedit.php
index ad43c6961a..94b1147629 100644
--- a/inc/modules/admin/what-guestedit.php
+++ b/inc/modules/admin/what-guestedit.php
@@ -10,7 +10,12 @@
* -------------------------------------------------------------------- *
* Kurzbeschreibung : Menue fuer die Gaeste editieren *
* -------------------------------------------------------------------- *
- * *
+ * $Revision:: $ *
+ * $Date:: $ *
+ * $Tag:: 0.2.1-FINAL $ *
+ * $Author:: $ *
+ * Needs to be in all Files and every File needs "svn propset *
+ * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2008 by Roland Haeder *
* For more information visit: http://www.mxchange.org *
@@ -38,28 +43,28 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
}
// Add description as navigation point
-ADD_DESCR("admin", __FILE__);
+ADD_DESCR('admin', __FILE__);
// Do we edit/delete/change main menus or sub menus?
-$AND = "(`what` = '' OR `what` IS NULL)"; $SUB = "";
+$AND = "(`what` = '' OR `what` IS NULL)"; $SUB = '';
-if (REQUEST_ISSET_GET(('sub'))) {
- $AND = sprintf("action='%s' AND `what` IS NOT NULL", SQL_ESCAPE(REQUEST_GET('sub')));
- $SUB = SQL_ESCAPE(REQUEST_GET('sub'));
+if (REQUEST_ISSET_GET('sub')) {
+ $AND = sprintf("`action`='%s' AND `what` IS NOT NULL", REQUEST_GET('sub'));
+ $SUB = REQUEST_GET('sub');
} // END - if
// Get count of (maybe) selected menu points
$chk = 0;
-if (REQUEST_ISSET_POST(('sel'))) $chk = SELECTION_COUNT(REQUEST_POST('sel'));
+if (REQUEST_ISSET_POST('sel')) $chk = SELECTION_COUNT(REQUEST_POST('sel'));
// List all menu points and make them editable
-if ((REQUEST_ISSET_POST(('edit'))) && ($chk > 0) && (!IS_DEMO()))
+if ((REQUEST_ISSET_POST('edit')) && ($chk > 0) && (!IS_DEMO()))
{
// Edit menu entries
define('__SUB_VALUE', $SUB);
define('__CHK_VALUE', $chk);
- $cnt = 0; $SW = 2; $OUT = "";
+ $cnt = 0; $OUT = ''; $SW = 2;
foreach (REQUEST_POST('sel') as $sel => $confirm)
{
if ($confirm == 1)
@@ -75,8 +80,8 @@ if ((REQUEST_ISSET_POST(('edit'))) && ($chk > 0) && (!IS_DEMO()))
$DATA = array(
'cnt' => $cnt,
'sel' => $sel,
- 'action' => ADMIN_MAKE_MENU_SELECTION("guest", "action", "sel_action[".$sel."]", $act),
- 'what' => ADMIN_MAKE_MENU_SELECTION("guest", "what", "sel_what[".$sel."]", $wht),
+ 'action' => ADMIN_MAKE_MENU_SELECTION('guest', "action", "sel_action[".$sel."]", $act),
+ 'what' => ADMIN_MAKE_MENU_SELECTION('guest', "what", "sel_what[".$sel."]", $wht),
'menu' => $menu,
'sw' => $SW,
);
@@ -99,12 +104,12 @@ if ((REQUEST_ISSET_POST(('edit'))) && ($chk > 0) && (!IS_DEMO()))
// Load template
LOAD_TEMPLATE("admin_gmenu_edit_form");
-} elseif ((REQUEST_ISSET_POST(('del'))) && (!IS_DEMO())) {
+} elseif ((REQUEST_ISSET_POST('del')) && (!IS_DEMO())) {
// Del menu entries with or without confirmation
define('__SUB_VALUE', $SUB);
define('__CHK_VALUE', $chk);
- $cnt = 0; $OUT = ""; $SW = 2;
+ $cnt = 0; $OUT = ''; $SW = 2;
foreach (REQUEST_POST('sel') as $sel => $confirm) {
if ($confirm == 1) {
$cnt++;
@@ -150,7 +155,7 @@ if ((REQUEST_ISSET_POST(('edit'))) && ($chk > 0) && (!IS_DEMO()))
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET `title`='%s', `action`='%s', `what`='%s' WHERE ".$AND." AND id=%s LIMIT 1",
array($menu, REQUEST_POST('sel_action', $sel), REQUEST_POST('sel_what', $sel), $sel),__FILE__, __LINE__);
}
- LOAD_TEMPLATE("admin_settings_saved", false, getMessage('SETTINGS_SAVED'));
+ LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
break;
case "del": // Delete menu
@@ -159,7 +164,7 @@ if ((REQUEST_ISSET_POST(('edit'))) && ($chk > 0) && (!IS_DEMO()))
SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE ".$AND." AND id=%s LIMIT 1",
array(bigintval($sel)), __FILE__, __LINE__);
}
- LOAD_TEMPLATE("admin_settings_saved", false, getMessage('SETTINGS_SAVED'));
+ LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
break;
case "status": // Change access levels
@@ -171,7 +176,7 @@ if ((REQUEST_ISSET_POST(('edit'))) && ($chk > 0) && (!IS_DEMO()))
SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_guest_menu` SET `visible`='%s', `locked`='%s' WHERE ".$AND." AND id=%s LIMIT 1",
array(REQUEST_POST('visible', $sel), REQUEST_POST('locked', $sel), $sel), __FILE__, __LINE__);
}
- LOAD_TEMPLATE("admin_settings_saved", false, getMessage('SETTINGS_SAVED'));
+ LOAD_TEMPLATE('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
break;
default: // Unexpected action
@@ -186,7 +191,7 @@ if ((REQUEST_ISSET_POST(('edit'))) && ($chk > 0) && (!IS_DEMO()))
define('__CHK_VALUE', $chk);
// Load template
- $SW = 2; $cnt = 0; $OUT = "";
+ $SW = 2; $cnt = 0; $OUT = '';
foreach (REQUEST_POST('sel') as $sel => $confirm)
{
if ($confirm == 1)
@@ -243,11 +248,11 @@ if ((REQUEST_ISSET_POST(('edit'))) && ($chk > 0) && (!IS_DEMO()))
SQL_FREERESULT($result);
} else {
// Main menu selected
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE (what='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
array(bigintval(REQUEST_GET('tid'))), __FILE__, __LINE__);
list($tid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE (what='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
+ $result = SQL_QUERY_ESC("SELECT id FROM `{!_MYSQL_PREFIX!}_guest_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
array(bigintval(REQUEST_GET('fid'))), __FILE__, __LINE__);
list($fid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
@@ -265,48 +270,51 @@ if ((REQUEST_ISSET_POST(('edit'))) && ($chk > 0) && (!IS_DEMO()))
// By default list menus
if (empty($SUB)) {
// 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",
- array($SUB), __FILE__, __LINE__);
+ $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($SUB), __FILE__, __LINE__);
}
// Get number of menu entries
$max = SQL_NUMROWS($result);
if ($max > 0) {
// Set sub value
+ // @TODO Rewrite this constant
define('__SUB_VALUE', $SUB);
// Init variables
$SW = 2;
$cnt = 0;
- $OUT = "";
+ $OUT = '';
- while (list($id, $act, $wht, $title, $sort) = SQL_FETCHROW($result)) {
+ // Process all menu entries
+ while ($content = SQL_FETCHARRAY($result)) {
$cnt++;
- if (($sort == 0) || (($sort == 1) && (!empty($SUB)))) {
+ if (($content['sort'] == 0) || (($content['sort'] == 1) && (!empty($SUB)))) {
// Is highest position
- $NAVI = "{--LOWER--}";
+ $NAVI = "{--LOWER--}";
} elseif ($cnt == $max) {
// Is lowest position
- $NAVI = "{--HIGHER--}";
- } elseif ($sort > 0) {
+ $NAVI = "{--HIGHER--}";
+ } elseif ($content['sort'] > 0) {
// Anything else between highest and lowest
- $NAVI = "{--HIGHER--}/{--LOWER--}";
+ $NAVI = "{--HIGHER--}/{--LOWER--}";
}
- if (empty($act)) $act = " ";
- if (empty($wht)) $wht = " ";
- if (empty($title)) $title = " ";
+ if (empty($content['action'])) $content['action'] = " ";
+ if (empty($content['what'])) $content['what'] = " ";
+ if (empty($content['title'])) $content['title'] = " ";
+
$content = array(
'sw' => $SW,
- 'id' => $id,
- 'action' => $act,
- 'what' => $wht,
- 'title' => $title,
+ 'id' => $content['id'],
+ 'action' => $content['action'],
+ 'what' => $content['what'],
+ 'title' => $content['title'],
'navi' => $NAVI,
- 'mode' => "guest"
+ 'mode' => 'guest'
);
$OUT .= LOAD_TEMPLATE("admin_menu_overview_row", true, $content);
$SW = 3 - $SW;
@@ -320,7 +328,7 @@ if ((REQUEST_ISSET_POST(('edit'))) && ($chk > 0) && (!IS_DEMO()))
LOAD_TEMPLATE("admin_gmenu_edit");
} else {
// Menu entries are missing... (???)
- LOAD_TEMPLATE("admin_settings_saved", false, getMessage('ADMIN_NO_MENUS_FOUND'));
+ LOAD_TEMPLATE('admin_settings_saved', false, getMessage('ADMIN_NO_MENUS_FOUND'));
}
}