-
Notifications
You must be signed in to change notification settings - Fork 12
/
cyrus.events.php
97 lines (67 loc) · 2.58 KB
/
cyrus.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
<?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");
$user=new usersMenus();
if($_GET["hostname"]==null){$hostname=$users->hostname;$_GET["hostname"]=$hostname;}else{$hostname=$_GET["hostname"];}
if($user->AsMailBoxAdministrator==false){header('location:users.index.php');exit();}
if(isset($_GET["post"])){echo PostfixLogs();exit;}
page();
function Page(){
$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;
//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','$page?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','$page?post=1');</script>
<script>demarre();</script>
";
echo iframe($html,0);
}
function PostfixLogs(){
$sock=new sockets();
$datas=$sock->getfile('cyrus_events');
writelogs(strlen($datas) . ' bytes',__FUNCTION__,__FILE__);
$tbl=explode("\n",$datas);
$tbl=array_reverse ($tbl, TRUE);
while (list ($num, $val) = each ($tbl) ){
$html=$html . "<div style='color:white;margin-bottom:3px;font-size:10px'><code>$val</code></div>";
}
echo RoundedBlack($html);
}