64ea2c9cacfd02710fb2e86cf29fb029e6cc406c
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 Updated copyright notice (2...

Bernd Wurst authored 11 years ago

5) Written 2008-2013 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) 
17) if (! defined("TOP_INCLUDED"))
18) {
19) 
20) define("TOP_INCLUDED", true);
21) 
22) require_once("inc/error.php");
bernd Wenn die Datenbank-Verbindu...

bernd authored 13 years ago

23) require_once("inc/debug.php");
bernd neue Bilder, mehr SSL-Zerti...

bernd authored 14 years ago

24) global $prefix, $section;
bernd webinterface => /webinterface

bernd authored 17 years ago

25) 
26) $menuitem = array();
27) $weighted_menuitem = array();
28) 
bernd Ermögliche submenüs

bernd authored 16 years ago

29) $submenu = array();
30) 
bernd Mehr config-optionen und co...

bernd authored 14 years ago

31) foreach (config('modules') as $module)
bernd webinterface => /webinterface

bernd authored 17 years ago

32) {
bernd Ermögliche submenüs

bernd authored 16 years ago

33)   $menu = false;
34)   if (file_exists("modules/{$module}/menu.php"))
35)     include("modules/{$module}/menu.php");
bernd Menü-Includes sinnvoller /...

bernd authored 16 years ago

36)   if ($menu === false)
37)   {
38)     DEBUG("Modul {$module} hat keine Menüeinträge");
39)     continue;
40)   }
41)   DEBUG("<h4>$module</h4>");
42)   DEBUG($menu);
bernd webinterface => /webinterface

bernd authored 17 years ago

43)   // $menu["foo"]["file"] enthält den Link
44)   foreach (array_keys($menu) as $key)
45)   {
46)     $menu[$key]["file"] = $prefix."go/".$module."/".$menu[$key]["file"];
47)     $weight = $menu[$key]["weight"];
bernd Ermögliche submenüs

bernd authored 16 years ago

48)     if (isset($menu[$key]['submenu']))
49)     {
bernd Auch submenüs sollten gewic...

bernd authored 15 years ago

50)       if (isset($submenu[$menu[$key]['submenu']][$weight]))
51)         $submenu[$menu[$key]['submenu']][$weight] = array_merge($submenu[$menu[$key]['submenu']][$weight], array($key => $menu[$key]));
bernd Ermögliche submenüs

bernd authored 16 years ago

52)       else
bernd Auch submenüs sollten gewic...

bernd authored 15 years ago

53)         $submenu[$menu[$key]['submenu']][$weight] = array($key => $menu[$key]);
bernd Ermögliche submenüs

bernd authored 16 years ago

54)     }
bernd webinterface => /webinterface

bernd authored 17 years ago

55)     else
bernd Ermögliche submenüs

bernd authored 16 years ago

56)     {
57)       if (array_key_exists($weight, $weighted_menuitem))
58)         $weighted_menuitem[$weight] = array_merge($weighted_menuitem[$weight], array($key => $menu[$key]));
59)       else
60)         $weighted_menuitem[$weight] = array($key => $menu[$key]);
61)     }
bernd webinterface => /webinterface

bernd authored 17 years ago

62)   }
63)   $menuitem = array_merge($menuitem, $menu);
64) }
65) 
66) ksort($weighted_menuitem);
bernd Ermögliche submenüs

bernd authored 16 years ago

67) DEBUG($weighted_menuitem);
bernd Auch submenüs sollten gewic...

bernd authored 15 years ago

68) 
69) foreach ($submenu AS $weight => $data) {
70)   ksort($submenu[$weight]);
71) }
72) 
bernd Ermögliche submenüs

bernd authored 16 years ago

73) DEBUG($submenu);
bernd webinterface => /webinterface

bernd authored 17 years ago

74) 
bernd Setze X-FRAME-OPTIONS um Cl...

bernd authored 13 years ago

75) // Verbiete das Laden in jeglichem Frameset
76) header("X-FRAME-OPTIONS: DENY");
bernd Einige Dummheiten repariert...

bernd authored 14 years ago

77) header("Content-Type: ".config('mime_type'));
bernd webinterface => /webinterface

bernd authored 17 years ago

78) 
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

79) if (!isset($html_header))
80)   $html_header = '';
bernd Usability: User sieht immer...

bernd authored 16 years ago

81) 
bernd submenu-items korrekt zuordnen

bernd authored 15 years ago

82) function array_key_exists_r($needle, $haystack)
83) {
84)     $result = array_key_exists($needle, $haystack);
85)     if ($result) return $result;
86)     foreach ($haystack as $v) {
87)         if (is_array($v)) {
88)             $result = array_key_exists_r($needle, $v);
89)         }
90)         if ($result) return $result;
91)     }
92)     return $result;
93) }
94) 
95) 
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

96) $menu = '';
bernd webinterface => /webinterface

bernd authored 17 years ago

97) 
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

98) foreach ($weighted_menuitem as $key => $menuitem)
bernd webinterface => /webinterface

bernd authored 17 years ago

99)         foreach ($menuitem as $key => $item)
100)         {
101)                 if ($key == $section)
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

