572cf3fbfab240e3d317932cf37849db312d0fa7
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) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 2 years ago

5) Written 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) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 2 years ago

9) This code is published under a 0BSD license.
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

10) 
11) 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.
12) */
bernd webinterface => /webinterface

bernd authored 17 years ago

13) 
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 1 year ago

14) if (!defined("TOP_INCLUDED")) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

15)     define("TOP_INCLUDED", true);
bernd webinterface => /webinterface

bernd authored 17 years ago

16) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

17)     require_once("inc/error.php");
18)     require_once("inc/debug.php");
19)     global $prefix, $section;
bernd Auch submenüs sollten gewic...

bernd authored 16 years ago

20) 
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

21)     $menuitem = [];
22)     $weighted_menuitem = [];
bernd Auch submenüs sollten gewic...

bernd authored 16 years ago

23) 
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

24)     $submenu = [];
bernd webinterface => /webinterface

bernd authored 17 years ago

25) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

26)     foreach (config('modules') as $module) {
Hanno Böck codingstyle fix: array syntax

Hanno Böck authored 2 years ago

27)         $menu = [];
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

28)         if (file_exists("modules/{$module}/menu.php")) {
29)             include("modules/{$module}/menu.php");
30)         }
Bernd Wurst do not initialize $menu as...

Bernd Wurst authored 2 years ago

31)         if (empty($menu)) {
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

32)             continue;
33)         }
34)         foreach (array_keys($menu) as $key) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

35)             $menu[$key]["file"] = $prefix . "go/" . $module . "/" . $menu[$key]["file"];
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

36)             $weight = $menu[$key]["weight"];
37)             if (isset($menu[$key]['submenu'])) {
38)                 if (isset($submenu[$menu[$key]['submenu']][$weight])) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

39)                     $submenu[$menu[$key]['submenu']][$weight] = array_merge($submenu[$menu[$key]['submenu']][$weight], [$key => $menu[$key]]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

40)                 } else {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

41)                     $submenu[$menu[$key]['submenu']][$weight] = [$key => $menu[$key]];
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

42)                 }
43)             } else {
44)                 if (array_key_exists($weight, $weighted_menuitem)) {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

45)                     $weighted_menuitem[$weight] = array_merge($weighted_menuitem[$weight], [$key => $menu[$key]]);
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

46)                 } else {
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 3 years ago

47)                     $weighted_menuitem[$weight] = [$key => $menu[$key]];
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

48)                 }
49)             }
50)         }
51)         $menuitem = array_merge($menuitem, $menu);
52)     }
bernd webinterface => /webinterface

bernd authored 17 years ago

53) 
Bernd Wurst Schiebe Menüpunkte auf die...

Bernd Wurst authored 5 years ago

54)     foreach ($submenu as $key => $content) {
55)         $found = false;
56)         foreach ($weighted_menuitem as $weight => $data) {
57)             if (array_key_exists($key, $data)) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

58)                 DEBUG("found requested submenu " . $key);
Bernd Wurst Schiebe Menüpunkte auf die...

Bernd Wurst authored 5 years ago

59)                 $found = true;
60)             }
61)         }
Hanno Böck Fix not operator (!) spaces

Hanno Böck authored 1 year ago

62)         if (!$found) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

63)             DEBUG("Submenu " . $key . " requested but not present!");
Bernd Wurst Schiebe Menüpunkte auf die...

Bernd Wurst authored 5 years ago

64)             // Ein Submenü von einem nicht existierenden Hauptmenü wird angefordert
65)             // Menüpunkt muss als Hauptmenüpunkt geführt werden
66)             $weighted_menuitem = $weighted_menuitem + $content;
67)         }
68)     }
69) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

70)     ksort($weighted_menuitem);
bernd Usability: User sieht immer...

bernd authored 17 years ago

71) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

72)     foreach ($submenu as $weight => $data) {
73)         ksort($submenu[$weight]);
bernd submenu-items korrekt zuordnen

bernd authored 16 years ago

74)     }
75) 
bernd webinterface => /webinterface

bernd authored 17 years ago

76) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

77)     if (!isset($html_header)) {
78)         $html_header = '';
79)     }
80) 
81)     function array_key_exists_r($needle, $haystack)
82)     {
83)         $result = array_key_exists($needle, $haystack);
84)         if ($result) {
85)             return $result;
86)         }
87)         foreach ($haystack as $v) {
88)             if (is_array($v)) {
89)                 $result = array_key_exists_r($needle, $v);
90)             }
91)             if ($result) {
92)                 return $result;
93)             }
bernd webinterface => /webinterface

bernd authored 17 years ago

