# HG changeset patch # User Michiel Broek # Date 1428009872 -7200 # Node ID 12734a3774e8e95f3049645c24d5569c4982f35b # Parent 8b7ef338bf49cb4482d384036a76b306289b6fce Added ARCHIVE GET file download command. diff -r 8b7ef338bf49 -r 12734a3774e8 www-thermferm/archives.php --- a/www-thermferm/archives.php Thu Apr 02 22:23:18 2015 +0200 +++ b/www-thermferm/archives.php Thu Apr 02 23:24:32 2015 +0200 @@ -223,6 +223,36 @@ /* + * Download popup. The file contents is dynamic generated from + * the thermferm server. + */ +function archive_dl() { + + $name = urldecode($_GET['name']); + + 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(); +} + + + +/* * */ function archive_dir() {