www-thermferm/archives.php

changeset 359
12734a3774e8
parent 357
64cd9865bd11
child 374
20999ef6d487
--- 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() {

mercurial