28667e96bdcc072a7485ff50021f54f555c59ea3
bernd Login via Client-Zertifikat...

bernd authored 15 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 Login via Client-Zertifikat...

bernd authored 15 years ago

14) require_once('session/start.php');
15) require_once('x509.php');
16) 
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

17) require_role([ROLE_SYSTEMUSER, ROLE_SUBUSER, ROLE_VMAIL_ACCOUNT]);
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

18) 
19) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

20) if ($_GET['action'] == 'new') {
21)     check_form_token('clientcert_add');
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 1 year ago

22)     if (!isset($_SESSION['clientcert_cert'])) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

23)         system_failure('Kein Zertifikat');
24)     }
Hanno remove whitespace in empty...

Hanno authored 6 years ago

25) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

26)     add_clientcert(
Hanno Update codingstyle accordin...

Hanno authored 5 years ago

27)         $_SESSION['clientcert_cert'],
28)         $_SESSION['clientcert_dn'],
29)         $_SESSION['clientcert_issuer'],
30)         $_SESSION['clientcert_serial'],
31)         $_SESSION['clientcert_valid_from'],
32)         $_SESSION['clientcert_valid_until']
Hanno Fix codingstyle

Hanno authored 5 years ago

33)     );
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

34) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

35)     // Räume session auf
36)     unset($_SESSION['clientcert_cert']);
37)     unset($_SESSION['clientcert_dn']);
38)     unset($_SESSION['clientcert_issuer']);
39)     unset($_SESSION['clientcert_serial']);
40)     unset($_SESSION['clientcert_valid_from']);
41)     unset($_SESSION['clientcert_valid_until']);
42)     header('Location: cert');
43) } elseif ($_GET['action'] == 'delete') {
44)     $cert = get_cert_by_id($_GET['id']);
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 1 year ago

45)     if (!$cert) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

46)         system_failure('no ID');
47)     }
48)     $username = null;
49)     if ($_SESSION['role'] & ROLE_SYSTEMUSER) {
50)         $username = $_SESSION['userinfo']['username'];
51)         if (isset($_SESSION['subuser'])) {
52)             $username = $_SESSION['subuser'];
53)         }
54)     } elseif ($_SESSION['role'] & ROLE_VMAIL_ACCOUNT) {
55)         $username = $_SESSION['mailaccount'];
56)     }
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 1 year ago

57)     if (!($cert['username'] == $username)) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

58)         system_failure('Das Zertifikat ist nicht für Ihren Zugang eingerichtet');
Bernd Wurst bugfix: missing brackets

Bernd Wurst authored 12 years ago

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

Hanno authored 6 years ago

60)     $sure = user_is_sure();
61)     if ($sure === null) {
Bernd Wurst Umstellung von filter_input...

Bernd Wurst authored 5 years ago

62)         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?"));
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

63)     } elseif ($sure === true) {
64)         delete_clientcert($cert['id']);
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 1 year ago

65)         if (!$debugmode) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

66)             header("Location: cert");
67)         }
68)     } elseif ($sure === false) {
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 1 year ago

69)         if (!$debugmode) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

70)             header("Location: cert");
71)         }
72)     }
73) } else {
74)     system_failure('Kein Kommando');