1aaaa700cdfda9c1e0bd92741205d07d8e0132de
bernd First draft of gitolite-mod...

bernd authored 12 years ago

1) <?php
2) require_role(ROLE_SYSTEMUSER);
3) 
bernd GIT-URL eingebaut

bernd authored 12 years ago

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

bernd authored 12 years ago

5) include('git.php');
6) 
7) if ($_GET['action'] == 'newuser') {
bernd Fürs erste feature-complete

bernd authored 12 years ago

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

bernd authored 12 years ago

9)   $handle = $_POST['handle'];
10)   if ($handle == '') {
11)     system_failure("Leere Benutzerbezeichnung!");
12)   }
13)   $users = list_users();
14)   if (in_array($handle, $users)) {
15)     system_failure("Ein Benutzer mit diesem Namen existiert bereits.");
16)   }
17)   newkey($_POST['pubkey'], $handle);
18)   if (! $debugmode)
19)     header('Location: git');
20)   die();
21) } elseif ($_GET['action'] == 'newkey') {
bernd Fürs erste feature-complete

bernd authored 12 years ago

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

bernd authored 12 years ago

23)   $handle = $_POST['handle'];
24)   if ($handle == '') {
25)     system_failure("Leere Benutzerbezeichnung!");
26)   }
27)   newkey($_POST['pubkey'], $handle);
28)   if (! $debugmode)
29)     header('Location: git');
30)   die();
bernd Fürs erste feature-complete

bernd authored 12 years ago

31) } elseif ($_GET['action'] == 'newrepo' || $_GET['action'] == 'editrepo') {
32)   check_form_token('git_edit');
33)   $permissions = array();
34)   $users = list_users();
35)   foreach ($users as $u) {  
36)     if (isset($_POST[$u])) {
37)       switch ($_POST[$u]) {
38)         case 'rwplus': $permissions[$u] = 'RW+';
39)           break;
40)         case 'rw': $permissions[$u] = 'RW';
41)           break;
42)         case 'r': $permissions[$u] = 'R';
43)           break;
44)       }
45)     }
46)   }
bernd Typo

bernd authored 12 years ago

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

bernd authored 12 years ago

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

bernd authored 12 years ago

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

bernd authored 12 years ago

50)     $description = $_POST['description'];
51)   } else {
52)     $description = NULL;
bernd Setze Berechtigung für gitw...

bernd authored 12 years ago

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

bernd authored 12 years ago

55)   if (! $debugmode)
56)     header('Location: git');
57)   die();
58)