91432186ce238f061b736c54b84a3b4bea12a675
bernd webinterface => /webinterface

bernd authored 17 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) 
Bernd Wurst Copyright year update

Bernd Wurst authored 6 years ago

5) Written 2008-2018 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) 
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) */
bernd webinterface => /webinterface

bernd authored 17 years ago

16) 
bernd XSS/CSRF-Bugs behoben

bernd authored 16 years ago

17) require_once("inc/security.php");
18) 
bernd webinterface => /webinterface

bernd authored 17 years ago

19) function system_failure($reason)
20) {
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

21) 	input_error($reason);
22) 	show_page();
bernd webinterface => /webinterface

bernd authored 17 years ago

23)         die();
24) }
25) 
26) 
27) function input_error($reason)
28) {
29)   global $input_error;
30)   if (!isset($input_error))
31)     $input_error = array();
32)   array_push($input_error, $reason);
33) }
34) 
35) function warning($msg)
36) {
bernd Warnings und Success-Meldun...

bernd authored 13 years ago

37)   if (!isset($_SESSION['warning']))
38)     $_SESSION['warning'] = array();
39)   array_push($_SESSION['warning'], $msg);
bernd webinterface => /webinterface

bernd authored 17 years ago

40) }
41) 
42) function success_msg($msg)
43) {
bernd Warnings und Success-Meldun...

bernd authored 13 years ago

44)   if (!isset($_SESSION['success_msg']))
45)     $_SESSION['success_msg'] = array();
46)   array_push($_SESSION['success_msg'], $msg);
bernd webinterface => /webinterface

bernd authored 17 years ago

47) }
48) 
49) 
bernd Erste Version des vmail-Modul

bernd authored 16 years ago

50) function we_have_an_error()
51) {
52)   global $input_error;
53) 
Hanno Böck avoid warnings about uncoun...

Hanno Böck authored 6 years ago

54)   if (isset($input_error))
55)     return (count($input_error) > 0);
56)   else
57)     return 0;
bernd Erste Version des vmail-Modul

bernd authored 16 years ago

58) }
59) 
60) 
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

61) function get_messages()
bernd webinterface => /webinterface

bernd authored 17 years ago

62) {
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

63)   $messages = '';
bernd webinterface => /webinterface

bernd authored 17 years ago

64)   global $input_error;
65)   if (isset($input_error))
66)   {
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

67)     $messages .= '<div class="error">
bernd webinterface => /webinterface

bernd authored 17 years ago

68)     <h3>Fehler</h3>
69)     <p>Folgende Fehler wurden festgestellt: </p>
70)     <ul>
71)     ';
72)     foreach ($input_error as $error)
73)     {
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

74)       $messages .= '<li>'.nl2br(filter_input_general($error))."</li>\n";
bernd webinterface => /webinterface

bernd authored 17 years ago

75)     }
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

76)     $messages .= '</ul>
bernd webinterface => /webinterface

bernd authored 17 years ago

77)     </div>';
78)   }
bernd Warnings und Success-Meldun...

bernd authored 13 years ago

79)   if (isset($_SESSION['warning']))
bernd webinterface => /webinterface

bernd authored 17 years ago

80)   {
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

81)     $messages .= '<div class="error">
bernd webinterface => /webinterface

bernd authored 17 years ago

82)     <ul>
83)     ';
bernd Warnings und Success-Meldun...

bernd authored 13 years ago

84)     foreach ($_SESSION['warning'] as $msg)
bernd webinterface => /webinterface

bernd authored 17 years ago

85)     {
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

86)       $messages .= '<li>'.nl2br(filter_input_general($msg))."</li>\n";
bernd webinterface => /webinterface

bernd authored 17 years ago

87)     }
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

88)     $messages .= '</ul>
bernd webinterface => /webinterface

bernd authored 17 years ago

89)     </div>';
bernd Warnings und Success-Meldun...

bernd authored 13 years ago

90)     unset($_SESSION['warning']);
bernd webinterface => /webinterface

bernd authored 17 years ago

91)   }
bernd Warnings und Success-Meldun...

bernd authored 13 years ago

92)   if (isset($_SESSION['success_msg']))
bernd webinterface => /webinterface

bernd authored 17 years ago

93)   {
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

94)     $messages .= '<div class="success">
bernd webinterface => /webinterface

bernd authored 17 years ago

95)     <ul>
96)     ';
bernd Warnings und Success-Meldun...

bernd authored 13 years ago

97)     foreach ($_SESSION['success_msg'] as $msg)
bernd webinterface => /webinterface

bernd authored 17 years ago

98)     {
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

99)       $messages .= '<li>'.nl2br(filter_input_general($msg))."</li>\n";
bernd webinterface => /webinterface

bernd authored 17 years ago

100)     }
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

101)     $messages .= '</ul>
bernd webinterface => /webinterface

bernd authored 17 years ago

102)     </div>';
bernd Warnings und Success-Meldun...

bernd authored 13 years ago

103)     unset($_SESSION['success_msg']);
bernd webinterface => /webinterface

bernd authored 17 years ago

104)   }
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

105)   return $messages;
bernd webinterface => /webinterface

bernd authored 17 years ago

106) }
107) 
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

108) function show_messages() 
109) {
110)   echo get_messages();
111) }
bernd webinterface => /webinterface

bernd authored 17 years ago

112) 
113) function require_role($roles)
114) {
115)   if (! is_array($roles))
116)     $roles = array($roles);
117)   $allow = false;
118)   foreach ($roles as $role)
bernd Nachtrag zum vorigen

bernd authored 16 years ago

119)     if ($role & $_SESSION['role'])
bernd webinterface => /webinterface

bernd authored 17 years ago

120)       $allow = true;
121)   if (! $allow)
bernd Nachtrag zum vorigen

bernd authored 16 years ago

122)     if ($_SESSION['role'] == ROLE_ANONYMOUS)
Bernd Wurst Entferne Javascript-Konstru...

Bernd Wurst authored 6 years ago

123)       login_screen();
bernd Nachtrag zum vorigen

bernd authored 16 years ago

124)     else
125)       login_screen("Diese Seite können Sie mit Ihren aktuellen Zugriffsrechten nicht benutzen, bitte melden Sie sich mit den benötigten Zugriffsrechten an!");
bernd webinterface => /webinterface

bernd authored 17 years ago

126) }
127) 
128) 
schokokeks.org web services changes to cert login stuff

schokokeks.org web services authored 6 years ago

129) function login_screen($why = NULL)
bernd webinterface => /webinterface

bernd authored 17 years ago

130) {
schokokeks.org web services changes to cert login stuff

schokokeks.org web services authored 6 years ago

131)   if (! $why) {
132)       if (isset($_COOKIE['CLIENTCERT_AUTOLOGIN']) && $_COOKIE['CLIENTCERT_AUTOLOGIN'] == '1') {
Bernd Wurst Entferne Javascript-Konstru...

Bernd Wurst authored 6 years ago

133)           redirect("/certlogin/index.php?destination=".urlencode($_SERVER['REQUEST_URI']));
schokokeks.org web services changes to cert login stuff

schokokeks.org web services authored 6 years ago

134)       }
Bernd Wurst Cookie-based autologin when...

Bernd Wurst authored 11 years ago

135)   }
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

136)   require_once('inc/theme.php');
137)   if ($why) {
138)     warning($why);
139)   }
140)   show_page('login');
141)   die();