CLEAN: How about changing the rest of the files with your variable? :p
[phorkie.git] / www / raw.php
index 28f7c56ee6ca3475a68507e3de2e27ec422a48d7..8e6024142766cc3c96e6d461b53ed42c077348ad 100644 (file)
@@ -1,9 +1,11 @@
 <?php
+namespace phorkie;
 /**
  * Displays a file
  */
-namespace phorkie;
+$securityLevel = '0';
 require_once 'www-header.php';
+
 $repo = new Repository();
 $repo->loadFromRequest();
 
@@ -17,5 +19,10 @@ if ($mimetype === null) {
     $mimetype = 'text/plain';
 }
 header('Content-Type: ' . $mimetype);
-readfile($file->getFullPath());
+if ($repo->hash === null) {
+    //IIRC readfile is not so memory-intensive for big files
+    readfile($file->getFullPath());
+} else {
+    echo $file->getContent();
+}
 ?>