gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r14733 - gauger


From: gnunet
Subject: [GNUnet-SVN] r14733 - gauger
Date: Fri, 25 Mar 2011 17:25:59 +0100

Author: bartpolot
Date: 2011-03-25 17:25:59 +0100 (Fri, 25 Mar 2011)
New Revision: 14733

Modified:
   gauger/plot.php
Log:
Optimized data output for big files, fixed plot command for names with special 
characters


Modified: gauger/plot.php
===================================================================
--- gauger/plot.php     2011-03-25 16:16:51 UTC (rev 14732)
+++ gauger/plot.php     2011-03-25 16:25:59 UTC (rev 14733)
@@ -27,18 +27,19 @@
  */
 function build_gnuplot_file($cmd, $rangecmd, $plotcmd) {
     $files = explode(",", $plotcmd);
+    $paths = array();
     foreach ($files as $i => $file) {
-        $path = preg_replace('/[^"]+"([^"]+).*/', '\1', $file);
-        $pathr = str_replace('/', '\/', $path);
-        $plotcmd = preg_replace('/'.$pathr.'/', "-", $plotcmd);
-        $files[$i] = file_get_contents(stripslashes($path));
+        $paths[$i] = stripslashes(preg_replace('/[^"]*"([^"]+).*/', '\1', 
$file));
+        $files[$i] = preg_replace('/"[^"]+/', '"-', $file, 1);
     }
+    $plotcmd = implode(",", $files);
     header('Content-Type: text/plain');
     header('Content-Disposition: attachment; filename=source.gp');
     echo str_replace("; ", ";\n", $cmd) . "\n";
     echo "$plotcmd;\n";
-    foreach($files as $file) {
-        echo "${file}e\n";
+    foreach($paths as $path) {
+        readfile($path);
+        echo "e\n";
     }
     die();
 }
@@ -154,7 +155,11 @@
             if($cg != 1) $plotcmd .= $counter;
             $plotcmd .= "\"";
             $plotcmd .= " with lines lw 2";
-            if($ch == 1 && $cg == 1) $plotcmd .= ", 
\"$DATADIR$host/$graph.dat\" notitle with yerrorbars lw 1";
+            if($ch == 1 && $cg == 1) {
+                $plotcmd .= ', ';
+                $plotcmd .= escapeshellcmd(" \"$DATADIR$host/$graph.dat\"");
+                $plotcmd .= " notitle with yerrorbars lw 1";
+            }
             $c++;
         }
     }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]