c208bd906b3991555db11b9229846c4601ca408c
bernd First draft of gitolite-mod...

bernd authored 12 years ago

1) <?php
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4) 
5) Written 2008-2012 by schokokeks.org Hosting, namely
6)   Bernd Wurst <bernd@schokokeks.org>
7)   Hanno Böck <hanno@schokokeks.org>
8) 
9) To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
10) 
11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see 
12) http://creativecommons.org/publicdomain/zero/1.0/
13) 
14) 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.
15) */
16) 
bernd First draft of gitolite-mod...

bernd authored 12 years ago

17) require_role(ROLE_SYSTEMUSER);
18) 
bernd GIT-URL eingebaut

bernd authored 12 years ago

19) $section = 'git_git';
bernd First draft of gitolite-mod...

bernd authored 12 years ago

20) include('git.php');
21) 
22) if ($_GET['action'] == 'newuser') {
bernd Fürs erste feature-complete

bernd authored 12 years ago

23)   check_form_token('git_newkey');
bernd First draft of gitolite-mod...

bernd authored 12 years ago

24)   $handle = $_POST['handle'];
25)   if ($handle == '') {
26)     system_failure("Leere Benutzerbezeichnung!");
27)   }
28)   $users = list_users();
29)   if (in_array($handle, $users)) {
30)     system_failure("Ein Benutzer mit diesem Namen existiert bereits.");
31)   }
32)   newkey($_POST['pubkey'], $handle);
33)   if (! $debugmode)
34)     header('Location: git');
35)   die();
36) } elseif ($_GET['action'] == 'newkey') {
bernd Fürs erste feature-complete

bernd authored 12 years ago

37)   check_form_token('git_newkey');
bernd First draft of gitolite-mod...

bernd authored 12 years ago

38)   $handle = $_POST['handle'];
39)   if ($handle == '') {
40)     system_failure("Leere Benutzerbezeichnung!");
41)   }
42)   newkey($_POST['pubkey'], $handle);
43)   if (! $debugmode)
44)     header('Location: git');
45)   die();
bernd Fürs erste feature-complete

bernd authored 12 years ago

46) } elseif ($_GET['action'] == 'newrepo' || $_GET['action'] == 'editrepo') {
47)   check_form_token('git_edit');
48)   $permissions = array();
49)   $users = list_users();
50)   foreach ($users as $u) {  
51)     if (isset($_POST[$u])) {
52)       switch ($_POST[$u]) {
53)         case 'rwplus': $permissions[$u] = 'RW+';
54)           break;
55)         case 'rw': $permissions[$u] = 'RW';
56)           break;
57)         case 'r': $permissions[$u] = 'R';
58)           break;
59)       }
60)     }
61)   }
bernd Typo

bernd authored 12 years ago

62)   if (isset($_POST['gitweb']) && ($_POST['gitweb'] == 'r')) {
bernd Setze Berechtigung für gitw...

bernd authored 12 years ago

63)     $permissions['gitweb'] = 'R';
bernd GIT-URL eingebaut

bernd authored 12 years ago

64)     $permissions['daemon'] = 'R';
bernd Bessere Handhabung öffentli...

bernd authored 12 years ago

65)     $description = $_POST['description'];
66)   } else {
67)     $description = NULL;
bernd Setze Berechtigung für gitw...

bernd authored 12 years ago

68)   }
69)   save_repo($_POST['repo'], $permissions, $description);
bernd Fürs erste feature-complete

bernd authored 12 years ago

70)   if (! $debugmode)
71)     header('Location: git');
72)   die();
73)