c208bd906b3991555db11b9229846c4601ca408c
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) 
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) */
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) 
bernd VMail-Quota-Zeug

bernd authored 12 years ago

54)   return (count($input_error) > 0);
bernd Erste Version des vmail-Modul

bernd authored 16 years ago

55) }
56) 
57) 
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

61)   global $input_error;
62)   if (isset($input_error))
63)   {
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

74)     </div>';
75)   }
bernd Warnings und Success-Meldun...

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

79)     <ul>
80)     ';
bernd Warnings und Success-Meldun...

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

92)     <ul>
93)     ';
bernd Warnings und Success-Meldun...

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

105) function show_messages() 
106) {
107)   echo get_messages();
108) }
bernd webinterface => /webinterface

bernd authored 17 years ago

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

bernd authored 16 years ago

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

bernd authored 17 years ago

117)       $allow = true;
118)   if (! $allow)
bernd Nachtrag zum vorigen

bernd authored 16 years ago

119)     if ($_SESSION['role'] == ROLE_ANONYMOUS)
120)       login_screen("Diese Seite können Sie erst benutzen, wenn Sie sich mit Ihren Zugangsdaten anmelden.");
121)     else
122)       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

123) }
124) 
125) 
126) function login_screen($why)
127) {
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

128)   require_once('inc/theme.php');
129)   if ($why) {
130)     warning($why);
131)   }
132)   show_page('login');
133)   die();