94)         }
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

95)         return $result;
96)     }
bernd webinterface => /webinterface

bernd authored 17 years ago

97) 
bernd back-to-admin feature

bernd authored 16 years ago

98) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

99)     $menu = '';
100) 
101)     foreach ($weighted_menuitem as $key => $menuitem) {
102)         foreach ($menuitem as $key => $item) {
103)             if ($key == $section) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

104)                 $menu .= '<a href="' . $item['file'] . '" class="menuitem active">' . $item['label'] . '</a>' . "\n";
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

105)             } else {
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

106)                 $menu .= '<a href="' . $item['file'] . '" class="menuitem">' . $item['label'] . '</a>' . "\n";
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

107)             }
108)             if (isset($submenu[$key])) {
109)                 if ($key == $section || (array_key_exists($key, $submenu) && array_key_exists_r($section, $submenu[$key]))) {
110)                     $menu .= "\n";
111)                     foreach ($submenu[$key] as $weight => $mysub) {
112)                         foreach ($mysub as $sec => $item) {
113)                             if ($sec == $section) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

114)                                 $menu .= '<a href="' . $item['file'] . '" class="submenuitem menuitem active">' . $item['label'] . '</a>' . "\n";
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

115)                             } else {
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

116)                                 $menu .= '<a href="' . $item['file'] . '" class="submenuitem menuitem">' . $item['label'] . '</a>' . "\n";
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

117)                             }
118)                         }
119)                     }
120)                     $menu .= "\n";
121)                 }
122)             }
123)         }
124)     }
bernd webinterface => /webinterface

bernd authored 17 years ago

125) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

126)     $userinfo = '';
127) 
128)     $role = $_SESSION['role'];
129)     if ($role != ROLE_ANONYMOUS) {
Hanno Böck Fix HTML errors and warnings

Hanno Böck authored 10 months ago

130)         $userinfo .= '<p class="userinfo">Angemeldet als:<br>';
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

131)         if ($role & ROLE_SYSTEMUSER && isset($_SESSION['subuser'])) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

132)             $userinfo .= '<strong>' . $_SESSION['subuser'] . '</strong>';
Hanno Böck Fix HTML errors and warnings

Hanno Böck authored 10 months ago

133)             $userinfo .= '<br>Mitbenutzer von ' . $_SESSION['userinfo']['username'];
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

134)         } elseif ($role & ROLE_SYSTEMUSER) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

135)             $userinfo .= '<strong>' . $_SESSION['userinfo']['username'] . '</strong>';
Hanno Böck Fix HTML errors and warnings

Hanno Böck authored 10 months ago

136)             $userinfo .= '<br>' . $_SESSION['userinfo']['name'];
137)             $userinfo .= '<br>(UID ' . $_SESSION['userinfo']['uid'] . (($role & ROLE_CUSTOMER) ? ', Kunde ' . $_SESSION['customerinfo']['customerno'] : '') . ')';
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

138)         } elseif ($role & ROLE_CUSTOMER) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

139)             $userinfo .= '<strong>' . $_SESSION['customerinfo']['name'] . '</strong>';
Hanno Böck Fix HTML errors and warnings

Hanno Böck authored 10 months ago

140)             $userinfo .= '<br>(Kunde ' . $_SESSION['customerinfo']['customerno'] . ')';
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

141)         } elseif ($role & (ROLE_MAILACCOUNT | ROLE_VMAIL_ACCOUNT)) {
Hanno Böck Fix HTML errors and warnings

Hanno Böck authored 10 months ago

142)             $userinfo .= '<strong>' . $_SESSION['mailaccount'] . '</strong><br>(Postfach von Benutzer <em>' . $_SESSION['userinfo']['username'] . '</em>)';
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

143)         }
144)         $userinfo .= '</p>';
145)     }
bernd webinterface => /webinterface

bernd authored 17 years ago

146) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

147)     if (isset($_SESSION['admin_user'])) {
148)         $userinfo .= '<p class="admininfo">';
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

149)         $userinfo .= '<a href="' . $prefix . 'go/su/back_to_admin">Zurück zu »' . $_SESSION['admin_user'] . '«</a>';
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

150)         $userinfo .= '</p>';
151)     }
bernd webinterface => /webinterface

bernd authored 17 years ago

152) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

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

bernd authored 17 years ago

154) 
Hanno Fix coding style with php-c...

Hanno authored 6 years ago

155)     $BASE_PATH = $prefix;
Hanno Böck Spaces between string conca...

Hanno Böck authored 1 year ago

156)     $THEME_PATH = $prefix . "themes/" . config('theme') . "/";