REVERT: variable name change
[phorkie.git] / www / index.php
index 044ac350dcf8979a566c19824d5cadbd1da22ca4..7ff1814767cb6a619d3ad939d52714c4b19dac42 100644 (file)
@@ -1,55 +1,13 @@
 <?php
 <?php
-namespace Phorkie;
 /**
 /**
- * Show paste creation form
- *
- * Elements:
- * - description
- * - file name (default: default.php)
- * - content
- *
- * Creates and redirects to display page
+ * Jump to the index as per the configuration
  */
  */
+namespace phorkie;
+$secureAtLevel = false;
 require_once 'www-header.php';
 
 require_once 'www-header.php';
 
-if (isset($_POST['file'])) {
-    //save
-    $rs = new Repositories();
-    $repo = $rs->createNew();
-    $vc = $repo->getVc();
-    $vc->initRepository();
-    foreach (glob($repo->repoDir . '/.git/hooks/*') as $hookfile) {
-        unlink($hookfile);
-    }
-    file_put_contents($repo->repoDir . '.git/description', $_POST['description']);
-
-    foreach ($_POST['file'] as $num => $arFile) {
-        if ($arFile['name'] != '') {
-            $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 <anonymous@phorkie>')
-        ->execute();
-    //redirect to phork
-    redirect($repo->getLink('display'));
-}
-
-$phork = array(
-    '1' => array(
-        'filename' => '',
-        'content' => '',
-        'type' => ''
-    )
+header(
+    'Location: '
+    . Tools::fullUrl('/' . $GLOBALS['phorkie']['cfg']['index'])
 );
 );
-render('index', array('file' => $phork, 'description' => ''));
-?>
\ No newline at end of file
+?>