aboutsummaryrefslogtreecommitdiff
path: root/www/index.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2012-03-29 23:17:34 +0200
committerChristian Weiske <cweiske@cweiske.de>2012-03-29 23:17:34 +0200
commit5c314428027bea7f3743d24968bd294e65b662ca (patch)
tree690aafd5b7facfd50460ffaeca89049738c77eea /www/index.php
parent88909f2355e6e53eec67a990c877cb64653cded4 (diff)
downloadphorkie-5c314428027bea7f3743d24968bd294e65b662ca.tar.gz
phorkie-5c314428027bea7f3743d24968bd294e65b662ca.zip
merge paste creation and paste edit code
Diffstat (limited to 'www/index.php')
-rw-r--r--www/index.php34
1 files changed, 3 insertions, 31 deletions
diff --git a/www/index.php b/www/index.php
index db3fd7b..d33604d 100644
--- a/www/index.php
+++ b/www/index.php
@@ -12,37 +12,9 @@ namespace Phorkie;
*/
require_once 'www-header.php';
-if (isset($_POST['files'])) {
- //save
- $rs = new Repositories();
- $repo = $rs->createNew();
- $vc = $repo->getVc();
- $vc->initRepository();
- foreach (glob($repo->repoDir . '/.git/hooks/*') as $hookfile) {
- unlink($hookfile);
- }
- $repo->setDescription($_POST['description']);
-
- foreach ($_POST['files'] as $num => $arFile) {
- if ($arFile['name'] != '') {
- //FIXME: fix file name from ..
- $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'));
+$repopo = new Repository_Post();
+if ($repopo->process($_POST)) {
+ redirect($repopo->repo->getLink('display'));
}
$phork = array(