Browse code

Codingstyle PSR12 + array syntax

Hanno Böck authored on 30/10/2021 21:18:17
Showing 1 changed files
... ...
@@ -64,7 +64,7 @@ if ($_GET['action'] == 'newuser') {
64 64
     die();
65 65
 } elseif ($_GET['action'] == 'newrepo' || $_GET['action'] == 'editrepo') {
66 66
     check_form_token('git_edit');
67
-    $permissions = array();
67
+    $permissions = [];
68 68
     $users = array_merge(list_users(), list_foreign_users());
69 69
     foreach ($users as $u) {
70 70
         if (isset($_POST[$u])) {
Browse code

Fix coding style with php-cs-checker, see https://cs.sensiolabs.org/

Hanno authored on 26/06/2018 13:58:19
Showing 1 changed files
... ...
@@ -8,7 +8,7 @@ Written 2008-2018 by schokokeks.org Hosting, namely
8 8
 
9 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 10
 
11
-You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see 
11
+You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
12 12
 http://creativecommons.org/publicdomain/zero/1.0/
13 13
 
14 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.
... ...
@@ -22,50 +22,53 @@ include('git.php');
22 22
 refresh_gitolite();
23 23
 
24 24
 if ($_GET['action'] == 'newuser') {
25
-  check_form_token('git_newkey');
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();
25
+    check_form_token('git_newkey');
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
+    }
38
+    die();
38 39
 } 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();
40
+    check_form_token('git_newforeignuser');
41
+    $handle = $_POST['handle'];
42
+    if ($handle == '') {
43
+        system_failure("Leere Benutzerbezeichnung!");
44
+    }
45
+    $users = list_foreign_users();
46
+    if (in_array($handle, $users)) {
47
+        system_failure("Diesen Benutzer haben Sie bereits hinzugefügt.");
48
+    }
49
+    new_foreign_user($handle);
50
+    if (! $debugmode) {
51
+        header('Location: git');
52
+    }
53
+    die();
52 54
 } elseif ($_GET['action'] == 'newkey') {
53
-  check_form_token('git_newkey');
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();
55
+    check_form_token('git_newkey');
56
+    $handle = $_POST['handle'];
57
+    if ($handle == '') {
58
+        system_failure("Leere Benutzerbezeichnung!");
59
+    }
60
+    newkey($_POST['pubkey'], $handle);
61
+    if (! $debugmode) {
62
+        header('Location: git');
63
+    }
64
+    die();
62 65
 } elseif ($_GET['action'] == 'newrepo' || $_GET['action'] == 'editrepo') {
63
-  check_form_token('git_edit');
64
-  $permissions = array();
65
-  $users = array_merge(list_users(), list_foreign_users());
66
-  foreach ($users as $u) {  
67
-    if (isset($_POST[$u])) {
68
-      switch ($_POST[$u]) {
66
+    check_form_token('git_edit');
67
+    $permissions = array();
68
+    $users = array_merge(list_users(), list_foreign_users());
69
+    foreach ($users as $u) {
70
+        if (isset($_POST[$u])) {
71
+            switch ($_POST[$u]) {
69 72
         case 'rwplus': $permissions[$u] = 'RW+';
70 73
           break;
71 74
         case 'rw': $permissions[$u] = 'RW';
... ...
@@ -73,21 +76,18 @@ if ($_GET['action'] == 'newuser') {
73 76
         case 'r': $permissions[$u] = 'R';
74 77
           break;
75 78
       }
79
+        }
80
+    }
81
+    if (isset($_POST['gitweb']) && ($_POST['gitweb'] == 'r')) {
82
+        $permissions['gitweb'] = 'R';
83
+        $permissions['daemon'] = 'R';
84
+        $description = $_POST['description'];
85
+    } else {
86
+        $description = null;
87
+    }
88
+    save_repo($_POST['repo'], $permissions, $description);
89
+    if (! $debugmode) {
90
+        header('Location: git');
76 91
     }
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');
88
-  die();
89
-  
92
+    die();
90 93
 }
91
-
92
-
93
-
Browse code

Copyright year update

Bernd Wurst authored on 13/01/2018 06:07:05
Showing 1 changed files
... ...
@@ -2,7 +2,7 @@
2 2
 /*
3 3
 This file belongs to the Webinterface of schokokeks.org Hosting
4 4
 
5
-Written 2008-2014 by schokokeks.org Hosting, namely
5
+Written 2008-2018 by schokokeks.org Hosting, namely
6 6
   Bernd Wurst <bernd@schokokeks.org>
7 7
   Hanno Böck <hanno@schokokeks.org>
8 8
 
Browse code

Rufe gitolite-Repo immer neu ab, vor jeder Änderung

Bernd Wurst authored on 26/03/2014 18:07:35
Showing 1 changed files
... ...
@@ -19,6 +19,8 @@ require_role(ROLE_SYSTEMUSER);
19 19
 $section = 'git_git';
20 20
 include('git.php');
21 21
 
22
+refresh_gitolite();
23
+
22 24
 if ($_GET['action'] == 'newuser') {
23 25
   check_form_token('git_newkey');
24 26
   $handle = $_POST['handle'];
Browse code

Lizenzinfos in eigenes Modul ausgelagert und Copyright auf 2014 angepasst

Bernd Wurst authored on 08/02/2014 05:45:07
Showing 1 changed files
... ...
@@ -2,7 +2,7 @@
2 2
 /*
3 3
 This file belongs to the Webinterface of schokokeks.org Hosting
4 4
 
5
-Written 2008-2013 by schokokeks.org Hosting, namely
5
+Written 2008-2014 by schokokeks.org Hosting, namely
6 6
   Bernd Wurst <bernd@schokokeks.org>
7 7
   Hanno Böck <hanno@schokokeks.org>
8 8
 
Browse code

Updated copyright notice (2012 => 2013)

Bernd Wurst authored on 19/01/2013 10:49:50
Showing 1 changed files
... ...
@@ -2,7 +2,7 @@
2 2
 /*
3 3
 This file belongs to the Webinterface of schokokeks.org Hosting
4 4
 
5
-Written 2008-2012 by schokokeks.org Hosting, namely
5
+Written 2008-2013 by schokokeks.org Hosting, namely
6 6
   Bernd Wurst <bernd@schokokeks.org>
7 7
   Hanno Böck <hanno@schokokeks.org>
8 8
 
Browse code

add foreign git users and grant permissions to them

Bernd Wurst authored on 12/03/2012 09:31:30
Showing 1 changed files
... ...
@@ -33,6 +33,20 @@ if ($_GET['action'] == 'newuser') {
33 33
   if (! $debugmode)
34 34
     header('Location: git');
35 35
   die();
36
+} elseif ($_GET['action'] == 'newforeignuser') {
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
+  die();
36 50
 } elseif ($_GET['action'] == 'newkey') {
37 51
   check_form_token('git_newkey');
38 52
   $handle = $_POST['handle'];
... ...
@@ -46,7 +60,7 @@ if ($_GET['action'] == 'newuser') {
46 60
 } elseif ($_GET['action'] == 'newrepo' || $_GET['action'] == 'editrepo') {
47 61
   check_form_token('git_edit');
48 62
   $permissions = array();
49
-  $users = list_users();
63
+  $users = array_merge(list_users(), list_foreign_users());
50 64
   foreach ($users as $u) {  
51 65
     if (isset($_POST[$u])) {
52 66
       switch ($_POST[$u]) {
Browse code

Added license tags for CC0, README and COPYING

Bernd Wurst authored on 11/03/2012 15:40:04
Showing 1 changed files
... ...
@@ -1,4 +1,19 @@
1 1
 <?php
2
+/*
3
+This file belongs to the Webinterface of schokokeks.org Hosting
4
+
5
+Written 2008-2012 by schokokeks.org Hosting, namely
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
+
2 17
 require_role(ROLE_SYSTEMUSER);
3 18
 
4 19
 $section = 'git_git';

git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@2101 87cf0b9e-d624-0410-a070-f6ee81989793

bernd authored on 21/12/2011 17:30:34
Showing 1 changed files
... ...
@@ -44,7 +44,7 @@ if ($_GET['action'] == 'newuser') {
44 44
       }
45 45
     }
46 46
   }
47
-  if (isset($_POST['gitweb']) && ($_POST['gitweb'] == 'r') {
47
+  if (isset($_POST['gitweb']) && ($_POST['gitweb'] == 'r')) {
48 48
     $permissions['gitweb'] = 'R';
49 49
     $permissions['daemon'] = 'R';
50 50
     $description = $_POST['description'];
Browse code

Prüfe Existenz des Array-Index vor Verwendung

git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@2100 87cf0b9e-d624-0410-a070-f6ee81989793

bernd authored on 21/12/2011 17:29:51
Showing 1 changed files
... ...
@@ -44,7 +44,7 @@ if ($_GET['action'] == 'newuser') {
44 44
       }
45 45
     }
46 46
   }
47
-  if ($_POST['gitweb'] == 'r') {
47
+  if (isset($_POST['gitweb']) && ($_POST['gitweb'] == 'r') {
48 48
     $permissions['gitweb'] = 'R';
49 49
     $permissions['daemon'] = 'R';
50 50
     $description = $_POST['description'];
Browse code

GIT-URL eingebaut

git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@2098 87cf0b9e-d624-0410-a070-f6ee81989793

bernd authored on 21/12/2011 16:51:54
Showing 1 changed files
... ...
@@ -1,6 +1,7 @@
1 1
 <?php
2 2
 require_role(ROLE_SYSTEMUSER);
3 3
 
4
+$section = 'git_git';
4 5
 include('git.php');
5 6
 
6 7
 if ($_GET['action'] == 'newuser') {
... ...
@@ -45,6 +46,7 @@ if ($_GET['action'] == 'newuser') {
45 46
   }
46 47
   if ($_POST['gitweb'] == 'r') {
47 48
     $permissions['gitweb'] = 'R';
49
+    $permissions['daemon'] = 'R';
48 50
     $description = $_POST['description'];
49 51
   } else {
50 52
     $description = NULL;
Browse code

Bessere Handhabung öffentlich abrufbarer Repositories

git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@2095 87cf0b9e-d624-0410-a070-f6ee81989793

bernd authored on 21/12/2011 16:51:53
Showing 1 changed files
... ...
@@ -45,8 +45,10 @@ if ($_GET['action'] == 'newuser') {
45 45
   }
46 46
   if ($_POST['gitweb'] == 'r') {
47 47
     $permissions['gitweb'] = 'R';
48
+    $description = $_POST['description'];
49
+  } else {
50
+    $description = NULL;
48 51
   }
49
-  $description = $_POST['description'];
50 52
   save_repo($_POST['repo'], $permissions, $description);
51 53
   if (! $debugmode)
52 54
     header('Location: git');
Browse code

Setze Berechtigung für gitweb und Beschreibung

git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@2094 87cf0b9e-d624-0410-a070-f6ee81989793

bernd authored on 21/12/2011 16:51:53
Showing 1 changed files
... ...
@@ -43,7 +43,11 @@ if ($_GET['action'] == 'newuser') {
43 43
       }
44 44
     }
45 45
   }
46
-  save_repo($_POST['repo'], $permissions);
46
+  if ($_POST['gitweb'] == 'r') {
47
+    $permissions['gitweb'] = 'R';
48
+  }
49
+  $description = $_POST['description'];
50
+  save_repo($_POST['repo'], $permissions, $description);
47 51
   if (! $debugmode)
48 52
     header('Location: git');
49 53
   die();
Browse code

Fürs erste feature-complete

git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@2092 87cf0b9e-d624-0410-a070-f6ee81989793

bernd authored on 21/12/2011 16:51:52
Showing 1 changed files
... ...
@@ -4,6 +4,7 @@ require_role(ROLE_SYSTEMUSER);
4 4
 include('git.php');
5 5
 
6 6
 if ($_GET['action'] == 'newuser') {
7
+  check_form_token('git_newkey');
7 8
   $handle = $_POST['handle'];
8 9
   if ($handle == '') {
9 10
     system_failure("Leere Benutzerbezeichnung!");
... ...
@@ -17,6 +18,7 @@ if ($_GET['action'] == 'newuser') {
17 18
     header('Location: git');
18 19
   die();
19 20
 } elseif ($_GET['action'] == 'newkey') {
21
+  check_form_token('git_newkey');
20 22
   $handle = $_POST['handle'];
21 23
   if ($handle == '') {
22 24
     system_failure("Leere Benutzerbezeichnung!");
... ...
@@ -25,6 +27,27 @@ if ($_GET['action'] == 'newuser') {
25 27
   if (! $debugmode)
26 28
     header('Location: git');
27 29
   die();
30
+} elseif ($_GET['action'] == 'newrepo' || $_GET['action'] == 'editrepo') {
31
+  check_form_token('git_edit');
32
+  $permissions = array();
33
+  $users = list_users();
34
+  foreach ($users as $u) {  
35
+    if (isset($_POST[$u])) {
36
+      switch ($_POST[$u]) {
37
+        case 'rwplus': $permissions[$u] = 'RW+';
38
+          break;
39
+        case 'rw': $permissions[$u] = 'RW';
40
+          break;
41
+        case 'r': $permissions[$u] = 'R';
42
+          break;
43
+      }
44
+    }
45
+  }
46
+  save_repo($_POST['repo'], $permissions);
47
+  if (! $debugmode)
48
+    header('Location: git');
49
+  die();
50
+  
28 51
 }
29 52
 
30 53
 
Browse code

First draft of gitolite-module, only key-management implemented

git-svn-id: https://svn.schokokeks.org/repos/tools/webinterface/trunk@2091 87cf0b9e-d624-0410-a070-f6ee81989793

bernd authored on 21/12/2011 16:51:51
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,31 @@
1
+<?php
2
+require_role(ROLE_SYSTEMUSER);
3
+
4
+include('git.php');
5
+
6
+if ($_GET['action'] == 'newuser') {
7
+  $handle = $_POST['handle'];
8
+  if ($handle == '') {
9
+    system_failure("Leere Benutzerbezeichnung!");
10
+  }
11
+  $users = list_users();
12
+  if (in_array($handle, $users)) {
13
+    system_failure("Ein Benutzer mit diesem Namen existiert bereits.");
14
+  }
15
+  newkey($_POST['pubkey'], $handle);
16
+  if (! $debugmode)
17
+    header('Location: git');
18
+  die();
19
+} elseif ($_GET['action'] == 'newkey') {
20
+  $handle = $_POST['handle'];
21
+  if ($handle == '') {
22
+    system_failure("Leere Benutzerbezeichnung!");
23
+  }
24
+  newkey($_POST['pubkey'], $handle);
25
+  if (! $debugmode)
26
+    header('Location: git');
27
+  die();
28
+}
29
+
30
+
31
+