-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathcyrus.antivirus.php
133 lines (103 loc) · 3.64 KB
/
cyrus.antivirus.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
133
<?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");
include_once('ressources/class.templates.inc');
include_once('ressources/class.ldap.inc');
include_once('ressources/class.users.menus.inc');
include_once('ressources/class.autofs.inc');
include_once('ressources/class.computers.inc');
$user=new usersMenus();
if($user->AsMailBoxAdministrator==false){
$tpl=new templates();
echo $tpl->_ENGINE_parse_body("{ERROR_NO_PRIVS}");
die();
}
if(isset($_GET["popup"])){popup();exit;}
if(isset($_GET["CyrusEnableAV"])){SaveConf();exit;}
js();
function js(){
$page=CurrentPageName();
$prefix=str_replace('.','_',$page);
$prefix=str_replace('-','',$prefix);
$tpl=new templates();
$title=$tpl->_ENGINE_parse_body('{cyrus_scan_antivirus}','cyrus.index.php');
$html="
var {$prefix}timeout=0;
var {$prefix}timerID = null;
var {$prefix}tant=0;
var {$prefix}reste=0;
function {$prefix}LoadPage(){
RTMMail(550,'$page?popup=yes','$title');
}
var x_SaveScanCyrusInfos=function (obj) {
{$prefix}LoadPage();
}
function SaveScanCyrusInfos(){
var XHR = new XHRConnection();
XHR.appendData('CyrusEnableAV',document.getElementById('CyrusEnableAV').value);
XHR.appendData('ProcessNice',document.getElementById('ProcessNice').value);
XHR.appendData('schedule',document.getElementById('schedule').value);
document.getElementById('ScanCyrusInfos').innerHTML='<center><img src=\"img/wait_verybig.gif\"></center>';
XHR.sendAndLoad('$page', 'GET',x_SaveScanCyrusInfos);
}
{$prefix}LoadPage();";
echo $html;
}
function SaveConf(){
$sock=new sockets();
$sock->SET_INFO("CyrusEnableAV",$_GET["CyrusEnableAV"]);
$ini=new Bs_IniHandler();
while (list ($num, $val) = each ($_GET) ){
$ini->_params["SCAN"][$num]=trim($val);
}
$sock->SaveConfigFile($ini->toString(),"CyrusAVConfig");
$tpl=new templates();
$sock->getfile('RestartDaemon');
echo html_entity_decode($tpl->_ENGINE_parse_body('{success}'));
}
function popup(){
$sock=new sockets();
$enable=Paragraphe_switch_img('{enable_cyrus_antivirus_scan}','{enable_cyrus_antivirus_scan_text}','CyrusEnableAV',$sock->GET_INFO("CyrusEnableAV"),"enable_cyrus_antivirus_scan",370);
$ini=new Bs_IniHandler();
$ini->loadString($sock->GET_INFO("CyrusAVConfig"));
if($ini->_params["SCAN"]["ProcessNice"]==null){$ini->_params["SCAN"]["ProcessNice"]=-15;}
$arrp=array(10=>"{default}",-15=>"{high}",10=>"{medium}",12=>"{low}",19=>'{very_low}');
$arrp=Field_array_Hash($arrp,'ProcessNice',$ini->_params["SCAN"]["ProcessNice"]);
$html="<H1>{cyrus_scan_antivirus}</H1>
<table style='width:100%'>
<tr>
<td valign='top'>
<img src='img/virus-server-128.png'>
</td>
<td valign='top'>
<div id='ScanCyrusInfos'>
<p class=caption>{cyrus_scan_antivirus_text}</p>
$enable<br>
".RoundedLightWhite("
<table style='width:100%'>
<tr>
<td valign='middle' class=legend nowrap>{ProcessNice}:</td>
<td>$arrp</td>
</tr>
<tr>
<td valign='middle' class=legend nowrap>{schedule}:</td>
<td>". Field_text('schedule',$ini->_params["SCAN"]["schedule"],'width:120px')." <input type='button' OnClick=\"javascript:Loadjs('cron.php?field=schedule');\" value='{schedule}...'></td>
</tr>
<tr>
<td colspan=2 align='right'>
<hr>
<input type='button' OnClick=\"javascript:SaveScanCyrusInfos();\" value='{save} »'>
</td>
</td>
</table>
")."
</div></td>
</tr>
</table>
";
$tpl=new templates();
echo $tpl->_ENGINE_parse_body($html,'cyrus.index.php,artica.performances.php');
}
?>