f7030eb6d07adc667bef8de57fdd0421c216516f
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();
Bernd Wurst add foreign git users and g...

Bernd Wurst authored 12 years ago

36) } elseif ($_GET['action'] == 'newforeignuser') {
37)   check_form_token('git_newforeignuser');
38)   $handle = $_POST['handle'];
39)   if ($handle == '') {
40)     system_failure("Leere Benutzerbezeichnung!");
41)   }
42)   $users = list_foreign_users();
43)   if (in_array($handle, $users)) {
44)     system_failure("Diesen Benutzer haben Sie bereits hinzugefügt.");
45)   }
46)   new_foreign_user($handle);
47)   if (! $debugmode)
48)     header('Location: git');
49)   die();
bernd First draft of gitolite-mod...

bernd authored 12 years ago

50) } elseif ($_GET['action'] == 'newkey') {
bernd Fürs erste feature-complete

bernd authored 12 years ago

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

bernd authored 12 years ago

52)   $handle = $_POST['handle'];
53)   if ($handle == '') {
54)     system_failure("Leere Benutzerbezeichnung!");
55)   }
56)   newkey($_POST['pubkey'], $handle);
57)   if (! $debugmode)
58)     header('Location: git');
59)   die();
bernd Fürs erste feature-complete

bernd authored 12 years ago

60) } elseif ($_GET['action'] == 'newrepo' || $_GET['action'] == 'editrepo') {
61)   check_form_token('git_edit');
62)   $permissions = array();
Bernd Wurst add foreign git users and g...

Bernd Wurst authored 12 years ago

63)   $users = array_merge(list_users(), list_foreign_users());
bernd Fürs erste feature-complete

bernd authored 12 years ago

64)   foreach ($users as $u) {  
65)     if (isset($_POST[$u])) {
66)       switch ($_POST[$u]) {
67)         case 'rwplus': $permissions[$u] = 'RW+';
68)           break;
69)         case 'rw': $permissions[$u] = 'RW';
70)           break;
71)         case 'r': $permissions[$u] = 'R';
72)           break;
73)       }
74)     }
75)   }
bernd Typo

bernd authored 12 years ago

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

bernd authored 12 years ago

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

bernd authored 12 years ago

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

bernd authored 12 years ago

79)     $description = $_POST['description'];
80)   } else {
81)     $description = NULL;
bernd Setze Berechtigung für gitw...

bernd authored 12 years ago

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

bernd authored 12 years ago

84)   if (! $debugmode)
85)     header('Location: git');
86)   die();
87)