diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2012-03-29 23:17:34 +0200 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2012-03-29 23:17:34 +0200 |
| commit | 5c314428027bea7f3743d24968bd294e65b662ca (patch) | |
| tree | 690aafd5b7facfd50460ffaeca89049738c77eea /www/edit.php | |
| parent | 88909f2355e6e53eec67a990c877cb64653cded4 (diff) | |
| download | phorkie-5c314428027bea7f3743d24968bd294e65b662ca.tar.gz phorkie-5c314428027bea7f3743d24968bd294e65b662ca.zip | |
merge paste creation and paste edit code
Diffstat (limited to 'www/edit.php')
| -rw-r--r-- | www/edit.php | 41 |
1 files changed, 2 insertions, 39 deletions
diff --git a/www/edit.php b/www/edit.php index 3bcec6e..9acc1d6 100644 --- a/www/edit.php +++ b/www/edit.php @@ -8,45 +8,8 @@ require_once 'www-header.php'; $repo = new Repository(); $repo->loadFromRequest(); -if (isset($_POST['files'])) { - $vc = $repo->getVc(); - $repo->setDescription($_POST['description']); - - $bChanged = false; - foreach ($_POST['files'] as $num => $arFile) { - if (!isset($arFile['original_name']) - || !$repo->hasFile($arFile['original_name']) - ) { - //FIXME: Show error message - continue; - } - //FIXME: fix file names from .. and ./ - if ($arFile['original_name'] != $arFile['name']) { - //FIXME: what to do with overwrites? - $vc->getCommand('mv') - ->addArgument($arFile['original_name']) - ->addArgument($arFile['name']) - ->execute(); - $bChanged = true; - } - $file = $repo->getFileByName($arFile['name']); - if ($file->getContent() != $arFile['content']) { - file_put_contents($file->getPath(), $arFile['content']); - $command = $vc->getCommand('add') - ->addArgument($file->getFilename()) - ->execute(); - $bChanged = true; - } - } - - if ($bChanged) { - $vc->getCommand('commit') - ->setOption('message', '') - ->setOption('allow-empty-message') - ->setOption('author', 'Anonymous <anonymous@phorkie>') - ->execute(); - } - +$repopo = new Repository_Post($repo); +if ($repopo->process($_POST)) { redirect($repo->getLink('display')); } |
