forked from poppyred/1.6.x
/
nginx.site.cache.php
executable file
·130 lines (93 loc) · 4.85 KB
/
nginx.site.cache.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
<?php
header("Pragma: no-cache");
header("Expires: 0");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
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.groups.inc');
include_once('ressources/class.artica.inc');
include_once('ressources/class.ini.inc');
include_once('ressources/class.squid.inc');
include_once('ressources/class.system.network.inc');
include_once('ressources/class.squid.reverse.inc');
if(isset($_GET["general-settings"])){general_settings();exit;}
if(isset($_POST["general-settings"])){general_settings_save();exit;}
if(isset($_GET["js"])){js();exit;}
if(isset($_GET["tabs"])){tabs();exit;}
page();
function page(){
$ID=intval($_GET["ID"]);
$tpl=new templates();
$page=CurrentPageName();
$fields_size=22;
$rv=new squid_reverse();
$q=new mysql_squid_builder();
$sock=new sockets();
$t=time();
$servername=$_GET["servername"];
$ligne=mysql_fetch_array($q->QUERY_SQL("SELECT * FROM reverse_www WHERE servername='$servername'"));
$cache_peer_id=$ligne["cache_peer_id"];
$ligne2=mysql_fetch_array($q->QUERY_SQL("SELECT cacheid FROM reverse_sources WHERE ID='$cache_peer_id'"));
if(intval($ligne2)==0){
echo FATAL_ERROR_SHOW_128("{nginx_error_no_cache_defined}");
return;
}
$html[]="<div style='width:98%' class=form>";
$html[]="<table style='width:100%'>";
$html[]="<tr><td colspan=2 style='font-size:40px;padding-bottom:20px'>{caching}</td></tr>";
$html[]=Field_checkbox_table("proxy_buffering-$t", "{proxy_buffering}",$ligne["proxy_buffering"],$fields_size,"{proxy_buffering_text}");
$html[]=Field_text_table("proxy_cache_min_uses-$t","{proxy_cache_min_uses}",$ligne["proxy_cache_min_uses"],$fields_size,"{proxy_cache_min_uses_text}",120);
$html[]=Field_text_table("proxy_cache_valid-$t","{proxy_cache_valid} ({minutes})",$ligne["proxy_cache_valid"],$fields_size,"{proxy_cache_valid_text}",120);
$html[]=Field_ipv4_table("proxy_buffers-$t","{proxy_buffers}",$ligne["proxy_buffers"],$fields_size,"{proxy_buffers_text}",120);
$html[]=Field_text_table("proxy_buffer_size-$t","{proxy_buffer_size} (k)",$ligne["proxy_buffer_size"],$fields_size,"{proxy_buffer_size_text}",110);
$html[]=Field_text_table("proxy_temp_file_write_size-$t","{proxy_temp_file_write_size} (k)",$ligne["proxy_temp_file_write_size"],$fields_size,"{proxy_temp_file_write_size_text}",110);
$html[]=Field_text_table("proxy_max_temp_file_size-$t","{proxy_max_temp_file_size} (MB)",$ligne["proxy_max_temp_file_size"],$fields_size,"{proxy_max_temp_file_size_text}",110);
$html[]=Field_button_table_autonome("{apply}","Submit$t",40);
$html[]="</table>";
$html[]="</div>
<script>
var xSubmit$t= function (obj) {
var results=obj.responseText;
if(results.length>3){alert(results);}
RefreshTab('main_nginx_server');
$('#NGINX_MAIN_TABLE').flexReload();
$('#NGINX_DESTINATION_MAIN_TABLE').flexReload();
var ID=$ID
if(ID==0){ YahooWin2Hide();}
}
function Submit$t(){
var proxy_buffering=0
var XHR = new XHRConnection();
XHR.appendData('general-settings','$servername');
if(document.getElementById('proxy_buffering-$t').checked){proxy_buffering=1;}
XHR.appendData('proxy_cache_min_uses',document.getElementById('proxy_cache_min_uses-$t').value);
XHR.appendData('proxy_buffering',proxy_buffering);
XHR.appendData('proxy_cache_valid',document.getElementById('proxy_cache_valid-$t').value);
XHR.appendData('proxy_buffers',document.getElementById('proxy_buffers-$t').value);
XHR.appendData('proxy_buffer_size',document.getElementById('proxy_buffer_size-$t').value);
XHR.appendData('proxy_max_temp_file_size',document.getElementById('proxy_max_temp_file_size-$t').value);
XHR.appendData('proxy_temp_file_write_size',document.getElementById('proxy_temp_file_write_size-$t').value);
XHR.sendAndLoad('$page', 'POST',xSubmit$t);
}
</script>
";
echo $tpl->_ENGINE_parse_body(@implode("\n", $html));
}
function general_settings_save(){
$q=new mysql_squid_builder();
$servername=$_POST["general-settings"];
$sql="UPDATE `reverse_www` SET
`proxy_buffering`='{$_POST["proxy_buffering"]}',
`proxy_cache_min_uses`='{$_POST["proxy_cache_min_uses"]}',
`proxy_cache_valid`='{$_POST["proxy_cache_valid"]}',
`proxy_buffers`='{$_POST["proxy_buffers"]}',
`proxy_buffer_size`='{$_POST["proxy_buffer_size"]}',
`proxy_max_temp_file_size`='{$_POST["proxy_max_temp_file_size"]}',
`proxy_temp_file_write_size`='{$_POST["proxy_temp_file_write_size"]}'
WHERE `servername`='$servername'";
$q->QUERY_SQL($sql);
if(!$q->ok){echo $q->mysql_error;}
}