From 6d0777840e50ce98f3d96629b4e92bbdccd3001c Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Sun, 25 Mar 2012 21:08:29 +0200 Subject: first code that allows you to create pastes and view them --- www/index.php | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'www/index.php') diff --git a/www/index.php b/www/index.php index e69de29..5276bf2 100644 --- a/www/index.php +++ b/www/index.php @@ -0,0 +1,52 @@ +initRepository(); + file_put_contents($dir . '.git/description', $_POST['description']); + + foreach ($_POST['file'] as $num => $arFile) { + if ($arFile['name'] != '') { + $fname = $arFile['name']; + } else { + $fname = 'phork' . $num . '.' . $arFile['type']; + } + $fpath = $dir . $fname; + file_put_contents($fpath, $arFile['content']); + //fixme: let the class do that when it is able to + $command = $vc->getCommand('add') + ->addArgument($fname) + ->execute(); + } + $command = $vc->getCommand('commit') + ->setOption('message', 'initial paste') + ->execute(); + //redirect to phork + redirect($n); +} + +$phork = array( + '1' => array( + 'filename' => '', + 'content' => '', + 'type' => '' + ) +); +render('index', array('file' => $phork, 'description' => '')); +?> \ No newline at end of file -- cgit v1.2.3