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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
|
<?php
include('../standard_header.inc.php');
$gbmcn = $_POST['gbmcn']; $gbmcn = htmlentities($gbmcn);
$oldgbmcn = $_POST['oldgbmcn'];
$gbmDN = $_POST['gbmdn'];
$rbsDN = $_POST['rbsdn'];
$mnr = $_POST['mnr'];
$sbmnr = $_POST['sbmnr'];
$rootfs = $_POST['rootfs'];
#$oldrootfs = $_POST['oldrootfs'];
$rootfspath = $_POST['rootfspath'];
$rootfssuffix = $_POST['rootfssuffix'];
#$oldrootfstype = $_POST['oldrootfstype'];
$attribs = $_POST['attribs'];
if (count($attribs) != 0){
foreach (array_keys($attribs) as $key){
$atts[$key] = htmlentities($attribs[$key]);
}
}
# print_r($meatts); echo "<br><br>";
$oldattribs = $_POST['oldattribs'];
if (count($oldattribs) != 0){
foreach (array_keys($oldattribs) as $key){
$oldatts[$key] = htmlentities($oldattribs[$key]);
}
}
#print_r($oldatts); echo "<br><br>";
$seconds = 2;
$get_mecn = str_replace ( " ", "_", $mecn );
$url = "gbm.php?dn=".$gbmDN."&mnr=".$mnr."&sbmnr=".$sbmnr;
echo "
<html>
<head>
<title>Computers Management</title>
<link rel='stylesheet' href='../styles.css' type='text/css'>
</head>
<body>
<table border='0' cellpadding='30' cellspacing='0'>
<tr><td>";
##############################################
# GBM CN (DN)
if ( $oldgbmcn == $gbmcn ){
# $mesg = "keine Aenderung<br>";
}
if ( $oldgbmcn != "" && $gbmcn != "" && $oldgbmcn != $gbmcn ){
echo "Name Generisches Boot Menü aendern<br>";
# hier noch Syntaxcheck
# Formulareingaben anpassen
$expgbm = explode(" ",$gbmcn);
foreach ($expgbm as $word){$expuc[] = ucfirst($word);}
$gbmcn = implode(" ",$expuc);
$gbmcn = preg_replace ( '/\s+([0-9A-Z])/', '$1', $gbmcn);
$newgbmDN = "cn=".$gbmcn.",".$rbsDN;
print_r($newgbmDN); echo "<br><br>";
if(move_subtree($gbmDN, $newgbmDN)){
adjust_gbm_dn($newgbmDN, $gbmDN);
$mesg = "Name Generisches Bootmenü erfolgreich geändert<br><br>";
$gbmDN = $newgbmDN;
}else{
$mesg = "Fehler beim ändern des Namen des Generischen Bootmenüs!<br><br>";
}
# newsubmenu holen...
$url = "gbm.php?dn=".$newgbmDN."&mnr=".$mnr."&sbmnr=".$sbmnr;
}
if ( $oldgbmcn != "" && $gbmcn == "" ){
echo "Name Generisches Bootmenü loeschen!<br>
Dieses ist Teil des DN, Sie werden des Generische Boot Menü komplett löschen<br><br>";
echo "Wollen Sie das Generische Boot Menü <b>".$oldgbmcn."</b> wirklich löschen?<br><br>
<form action='gbm_delete.php' method='post'>
Falls ja:<br><br>
<input type='hidden' name='dn' value='".$gbmDN."'>
<input type='hidden' name='name' value='".$oldgbmcn."'>
<input type='Submit' name='apply' value='löschen' class='small_loginform_button'><br><br>
</form>
<form action='".$url."' method='post'>
Falls, nein:<br><br>
<input type='Submit' name='apply' value='zurück' class='small_loginform_button'>
</form>";
$seconds = 600;
}
###################################
# RootFS
if ( $rootfs != "" ){
if ( $rootfs == "none" ){
echo "Root FS löschen!<br>";
$entrydel ['rootfs'] = array();
if(ldap_mod_del($ds,$gbmDN,$entrydel)){
$mesg = "Attribut <b>RootFS</b> erfolgreich gelöscht<br><br>";
}else{
$mesg = "Fehler beim löschen des Attributs <b>RootFS</b><br><br>";
}
}else{
echo "Root FS ändern!<br>";
$entrymod ['rootfs'] = $rootfs.$rootfssuffix;
if(ldap_mod_replace($ds,$gbmDN,$entrymod)){
$mesg = "Attribut <b>RootFS</b> erfolgreich geändert<br><br>";
}else{
$mesg = "Fehler beim ändern des Attributs <b>RootFS</b><br><br>";
}
}
}
###################################
# RootFS Type
#if ( $oldrootfstype == $rootfstype ){
# # $mesg = "keine Aenderung<br>";
#}
#if ( $oldrootfstype == "" && $rootfstype != "" ){
# $entryadd ['rootfstype'] = $rootfstype;
# if(ldap_mod_add($ds,$gbmDN,$entryadd)){
# $mesg = "Attribute <b>RootfsType</b> erfolgreich eingetragen<br><br>";
# }else{
# $mesg = "Fehler beim eintragen der Attribute <b>RootfsType</b><br><br>";
# }
#}
#if ( $oldrootfstype != "" && $rootfstype != "" && $oldrootfstype != $rootfstype ){
# echo "Root FS Type ändern<br>";
# $entrymod ['rootfstype'] = $rootfstype;
# if(ldap_mod_replace($ds,$gbmDN,$entrymod)){
# $mesg = "Attribute <b>RootfsType</b> erfolgreich geaendert<br><br>";
# }else{
# $mesg = "Fehler beim aendern der Attribute <b>RootfsType</b><br><br>";
# }
#}
#if ( $oldrootfstype != "" && $rootfstype == "" ){
# echo "Root FS Type löschen!<br>";
# $entrydel ['rootfstype'] = array();
# if(ldap_mod_del($ds,$gbmDN,$entrydel)){
# $mesg = "Attribute <b>RootfsType</b> erfolgreich geloescht<br><br>";
# }else{
# $mesg = "Fehler beim loeschen der Attribute <b>RootfsType</b><br><br>";
# }
#}
###################################
# restliche Attribute
$entryadd = array();
$entrymod = array();
$entrydel = array();
foreach (array_keys($atts) as $key){
if ( $oldatts[$key] == $atts[$key] ){
# nix
}
if ( $oldatts[$key] == "" && $atts[$key] != "" ){
# hier noch Syntaxcheck
$entryadd[$key] = $atts[$key];
}
if ( $oldatts[$key] != "" && $atts[$key] != "" && $oldatts[$key] != $atts[$key] ){
# hier noch Syntaxcheck
$entrymod[$key] = $atts[$key];
}
if ( $oldatts[$key] != "" && $atts[$key] == "" ){
# hier noch Syntaxcheck
$entrydel[$key] = $oldatts[$key];
}
}
#print_r($entryadd); echo "<br>";
#print_r($entrymod); echo "<br>";
#print_r($entrydel); echo "<br>";
if (count($entryadd) != 0 ){
#print_r($entryadd); echo "<br>";
#echo "neu anlegen<br>";
foreach (array_keys($entryadd) as $key){
$addatts .= "<b>".$key."</b>,";
}
if(ldap_mod_add($ds,$gbmDN,$entryadd)){
$mesg = "Attribute ".$addatts." erfolgreich eingetragen<br><br>";
}else{
$mesg = "Fehler beim eintragen der Attribute ".$addatts."<br><br>";
}
}
if (count($entrymod) != 0 ){
#print_r($entrymod); echo "<br>";
#echo "ändern<br>";
foreach (array_keys($entrymod) as $key){
$modatts .= "<b>".$key."</b>,";
}
if(ldap_mod_replace($ds,$gbmDN,$entrymod)){
$mesg = "Attribute ".$modatts." erfolgreich geaendert<br><br>";
}else{
$mesg = "Fehler beim aendern der Attribute ".$modatts."<br><br>";
}
}
if (count($entrydel) != 0 ){
#print_r($entrydel); echo "<br>";
#echo "löschen<br>";
foreach (array_keys($entrydel) as $key){
$delatts .= "<b>".$key."</b>,";
}
if(ldap_mod_del($ds,$gbmDN,$entrydel)){
$mesg = "Attribute ".$delatts." erfolgreich geloescht<br><br>";
}else{
$mesg = "Fehler beim loeschen der Attribute ".$delatts."<br><br>";
}
}
$mesg .= "<br>Sie werden automatisch auf die vorherige Seite zurückgeleitet. <br>
Falls nicht, klicken Sie hier <a href=".$url." style='publink'>back</a>";
redirect($seconds, $url, $mesg, $addSessionId = TRUE);
echo "</td></tr></table></body>
</html>";
?>
|