forked from dtouzeau/artica
-
Notifications
You must be signed in to change notification settings - Fork 0
/
postfix.events.php
213 lines (154 loc) · 5.73 KB
/
postfix.events.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<?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");
session_start();
include_once("ressources/class.templates.inc");
include_once("ressources/class.ldap.inc");
if(isset($_GET["post"])){echo PostfixLogs();exit;}
if(isset($_GET["pop"])){echo PostfixLogsPop();exit;}
if(isset($_GET["getPopupLogs"])){echo getPopupLogs();exit;}
page();
function Page(){
$html="
<script language=\"JavaScript\"> // une premiere fonction pour manipuler les valeurs \"dynamiques\"
function mettre(){
document.form1.source.focus();
document.form1.source.select();
}
var timerID = null;
var timerID1 = null;
var tant=0;
var reste=0;
function demarre(){
tant = tant+1;
reste=10-tant;
document.getElementById('wait').innerHTML=\"- \" + reste + \" s\";
if (tant < 10 ) { //exemple:caler a une minute (60*1000)
timerID = setTimeout(\"demarre()\",1000);
} else {
tant = 0;
document.getElementById('wait').innerHTML='<img src=img/wait.gif>';
LoadAjax2('postlogs','postfix.events.php?post=1');
demarre(); //la boucle demarre !
}
}
function demar1(){
tant = tant+1;
if (tant < 2 ) { //delai court pour le premier affichage !
timerID = setTimeout(\"demar1()\",1000);
} else {
tant = 0; //reinitialise le compteur
LoadAjax2('postlogs','postfix.events.php?post=1');
demarre(); //on lance la fonction demarre qui relance le compteur
}
}
</script>
<div id=wait style='margin:5px;font-weight:bold;font-size:12px;text-align:right'></div>
<div id=postlogs></div>
<script>LoadAjax2('postlogs','postfix.events.php?post=1');</script>
<script>demarre();</script>
";
$tplusr=new template_users('{postfix_events}',$html,0,0,0,0);
echo $tplusr->web_page;
}
function PostfixLogs(){
$sock=new sockets();
$tbl=unserialize(base64_decode($sock->getFrameWork('cmd.php?postfix-tail=yes')));
$tbl=array_reverse ($tbl, TRUE);
while (list ($num, $val) = each ($tbl) ){
$html=$html . "<div style='color:white;margin-bottom:3px'><code>$val</code></div>";
}
echo RoundedBlack($html);
}
function getPopupLogs(){
$sock=new sockets();
if(isset($_GET["filter"])){
$tbl=unserialize(base64_decode($sock->getFrameWork("cmd.php?postfix-tail=yes&filter={$_GET["filter"]}")));
$_COOKIE["postfix_filter"]=$_GET["filter"];
}else{
$tbl=unserialize(base64_decode($sock->getFrameWork('cmd.php?postfix-tail=yes')));
}
$tbl=array_reverse ($tbl, TRUE);
while (list ($num, $val) = each ($tbl) ){
if(trim($val)<>null){
$img=statusLogs($val);
$html=$html . "<div style='black;margin-bottom:1px;padding:2px;border-bottom:1px dotted #CCCCCC;border-left:5px solid #CCCCCC;width:105%;margin-left:-30px'>
<table style='width:100%'>
<tr>
<td width=1%><img src='$img'></td><td><code style='font-size:10px'>$val</code></td>
</tr>
</table>
</div>";
}
}
echo $html;
}
function PostfixLogsPop(){
$page=CurrentPageName();
$html="
<script language=\"JavaScript\"> // une premiere fonction pour manipuler les valeurs \"dynamiques\"
function mettre(){
document.form1.source.focus();
document.form1.source.select();
}
var timerID = null;
var timerID1 = null;
var tant=0;
var reste=0;
function demarre(){
tant = tant+1;
reste=10-tant;
if (tant < 5 ) { //exemple:caler a une minute (60*1000)
timerID = setTimeout(\"demarre()\",700);
} else {
tant = 0;
//;
postlogs();
demarre(); //la boucle demarre !
}
}
var x_postlogs=function(obj){
var tempvalue=obj.responseText;
document.getElementById('postlogs').innerHTML=tempvalue;
document.getElementById('showstatus').innerHTML=' ';
}
function postlogs(){
var filter=document.getElementById('filter').value;
document.getElementById('showstatus').innerHTML='<img src=img/wait.gif>';
var XHR = new XHRConnection();
if(filter.length>0){
XHR.appendData('filter',filter);
}
XHR.appendData('getPopupLogs','1');
XHR.sendAndLoad('$page', 'GET',x_postlogs);
}
function demar1(){
tant = tant+1;
if (tant < 2 ) { //delai court pour le premier affichage !
timerID = setTimeout(\"demar1()\",1000);
} else {
tant = 0; //reinitialise le compteur
LoadAjax2('postlogs','postfix.events.php?getPopupLogs=1');
demarre(); //on lance la fonction demarre qui relance le compteur
}
}
</script>
<table style='width:100%;padding:3px;margin:3px;border:1px solid #CCCCCC'>
<tr>
<td class=legend width=1%>{filter}:</td>
<td width=98%><input type='text' id='filter' name='filter' value='{$_COOKIE["postfix_filter"]}' style='width:190px'>
<td width=1%><span id='showstatus'></span>
</tr>
</table>
<div id=wait style='margin:5px;font-weight:bold;font-size:12px;text-align:right'></div>
<div id=postlogs style='width:100%'></div>
<script>LoadAjax2('postlogs','postfix.events.php?getPopupLogs=1');</script>
<script>demarre();</script>
";
$tpl=new template_users("{postfix_events}",$html);
$tpl->nogbPopup=1;
$tpl->_BuildPopUp($html,"{postfix_events}");
echo $tpl->web_page;
}