diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2012-03-26 08:05:46 +0200 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2012-03-26 08:05:46 +0200 |
| commit | 5f427dd38c8d47711ea73015076bb390761e05dd (patch) | |
| tree | 023a342befae896020e60581d7efaa91abcdcba4 /www/display.php | |
| parent | 6d0777840e50ce98f3d96629b4e92bbdccd3001c (diff) | |
| download | phorkie-5f427dd38c8d47711ea73015076bb390761e05dd.tar.gz phorkie-5f427dd38c8d47711ea73015076bb390761e05dd.zip | |
use repository and file classes
Diffstat (limited to 'www/display.php')
| -rw-r--r-- | www/display.php | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/www/display.php b/www/display.php index 5bd06bb..b6b7d7f 100644 --- a/www/display.php +++ b/www/display.php @@ -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' ) + */ ) ); ?> |
