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 2 years 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 2 years 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) 
16) include("git.php");
17) 
18) $section = 'git_git';
19) 
bernd Fürs erste feature-complete

bernd authored 12 years ago

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

Bernd Wurst authored 12 years ago

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

bernd authored 12 years ago

23) 
bernd Fürs erste feature-complete

bernd authored 12 years ago

24) $action = '';
25) $form = '';
26) 
bernd Bessere Handhabung öffentli...

bernd authored 12 years ago

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

bernd authored 12 years ago

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

Hanno authored 6 years ago

37)     $action = 'editrepo';
38)     title("Zugriff auf GIT-Repository ändern");
39)     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

40)     $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

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

Hanno authored 6 years ago

42)     $action = 'newrepo';
43)     title("Neues GIT-Repository anlegen");
44)     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>");
45)     $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

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

Hanno authored 6 years ago

50)     $r = $rw = $rwplus = '';
51)     if (isset($_GET['repo']) && isset($repos[$_GET['repo']])) {
52)         $permissions = $repos[$_GET['repo']]['users'];
53)         if (isset($permissions[$user])) {
54)             switch ($permissions[$user]) {
Hanno Böck more strict codingstyle wit...

Hanno Böck authored 2 years ago

55)                 case 'RW+': $rwplus = ' selected="selected"';
bernd Fürs erste feature-complete

bernd authored 12 years ago

56)                     break;
Hanno Böck more strict codingstyle wit...

Hanno Böck authored 2 years ago

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

Hanno authored 6 years ago

62)         }
bernd Fürs erste feature-complete

bernd authored 12 years ago

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

Hanno authored 6 years ago

64)     $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

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

Hanno authored 6 years ago

67)     $r = $rw = $rwplus = '';
68)     if (isset($_GET['repo']) && isset($repos[$_GET['repo']])) {
69)         $permissions = $repos[$_GET['repo']]['users'];
70)         if (isset($permissions[$user])) {
71)             switch ($permissions[$user]) {
Hanno Böck more strict codingstyle wit...

Hanno Böck authored 2 years ago

72)                 case 'RW+': $rwplus = ' selected="selected"';
73)                     break;
74)                 case 'RW': $rw = ' selected="selected"';
75)                     break;
76)                 case 'R': $r = ' selected="selected"';
Bernd Wurst add foreign git users and g...

Bernd Wurst authored 12 years ago

77)                     break;
Hanno Böck more strict codingstyle wit...

Hanno Böck authored 2 years ago

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

Hanno authored 6 years ago

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

Bernd Wurst authored 12 years ago

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

Hanno authored 6 years ago

81)     $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

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

bernd authored 12 years ago

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

bernd authored 12 years ago

85) $disabled = $checked ? '' : ' disabled="disabled"';
86) $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

87) <label for="description">Beschreibung des Repository:</label> <input type="text" name="description" id="description" value="'.filter_output_html($description).'"'.$disabled.' /></p>';