-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdhcp3_del.php
87 lines (76 loc) · 2.46 KB
/
dhcp3_del.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
<?php
// Delete a user template object
// $Id: dhcp3_del.php,v 2.1 2007-07-19 10:27:57 turbo Exp $
//
// {{{ Setup session etc
require("./include/pql_session.inc");
require($_SESSION["path"]."/include/pql_config.inc");
include($_SESSION["path"]."/header.html");
// }}}
if(@$_REQUEST["subnet"]) {
// Called from tables/host_details-dhcp3_subnet.inc
$mask = $_pql->get_attribute($_REQUEST["subnet"], pql_get_define("PQL_ATTR_DHCP3_NETMASK"));
$tmp = explode(',', $_REQUEST["subnet"]);
$tmp = explode('=', $tmp[0]);
$subnet = $tmp[1].'/'.$mask;
$what = $LANG->_('DHCP subnetwork').' '.pql_maybe_decode($subnet);
$DEL_DN = $_REQUEST["subnet"];
} elseif(@$_REQUEST["subhost"]) {
// Called from tables/host_details-dhcp3_subnet.inc
$tmp = explode(',', $_REQUEST["subhost"]);
$tmp = explode('=', $tmp[0]);
$subhost = $tmp[1];
$what = $LANG->_('DHCP subhost').' '.pql_maybe_decode($subhost);
$DEL_DN = $_REQUEST["subhost"];
} else {
die(pql_complete_constant($LANG->_('Unknown type in file %file%'),
array('file' => __FILE__)));
}
?>
<span class="title1"><?php echo pql_complete_constant($LANG->_('Remove %what%'),
array('what' => $what))?></span>
<br><br>
<?php
if(isset($_REQUEST["ok"]) || !pql_get_define("PQL_CONF_VERIFY_DELETE", $DEL_DN)) {
// {{{ We're said yes to delete OR we don't care!
if(pql_get_define("PQL_CONF_DEBUG_ME")) {
die("Should have deleted '<b>".$DEL_DN."</b>'<br>");
} else {
if(!$_pql->delete($DEL_DN)) {
pql_format_error(1);
die();
}
if(@$_REQUEST["subnet"]) {
pql_header("host_detail.php?view=dhcp3&host=".$_REQUEST["host"]."&ref=physical", 1);
} else {
pql_header("config_detail.php?view=template", 1);
}
}
// }}}
} else {
// {{{ Verify deletion...
?>
<br><br>
<img src="images/info.png" width="16" height="16" border="0">
<?php echo $LANG->_('Are you really sure'); ?>
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="GET">
<?php if(@$_REQUEST["subnet"]) { ?>
<input type="hidden" name="subnet" value="<?php echo urlencode($_REQUEST["subnet"])?>">
<?php } else { ?>
<input type="hidden" name="rootdn" value="<?php echo urlencode($_REQUEST["rootdn"])?>">
<?php } ?>
<input type="submit" name="ok" value="<?php echo $LANG->_('Yes')?>">
<input type="button" name="back" value="<?php echo $LANG->_('No')?>" onClick="history.back();">
</form>
<?php
// }}}
}
pql_flush();
/*
* Local variables:
* mode: php
* mode: font-lock
* tab-width: 4
* End:
*/
?>