git.cweiske.de
/
phorkie.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
listing all pastes works
[phorkie.git]
/
www
/
index.php
diff --git
a/www/index.php
b/www/index.php
index 5276bf2c96f6c14f436f34eec566006357317754..044ac350dcf8979a566c19824d5cadbd1da22ca4 100644
(file)
--- a/
www/index.php
+++ b/
www/index.php
@@
-1,4
+1,5
@@
<?php
<?php
+namespace Phorkie;
/**
* Show paste creation form
*
/**
* Show paste creation form
*
@@
-13,13
+14,14
@@
require_once 'www-header.php';
if (isset($_POST['file'])) {
//save
if (isset($_POST['file'])) {
//save
- $repoDir = $GLOBALS['phorkie']['cfg']['repos'];
- $n = count(glob($repoDir . '/*', GLOB_ONLYDIR));
- $dir = $repoDir . '/' . $n . '/';
- mkdir($dir, 0777);//FIXME
- $vc = new VersionControl_Git($dir);
+ $rs = new Repositories();
+ $repo = $rs->createNew();
+ $vc = $repo->getVc();
$vc->initRepository();
$vc->initRepository();
- file_put_contents($dir . '.git/description', $_POST['description']);
+ 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'] != '') {
foreach ($_POST['file'] as $num => $arFile) {
if ($arFile['name'] != '') {
@@
-27,7
+29,7
@@
if (isset($_POST['file'])) {
} else {
$fname = 'phork' . $num . '.' . $arFile['type'];
}
} else {
$fname = 'phork' . $num . '.' . $arFile['type'];
}
- $fpath = $
d
ir . $fname;
+ $fpath = $
repo->repoD
ir . $fname;
file_put_contents($fpath, $arFile['content']);
//fixme: let the class do that when it is able to
$command = $vc->getCommand('add')
file_put_contents($fpath, $arFile['content']);
//fixme: let the class do that when it is able to
$command = $vc->getCommand('add')
@@
-36,9
+38,10
@@
if (isset($_POST['file'])) {
}
$command = $vc->getCommand('commit')
->setOption('message', 'initial paste')
}
$command = $vc->getCommand('commit')
->setOption('message', 'initial paste')
+ ->setOption('author', 'Anonymous <anonymous@phorkie>')
->execute();
//redirect to phork
->execute();
//redirect to phork
- redirect($
n
);
+ redirect($
repo->getLink('display')
);
}
$phork = array(
}
$phork = array(