X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/cec8f61ab84122a3f4b0702aaad6f7a141f99f7b..53e6e11d2b3ffd73abdd166c3a3d983479fc3040:/www/index.php diff --git a/www/index.php b/www/index.php index db3fd7b..54b1e3a 100644 --- a/www/index.php +++ b/www/index.php @@ -1,5 +1,5 @@ createNew(); - $vc = $repo->getVc(); - $vc->initRepository(); - foreach (glob($repo->repoDir . '/.git/hooks/*') as $hookfile) { - unlink($hookfile); - } - $repo->setDescription($_POST['description']); - - foreach ($_POST['files'] as $num => $arFile) { - if ($arFile['name'] != '') { - //FIXME: fix file name from .. - $fname = $arFile['name']; - } else { - $fname = 'phork' . $num . '.' . $arFile['type']; - } - $fpath = $repo->repoDir . $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') - ->setOption('author', 'Anonymous ') - ->execute(); - //redirect to phork - redirect($repo->getLink('display')); +$repopo = new Repository_Post(); +if ($repopo->process($_POST)) { + redirect($repopo->repo->getLink('display')); } $phork = array( '1' => new File(null, null) ); -render('index', array('files' => $phork, 'description' => '')); -?> \ No newline at end of file +$db = new Database(); +render( + 'index', + array( + 'files' => $phork, + 'description' => '', + 'htmlhelper' => new HtmlHelper(), + 'recents' => $db->getSearch()->listAll(0, 5, 'crdate', 'desc'), + 'dh' => new \Date_HumanDiff(), + ) +); +?>