Sun, 08 Mar 2015 19:52:53 +0100
Added archives web page
333 | 1 | <?php |
2 | /***************************************************************************** | |
3 | * Copyright (C) 2015 | |
4 | * | |
5 | * Michiel Broek <mbroek at mbse dot eu> | |
6 | * | |
7 | * This file is part of ThermFerm | |
8 | * | |
9 | * This is free software; you can redistribute it and/or modify it | |
10 | * under the terms of the GNU General Public License as published by the | |
11 | * Free Software Foundation; either version 2, or (at your option) any | |
12 | * later version. | |
13 | * | |
14 | * ThermFerm is distributed in the hope that it will be useful, but | |
15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | * General Public License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU General Public License | |
20 | * along with ThermFerm; see the file COPYING. If not, write to the Free | |
21 | * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | |
22 | *****************************************************************************/ | |
23 | ||
24 | require_once('utilities.php'); | |
25 | ||
26 | if (isset($_GET['action'])) { | |
27 | switch ($_GET['action']) { | |
28 | case 'dl': archive_dl(); | |
29 | break; | |
30 | case 'view': archive_view(); | |
31 | break; | |
32 | default: break; | |
33 | } | |
34 | } else { | |
35 | archive_dir(); | |
36 | } | |
37 | ||
38 | exit; | |
39 | ||
40 | /**************************************************************************** | |
41 | * | |
42 | */ | |
43 | ||
44 | ||
45 | ||
46 | ||
47 | /* | |
48 | * | |
49 | */ | |
50 | function archive_dir() { | |
51 | ||
52 | $answer = send_cmd("ARCHIVE DIR"); | |
53 | $reply = explode("\r\n", $answer); | |
54 | ||
55 | $outstr = build_header("Archived logfiles"); | |
56 | $outstr .= ' <div id="errors">'.PHP_EOL; | |
57 | $outstr .= ' </div> <!-- errors -->'.PHP_EOL; | |
58 | $outstr .= ' <div id="etable">'.PHP_EOL; | |
59 | $outstr .= ' <table class="setup">'.PHP_EOL; | |
60 | $outstr .= ' <tr class="trhead">'.PHP_EOL; | |
61 | $outstr .= ' <td class="setup" style="width: 340px;">File name</td>'.PHP_EOL; | |
62 | $outstr .= ' <td class="setup" style="width: 90px;">Mode</td>'.PHP_EOL; | |
63 | $outstr .= ' <td class="setup" style="width: 100px;">Size</td>'.PHP_EOL; | |
64 | $outstr .= ' <td class="setup" style="width: 140px;">Date</td>'.PHP_EOL; | |
65 | $outstr .= ' <td class="setup" style="width: 110px;">Action</td>'.PHP_EOL; | |
66 | $outstr .= ' </tr>'.PHP_EOL; | |
67 | ||
68 | if (startsWith($reply[0], "212")) { | |
69 | $j = 1; | |
70 | while (1) { | |
71 | if (strcmp($reply[$j], ".") == 0) | |
72 | break; | |
73 | $f = explode(",", $reply[$j]); | |
74 | $outstr .= ' <tr class="setup">'.PHP_EOL; | |
75 | $outstr .= ' <td class="setup">'.$f[0].'</td>'.PHP_EOL; | |
76 | $outstr .= ' <td class="setup">'.$f[1].'</td>'.PHP_EOL; | |
77 | $outstr .= ' <td class="setup">'.$f[2].'</td>'.PHP_EOL; | |
78 | $outstr .= ' <td class="setup">'.$f[3].'</td>'.PHP_EOL; | |
79 | $outstr .= ' <td class="setup"><a href="archives.php?action=dl&name='.$f[0].'">Download</a>'; | |
80 | $outstr .= ' <a href="archives.php?action=view&name='.$f[0].'">View</a></td>'.PHP_EOL; | |
81 | $outstr .= ' </tr>'.PHP_EOL; | |
82 | $j++; | |
83 | } | |
84 | } | |
85 | ||
86 | $outstr .= ' </table>'.PHP_EOL; | |
87 | $outstr .= ' </div> <!-- etable -->'.PHP_EOL; | |
88 | $outstr .= build_footer(); | |
89 | echo $outstr; | |
90 | } | |
91 | ||
92 | ||
93 |