8a4acb54b452ad801825c59cc7aa542eae0f9f3f
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) 
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)   {
Bernd Wurst Alten Debug-Output entfernt...

Bernd Wurst authored 6 years ago

38)     #DEBUG("Modul {$module} hat keine Menüeinträge");
bernd Menü-Includes sinnvoller /...

bernd authored 16 years ago

39)     continue;
40)   }
Bernd Wurst Binde style.css von Modulen...

Bernd Wurst authored 6 years ago

41)   // Menüeinträge spammen den debug-output zu
42)   //DEBUG("<h4>$module</h4>");
43)   //DEBUG($menu);
bernd webinterface => /webinterface

bernd authored 17 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

51)       if (isset($submenu[$menu[$key]['submenu']][$weight]))
52)         $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

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

bernd authored 16 years ago

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

bernd authored 16 years ago

55)     }
bernd webinterface => /webinterface

bernd authored 17 years ago

56)     else
bernd Ermögliche submenüs

bernd authored 16 years ago

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

bernd authored 17 years ago

63)   }
64)   $menuitem = array_merge($menuitem, $menu);
65) }
66) 
67) ksort($weighted_menuitem);
Bernd Wurst Alten Debug-Output entfernt...

Bernd Wurst authored 6 years ago

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

bernd authored 16 years ago

69) 
70) foreach ($submenu AS $weight => $data) {
71)   ksort($submenu[$weight]);
72) }
73) 
Bernd Wurst Alten Debug-Output entfernt...

Bernd Wurst authored 6 years ago

74) #DEBUG($submenu);
bernd webinterface => /webinterface

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 14 years ago

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

bernd authored 17 years ago

79) 
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

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

bernd authored 16 years ago

82) 
bernd submenu-items korrekt zuordnen

bernd authored 16 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

98) 
bernd Umstellung auf Theme-Suppor...

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 16 years ago

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

bernd authored 13 years ago

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

bernd authored 13 years ago

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

bernd authored 16 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 16 years ago

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

bernd authored 13 years ago

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

bernd authored 16 years ago

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

bernd authored 13 years ago

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

bernd authored 16 years ago

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

bernd authored 13 years ago

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

bernd authored 17 years ago

122)                         }
bernd Ermögliche submenüs

bernd authored 16 years ago

123) 		}
bernd webinterface => /webinterface

bernd authored 17 years ago

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

bernd authored 13 years ago

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

bernd authored 16 years ago

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

bernd authored 13 years ago

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

bernd authored 13 years ago

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

bernd authored 13 years ago

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

Bernd Wurst authored 11 years ago

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

bernd authored 16 years ago

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

Bernd Wurst authored 11 years ago

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

bernd authored 16 years ago

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

bernd authored 16 years ago

145)   elseif ($role & (ROLE_MAILACCOUNT | ROLE_VMAIL_ACCOUNT)) {
Bernd Wurst Zeige User-Infos beim Login...

Bernd Wurst authored 11 years ago

146)     $userinfo .= '<strong>'.$_SESSION['mailaccount'].'</strong><br />(Postfach von Benutzer <em>'.$_SESSION['userinfo']['username'].'</em>)';
bernd Hanno mag mein tolles Bildc...

bernd authored 16 years ago

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

bernd authored 13 years ago

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

bernd authored 16 years ago

149) }
bernd back-to-admin feature

bernd authored 15 years ago

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

bernd authored 13 years ago

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

bernd authored 15 years ago

155) }
bernd webinterface => /webinterface

bernd authored 17 years ago

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)