102)                         $menu .= '<a href="'.$item['file'].'" class="menuitem active">'.$item['label'].'</a>'."\n";
bernd Ermögliche submenüs

bernd authored 16 years ago

103)                 else
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

104)                         $menu .= '<a href="'.$item['file'].'" class="menuitem">'.$item['label'].'</a>'."\n";
bernd So herum macht das eigentli...

bernd authored 13 years ago

105)                 if (isset($submenu[$key]))
bernd Ermögliche submenüs

bernd authored 16 years ago

106)                 {
bernd So herum macht das eigentli...

bernd authored 13 years ago

107)                         if ($key == $section || (array_key_exists($key, $submenu) && array_key_exists_r($section, $submenu[$key])))
bernd webinterface => /webinterface

bernd authored 17 years ago

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

bernd authored 13 years ago

109)                                 $menu .= "\n";
bernd Auch submenüs sollten gewic...

bernd authored 15 years ago

110) 				foreach ($submenu[$key] as $weight => $mysub) 
111) 				{
112)                                   foreach ($mysub as $sec => $item)
113)                                   {
114)                                           if ($sec == $section)
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

115)                                                   $menu .= '<a href="'.$item['file'].'" class="submenuitem menuitem active">'.$item['label'].'</a>'."\n";
bernd Auch submenüs sollten gewic...

bernd authored 15 years ago

116)                                           else
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

117)                                                   $menu .= '<a href="'.$item['file'].'" class="submenuitem menuitem">'.$item['label'].'</a>'."\n";
bernd Auch submenüs sollten gewic...

bernd authored 15 years ago

118)                                   }
119) 				}
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

120)                                 $menu .= "\n";
bernd webinterface => /webinterface

bernd authored 17 years ago

121)                         }
bernd Ermögliche submenüs

bernd authored 16 years ago

122) 		}
bernd webinterface => /webinterface

bernd authored 17 years ago

123) 
124)         }
125) 
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

126) $userinfo = '';
127) 
128) $role = $_SESSION['role'];
bernd Hanno mag mein tolles Bildc...

bernd authored 16 years ago

129) if ($role != ROLE_ANONYMOUS) {
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

130)   $userinfo .= '<p class="userinfo">Angemeldet als:<br />';
bernd Erlaube subusers, die nur Z...

bernd authored 13 years ago

131)   if ($role & ROLE_SYSTEMUSER && isset($_SESSION['subuser'])) {
132)     $userinfo .= '<strong>'.$_SESSION['subuser'].'</strong>';
133)     $userinfo .= '<br />Mitbenutzer von '.$_SESSION['userinfo']['username'];
134)   }
135)   elseif ($role & ROLE_SYSTEMUSER) {
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

136)     $userinfo .= '<strong>'.$_SESSION['userinfo']['username'].'</strong>';
137)     $userinfo .= '<br />'.$_SESSION['userinfo']['name'];
Bernd Wurst Zeige Kundennummer und UID...

Bernd Wurst authored 11 years ago

138)     $userinfo .= '<br />(UID '.$_SESSION['userinfo']['uid'].(($role & ROLE_CUSTOMER) ? ', Kunde '.$_SESSION['customerinfo']['customerno'] : '').')';
bernd Hanno mag mein tolles Bildc...

bernd authored 16 years ago

139)   }
140)   elseif ($role & ROLE_CUSTOMER) {
Bernd Wurst Zeige Kundennummer und UID...

Bernd Wurst authored 11 years ago

141)     $userinfo .= '<strong>'.$_SESSION['customerinfo']['name'].'</strong>';
142)     $userinfo .= '<br />(Kunde '.$_SESSION['customerinfo']['customerno'].')';
bernd Hanno mag mein tolles Bildc...

bernd authored 16 years ago

143)   }
bernd VMail-accounts können sich...

bernd authored 16 years ago

144)   elseif ($role & (ROLE_MAILACCOUNT | ROLE_VMAIL_ACCOUNT)) {
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

145)     $userinfo .= '<strong>'.$_SESSION['mailaccount'].'</strong><br />(E-Mail-Account)';
bernd Hanno mag mein tolles Bildc...

bernd authored 16 years ago

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

bernd authored 13 years ago

147)   $userinfo .= '</p>';
bernd Hanno mag mein tolles Bildc...

bernd authored 16 years ago

148) }
bernd back-to-admin feature

bernd authored 15 years ago

149) 
150) if (isset($_SESSION['admin_user'])) {
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

151)   $userinfo .= '<p class="admininfo">';
152)   $userinfo .= '<a href="'.$prefix.'go/su/back_to_admin">Zurück zu »'.$_SESSION['admin_user'].'«</a>';
153)   $userinfo .= '</p>';
bernd back-to-admin feature

bernd authored 15 years ago

154) }
bernd webinterface => /webinterface

bernd authored 17 years ago

155) 
156) 
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

157) $messages = get_messages();
bernd webinterface => /webinterface

bernd authored 17 years ago

158) 
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

159) $BASE_PATH = $prefix;
160) $THEME_PATH = $prefix."themes/".config('theme')."/";
bernd webinterface => /webinterface

bernd authored 17 years ago

161) 
162)