use repository and file classes
[phorkie.git] / www / display.php
index 5bd06bbb55ded4776a6b0fcec643243a3549649b..b6b7d7f7939242f9aa21505a35197087e1ed155b 100644 (file)
@@ -1,23 +1,14 @@
 <?php
+namespace Phorkie;
 /**
  * Display paste contents
- *
  */
 require_once 'www-header.php';
 
-if (!isset($_GET['id'])) {
-    errout(400, 'Paste ID missing');
-}
-if (!is_numeric($_GET['id'])) {
-    errout(400, 'Paste ID not numeric');
-}
-$id = (int)$_GET['id'];
-$repoDir = $GLOBALS['phorkie']['cfg']['repos'] . '/' . $id;
-if (!is_dir($repoDir)) {
-    errout(404, 'Paste not found');
-}
+$repo = new Repository();
+$repo->loadFromRequest();
 
-$files = glob($repoDir . '/*');
+/*
 $tplFiles = array();
 foreach ($files as $file) {
     $tplFile = array();
@@ -28,15 +19,19 @@ foreach ($files as $file) {
     $tplFile['raw'] = '/' . $id . '/raw/' . $tplFile['filename'];
     $tplFiles[] = $tplFile;
 }
+*/
 
 render(
     'display',
     array(
+        'repo' => $repo,
+        /*
         'description' => file_get_contents($repoDir . '/.git/description'),
         'files' => $tplFiles,
         'links' => array(
             'edit' => '/' . $id . '/edit'
         )
+        */
     )
 );
 ?>