3 * Show paste creation form
7 * - file name (default: default.php)
10 * Creates and redirects to display page
12 require_once 'www-header.php';
14 if (isset($_POST['file'])) {
16 $repoDir = $GLOBALS['phorkie']['cfg']['repos'];
17 $n = count(glob($repoDir . '/*', GLOB_ONLYDIR));
18 $dir = $repoDir . '/' . $n . '/';
19 mkdir($dir, 0777);//FIXME
20 $vc = new VersionControl_Git($dir);
21 $vc->initRepository();
22 file_put_contents($dir . '.git/description', $_POST['description']);
24 foreach ($_POST['file'] as $num => $arFile) {
25 if ($arFile['name'] != '') {
26 $fname = $arFile['name'];
28 $fname = 'phork' . $num . '.' . $arFile['type'];
30 $fpath = $dir . $fname;
31 file_put_contents($fpath, $arFile['content']);
32 //fixme: let the class do that when it is able to
33 $command = $vc->getCommand('add')
37 $command = $vc->getCommand('commit')
38 ->setOption('message', 'initial paste')
51 render('index', array('file' => $phork, 'description' => ''));