]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/software/matita/scripts/public_html/showquery.php
added raw query form
[helm.git] / helm / software / matita / scripts / public_html / showquery.php
index e7db764d80e78d5f529490668a674b23386a5a83..cff5c032e9cfa829bb45109f96a9230944bb0e76 100644 (file)
@@ -7,21 +7,13 @@
   $qs = array();
   foreach($nqs as $v){
     $x = explode("@@@",$v);
-    $qs[$x[0]] = $x[1];
+    if ($x[1] == NULL) {
+      $qs["Unnamed"] = $x[0];
+    } else {
+      $qs[$x[0]] = mysql_escape_string($x[1]);
+    }
   }
 
-function prettify($s) {
-  if (preg_match("/^[0-9]{12}$/",$s)) {
-    $year = substr($s,0,4);
-    $month = substr($s,4,2);
-    $day = substr($s,6,2);
-    $hour = substr($s,8,2);
-    $minute = substr($s,10,2);
-    return $day . "/" . $month . "/" . $year . " " . $hour . ":" . $minute;
-  } else
-    return $s;
-}
-  
 ?>
 <html>
   <head>
@@ -29,32 +21,13 @@ function prettify($s) {
   </head>
   <body>
     <h1>QUERY results</h1>
-<? foreach( $qs as $name => $q) { ?>
+<? foreach( $qs as $name => $q) { $i=0;?>
     <h2><? echo $name; ?></h2>
     <p>
-    <tt><? print $q; ?></tt>
+    <tt><? echo $q; ?></tt>
     </p>
     <table border=1>
-    <? 
-      $q = query($q);
-      echo "<tr>";
-      foreach( $q[0] as $name => $txt) {
-          echo "<th>$name</th>";
-        }
-      echo "</tr>\n";
-      $i=0;
-      foreach ($q as $k => $v) {
-        $i = $i + 1;
-        if ( $i%2 == 0)
-          echo "<tr class=\"even\">";      
-        else
-          echo "<tr class=\"odd\">";
-        foreach( $v as $name => $txt) {
-          echo "<td>" . prettify($txt) . "</td>";
-        }
-        echo "</tr>\n";      
-      }
-    ?>
+    <?  query($q,"printer"); ?>
     </table>
 <? } ?>
     <p><a href="bench.php">BACK to the query page</a></p>