4 * Show paste creation form
8 * - file name (default: default.php)
11 * Creates and redirects to display page
13 require_once 'www-header.php';
15 if (isset($_POST['file'])) {
17 $rs = new Repositories();
18 $repo = $rs->createNew();
20 $vc->initRepository();
21 foreach (glob($repo->repoDir . '/.git/hooks/*') as $hookfile) {
24 file_put_contents($repo->repoDir . '.git/description', $_POST['description']);
26 foreach ($_POST['file'] as $num => $arFile) {
27 if ($arFile['name'] != '') {
28 $fname = $arFile['name'];
30 $fname = 'phork' . $num . '.' . $arFile['type'];
32 $fpath = $repo->repoDir . $fname;
33 file_put_contents($fpath, $arFile['content']);
34 //fixme: let the class do that when it is able to
35 $command = $vc->getCommand('add')
39 $command = $vc->getCommand('commit')
40 ->setOption('message', 'initial paste')
41 ->setOption('author', 'Anonymous <anonymous@phorkie>')
44 redirect($repo->getLink('display'));
54 render('index', array('file' => $phork, 'description' => ''));