2626dd47daad110c63a82c0560b134e2364eeac3
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) 
Bernd Wurst Copyright year update

Bernd Wurst authored 6 years ago

5) Written 2008-2018 by schokokeks.org Hosting, namely
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

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) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

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) 
Bernd Wurst Rufe gitolite-Repo immer ne...

Bernd Wurst authored 10 years ago

22) refresh_gitolite();
23) 
bernd First draft of gitolite-mod...

bernd authored 12 years ago

24) if ($_GET['action'] == 'newuser') {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

25)     check_form_token('git_newkey');
26)     $handle = $_POST['handle'];
27)     if ($handle == '') {
28)         system_failure("Leere Benutzerbezeichnung!");
29)     }
30)     $users = list_users();
31)     if (in_array($handle, $users)) {
32)         system_failure("Ein Benutzer mit diesem Namen existiert bereits.");
33)     }
34)     newkey($_POST['pubkey'], $handle);
35)     if (! $debugmode) {
36)         header('Location: git');
37)     }
38)     die();
Bernd Wurst add foreign git users and g...

Bernd Wurst authored 12 years ago

39) } elseif ($_GET['action'] == 'newforeignuser') {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

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

bernd authored 12 years ago

54) } elseif ($_GET['action'] == 'newkey') {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

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

bernd authored 12 years ago

65) } elseif ($_GET['action'] == 'newrepo' || $_GET['action'] == 'editrepo') {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

66)     check_form_token('git_edit');
67)     $permissions = array();
68)     $users = array_merge(list_users(), list_foreign_users());
69)     foreach ($users as $u) {
70)         if (isset($_POST[$u])) {
71)             switch ($_POST[$u]) {
bernd Fürs erste feature-complete

bernd authored 12 years ago

72)         case 'rwplus': $permissions[$u] = 'RW+';
73)           break;
74)         case 'rw': $permissions[$u] = 'RW';
75)           break;
76)         case 'r': $permissions[$u] = 'R';
77)           break;
78)       }
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

79)         }
80)     }
81)     if (isset($_POST['gitweb']) && ($_POST['gitweb'] == 'r')) {
82)         $permissions['gitweb'] = 'R';
83)         $permissions['daemon'] = 'R';
84)         $description = $_POST['description'];
85)     } else {
86)         $description = null;
87)     }
88)     save_repo($_POST['repo'], $permissions, $description);
89)     if (! $debugmode) {
90)         header('Location: git');
bernd Fürs erste feature-complete

bernd authored 12 years ago

91)     }
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

92)     die();