$GLOBALS['phorkie']['auth'] = array(
'secure' => 0, // 0 = public, no authentication, 1 = protect adds/edits/deletes, 2 = use authentication
'userlist' => false, // true = user must be explicitly defined, false = anyone allowed, but they must authenticate
+ 'anonymousName' => 'Anonymous', // Email for non-authenticated commits
'anonymousEmail' => 'anonymous@phorkie' // Email for non-authenticated commits
);
$GLOBALS['phorkie']['tools'] = array(
*
* @return boolean True if the post was successful
*/
- public function process($postData)
+ public function process($postData, $sessionData)
{
if (!isset($postData['files'])) {
return false;
}
}
+ $commitmsg = "phorkie commit";
+ if (isset($sessionData['identity'])) {
+ $commitmsg .= " from ".$sessionData['identity'];
+ } else {
+ $commitmsg .= " by ".$sessionData['ipaddr'];
+ }
+
if ($bCommit) {
$vc->getCommand('commit')
- ->setOption('message', '')
- ->setOption('allow-empty-message')
- ->setOption('author', 'Anonymous <anonymous@phorkie>')
+ ->setOption('message', $commitmsg)
+ ->setOption('author', $sessionData['name'].' <'.$sessionData['email'].'>')
->execute();
$bChanged = true;
}
$repo->loadFromRequest();
$repopo = new Repository_Post($repo);
-if ($repopo->process($_POST)) {
+if ($repopo->process($_POST, $_SESSION)) {
redirect($repo->getLink('display'));
}
}
$repopo = new Repository_Post();
-if ($repopo->process($_POST)) {
+if ($repopo->process($_POST, $_SESSION)) {
redirect($repopo->repo->getLink('display'));
}
if ($GLOBALS['phorkie']['cfg']['setupcheck']) {
SetupCheck::run();
}
+
+// Set/Get git commit session variables
+$_SESSION['ipaddr'] = $_SERVER['REMOTE_ADDR'];
+if (!isset($_SESSION['name'])) { $_SESSION['name'] = $GLOBALS['phorkie']['auth']['anonymousName']; }
+if (!isset($_SESSION['email'])) { $_SESSION['email'] = $GLOBALS['phorkie']['auth']['anonymousEmail']; }
+
\Twig_Autoloader::register();
$loader = new \Twig_Loader_Filesystem($GLOBALS['phorkie']['cfg']['tpl']);