forked from dtouzeau/artica-1.5
/
dnsmasq.index.php
executable file
·132 lines (93 loc) · 3.12 KB
/
dnsmasq.index.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
include_once('ressources/class.templates.inc');
include_once('ressources/class.ldap.inc');
include_once('ressources/class.users.menus.inc');
if(posix_getuid()<>0){
$user=new usersMenus();
if($user->AsDnsAdministrator==false){
$tpl=new templates();
echo $tpl->_ENGINE_parse_body("alert('{ERROR_NO_PRIVS}');");
die();exit();
}
}
if(isset($_GET["tabs"])){tabs();exit;}
js();
function js(){
$tpl=new templates();
$title=$tpl->_ENGINE_parse_body("{APP_DNSMASQ}");
$page=CurrentPageName();
$js=@file_get_contents("js/dnsmasq.js");
$start="DNSMASQ_START2()";
if(isset($_GET["popup"])){$start="DNSMASQ_START1()";}
$html="
function DNSMASQ_START2(){
if(!document.getElementById('BodyContent')){alert('BodyContent no such id');}
$('#BodyContent').load('$page?tabs=yes');
}
function DNSMASQ_START1(){
YahooWin2(760,'$page?tabs=yes','$title');
}
$start;
$js
";
echo $html;
}
function tabs(){
$page=CurrentPageName();
$tpl=new templates();
$array["params"]='{dnsmasq_DNS_cache_settings}';
$array["records"]='{dnsmasq_DNS_records}';
$array["hosts"]='{hosts}';
$array["logs"]='{events}';
while (list ($num, $ligne) = each ($array) ){
if($num=="params"){
$html[]= $tpl->_ENGINE_parse_body("<li><a href=\"dnsmasq.dns.settings.php\"><span>$ligne</span></a></li>\n");
continue;
}
if($num=="records"){
$html[]= $tpl->_ENGINE_parse_body("<li><a href=\"dnsmasq.records.settings.php\"><span>$ligne</span></a></li>\n");
continue;
}
if($num=="hosts"){
$html[]= $tpl->_ENGINE_parse_body("<li><a href=\"dnsmasq.hosts.settings.php\"><span>$ligne</span></a></li>\n");
continue;
}
if($num=="logs"){
$html[]= $tpl->_ENGINE_parse_body("<li><a href=\"dnsmasq.daemon.events.php\"><span>$ligne</span></a></li>\n");
continue;
}
$html[]= $tpl->_ENGINE_parse_body("<li><a href=\"$page?$num=yes\"><span>$ligne</span></a></li>\n");
}
echo "
<div id=main_config_dnsmasq style='width:100%;height:650px;overflow:auto'>
<ul>". implode("\n",$html)."</ul>
</div>
<script>
$(document).ready(function() {
$(\"#main_config_dnsmasq\").tabs();});
</script>";
}
function page(){
$usersmenus=new usersMenus();
if($usersmenus->AsPostfixAdministrator==true){}else{header('location:users.index.php');exit;}
$html="<table style='width:600px' align=center>
<tr>
<td width=50% valign='top' class='caption' style='text-align:justify'>
<img src='img/bg_dns.jpg'><p>
{dnsmasq_intro}</p></td>
<td valign='top'>
<table>";
if($usersmenus->AsPostfixAdministrator==true){
$html=$html . "
<tr><td valign='top' >".Paragraphe('folder-tools-64.jpg','{dnsmasq_DNS_cache_settings}','{dnsmasq_DNS_cache_settings_text}','dnsmasq.dns.settings.php') ."</td></tr>
<tr><td valign='top' >".Paragraphe('folder-storage-64.jpg','{dnsmasq_DNS_records}','{dnsmasq_DNS_records_text}','dnsmasq.records.settings.php') ."</td></tr>
<tr><td valign='top'> ".Paragraphe('folder-logs-64.jpeg','{events}','{events_text}','dnsmasq.daemon.events.php') ."</td></tr>";
}
$html=$html . "</table>
</td>
</tr>
</table>
";
$tpl=new template_users('DnsMasq',$html);
echo $tpl->web_page;
}