e72937dc3923fc130a79d3aa7a54b3a4853aca3e
bernd webinterface => /webinterface

bernd authored 18 years ago

1) <?php
Hanno Böck Add newlines before comment...

Hanno Böck authored 1 year ago

2) 
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 14 years ago

3) /*
4) This file belongs to the Webinterface of schokokeks.org Hosting
5) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 3 years ago

6) Written by schokokeks.org Hosting, namely
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 14 years ago

7)   Bernd Wurst <bernd@schokokeks.org>
8)   Hanno Böck <hanno@schokokeks.org>
9) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 3 years ago

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

Bernd Wurst authored 14 years ago

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

bernd authored 18 years ago

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

Hanno Böck authored 2 years ago

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

Hanno authored 7 years ago

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

bernd authored 18 years ago

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

Hanno authored 7 years ago

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

bernd authored 17 years ago

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

Hanno Böck authored 4 years ago

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

bernd authored 17 years ago

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

Hanno Böck authored 4 years ago

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

bernd authored 18 years ago

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

Hanno authored 7 years ago

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

Hanno Böck authored 4 years ago

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

Hanno authored 7 years ago

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

Bernd Wurst authored 4 years ago

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

Hanno authored 7 years ago

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

Hanno Böck authored 2 years ago

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

Hanno authored 7 years ago

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

Hanno Böck authored 4 years ago

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

Hanno authored 7 years ago

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

Hanno Böck authored 4 years ago

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

Hanno authored 7 years ago

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

Hanno Böck authored 4 years ago

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

Hanno authored 7 years ago

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

Hanno Böck authored 4 years ago

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

Hanno authored 7 years ago

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

bernd authored 18 years ago

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

Bernd Wurst authored 7 years ago

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

Hanno Böck authored 2 years ago

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

Bernd Wurst authored 7 years ago

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

Hanno Böck authored 2 years ago

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

Hanno Böck authored 2 years ago

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

Bernd Wurst authored 7 years ago

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

Hanno authored 7 years ago

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

bernd authored 18 years ago

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

Hanno authored 7 years ago

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

bernd authored 17 years ago

75)     }
76) 
bernd webinterface => /webinterface

bernd authored 18 years ago

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

Hanno authored 7 years ago

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

bernd authored 18 years ago

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

Hanno authored 7 years ago

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

bernd authored 18 years ago

98) 
bernd back-to-admin feature

bernd authored 17 years ago

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

Hanno authored 7 years ago

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

Hanno Böck authored 2 years ago

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

Hanno authored 7 years ago

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

Hanno Böck authored 2 years ago

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

Hanno authored 7 years ago

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

Hanno Böck authored 2 years ago

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

Hanno authored 7 years ago

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

Hanno Böck authored 2 years ago

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

Hanno authored 7 years ago

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

bernd authored 18 years ago

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

Hanno authored 7 years ago

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

Hanno Böck authored 2 years ago

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

Hanno authored 7 years ago

132)         if ($role & ROLE_SYSTEMUSER && isset($_SESSION['subuser'])) {
Bernd Wurst Set translate=no to several...

Bernd Wurst authored 9 months ago

133)             $userinfo .= '<strong translate="no">' . $_SESSION['subuser'] . '</strong>';
Hanno Böck codingstyle

Hanno Böck authored 9 months ago

134)             $userinfo .= '<br>Mitbenutzer von <span translate="no">' . $_SESSION['userinfo']['username'] . '</span>';
Hanno Fix coding style with php-c...

Hanno authored 7 years ago

135)         } elseif ($role & ROLE_SYSTEMUSER) {
Bernd Wurst Set translate=no to several...

Bernd Wurst authored 9 months ago

136)             $userinfo .= '<strong translate="no">' . $_SESSION['userinfo']['username'] . '</strong>';
Hanno Böck codingstyle

Hanno Böck authored 9 months ago

137)             $userinfo .= '<br><span translate="no">' . $_SESSION['userinfo']['name'] . '</span>';
Hanno Böck Fix HTML errors and warnings

Hanno Böck authored 2 years ago

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

Hanno authored 7 years ago

139)         } elseif ($role & ROLE_CUSTOMER) {
Bernd Wurst Set translate=no to several...

Bernd Wurst authored 9 months ago

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

Hanno Böck authored 2 years ago

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

Hanno authored 7 years ago

142)         } elseif ($role & (ROLE_MAILACCOUNT | ROLE_VMAIL_ACCOUNT)) {
Bernd Wurst Set translate=no to several...

Bernd Wurst authored 9 months ago

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

Hanno authored 7 years ago

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

bernd authored 18 years ago

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

Hanno authored 7 years ago

148)     if (isset($_SESSION['admin_user'])) {
149)         $userinfo .= '<p class="admininfo">';
Bernd Wurst Set translate=no to several...

Bernd Wurst authored 9 months ago

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

Hanno authored 7 years ago

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

bernd authored 18 years ago

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

Hanno authored 7 years ago

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

bernd authored 18 years ago

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

Hanno authored 7 years ago

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

Hanno Böck authored 2 years ago

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