e31f1e42197d87dcf16ecb5b8f45e4810a75c2b2
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 Lizenzinfos in eigenes Modu...

Bernd Wurst authored 10 years ago

5) Written 2008-2014 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) 
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) 
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') {
bernd Fürs erste feature-complete

bernd authored 12 years ago

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

bernd authored 12 years ago

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

Bernd Wurst authored 12 years ago

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

bernd authored 12 years ago

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

bernd authored 12 years ago

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

bernd authored 12 years ago

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

bernd authored 12 years ago

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

Bernd Wurst authored 12 years ago

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

bernd authored 12 years ago

66)   foreach ($users as $u) {  
67)     if (isset($_POST[$u])) {
68)       switch ($_POST[$u]) {
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)       }
76)     }
77)   }
bernd Typo

bernd authored 12 years ago

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

bernd authored 12 years ago

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

bernd authored 12 years ago

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

bernd authored 12 years ago

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

bernd authored 12 years ago

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

bernd authored 12 years ago

86)   if (! $debugmode)
87)     header('Location: git');
88)   die();
89)