Browse code

Change license from CC0 to 0BSD, all contributors agreed

Hanno Böck authored on 20/08/2022 09:22:23
Showing 1 changed files
... ...
@@ -2,14 +2,11 @@
2 2
 /*
3 3
 This file belongs to the Webinterface of schokokeks.org Hosting
4 4
 
5
-Written 2008-2018 by schokokeks.org Hosting, namely
5
+Written by schokokeks.org Hosting, namely
6 6
   Bernd Wurst <bernd@schokokeks.org>
7 7
   Hanno Böck <hanno@schokokeks.org>
8 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/
9
+This code is published under a 0BSD license.
13 10
 
14 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.
15 12
 */
Browse code

Codingstyle PSR12 + array syntax

Hanno Böck authored on 30/10/2021 21:18:17
Showing 1 changed files
... ...
@@ -17,7 +17,7 @@ Nevertheless, in case you use a significant part of this code, we ask (but not r
17 17
 require_once('session/start.php');
18 18
 require_once('x509.php');
19 19
 
20
-require_role(array(ROLE_SYSTEMUSER, ROLE_SUBUSER, ROLE_VMAIL_ACCOUNT));
20
+require_role([ROLE_SYSTEMUSER, ROLE_SUBUSER, ROLE_VMAIL_ACCOUNT]);
21 21
 
22 22
 
23 23
 if ($_GET['action'] == 'new') {
Browse code

Fix codingstyle

Hanno authored on 27/10/2019 08:54:14
Showing 1 changed files
... ...
@@ -33,8 +33,7 @@ if ($_GET['action'] == 'new') {
33 33
         $_SESSION['clientcert_serial'],
34 34
         $_SESSION['clientcert_valid_from'],
35 35
         $_SESSION['clientcert_valid_until']
36
-
37
-  );
36
+    );
38 37
 
39 38
     // Räume session auf
40 39
     unset($_SESSION['clientcert_cert']);
Browse code

Umstellung von filter_input_general() auf filter_output_html()

Bernd Wurst authored on 21/09/2019 17:07:48
Showing 1 changed files
... ...
@@ -63,7 +63,7 @@ if ($_GET['action'] == 'new') {
63 63
     }
64 64
     $sure = user_is_sure();
65 65
     if ($sure === null) {
66
-        are_you_sure("action=delete&id={$cert['id']}", filter_input_general("Möchten Sie das Zertifikat »{$cert['dn']}« (Seriennummer {$cert['serial']}, Gültig von {$cert['valid_from']} bis {$cert['valid_until']}) wirklich löschen?"));
66
+        are_you_sure("action=delete&id={$cert['id']}", filter_output_html("Möchten Sie das Zertifikat »{$cert['dn']}« (Seriennummer {$cert['serial']}, Gültig von {$cert['valid_from']} bis {$cert['valid_until']}) wirklich löschen?"));
67 67
     } elseif ($sure === true) {
68 68
         delete_clientcert($cert['id']);
69 69
         if (! $debugmode) {
Browse code

Update codingstyle according to latest PHP CS Fixer 2.14.2

Hanno authored on 28/03/2019 18:56:56
Showing 1 changed files
... ...
@@ -27,17 +27,12 @@ if ($_GET['action'] == 'new') {
27 27
     }
28 28
 
29 29
     add_clientcert(
30
-
31
-      $_SESSION['clientcert_cert'],
32
-
33
-      $_SESSION['clientcert_dn'],
34
-
35
-      $_SESSION['clientcert_issuer'],
36
-                 $_SESSION['clientcert_serial'],
37
-
38
-      $_SESSION['clientcert_valid_from'],
39
-
40
-      $_SESSION['clientcert_valid_until']
30
+        $_SESSION['clientcert_cert'],
31
+        $_SESSION['clientcert_dn'],
32
+        $_SESSION['clientcert_issuer'],
33
+        $_SESSION['clientcert_serial'],
34
+        $_SESSION['clientcert_valid_from'],
35
+        $_SESSION['clientcert_valid_until']
41 36
 
42 37
   );
43 38
 
Browse code

Fix XSS Clientcert

Hanno authored on 25/01/2019 09:53:37
Showing 1 changed files
... ...
@@ -68,7 +68,7 @@ if ($_GET['action'] == 'new') {
68 68
     }
69 69
     $sure = user_is_sure();
70 70
     if ($sure === null) {
71
-        are_you_sure("action=delete&id={$cert['id']}", "Möchten Sie das Zertifikat »{$cert['dn']}« (Seriennummer {$cert['serial']}, Gültig von {$cert['valid_from']} bis {$cert['valid_until']}) wirklich löschen?");
71
+        are_you_sure("action=delete&id={$cert['id']}", filter_input_general("Möchten Sie das Zertifikat »{$cert['dn']}« (Seriennummer {$cert['serial']}, Gültig von {$cert['valid_from']} bis {$cert['valid_until']}) wirklich löschen?"));
72 72
     } elseif ($sure === true) {
73 73
         delete_clientcert($cert['id']);
74 74
         if (! $debugmode) {
Browse code

remove whitespace in empty lines

Hanno authored on 26/06/2018 23:36:40
Showing 1 changed files
... ...
@@ -25,20 +25,20 @@ if ($_GET['action'] == 'new') {
25 25
     if (! isset($_SESSION['clientcert_cert'])) {
26 26
         system_failure('Kein Zertifikat');
27 27
     }
28
-  
28
+
29 29
     add_clientcert(
30
-  
30
+
31 31
       $_SESSION['clientcert_cert'],
32
-  
32
+
33 33
       $_SESSION['clientcert_dn'],
34
-  
34
+
35 35
       $_SESSION['clientcert_issuer'],
36 36
                  $_SESSION['clientcert_serial'],
37
-  
37
+
38 38
       $_SESSION['clientcert_valid_from'],
39
-  
39
+
40 40
       $_SESSION['clientcert_valid_until']
41
-  
41
+
42 42
   );
43 43
 
44 44
     // Räume session auf
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.
... ...
@@ -20,58 +20,65 @@ require_once('x509.php');
20 20
 require_role(array(ROLE_SYSTEMUSER, ROLE_SUBUSER, ROLE_VMAIL_ACCOUNT));
21 21
 
22 22
 
23
-if ($_GET['action'] == 'new')
24
-{
25
-  check_form_token('clientcert_add');
26
-  if (! isset($_SESSION['clientcert_cert']))
27
-    system_failure('Kein Zertifikat');
23
+if ($_GET['action'] == 'new') {
24
+    check_form_token('clientcert_add');
25
+    if (! isset($_SESSION['clientcert_cert'])) {
26
+        system_failure('Kein Zertifikat');
27
+    }
28
+  
29
+    add_clientcert(
30
+  
31
+      $_SESSION['clientcert_cert'],
32
+  
33
+      $_SESSION['clientcert_dn'],
34
+  
35
+      $_SESSION['clientcert_issuer'],
36
+                 $_SESSION['clientcert_serial'],
37
+  
38
+      $_SESSION['clientcert_valid_from'],
39
+  
40
+      $_SESSION['clientcert_valid_until']
28 41
   
29
-  add_clientcert($_SESSION['clientcert_cert'], $_SESSION['clientcert_dn'], $_SESSION['clientcert_issuer'], 
30
-                 $_SESSION['clientcert_serial'], $_SESSION['clientcert_valid_from'], $_SESSION['clientcert_valid_until']);
42
+  );
31 43
 
32
-  // Räume session auf
33
-  unset($_SESSION['clientcert_cert']);
34
-  unset($_SESSION['clientcert_dn']);
35
-  unset($_SESSION['clientcert_issuer']);
36
-  unset($_SESSION['clientcert_serial']);
37
-  unset($_SESSION['clientcert_valid_from']);
38
-  unset($_SESSION['clientcert_valid_until']);
39
-  header('Location: cert');
40
-}
41
-elseif ($_GET['action'] == 'delete')
42
-{
43
-  $cert = get_cert_by_id($_GET['id']);
44
-  if (! $cert)
45
-    system_failure('no ID');
46
-  $username = NULL;
47
-  if ($_SESSION['role'] & ROLE_SYSTEMUSER) {
48
-    $username = $_SESSION['userinfo']['username'];
49
-    if (isset($_SESSION['subuser'])) {
50
-      $username = $_SESSION['subuser'];
44
+    // Räume session auf
45
+    unset($_SESSION['clientcert_cert']);
46
+    unset($_SESSION['clientcert_dn']);
47
+    unset($_SESSION['clientcert_issuer']);
48
+    unset($_SESSION['clientcert_serial']);
49
+    unset($_SESSION['clientcert_valid_from']);
50
+    unset($_SESSION['clientcert_valid_until']);
51
+    header('Location: cert');
52
+} elseif ($_GET['action'] == 'delete') {
53
+    $cert = get_cert_by_id($_GET['id']);
54
+    if (! $cert) {
55
+        system_failure('no ID');
56
+    }
57
+    $username = null;
58
+    if ($_SESSION['role'] & ROLE_SYSTEMUSER) {
59
+        $username = $_SESSION['userinfo']['username'];
60
+        if (isset($_SESSION['subuser'])) {
61
+            $username = $_SESSION['subuser'];
62
+        }
63
+    } elseif ($_SESSION['role'] & ROLE_VMAIL_ACCOUNT) {
64
+        $username = $_SESSION['mailaccount'];
65
+    }
66
+    if (! ($cert['username'] == $username)) {
67
+        system_failure('Das Zertifikat ist nicht für Ihren Zugang eingerichtet');
51 68
     }
52
-  } elseif ($_SESSION['role'] & ROLE_VMAIL_ACCOUNT) {
53
-    $username = $_SESSION['mailaccount'];
54
-  }
55
-  if (! ($cert['username'] == $username))
56
-    system_failure('Das Zertifikat ist nicht für Ihren Zugang eingerichtet');
57
-  $sure = user_is_sure();
58
-  if ($sure === NULL)
59
-  {
60
-    are_you_sure("action=delete&id={$cert['id']}", "Möchten Sie das Zertifikat »{$cert['dn']}« (Seriennummer {$cert['serial']}, Gültig von {$cert['valid_from']} bis {$cert['valid_until']}) wirklich löschen?");
61
-  }
62
-  elseif ($sure === true)
63
-  {
64
-    delete_clientcert($cert['id']);
65
-    if (! $debugmode)
66
-      header("Location: cert");
67
-  }
68
-  elseif ($sure === false)
69
-  {
70
-    if (! $debugmode)
71
-      header("Location: cert");
72
-  }
69
+    $sure = user_is_sure();
70
+    if ($sure === null) {
71
+        are_you_sure("action=delete&id={$cert['id']}", "Möchten Sie das Zertifikat »{$cert['dn']}« (Seriennummer {$cert['serial']}, Gültig von {$cert['valid_from']} bis {$cert['valid_until']}) wirklich löschen?");
72
+    } elseif ($sure === true) {
73
+        delete_clientcert($cert['id']);
74
+        if (! $debugmode) {
75
+            header("Location: cert");
76
+        }
77
+    } elseif ($sure === false) {
78
+        if (! $debugmode) {
79
+            header("Location: cert");
80
+        }
81
+    }
82
+} else {
83
+    system_failure('Kein Kommando');
73 84
 }
74
-else
75
-  system_failure('Kein Kommando');
76
-
77
-
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

Speichere und zeige Start- und Enddatum von Client-Zertifikaten

Bernd Wurst authored on 07/04/2016 06:07:38
Showing 1 changed files
... ...
@@ -26,13 +26,16 @@ if ($_GET['action'] == 'new')
26 26
   if (! isset($_SESSION['clientcert_cert']))
27 27
     system_failure('Kein Zertifikat');
28 28
   
29
-  add_clientcert($_SESSION['clientcert_cert'], $_SESSION['clientcert_dn'], $_SESSION['clientcert_issuer'], $_SESSION['clientcert_serial']);
29
+  add_clientcert($_SESSION['clientcert_cert'], $_SESSION['clientcert_dn'], $_SESSION['clientcert_issuer'], 
30
+                 $_SESSION['clientcert_serial'], $_SESSION['clientcert_valid_from'], $_SESSION['clientcert_valid_until']);
30 31
 
31 32
   // Räume session auf
32 33
   unset($_SESSION['clientcert_cert']);
33 34
   unset($_SESSION['clientcert_dn']);
34 35
   unset($_SESSION['clientcert_issuer']);
35 36
   unset($_SESSION['clientcert_serial']);
37
+  unset($_SESSION['clientcert_valid_from']);
38
+  unset($_SESSION['clientcert_valid_until']);
36 39
   header('Location: cert');
37 40
 }
38 41
 elseif ($_GET['action'] == 'delete')
... ...
@@ -54,7 +57,7 @@ elseif ($_GET['action'] == 'delete')
54 57
   $sure = user_is_sure();
55 58
   if ($sure === NULL)
56 59
   {
57
-    are_you_sure("action=delete&id={$cert['id']}", "Möchten Sie das Zertifikat »{$cert['dn']}« (Seriennummer {$cert['serial']}) wirklich löschen?");
60
+    are_you_sure("action=delete&id={$cert['id']}", "Möchten Sie das Zertifikat »{$cert['dn']}« (Seriennummer {$cert['serial']}, Gültig von {$cert['valid_from']} bis {$cert['valid_until']}) wirklich löschen?");
58 61
   }
59 62
   elseif ($sure === true)
60 63
   {
Browse code

Speichere und zeige Seriennummer von Client-Zertifikaten

Bernd Wurst authored on 07/04/2016 05:37:36
Showing 1 changed files
... ...
@@ -26,12 +26,13 @@ if ($_GET['action'] == 'new')
26 26
   if (! isset($_SESSION['clientcert_cert']))
27 27
     system_failure('Kein Zertifikat');
28 28
   
29
-  add_clientcert($_SESSION['clientcert_cert'], $_SESSION['clientcert_dn'], $_SESSION['clientcert_issuer']);
29
+  add_clientcert($_SESSION['clientcert_cert'], $_SESSION['clientcert_dn'], $_SESSION['clientcert_issuer'], $_SESSION['clientcert_serial']);
30 30
 
31 31
   // Räume session auf
32 32
   unset($_SESSION['clientcert_cert']);
33 33
   unset($_SESSION['clientcert_dn']);
34 34
   unset($_SESSION['clientcert_issuer']);
35
+  unset($_SESSION['clientcert_serial']);
35 36
   header('Location: cert');
36 37
 }
37 38
 elseif ($_GET['action'] == 'delete')
... ...
@@ -53,7 +54,7 @@ elseif ($_GET['action'] == 'delete')
53 54
   $sure = user_is_sure();
54 55
   if ($sure === NULL)
55 56
   {
56
-    are_you_sure("action=delete&id={$cert['id']}", "Möchten Sie das Zertifikat »{$cert['dn']}« wirklich löschen?");
57
+    are_you_sure("action=delete&id={$cert['id']}", "Möchten Sie das Zertifikat »{$cert['dn']}« (Seriennummer {$cert['serial']}) wirklich löschen?");
57 58
   }
58 59
   elseif ($sure === true)
59 60
   {
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

bugfix: missing brackets

Bernd Wurst authored on 30/03/2012 17:42:33
Showing 1 changed files
... ...
@@ -42,8 +42,9 @@ elseif ($_GET['action'] == 'delete')
42 42
   $username = NULL;
43 43
   if ($_SESSION['role'] & ROLE_SYSTEMUSER) {
44 44
     $username = $_SESSION['userinfo']['username'];
45
-    if (isset($_SESSION['subuser']))
45
+    if (isset($_SESSION['subuser'])) {
46 46
       $username = $_SESSION['subuser'];
47
+    }
47 48
   } elseif ($_SESSION['role'] & ROLE_VMAIL_ACCOUNT) {
48 49
     $username = $_SESSION['mailaccount'];
49 50
   }
Browse code

bugfix: (once again) most users have multiple roles, so checking with == is wrong

Bernd Wurst authored on 30/03/2012 17:19:34
Showing 1 changed files
... ...
@@ -40,11 +40,11 @@ elseif ($_GET['action'] == 'delete')
40 40
   if (! $cert)
41 41
     system_failure('no ID');
42 42
   $username = NULL;
43
-  if ($_SESSION['role'] == ROLE_SYSTEMUSER) {
43
+  if ($_SESSION['role'] & ROLE_SYSTEMUSER) {
44 44
     $username = $_SESSION['userinfo']['username'];
45 45
     if (isset($_SESSION['subuser']))
46 46
       $username = $_SESSION['subuser'];
47
-  } elseif ($_SESSION['role'] == ROLE_VMAIL_ACCOUNT) {
47
+  } elseif ($_SESSION['role'] & ROLE_VMAIL_ACCOUNT) {
48 48
     $username = $_SESSION['mailaccount'];
49 49
   }
50 50
   if (! ($cert['username'] == $username))
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_once('session/start.php');
3 18
 require_once('x509.php');
4 19
 
Browse code

Ermögliche Client-Cert-Login auch für VMail-Accounts

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

bernd authored on 05/03/2012 06:19:25
Showing 1 changed files
... ...
@@ -2,7 +2,7 @@
2 2
 require_once('session/start.php');
3 3
 require_once('x509.php');
4 4
 
5
-require_role(ROLE_SYSTEMUSER);
5
+require_role(array(ROLE_SYSTEMUSER, ROLE_SUBUSER, ROLE_VMAIL_ACCOUNT));
6 6
 
7 7
 
8 8
 if ($_GET['action'] == 'new')
... ...
@@ -24,8 +24,15 @@ elseif ($_GET['action'] == 'delete')
24 24
   $cert = get_cert_by_id($_GET['id']);
25 25
   if (! $cert)
26 26
     system_failure('no ID');
27
-  if (!((!isset($_SESSION['subuser']) && $cert['username'] == $_SESSION['userinfo']['username']) ||
28
-        (isset($_SESSION['subuser']) && $cert['username'] == $_SESSION['subuser'])))
27
+  $username = NULL;
28
+  if ($_SESSION['role'] == ROLE_SYSTEMUSER) {
29
+    $username = $_SESSION['userinfo']['username'];
30
+    if (isset($_SESSION['subuser']))
31
+      $username = $_SESSION['subuser'];
32
+  } elseif ($_SESSION['role'] == ROLE_VMAIL_ACCOUNT) {
33
+    $username = $_SESSION['mailaccount'];
34
+  }
35
+  if (! ($cert['username'] == $username))
29 36
     system_failure('Das Zertifikat ist nicht für Ihren Zugang eingerichtet');
30 37
   $sure = user_is_sure();
31 38
   if ($sure === NULL)
Browse code

Erlaube das Löschen von Client-Certs für einen Subuser

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

bernd authored on 19/10/2010 04:49:06
Showing 1 changed files
... ...
@@ -24,7 +24,8 @@ elseif ($_GET['action'] == 'delete')
24 24
   $cert = get_cert_by_id($_GET['id']);
25 25
   if (! $cert)
26 26
     system_failure('no ID');
27
-  if ($cert['username'] != $_SESSION['userinfo']['username'])
27
+  if (!((!isset($_SESSION['subuser']) && $cert['username'] == $_SESSION['userinfo']['username']) ||
28
+        (isset($_SESSION['subuser']) && $cert['username'] == $_SESSION['subuser'])))
28 29
     system_failure('Das Zertifikat ist nicht für Ihren Zugang eingerichtet');
29 30
   $sure = user_is_sure();
30 31
   if ($sure === NULL)
Browse code

* alle internen Links sinnvoll (und gleichartig!) encoden * Automatischer Upgrader für Drupal funktioniert jetzt

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

bernd authored on 07/03/2009 14:48:53
Showing 1 changed files
... ...
@@ -29,7 +29,7 @@ elseif ($_GET['action'] == 'delete')
29 29
   $sure = user_is_sure();
30 30
   if ($sure === NULL)
31 31
   {
32
-    are_you_sure("action=delete&amp;id={$cert['id']}", "Möchten Sie das Zertifikat »{$cert['dn']}« wirklich löschen?");
32
+    are_you_sure("action=delete&id={$cert['id']}", "Möchten Sie das Zertifikat »{$cert['dn']}« wirklich löschen?");
33 33
   }
34 34
   elseif ($sure === true)
35 35
   {
Browse code

Login via Client-Zertifikat (userinterface)

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

bernd authored on 05/03/2009 11:13:27
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,49 @@
1
+<?php
2
+require_once('session/start.php');
3
+require_once('x509.php');
4
+
5
+require_role(ROLE_SYSTEMUSER);
6
+
7
+
8
+if ($_GET['action'] == 'new')
9
+{
10
+  check_form_token('clientcert_add');
11
+  if (! isset($_SESSION['clientcert_cert']))
12
+    system_failure('Kein Zertifikat');
13
+  
14
+  add_clientcert($_SESSION['clientcert_cert'], $_SESSION['clientcert_dn'], $_SESSION['clientcert_issuer']);
15
+
16
+  // Räume session auf
17
+  unset($_SESSION['clientcert_cert']);
18
+  unset($_SESSION['clientcert_dn']);
19
+  unset($_SESSION['clientcert_issuer']);
20
+  header('Location: cert');
21
+}
22
+elseif ($_GET['action'] == 'delete')
23
+{
24
+  $cert = get_cert_by_id($_GET['id']);
25
+  if (! $cert)
26
+    system_failure('no ID');
27
+  if ($cert['username'] != $_SESSION['userinfo']['username'])
28
+    system_failure('Das Zertifikat ist nicht für Ihren Zugang eingerichtet');
29
+  $sure = user_is_sure();
30
+  if ($sure === NULL)
31
+  {
32
+    are_you_sure("action=delete&amp;id={$cert['id']}", "Möchten Sie das Zertifikat »{$cert['dn']}« wirklich löschen?");
33
+  }
34
+  elseif ($sure === true)
35
+  {
36
+    delete_clientcert($cert['id']);
37
+    if (! $debugmode)
38
+      header("Location: cert");
39
+  }
40
+  elseif ($sure === false)
41
+  {
42
+    if (! $debugmode)
43
+      header("Location: cert");
44
+  }
45
+}
46
+else
47
+  system_failure('Kein Kommando');
48
+
49
+