diff -r 1ff1a95a7614 -r 44d41db09466 www-thermferm/archives.php --- a/www-thermferm/archives.php Thu May 09 15:17:30 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,328 +0,0 @@ - - * - * Copyright (C) 2015-2018 - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any - * later version. - * - * ThermFerm is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ThermFerm; see the file COPYING. If not, write to the Free - * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - - -require_once('utilities.php'); -$my_style = 'ui-redmond'; - -if (isset($_GET['action'])) { - switch ($_GET['action']) { - case 'dl': archive_dl(); - break; - case 'view': archive_view(); - break; - default: break; - } -} else { - archive_dir(); -} - -exit; - -/**************************************************************************** - * - */ - -/* - * View an archived file in graph format - */ -function archive_view() { - - global $my_style; - - $name = urldecode($_GET['name']); - $return = urldecode($_GET['return']); - - $answer = send_cmd('GLOBAL GET'); - $arr = explode("\r\n", $answer); - $version = "?"; - - if (startsWith($arr[0], "213")) { - $j = 1; - while (1) { - if (strcmp($arr[$j], ".") == 0) - break; - $f = explode(",", $arr[$j]); - - if ($f[0] == "RELEASE") - $version = $f[1]; - $j++; - } - } - - $outstr = ''.PHP_EOL; - $outstr .= ''.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' Archive View '.$name.''.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - - $outstr .= ' '.PHP_EOL; - $outstr .= '
'.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= '
'.PHP_EOL; - - $outstr .= ' '.PHP_EOL; - $outstr .= '
'.PHP_EOL; - $outstr .= '
'.PHP_EOL; - $outstr .= '
'.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= '
'.PHP_EOL; - $outstr .= '
'.PHP_EOL; - - $outstr .= ' '.PHP_EOL; - $outstr .= build_footer(); - echo $outstr; -} - - - -/* - * Download popup. The file contents is dynamic generated from - * the thermferm server. - */ -function archive_dl() { - - $name = urldecode($_GET['name']) . ".log"; - - header('Content-Type: text/plain'); - header('Content-Disposition: attachment; filename="'.$name.'"'); - - $answer = send_cmd('ARCHIVE GET '.$name); - $arr = explode("\r\n", $answer); - - $outstr = ''; - if (startsWith($arr[0], "212")) { - $j = 1; - while (1) { - if (strcmp($arr[$j], ".") == 0) - break; - $outstr .= $arr[$j].PHP_EOL; - $j++; - } - } - echo $outstr; - exit(); -} - - - -/* - * Show directory - */ -function archive_dir() { - - $answer = send_cmd("ARCHIVE DIR"); - $reply = explode("\r\n", $answer); - - $outstr = build_header("Archived logfiles"); - $outstr .= '
'.PHP_EOL; - $outstr .= '
'.PHP_EOL; - $outstr .= '
'.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - - if (startsWith($reply[0], "212")) { - $j = 1; - while (1) { - if (strcmp($reply[$j], ".") == 0) - break; - $f = explode(",", $reply[$j]); - $name = urlencode(basename($f[0], ".log")); - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $j++; - } - } - - $outstr .= '
File nameModeSizeDateAction
'.$f[0].''.$f[1].''.$f[2].''.$f[3].'Download'; - $outstr .= ' View
'.PHP_EOL; - $outstr .= '
'.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= build_footer(); - echo $outstr; -} - - -