forked from poppyred/1.6.x
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pureftp.events.php
executable file
·211 lines (158 loc) · 5.06 KB
/
pureftp.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
<?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["start"])){echo start();exit;}
if(isset($_GET["post"])){echo events();exit;}
if(isset($_GET["who"])){echo who_js();exit;}
if(isset($_GET["who-start"])){echo who_start();exit;}
if(isset($_GET["who-build"])){echo who_events();exit;}
js();exit;
function who_start(){
$events=who_events(1);
$html="
<H1>{APP_PUREFTPD} {current_connections}</H1>
<div id='showeventsWHO' style='width:100%;height:250px;overflow:auto'>
$events
</div>
";
$tpl=new templates();
echo $tpl->_ENGINE_parse_body($html,'fileshares.index.php');
}
function who_js(){
$page=CurrentPageName();
$tpl=new templates();
$title=$tpl->_ENGINE_parse_body("{APP_PUREFTPD} {events}");
$html="
var timerPureLogsWHO = null;
var tantPureLogsWHO=0;
var restePurelogsWHO=0;
function PureCronDemarreWHO(){
tantPureLogsWHO = tantPureLogsWHO+1;
restePurelogsWHO=10-tantPureLogsWHO;
if(!YahooWin3Open()){return false;}
if (restePurelogsWHO >0 ) {
timerPureLogsWHO = setTimeout(\"PureCronDemarreWHO()\",700);
} else {
tantPureLogsWHO = 0;
LoadAjax2('showeventsWHO','$page?who-build=1');
PureCronDemarreWHO();
}
}
function pureftpdEventsWHO(){
YahooWin3('600','$page?who-start=yes','$title');
setTimeout(\"PureCronDemarreWHO()\",1700);
}
pureftpdEventsWHO();
";
echo $html;
}
function who_events($return=0){
$sock=new sockets();
$data=$sock->getfile("pureftpwho");
$data=str_replace("Content-Type: text/html","",$data);
$data=str_replace('summary="Pure-FTPd server status"',"style='width:99%' class=table_form",$data);
if($return==1){return $data;}
echo $data;
}
function js(){
$page=CurrentPageName();
$tpl=new templates();
$title=$tpl->_ENGINE_parse_body("{APP_PUREFTPD} {events}");
$html="
var timerPureLogs = null;
var tantPureLogs=0;
var restePurelogs=0;
function PureCronDemarre(){
tantPureLogs = tantPureLogs+1;
restePurelogs=10-tantPureLogs;
if(!YahooWin2Open()){return false;}
if (restePurelogs >0 ) {
timerPureLogs = setTimeout(\"PureCronDemarre()\",700);
} else {
tantPureLogs = 0;
LoadAjax2('showevents','$page?post=1');
PureCronDemarre();
}
}
function pureftpdEvents(){
YahooWin2('600','$page?start=yes','$title');
setTimeout(\"PureCronDemarre()\",1700);
}
pureftpdEvents();
";
echo $html;
}
function start(){
$events=events(1);
$html="
<H1>{APP_PUREFTPD} {events}</H1>
<div id='showevents' style='width:100%;height:250px;overflow:auto'>
$events
</div>
";
$tpl=new templates();
echo $tpl->_ENGINE_parse_body($html);
}
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;
var current_page=\"$page\";
function demarre(){
tant = tant+1;
reste=10-tant;
document.getElementById('wait').innerHTML='';
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('showevents','$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('showevents','$page?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=showevents></div>
<script>LoadAjax2('showevents','$page?post=1');</script>
<script>demarre();</script>
";
$tplusr=new template_users('{events}',$html,0,0,0,0);
echo $tplusr->web_page;
}
function events($return=0){
$sock=new sockets();
$datas=$sock->getfile('pureftpd_logs');
writelogs(strlen($datas) . ' bytes',__FUNCTION__,__FILE__);
$tbl=explode("\n",$datas);
$tbl=array_reverse ($tbl, TRUE);
while (list ($num, $val) = each ($tbl) ){
$val=htmlentities($val);
$html=$html . "<div style='color:white;margin-bottom:3px'><code>$val</code></div>";
}
if($return==1){return RoundedBlack($html);}
echo RoundedBlack($html);
}