X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-memedit.php;h=195ae9510a29996efd81a0c897a086a0272c72a5;hb=eb301334eb0960dd060cc0d59e6021260a41f835;hp=d240fc7d6349596bb412307850310f1f7cbeebcd;hpb=b7c28074ad5f8674f59f454f80703b97600897cb;p=mailer.git
diff --git a/inc/modules/admin/what-memedit.php b/inc/modules/admin/what-memedit.php
index d240fc7d63..195ae9510a 100644
--- a/inc/modules/admin/what-memedit.php
+++ b/inc/modules/admin/what-memedit.php
@@ -10,9 +10,14 @@
* -------------------------------------------------------------------- *
* Kurzbeschreibung : Editieren Sie das Menue fuer Ihre Mitglieder *
* -------------------------------------------------------------------- *
- * *
+ * $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 *
+ * Copyright (c) 2003 - 2009 by Roland Haeder *
* For more information visit: http://www.mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -32,300 +37,272 @@
************************************************************************/
// Some security stuff...
-if ((ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) || (!IS_ADMIN()))
-{
- $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
- require($INC);
-}
+if ((!defined('__SECURITY')) || (!isAdmin())) {
+ die();
+} // END - if
+
// Add description as navigation point
-ADD_DESCR("admin", basename(__FILE__));
+addMenuDescription('admin', __FILE__);
// Do we edit/delete/change main menus or sub menus?
-$AND = "what = ''"; $SUB = "";
+$AND = "(`what` = '' OR `what` IS NULL)"; $SUB = '';
-if (!empty($_GET['sub']))
-{
- $AND = sprintf("action='%s'", SQL_ESCAPE($_GET['sub']));
- $SUB = SQL_ESCAPE($_GET['sub']);
-}
+if (isGetRequestElementSet('sub')) {
+ $AND = sprintf("`action`='%s' AND `what` IS NOT NULL", getRequestElement('sub'));
+ $SUB = getRequestElement('sub');
+} // END - if
// Get count of (maybe) selected menu points
$chk = 0;
-if (!empty($_POST['sel'])) $chk = SELECTION_COUNT($_POST['sel']);
+if (isPostRequestElementSet('sel')) $chk = countPostSelection();
-OPEN_TABLE("100%", "admin_content admin_content_align", "");
// List all menu points and make them editable
-OUTPUT_HTML("
-
");
-if ((isset($_POST['edit'])) && ($chk > 0) && (!IS_DEMO()))
-{
+if ((isPostRequestElementSet('edit')) && ($chk > 0) && (!isDemoModeActive())) {
// Edit menu entries
- define('__SUB_VALUE', $SUB);
- define('__CHK_VALUE', $chk);
- $SW = 2; $cnt = 0; $OUT = "";
- foreach ($_POST['sel'] as $sel=>$confirm)
- {
- if ($confirm == 1)
- {
+ $content['sub'] = $SUB;
+ $content['chk'] = $chk;
+ $SW = 2; $cnt = 0; $OUT = '';
+ foreach (postRequestElement('sel') as $sel => $confirm) {
+ if ($confirm == 1) {
$cnt++;
- $result = SQL_QUERY_ESC("SELECT title, action, what, descr FROM "._MYSQL_PREFIX."_member_menu WHERE ".$AND." AND id=%d LIMIT 1",
- array(bigintval($sel)), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1)
- {
+ $result = SQL_QUERY_ESC("SELECT `title`, `action`, `what` FROM `{?_MYSQL_PREFIX?}_member_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...
- list($menu, $act, $wht, $descr) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
- $content = array(
+ $data = SQL_FETCHARRAY($result);
+ $data = array(
'cnt' => $cnt,
'sel' => $sel,
- 'menu' => $menu,
+ 'menu' => $data['title'],
'sw' => $SW,
- 'act' => ADMIN_MAKE_MENU_SELECTION("member", "act", "sel_act[".$sel."]", $act),
- 'what' => ADMIN_MAKE_MENU_SELECTION("member", "what", "sel_what[".$sel."]", $wht),
+ 'act' => adminAddMenuSelectionBox('member', 'act' , 'sel_act[' . $sel . ']', $data['action']),
+ 'what' => adminAddMenuSelectionBox('member', 'what', 'sel_what[' . $sel . ']', $data['what']),
);
+
// Load template
- $OUT .= LOAD_TEMPLATE("admin_mmenu_edit_row", true, $content);
- }
- else
- {
+ $OUT .= loadTemplate('admin_mmenu_edit_row', true, $data);
+ } else {
// Entry not found?
- $content = array(
+ $data = array(
'sw' => $SW,
'sel' => $sel
);
- $OUT .= LOAD_TEMPLATE("admin_menu_404_row", true, $content);
+
+ // Load template
+ $OUT .= loadTemplate('admin_menu_404_row', true, $data);
}
+ SQL_FREERESULT($result);
$SW = 3 - $SW;
}
}
- define('__MENU_ROWS', $OUT);
- define('__CNT_VALUE', $cnt);
+ $content['rows'] = $OUT;
+ $content['cnt'] = $cnt;
// Load template
- LOAD_TEMPLATE("admin_mmenu_edit");
-}
- elseif ((isset($_POST['del'])) && ($chk > 0) && (!IS_DEMO()))
-{
+ loadTemplate('admin_mmenu_edit', false, $content);
+} elseif ((isPostRequestElementSet('del')) && ($chk > 0) && (!isDemoModeActive())) {
// Del menu entries with or without confirmation
- define('__SUB_VALUE', $SUB);
- define('__CHK_VALUE', $chk);
- $SW = 2; $cnt = 0; $OUT = "";
- foreach ($_POST['sel'] as $sel=>$confirm)
- {
- if ($confirm == 1)
- {
+ $content['sub'] = $SUB;
+ $content['chk'] = $chk;
+ $SW = 2; $cnt = 0; $OUT = '';
+ foreach (postRequestElement('sel') as $sel => $confirm) {
+ if ($confirm == 1) {
$cnt++;
- $result = SQL_QUERY_ESC("SELECT title FROM "._MYSQL_PREFIX."_member_menu WHERE ".$AND." AND id=%d LIMIT 1",
- array(bigintval($sel)), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1)
- {
+ $result = SQL_QUERY_ESC("SELECT `title` FROM `{?_MYSQL_PREFIX?}_member_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...
list($title) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
$content = array(
'cnt' => $cnt,
'sel' => $sel,
'title' => $title
);
- $OUT .= LOAD_TEMPLATE("admin_mmenu_delete_row", true, $content);
- }
- else
- {
+
+ // Load template
+ $OUT .= loadTemplate('admin_mmenu_delete_row', true, $content);
+ } else {
// Entry not found?
$content = array(
'sw' => $SW,
'sel' => $sel
);
- $OUT .= LOAD_TEMPLATE("admin_menu_404_row", true, $content);
+
+ // Load template
+ $OUT .= loadTemplate('admin_menu_404_row', true, $content);
}
- }
- }
- define('__MENU_ROWS', $OUT);
- define('__CNT_VALUE', $cnt);
+ SQL_FREERESULT($result);
+ } // END - if
+ } // END - foreach
+ $content['rows'] = $OUT;
+ $content['cnt'] = $cnt;
// Load template
- LOAD_TEMPLATE("admin_mmenu_delete");
-}
- elseif ((isset($_POST['status'])) && ($chk > 0) && (!IS_DEMO()))
-{
+ loadTemplate('admin_mmenu_delete', false, $content);
+} elseif ((isPostRequestElementSet('status')) && ($chk > 0) && (!isDemoModeActive())) {
// Change status (visible / locked)
- define('__SUB_VALUE', $SUB);
- define('__CHK_VALUE', $chk);
- $SW = 2; $cnt = 0; $OUT = "";
- foreach ($_POST['sel'] as $sel=>$confirm)
- {
- if ($confirm == 1)
- {
+ $content['sub'] = $SUB;
+ $content['chk'] = $chk;
+ $SW = 2; $cnt = 0; $OUT = '';
+ foreach (postRequestElement('sel') as $sel => $confirm) {
+ if ($confirm == 1) {
$cnt++;
- $result = SQL_QUERY_ESC("SELECT title, visible, locked FROM "._MYSQL_PREFIX."_member_menu WHERE ".$AND." AND id=%d LIMIT 1",
- array(bigintval($sel)), __FILE__, __LINE__);
- if (SQL_NUMROWS($result) == 1)
- {
+ $result = SQL_QUERY_ESC("SELECT `title`, `visible`, `locked` FROM `{?_MYSQL_PREFIX?}_member_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...
- list($menu, $vis, $locked) = SQL_FETCHROW($result);
- SQL_FREERESULT($result);
- $content = array(
+ $data = SQL_FETCHARRAY($result);
+ $data = array(
'cnt' => $cnt,
- 'menu' => $menu,
+ 'menu' => $data['title'],
'sel' => $sel,
'sw' => $SW,
- 'visible' => ADD_SELECTION("yn", $vis , "visible", $sel),
- 'locked' => ADD_SELECTION("yn", $locked, "locked" , $sel),
+ 'visible' => addSelectionBox('yn', $data['visible'], 'visible', $sel),
+ 'locked' => addSelectionBox('yn', $data['locked'] , 'locked' , $sel),
);
// Load template
- $OUT .= LOAD_TEMPLATE("admin_menu_status_row", true, $content);
- }
- else
- {
+ $OUT .= loadTemplate('admin_menu_status_row', true, $data);
+ } else {
// Entry not found?
- $content = array(
+ $data = array(
'sw' => $SW,
'sel' => $sel
);
- $OUT .= LOAD_TEMPLATE("admin_menu_404_row", true, $content);
+
+ // Load template
+ $OUT .= loadTemplate('admin_menu_404_row', true, $data);
}
+ SQL_FREERESULT($result);
$SW = 3 - $SW;
- }
- }
- define('__MENU_ROWS', $OUT);
- define('__CNT_VALUE', $cnt);
- //
- LOAD_TEMPLATE("admin_mmenu_status");
-}
- elseif ((isset($_POST['ok'])) && (!IS_DEMO()))
-{
+ } // END - if
+ } // END - foreach
+ $content['rows'] = $OUT;
+ $content['cnt'] = $cnt;
+
+ // Load template
+ loadTemplate('admin_mmenu_status', false, $content);
+} elseif ((isFormSent()) && (!isDemoModeActive())) {
// An act is done...
- foreach ($_POST['sel'] as $sel=>$menu)
- {
- $AND = "what = ''";
+ foreach (postRequestElement('sel') as $sel => $menu) {
+ $AND = "(`what` = '' OR `what` IS NULL)";
$sel = bigintval($sel);
- if (!empty($SUB)) $AND = "action='".$SUB."'";
- switch ($_POST['ok'])
- {
- case "edit": // Edit menu
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_member_menu SET title='%s', action='%s', what='%s', descr='%s' WHERE ".$AND." AND id=%d LIMIT 1",
- array($menu, $_POST['sel_act'][$sel], $_POST['sel_what'][$sel], $_POST['sel_descr'][$sel], $sel), __FILE__, __LINE__);
- break;
+ if (!empty($SUB)) $AND = "`action`='".$SUB."'";
+ switch (postRequestElement('ok')) {
+ case 'edit': // Edit menu
+ SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `title`='%s', `action`='%s', `what`='%s' WHERE ".$AND." AND `id`=%s LIMIT 1",
+ array($menu, postRequestElement('sel_act', $sel), postRequestElement('sel_what', $sel), $sel), __FILE__, __LINE__);
+ break;
- case "del": // Delete menu
- $result = SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM "._MYSQL_PREFIX."_member_menu WHERE ".$AND." AND id=%d LIMIT 1",
- array($sel), __FILE__, __LINE__);
- break;
+ case 'del': // Delete menu
+ SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE ".$AND." AND `id`=%s LIMIT 1",
+ array($sel), __FILE__, __LINE__);
+ break;
- case "status": // Change status of menus
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_member_menu SET visible='%s', locked='%s' WHERE ".$AND." AND id=%d LIMIT 1",
- array($_POST['visible'][$sel], $_POST['locked'][$sel], $sel), __FILE__, __LINE__);
- break;
- }
+ case 'status': // Change status of menus
+ SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `visible`='%s', `locked`='%s' WHERE ".$AND." AND `id`=%s LIMIT 1",
+ array(postRequestElement('visible', $sel), postRequestElement('locked', $sel), $sel), __FILE__, __LINE__);
+ break;
+ } // END - switch
break;
- }
+ } // END - foreach
// Load template
- LOAD_TEMPLATE("admin_data_saved");
-}
- else
-{
- if ((!empty($_GET['act'])) && (!empty($_GET['tid'])) && (!empty($_GET['fid'])))
- {
+ loadTemplate('admin_settings_saved', false, getMessage('SETTINGS_SAVED'));
+} else {
+ if ((isGetRequestElementSet('act')) && (isGetRequestElementSet('tid')) && (isGetRequestElementSet('fid'))) {
+ // Init
+ $tid = ''; $fid = '';
+
// Get IDs
- if (!empty($_GET['w']))
- {
+ if (isGetRequestElementSet('w')) {
// Sub menus selected
- $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_member_menu WHERE action='%s' AND sort='%s' LIMIT 1",
- array(bigintval($_GET['act']), bigintval($_GET['tid'])), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
+ array(bigintval(getRequestElement('act')), bigintval(getRequestElement('tid'))), __FILE__, __LINE__);
list($tid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_member_menu WHERE action='%s' AND sort='%s' LIMIT 1",
- array(bigintval($_GET['act']), bigintval($_GET['fid'])), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE `action`='%s' AND `sort`='%s' LIMIT 1",
+ array(bigintval(getRequestElement('act')), bigintval(getRequestElement('fid'))), __FILE__, __LINE__);
list($fid) = SQL_FETCHROW($result);
SQL_FREERESULT($result);
- }
- else
- {
+ } else {
// Main menu selected
- $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_member_menu WHERE (what='' OR what IS NULL) AND sort='%s' LIMIT 1",
- array(bigintval($_GET['tid'])), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
+ array(bigintval(getRequestElement('tid'))), __FILE__, __LINE__);
list($tid) = SQL_FETCHROW($result);
- $result = SQL_QUERY_ESC("SELECT id FROM "._MYSQL_PREFIX."_member_menu WHERE (what='' OR what IS NULL) AND sort='%s' LIMIT 1",
- array(bigintval($_GET['fid'])), __FILE__, __LINE__);
+ $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE (`what`='' OR `what` IS NULL) AND `sort`='%s' LIMIT 1",
+ array(bigintval(getRequestElement('fid'))), __FILE__, __LINE__);
list($fid) = SQL_FETCHROW($result);
}
- if ((!empty($tid)) && (!empty($fid)))
- {
+ if ((!empty($tid)) && (!empty($fid))) {
// Sort menu
- $result_sort = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_member_menu SET sort='%s' WHERE ".$AND." AND id=%d LIMIT 1",
- array(bigintval($_GET['tid']), bigintval($fid)), __FILE__, __LINE__);
- $result_sort = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_member_menu SET sort='%s' WHERE ".$AND." AND id=%d LIMIT 1",
- array(bigintval($_GET['fid']), bigintval($tid)), __FILE__, __LINE__);
- }
+ SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `sort`='%s' WHERE ".$AND." AND id=%s LIMIT 1",
+ array(bigintval(getRequestElement('tid')), bigintval($fid)), __FILE__, __LINE__);
+ SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_member_menu` SET `sort`='%s' WHERE ".$AND." AND id=%s LIMIT 1",
+ array(bigintval(getRequestElement('fid')), bigintval($tid)), __FILE__, __LINE__);
+ } // END - -fi
}
- if (!empty($SUB))
- {
+ if (!empty($SUB)) {
// Edit sub menus
- $result = SQL_QUERY("SELECT id, action, what, title, sort FROM "._MYSQL_PREFIX."_member_menu WHERE ".$AND." AND what != '' ORDER BY sort ASC", __FILE__, __LINE__);
- }
- else
- {
+ $result = SQL_QUERY("SELECT `id`, `action`, `what`, `title`, `sort` FROM `{?_MYSQL_PREFIX?}_member_menu` WHERE ".$AND." AND `what` != '' AND `what` IS NOT NULL ORDER BY `sort` ASC", __FILE__, __LINE__);
+ } else {
// Edit main menus
- $result = SQL_QUERY("SELECT id, action, what, title, sort FROM "._MYSQL_PREFIX."_member_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?}_member_menu` WHERE (`what`='' OR `what` IS NULL) ORDER BY `sort` ASC", __FILE__, __LINE__);
}
+
+ // Get total menu entries
$max = SQL_NUMROWS($result);
- if ($max > 0)
- {
- $SUB = "";
- if (!empty($SUB)) $SUB = $SUB;
- define('__SUB_VALUE', $SUB);
- $SW = 2; $cnt = 0; $OUT = "";
- while (list($id, $act, $wht, $title, $sort) = SQL_FETCHROW($result))
- {
+ // Some are there?
+ if ($max > 0) {
+ // Set sub value
+ $content['sub'] = $SUB;
+
+ $SW = 2; $cnt = 0; $OUT = '';
+ while ($data = SQL_FETCHARRAY($result)) {
+ // Init navigation
+ $data['navi'] = '';
$cnt++;
- if (($sort == 0) || (($sort == 1) && (!empty($SUB))))
- {
+ if (($data['sort'] == 0) || (($data['sort'] == 1) && (!empty($SUB)))) {
// Is highest position
- $NAVI = "
".LOWER."";
- }
- elseif ($cnt == $max)
- {
+ $data['navi'] = "
{--LOWER--}";
+ } elseif ($cnt == $max) {
// Is lowest position
- $NAVI = "
".HIGHER."";
- }
- elseif ($sort > 0)
- {
+ $data['navi'] = "
{--HIGHER--}";
+ } elseif ($data['sort'] > 0) {
// Anything else between highest and lowest
- $NAVI = "
".HIGHER."/
".LOWER."";
+ $data['navi'] = "
{--HIGHER--}/
{--LOWER--}";
}
- if (empty($act)) $act = " ";
- if (empty($wht)) $wht = " ";
- if (empty($title)) $title = " ";
- $content = array(
- 'sw' => $SW,
- 'id' => $id,
- 'action' => $act,
- 'what' => $wht,
- 'title' => $title,
- 'navi' => $NAVI,
- 'mode' => "mem",
- );
- $OUT .= LOAD_TEMPLATE("admin_menu_overview_row", true, $content);
+
+ // Fix empty values for Firefox
+ if (empty($data['action'])) $data['action'] = ' ';
+ if (empty($data['what'])) $data['what'] = ' ';
+ if (empty($data['title'])) $data['title'] = ' ';
+
+ // Add more entries
+ $data['sw'] = $SW;
+ $data['mode'] = 'mem';
+
+ // Load row template and switch color
+ $OUT .= loadTemplate('admin_menu_overview_row', true, $data);
$SW = 3 - $SW;
}
// Free memory
SQL_FREERESULT($result);
- define('__MENU_ROWS', $OUT);
- LOAD_TEMPLATE("admin_mmenu_overview");
- }
- else
- {
+
+ // Remember rows in array
+ $content['rows'] = $OUT;
+
+ // Load main template
+ loadTemplate('admin_mmenu_overview', false, $content);
+ } else {
// Menu entries are missing... (???)
- LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_NO_MENUS_FOUND);
+ loadTemplate('admin_settings_saved', false, getMessage('ADMIN_NO_MENUS_FOUND'));
}
}
-OUTPUT_HTML("
");
-CLOSE_TABLE();
-//
+
+// [EOF]
?>