-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcontrol_cat.php
More file actions
152 lines (129 loc) · 4.11 KB
/
control_cat.php
File metadata and controls
152 lines (129 loc) · 4.11 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<?php
// shows details of specified category of attributes
// $Id: control_cat.php,v 2.27 2008-03-19 12:17:47 turbo Exp $
//
// {{{ Setup session etc
require("./include/pql_session.inc");
require($_SESSION["path"]."/include/pql_config.inc");
require($_SESSION["path"]."/include/pql_control.inc");
require($_SESSION["path"]."/include/pql_control_plugins.inc");
$_pql_control = new pql_control($_SESSION["USER_HOST"], $_SESSION["USER_DN"], $_SESSION["USER_PASS"]);
include($_SESSION["path"]."/header.html");
// }}}
// {{{ Load plugin categories
require($_SESSION["path"]."/include/pql_control_plugins.inc");
$cats = pql_plugin_get_cats();
asort($cats);
// }}}
// {{{ Load plugin attributes
$plugins = pql_plugin_get_catplugins($_REQUEST["cat"]);
if(!is_array($plugins)) {
die($LANG->_('Invalid category')."!");
}
// }}}
// {{{ Setup the controls view buttons
// ---- First the 'top' buttons (same as on control_detail.php)
$buttons1 = array('default' => 'Base values');
foreach($cats as $cat) {
$new = array(urlencode($cat) => $cat);
$buttons1 = $buttons1 + $new;
}
$new = array('action' => 'Action');
$buttons1 = $buttons1 + $new;
// ---- Then the plugin attributes
$buttons2 = array();
foreach($plugins as $plugin) {
$new = array($plugin => $plugin);
$buttons2 = $buttons2 + $new;
}
// }}}
// {{{ Print status message, if one is available
if(isset($msg)) {
pql_format_status_msg($msg);
}
// }}}
?>
<span class="title1"><?php echo $_REQUEST["cat"]?></span>
<br><br>
<?php
// {{{ Load the requested control category
if(@empty($_REQUEST["view"])) {
$_REQUEST["view"] = $plugins[0];
}
// }}}
// {{{ Setup the host view buttons
if($_REQUEST["ref"]) {
if(@$_REQUEST["view"])
// Save this so it doesn't disappear
$tmp = $_REQUEST["view"];
$_REQUEST["view"] = 'mailsrv';
$buttons = array();
if(pql_get_define("PQL_CONF_HOSTACL_USE")) {
$new = array('hostacl' => 'Host Control');
$buttons = $buttons + $new;
}
if(pql_get_define("PQL_CONF_AUTOMOUNT_USE")) {
$new = array('automount' => 'Automount Information');
$buttons = $buttons + $new;
}
if(pql_get_define("PQL_CONF_CONTROL_USE")) {
$new = array('mailsrv' => 'Mailserver Administration');
$buttons = $buttons + $new;
}
if(pql_get_define("PQL_CONF_WEBSRV_USE")) {
$new = array('websrv' => 'Webserver Administration');
$buttons = $buttons + $new;
}
if(pql_get_define("PQL_CONF_RADIUS_USE")) {
$new = array('radius' => 'RADIUS Administration');
$buttons = $buttons + $new;
}
if(pql_get_define("PQL_CONF_BIND9_USE")) {
$new = array('dns' => 'DNS Administration');
$buttons = $buttons + $new;
}
pql_generate_button($buttons, "host=".urlencode($_REQUEST["host"])."&ref=".$_REQUEST["ref"], 'host_detail.php'); echo " <br>\n";
if(@$tmp)
// Restore the view value
$_REQUEST["view"] = $tmp;
else
// Unset the view value (so it can be set below)
unset($_REQUEST["view"]);
}
// }}}
// {{{ Output the buttons to the browser
// The fiddeling with the '$_SERVER["PHP_SELF"]' value
// is because we have to fake it the first time we call
// pql_generate_button(). It uses the value to setup the
// URI, and only 'control_detail.php' knows how to convert
// the 'view=...' option to a 'cat=...' option.
$tmp = $_SERVER["PHP_SELF"];
$_SERVER["PHP_SELF"] = eregi_replace('control_cat.php', 'control_detail.php', $_SERVER["PHP_SELF"]);
pql_generate_button($buttons1, "mxhost=".$_REQUEST["mxhost"]); echo " <br>\n";
$_SERVER["PHP_SELF"] = $tmp; unset($tmp);
pql_generate_button($buttons2, 'mxhost='.$_REQUEST["mxhost"].'&cat='.urlencode($_REQUEST["cat"])); echo " <br>\n";
// }}}
// {{{ Show the view for this plugin
if($_REQUEST["view"]) {
$file = $_SESSION["path"]."/"."include/".pql_plugin_get_filename($_REQUEST["view"]);
include($file);
$func = $_REQUEST["view"] . "_print_view";
if(function_exists($func)) {
call_user_func($func, $_REQUEST["mxhost"]);
echo "<br><br>";
}
}
// }}}
?>
</body>
</html>
<?php
pql_flush();
/*
* Local variables:
* mode: php
* mode: font-lock
* tab-width: 4
* End:
*/
?>