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 file_put_contents($repo->repoDir . '.git/description', $_POST['description']);
23 foreach ($_POST['file'] as $num => $arFile) {
24 if ($arFile['name'] != '') {
25 $fname = $arFile['name'];
27 $fname = 'phork' . $num . '.' . $arFile['type'];
29 $fpath = $repo->repoDir . $fname;
30 file_put_contents($fpath, $arFile['content']);
31 //fixme: let the class do that when it is able to
32 $command = $vc->getCommand('add')
36 $command = $vc->getCommand('commit')
37 ->setOption('message', 'initial paste')
38 ->setOption('author', 'Anonymous <anonymous@phorkie>')
41 redirect($repo->getLink('display'));
51 render('index', array('file' => $phork, 'description' => ''));