7ae33deebfbf80fde9235c3cea37c80930fe1f77
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) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 1 year ago

5) Written 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) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 1 year ago

9) This code is published under a 0BSD license.
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

10) 
11) 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.
12) */
13) 
bernd First draft of gitolite-mod...

bernd authored 12 years ago

14) require_role(ROLE_SYSTEMUSER);
15) 
bernd GIT-URL eingebaut

bernd authored 12 years ago

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

bernd authored 12 years ago

17) include('git.php');
18) 
Bernd Wurst Rufe gitolite-Repo immer ne...

Bernd Wurst authored 10 years ago

19) refresh_gitolite();
20) 
bernd First draft of gitolite-mod...

bernd authored 12 years ago

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

Hanno authored 5 years ago

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

Bernd Wurst authored 12 years ago

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

Hanno authored 5 years ago

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)     }
50)     die();
bernd First draft of gitolite-mod...

bernd authored 12 years ago

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

Hanno authored 5 years ago

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

bernd authored 12 years ago

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

Hanno authored 5 years ago

63)     check_form_token('git_edit');
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 2 years ago

64)     $permissions = [];
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

65)     $users = array_merge(list_users(), list_foreign_users());
66)     foreach ($users as $u) {
67)         if (isset($_POST[$u])) {
68)             switch ($_POST[$u]) {
Hanno Böck more strict codingstyle wit...

Hanno Böck authored 1 year ago

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

Hanno authored 5 years ago

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

bernd authored 12 years ago

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

Hanno authored 5 years ago

89)     die();