-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMenuSetup.php
111 lines (98 loc) · 3.35 KB
/
MenuSetup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
/*******************************************************************************
*
* filename : MenuEditor.php
* last change : 2007-06-28
* website : http://www.churchdb.org
* copyright : Copyright 2007 Frederick To
*
* InfoCentral is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
******************************************************************************/
//Include the function library
require "Include/Config.php";
require "Include/Functions.php";
// Security: User must have Manage Groups permission
if (!$_SESSION['bAdmin'])
{
Redirect("Menu.php");
exit;
}
//Set the page title
$sPageTitle = gettext("Menu Item Editor");
function Start_Menu($menu) {
echo "Menu $menu<br>";
GetMenu($menu, 0);
}
function GetMenu($menu, $plvl) {
global $cnInfoCentral;
$query = "SELECT mid, name, ismenu, content, uri, statustext, session_var, session_var_in_text, session_var_in_uri, url_parm_name, security_grp, active FROM menuconfig_mcf WHERE parent = '$menu' ORDER BY sortorder";
$rsMenu = mysql_query($query, $cnInfoCentral);
$item_cnt = mysql_num_rows($rsMenu);
$idx = 1;
$ptr = 1;
$lvl = $plvl + 1;
while ($aRow = mysql_fetch_array($rsMenu)) {
GetMenuItem($aRow, $idx, $lvl);
if ($ptr < $item_cnt) {
$idx++;
}
$ptr++;
}
}
function GetMenuItem($aMenu,$mIdx,$lvl) {
global $sRootPath, $sRowClass;
$sRowClass = AlternateRowStyle($sRowClass);
$link = ($aMenu['uri'] == "") ? " " : $sRootPath."/".$aMenu['uri'];
$text = $aMenu['statustext'];
if (!is_null($aMenu['session_var'])) {
if (($link > "") & ($aMenu['session_var_in_uri'])) {
if (strstr($link, "?")&&true) {
$cConnector = "&";
} else {
$cConnector = "?";
}
$link .= $cConnector.$aMenu['url_parm_name']."=$"."_SESSION[".$aMenu['session_var']."]";
}
if (($text > "") & ($aMenu['session_var_in_text'])) {
$text .= " ".$_SESSION[$aMenu['session_var']];
}
}
$sContent = $aMenu['content'];
if (strlen($sContent) < 1) {
$sContent = "{".$aMenu['name']."}";
}
if ($aMenu['active']) {
$sContent .= " (".gettext("Active").")";
} else {
$sContent .= " (".gettext("Inactive").")";
}
if (strlen($sContent) < 1) {
$sContent = "{".$aMenu['name']."}";
}
echo "<tr class=\"$sRowClass\"><td>".str_repeat(" ",$lvl*3).$sContent."</td>"
."<td>".$link."</td>";
echo "<td><a class=\"smallText\" href=\"MenuEditor.php?mid=" . $aMenu['mid'] . "\">" . gettext("Edit") . "</a></td>";
echo "<td> <a class=\"smallText\" href=\"MenuEditor.php?mid=" . $aMenu['mid'] . "&mode=Delete\">" . gettext("Delete") . "</a> </td>";
if ($aMenu['ismenu']) {
$sMenuName = $aMenu['name'];
echo "<td><a class=\"smallText\" href=\"javascript:void(0)\" onClick=\"Newwin=window.open('MenuManager.php?menu=$sMenuName','Newwin','toolbar=no,status=no,scrollbars=yes,resizable=yes,width=400,height=500')\">" . gettext("Edit List Options") . "</a></td>";
} else {
echo "<td> </td>";
}
echo "</tr>";
if ($aMenu['ismenu']) {
GetMenu($aMenu['name'],$lvl);
}
}
$sPageTitle = "Menu Setup:";
include "Include/Header.php";
$sRowClass = "RowColorA";
echo "<table border=0>";
Start_Menu("root");
echo "</table>";
include "Include/Footer.php";
?>