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['files'])) {
17 $rs = new Repositories();
18 $repo = $rs->createNew();
20 $vc->initRepository();
21 foreach (glob($repo->repoDir . '/.git/hooks/*') as $hookfile) {
24 $repo->setDescription($_POST['description']);
26 foreach ($_POST['files'] as $num => $arFile) {
27 if ($arFile['name'] != '') {
28 //FIXME: fix file name from ..
29 $fname = $arFile['name'];
31 $fname = 'phork' . $num . '.' . $arFile['type'];
33 $fpath = $repo->repoDir . $fname;
34 file_put_contents($fpath, $arFile['content']);
35 //fixme: let the class do that when it is able to
36 $command = $vc->getCommand('add')
40 $command = $vc->getCommand('commit')
41 ->setOption('message', 'initial paste')
42 ->setOption('author', 'Anonymous <anonymous@phorkie>')
45 redirect($repo->getLink('display'));
49 '1' => new File(null, null)
51 render('index', array('files' => $phork, 'description' => ''));