forked from poppyred/1.6.x
/
ufdbguard.urichange.php
executable file
·86 lines (66 loc) · 2.76 KB
/
ufdbguard.urichange.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
<?php
if(isset($_GET["verbose"])){$GLOBALS["VERBOSE"]=true;ini_set('display_errors', 1);ini_set('error_reporting', E_ALL);ini_set('error_prepend_string',null);ini_set('error_append_string',null);}
include_once('ressources/class.templates.inc');
include_once('ressources/class.ldap.inc');
include_once('ressources/class.users.menus.inc');
include_once('ressources/class.squid.inc');
include_once('ressources/class.ActiveDirectory.inc');
include_once('ressources/class.compile.ufdbguard.inc');
if(isset($_POST["servername_squidguard"])){Save();exit;}
if(isset($_GET["popup"])){popup();exit;}
js();
function js(){
$tpl=new templates();
$page=CurrentPageName();
$title=$tpl->_ENGINE_parse_body("{webpage_deny_url}");
header("content-type: application/x-javascript");
$html="YahooWin5('650','$page?popup=yes','$title');";
echo $html;
}
function popup(){
$page=CurrentPageName();
$sock=new sockets();
$users=new usersMenus();
$t=time();
$SquidGuardIPWeb=$sock->GET_INFO("SquidGuardIPWeb");
$fulluri=$sock->GET_INFO("SquidGuardIPWeb");
$SquidGuardServerName=$sock->GET_INFO("SquidGuardServerName");
if(preg_match("#\/(.+?):([0-9]+)\/#",$SquidGuardIPWeb,$re)){$SquidGuardIPWeb="{$re[1]}:{$re[2]}";}
if(preg_match("#(.+?):([0-9]+)#",$SquidGuardIPWeb,$re)){
$SquidGuardServerName=$re[1];
$SquidGuardApachePort=$re[2];
}
if($SquidGuardServerName=="/"){$SquidGuardServerName=null;}
$html="<div style='width:98%' class=form>
<table style='width:100%'>
". Field_ipv4_table("servername_squidguard-$t", "{ipaddr}",$SquidGuardServerName,35).
Field_button_table_autonome("{apply}", "Save$t()",35)."</table>
</div>
<script>
var xSave$t=function(obj){
YahooWin5Hide();
RefreshTab('main_dansguardian_mainrules');
Loadjs('dansguardian2.compile.php');
}
function Save$t(){
var XHR = new XHRConnection();
XHR.appendData('servername_squidguard',document.getElementById('servername_squidguard-$t').value);
XHR.sendAndLoad('$page', 'POST',xSave$t);
}
</script>
";
$tpl=new templates();
echo $tpl->_ENGINE_parse_body($html);
}
function Save(){
$sock=new sockets();
$SquidGuardApachePort=intval($sock->GET_INFO("SquidGuardApachePort"));
$SquidGuardApacheSSLPort=intval($sock->GET_INFO("SquidGuardApacheSSLPort"));
if($SquidGuardApacheSSLPort==0){$SquidGuardApacheSSLPort=9025;}
if($SquidGuardApachePort==0){$SquidGuardApachePort=9020;}
$sock->SET_INFO("SquidGuardServerName", $_POST["servername_squidguard"]);
$SquidGuardIPWeb="http://".$_POST["servername_squidguard"].":$SquidGuardApachePort/exec.squidguard.php";
$SquidGuardIPWebSSL="https://".$_POST["servername_squidguard"].":$SquidGuardApacheSSLPort/exec.squidguard.php";
$sock->SET_INFO("SquidGuardIPWeb",$SquidGuardIPWeb);
$sock->SET_INFO("SquidGuardIPWebSSL",$SquidGuardIPWebSSL);
}