817c65adda112986961f253b2b9e9cb66026565a
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 Wurst Ermögliche das Umziehen von...

Bernd Wurst authored 6 years ago

40)   $backtrace = debug_backtrace();
41)   DEBUG('WARNING:<br>'.$backtrace[0]['file'].':'.$backtrace[0]['line'].': '.$msg);
bernd webinterface => /webinterface

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

49) }
50) 
51) 
bernd Erste Version des vmail-Modul

bernd authored 16 years ago

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

Hanno Böck authored 6 years ago

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

bernd authored 16 years ago

60) }
61) 
62) 
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

79)     </div>';
80)   }
bernd Warnings und Success-Meldun...

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

84)     <ul>
85)     ';
bernd Warnings und Success-Meldun...

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

97)     <ul>
98)     ';
bernd Warnings und Success-Meldun...

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

108) }
109) 
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

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

bernd authored 17 years ago

114) 
115) function require_role($roles)
116) {
Bernd Wurst Blende Aktionen aus, wenn d...

Bernd Wurst authored 6 years ago

117)   if (! is_array($roles)) {
bernd webinterface => /webinterface

bernd authored 17 years ago

118)     $roles = array($roles);
Bernd Wurst Blende Aktionen aus, wenn d...

Bernd Wurst authored 6 years ago

119)   }
bernd webinterface => /webinterface

bernd authored 17 years ago

120)   $allow = false;
Bernd Wurst Blende Aktionen aus, wenn d...

Bernd Wurst authored 6 years ago

121)   foreach ($roles as $role) {
122)     if ($role & $_SESSION['role']) {
bernd webinterface => /webinterface

bernd authored 17 years ago

123)       $allow = true;
Bernd Wurst Blende Aktionen aus, wenn d...

Bernd Wurst authored 6 years ago

124)     }
125)   }
126)   if (! $allow) {
127)     if ($_SESSION['role'] == ROLE_ANONYMOUS) {
Bernd Wurst Entferne Javascript-Konstru...

Bernd Wurst authored 6 years ago

128)       login_screen();
Bernd Wurst Blende Aktionen aus, wenn d...

Bernd Wurst authored 6 years ago

129)     } else {
130)       $backtrace = debug_backtrace();
131)       DEBUG($backtrace[0]['file'].':'.$backtrace[0]['line'].': Current user does not have any of the required roles: '.implode(",",$roles));
bernd Nachtrag zum vorigen

bernd authored 16 years ago

132)       login_screen("Diese Seite können Sie mit Ihren aktuellen Zugriffsrechten nicht benutzen, bitte melden Sie sich mit den benötigten Zugriffsrechten an!");
Bernd Wurst Blende Aktionen aus, wenn d...

Bernd Wurst authored 6 years ago

133)     }
134)   }
bernd webinterface => /webinterface

bernd authored 17 years ago

135) }
136) 
137) 
schokokeks.org web services changes to cert login stuff

schokokeks.org web services authored 6 years ago

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

bernd authored 17 years ago

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

schokokeks.org web services authored 6 years ago

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

Bernd Wurst authored 6 years ago

142)           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

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

Bernd Wurst authored 11 years ago

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

bernd authored 13 years ago

145)   require_once('inc/theme.php');
146)   if ($why) {
147)     warning($why);
148)   }
149)   show_page('login');
150)   die();