Alternc  latest
Alternc logiel libre pour l'hébergement
logs_tail.php
Go to the documentation of this file.
1 <?php
2 /*
3  ----------------------------------------------------------------------
4  LICENSE
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License (GPL)
8  as published by the Free Software Foundation; either version 2
9  of the License, or (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  To read the license please visit http://www.gnu.org/copyleft/gpl.html
17  ----------------------------------------------------------------------
18 */
19 
20 /**
21  * Show the end of a log file and refresh automatically every few seconds
22  * similar to a tail -f in a console
23  *
24  * @copyright AlternC-Team 2000-2017 https://alternc.com/
25  */
26 
27 require_once("../class/config.php");
28 
29 $fields = array (
30  "file" => array ("request", "string", ""),
31  "autoreload" => array ("request", "integer", "1"),
32  "lines" => array ("request", "integer", "20"),
33 );
35 
36 include_once("head.php");
37 
38 $string=$log->tail($file,$lines);
39 if (!$string) {
40  $file=_("unknown");
41 }
42 ?>
43 <h3><?php __("Follow a recent log"); ?></h3>
44 <p><?php printf(_("Please find below the last lines of file <b>%s</b>"),$file); ?></p>
45 <form method="get" action="logs_tail.php" name="update" id="update">
46  <input type="hidden" name="file" value="<?php ehe($file); ?>" />
47  <input type="hidden" name="autoreload" value="<?php ehe($autoreload); ?>" />
48 <?php if ($autoreload) {
49 ?>
50 <input type="button" class="inb" name="autoreload" value="<?php __("Stop Auto Reload"); ?>" onclick="document.location='logs_tail.php?file=<?php eue($file); ?>&autoreload=0&lines=<?php eue($lines); ?>'"/>
51 <?php
52 } else {
53 ?>
54 <input type="button" class="inb" name="autoreload" value="<?php __("Auto Reload"); ?>" onclick="document.location='logs_tail.php?file=<?php eue($file); ?>&autoreload=1&lines=<?php eue($lines); ?>'"/>
55 <?php
56 } ?>
57 <select id="lines" name="lines" onchange="document.forms['update'].submit()">
58  <?php
59  $alines=array(10=>10, 20=>20, 30=>30, 50=>50, 100=>100, 200=>200, 500=>500, 1000=>1000);
60 eoption($alines,$lines);
61 ?>
62 </select> <?php __("Last lines shown"); ?>
63 &nbsp;
64 <?php echo "<a class=\"inb\" href=\"logs_download.php?file=".$file."\">"._("Download")."</a>"; ?>
65 <a class="inb" href="logs_list.php" ><?php __("Back to the logs list"); ?></a>
66 <hr id="topbar"/>
67 <br />
68 <?php
69 echo $msg->msg_html_all();
70 ?>
71 <pre style=" white-space: pre-wrap; /* CSS 3 */
72  white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
73  white-space: -pre-wrap; /* Opera 4-6 */
74  white-space: -o-pre-wrap; /* Opera 7 */
75  word-wrap: break-word; /* Internet Explorer 5.5+ */" >
76 <?php echo $string; ?>
77 </pre>
78 <?php
79  if ($autoreload) {
80 ?>
81 <script type="text/javascript">
82 window.setTimeout("document.location=document.location",5000);
83 </script>
84 <?php
85  }
86 require_once("foot.php");
87 ?>
$msg
Definition: bootstrap.php:75
eoption($values, $cur, $onedim=false)
select_values($arr,$cur) echo des <option> du tableau $values ou de la table sql $values selectionne ...
Definition: functions.php:619
__($str)
Definition: functions.php:404
getFields($fields, $requestOnly=false)
Get the Fields of the posted form from $_REQUEST or POST or GET and check their type.
Definition: functions.php:688
$string
Definition: logs_tail.php:38
$alines
Definition: logs_tail.php:59
$fields
Show the end of a log file and refresh automatically every few seconds similar to a tail -f in a cons...
Definition: logs_tail.php:29