3ef995c2108fe77d22c0b556fb9717cb848bc48f
bernd Login via Client-Zertifikat...

bernd authored 16 years ago

1) <?php
Hanno Böck Add newlines before comment...

Hanno Böck authored 10 months ago

2) 
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 13 years ago

3) /*
4) This file belongs to the Webinterface of schokokeks.org Hosting
5) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 3 years ago

6) Written by schokokeks.org Hosting, namely
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 13 years ago

7)   Bernd Wurst <bernd@schokokeks.org>
8)   Hanno Böck <hanno@schokokeks.org>
9) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 3 years ago

10) This code is published under a 0BSD license.
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 13 years ago

11) 
12) 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.
13) */
14) 
bernd Login via Client-Zertifikat...

bernd authored 16 years ago

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

Hanno Böck authored 4 years ago

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

bernd authored 16 years ago

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

Hanno authored 7 years ago

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

Hanno Böck authored 2 years ago

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

Hanno authored 7 years ago

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

Hanno authored 7 years ago

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

Hanno authored 7 years ago

27)     add_clientcert(
Hanno Update codingstyle accordin...

Hanno authored 6 years ago

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

Hanno authored 6 years ago

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

bernd authored 16 years ago

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

Hanno authored 7 years ago

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

Hanno Böck authored 2 years ago

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

Hanno authored 7 years ago

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

Hanno Böck authored 2 years ago

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

Hanno authored 7 years ago

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

Bernd Wurst authored 13 years ago

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

Hanno authored 7 years ago

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

Bernd Wurst authored 6 years ago

63)         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 7 years ago

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

Hanno Böck authored 2 years ago

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

Hanno authored 7 years ago

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

Hanno Böck authored 2 years ago

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

Hanno authored 7 years ago

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