c42127d3cab5c78430e578a07038f54f8cdff459
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 6 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) 
19) include("git.php");
20) 
21) $section = 'git_git';
22) 
bernd Fürs erste feature-complete

bernd authored 12 years ago

23) $repos = list_repos();
24) $users = list_users();
Bernd Wurst add foreign git users and g...

Bernd Wurst authored 12 years ago

25) $foreign_users = list_foreign_users();
bernd First draft of gitolite-mod...

bernd authored 12 years ago

26) 
bernd Fürs erste feature-complete

bernd authored 12 years ago

27) $action = '';
28) $form = '';
29) 
bernd Bessere Handhabung öffentli...

bernd authored 12 years ago

30) html_header("<script type=\"text/javascript\">
31)   function showDescription( ) {
32)     var do_it = (document.getElementById('gitweb').checked == false);
33)     var inputfield = document.getElementById('description');
34)     inputfield.disabled = do_it;
35)     }
36) </script>
37) ");
38) 
bernd Fürs erste feature-complete

bernd authored 12 years ago

39) if (isset($_GET['repo']) && isset($repos[$_GET['repo']])) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

40)     $action = 'editrepo';
41)     title("Zugriff auf GIT-Repository ändern");
42)     output("<p>Legen Sie hier fest, welche Berechtigungen für welche SSH-Keys gelten sollen.</p>");
Bernd Wurst Umstellung von filter_input...

Bernd Wurst authored 5 years ago

43)     $form .= '<table><tr><td>Name des Repository</td><td><input type="hidden" name="repo" value="'.filter_output_html($_GET['repo']).'" />'.filter_output_html($_GET['repo']).'</td></tr>';
bernd Fürs erste feature-complete

bernd authored 12 years ago

44) } else {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

45)     $action = 'newrepo';
46)     title("Neues GIT-Repository anlegen");
47)     output("<p>Geben Sie einen Namen für das neue Repository an und legen Sie fest, welche Berechtigungen für welche SSH-Keys gelten sollen.</p>");
48)     $form .= '<table><tr><td><label for="repo">Name des Repository</label></td><td><input type="text" id="repo" name="repo" /></td></tr>';
bernd Fürs erste feature-complete

bernd authored 12 years ago

49) }
50) 
51) $form .= '<tr><td>Berechtigungen</td><td>';
52) foreach ($users as $user) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

53)     $r = $rw = $rwplus = '';
54)     if (isset($_GET['repo']) && isset($repos[$_GET['repo']])) {
55)         $permissions = $repos[$_GET['repo']]['users'];
56)         if (isset($permissions[$user])) {
57)             switch ($permissions[$user]) {
bernd Fürs erste feature-complete

bernd authored 12 years ago

58)         case 'RW+': $rwplus = ' selected="selected"';
59)                     break;
60)         case 'RW': $rw = ' selected="selected"';
61)                    break;
62)         case 'R': $r = ' selected="selected"';
63)                   break;
64)       }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

65)         }
bernd Fürs erste feature-complete

bernd authored 12 years ago

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

Hanno authored 6 years ago

67)     $form .= '<p>'.$user.': <select name="'.$user.'"><option value="-">Zugriff verweigern</option><option value="r"'.$r.'>Lesezugriff erlauben</option><option value="rw"'.$rw.'>Lese- und Schreibzugriff</option><option value="rwplus"'.$rwplus.'>erweiterter Lese- und Schreibzugriff (inkl. &quot;rewind&quot;)</option></select></p>';
Bernd Wurst add foreign git users and g...

Bernd Wurst authored 12 years ago

68) }
69) foreach ($foreign_users as $user) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

70)     $r = $rw = $rwplus = '';
71)     if (isset($_GET['repo']) && isset($repos[$_GET['repo']])) {
72)         $permissions = $repos[$_GET['repo']]['users'];
73)         if (isset($permissions[$user])) {
74)             switch ($permissions[$user]) {
Bernd Wurst add foreign git users and g...

Bernd Wurst authored 12 years ago

75)         case 'RW+': $rwplus = ' selected="selected"';
76)                     break;
77)         case 'RW': $rw = ' selected="selected"';
78)                    break;
79)         case 'R': $r = ' selected="selected"';
80)                   break;
81)       }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

82)         }
Bernd Wurst add foreign git users and g...

Bernd Wurst authored 12 years ago

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

Hanno authored 6 years ago

84)     $form .= '<p>'.$user.': <select name="'.$user.'"><option value="-">Zugriff verweigern</option><option value="r"'.$r.'>Lesezugriff erlauben</option><option value="rw"'.$rw.'>Lese- und Schreibzugriff</option><option value="rwplus"'.$rwplus.'>erweiterter Lese- und Schreibzugriff (inkl. &quot;rewind&quot;)</option></select></p>';
bernd Fürs erste feature-complete

bernd authored 12 years ago

85) }
bernd Setze Berechtigung für gitw...

bernd authored 12 years ago

86) $checked = (isset($_GET['repo']) && isset($repos[$_GET['repo']]) && isset($repos[$_GET['repo']]['users']['gitweb']) && $repos[$_GET['repo']]['users']['gitweb'] == 'R') ? ' checked="checked"' : '';
87) $description = (isset($_GET['repo']) && isset($repos[$_GET['repo']])) ? $repos[$_GET['repo']]['description'] : '';
bernd Bessere Handhabung öffentli...

bernd authored 12 years ago

88) $disabled = $checked ? '' : ' disabled="disabled"';
89) $form .= '<p><input type="checkbox" name="gitweb" id="gitweb" value="r"'.$checked.' onclick="showDescription()" /> <label for="gitweb">Öffentlicher Lesezugriff via gitweb</label><br />
Bernd Wurst Umstellung von filter_input...

Bernd Wurst authored 5 years ago

90) <label for="description">Beschreibung des Repository:</label> <input type="text" name="description" id="description" value="'.filter_output_html($description).'"'.$disabled.' /></p>';
bernd Fürs erste feature-complete

bernd authored 12 years ago

91) $form .= '</td></tr></table>';
92) $form .= '<p><input type="submit" value="Speichern" /></p>';
93) 
94) output(html_form('git_edit', 'save', 'action='.$action, $form));