git.schokokeks.org
Repositories
Help
Report an Issue
webinterface.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
dcc202f
Branches
Tags
master
ticket
webinterface.git
modules
gitolite
save.php
Change license from CC0 to 0BSD, all contributors agreed
Hanno Böck
commited
dcc202f
at 2022-08-20 09:22:23
save.php
Blame
History
Raw
<?php /* This file belongs to the Webinterface of schokokeks.org Hosting Written by schokokeks.org Hosting, namely Bernd Wurst <bernd@schokokeks.org> Hanno Böck <hanno@schokokeks.org> This code is published under a 0BSD license. Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code. */ require_role(ROLE_SYSTEMUSER); $section = 'git_git'; include('git.php'); refresh_gitolite(); if ($_GET['action'] == 'newuser') { check_form_token('git_newkey'); $handle = $_POST['handle']; if ($handle == '') { system_failure("Leere Benutzerbezeichnung!"); } $users = list_users(); if (in_array($handle, $users)) { system_failure("Ein Benutzer mit diesem Namen existiert bereits."); } newkey($_POST['pubkey'], $handle); if (! $debugmode) { header('Location: git'); } die(); } elseif ($_GET['action'] == 'newforeignuser') { check_form_token('git_newforeignuser'); $handle = $_POST['handle']; if ($handle == '') { system_failure("Leere Benutzerbezeichnung!"); } $users = list_foreign_users(); if (in_array($handle, $users)) { system_failure("Diesen Benutzer haben Sie bereits hinzugefügt."); } new_foreign_user($handle); if (! $debugmode) { header('Location: git'); } die(); } elseif ($_GET['action'] == 'newkey') { check_form_token('git_newkey'); $handle = $_POST['handle']; if ($handle == '') { system_failure("Leere Benutzerbezeichnung!"); } newkey($_POST['pubkey'], $handle); if (! $debugmode) { header('Location: git'); } die(); } elseif ($_GET['action'] == 'newrepo' || $_GET['action'] == 'editrepo') { check_form_token('git_edit'); $permissions = []; $users = array_merge(list_users(), list_foreign_users()); foreach ($users as $u) { if (isset($_POST[$u])) { switch ($_POST[$u]) { case 'rwplus': $permissions[$u] = 'RW+'; break; case 'rw': $permissions[$u] = 'RW'; break; case 'r': $permissions[$u] = 'R'; break; } } } if (isset($_POST['gitweb']) && ($_POST['gitweb'] == 'r')) { $permissions['gitweb'] = 'R'; $permissions['daemon'] = 'R'; $description = $_POST['description']; } else { $description = null; } save_repo($_POST['repo'], $permissions, $description); if (! $debugmode) { header('Location: git'); } die(); }