X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/cec8f61ab84122a3f4b0702aaad6f7a141f99f7b..7dcd592544ae0b55d0e205ff83631067a0d0aa6b:/www/edit.php diff --git a/www/edit.php b/www/edit.php index 3bcec6e..e59bcd1 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 ') - ->execute(); - } - +$repopo = new Repository_Post($repo); +if ($repopo->process($_POST)) { redirect($repo->getLink('display')); } @@ -54,6 +17,7 @@ render( 'edit', array( 'repo' => $repo, + 'htmlhelper' => new HtmlHelper(), ) ); ?>