Rev 236 | Rev 242 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | daniel-mar | 1 | <?php |
2 | |||
3 | /* |
||
4 | * OIDplus 2.0 |
||
5 | * Copyright 2019 Daniel Marschall, ViaThinkSoft |
||
6 | * |
||
7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
||
8 | * you may not use this file except in compliance with the License. |
||
9 | * You may obtain a copy of the License at |
||
10 | * |
||
11 | * http://www.apache.org/licenses/LICENSE-2.0 |
||
12 | * |
||
13 | * Unless required by applicable law or agreed to in writing, software |
||
14 | * distributed under the License is distributed on an "AS IS" BASIS, |
||
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||
16 | * See the License for the specific language governing permissions and |
||
17 | * limitations under the License. |
||
18 | */ |
||
19 | |||
207 | daniel-mar | 20 | header('Content-Type:text/html; charset=UTF-8'); |
2 | daniel-mar | 21 | |
207 | daniel-mar | 22 | require_once __DIR__ . '/includes/oidplus.inc.php'; |
23 | |||
240 | daniel-mar | 24 | set_exception_handler('html_exception_handler'); |
25 | function html_exception_handler($exception) { |
||
26 | if ($exception instanceof OIDplusConfigInitializationException) { |
||
27 | echo "<h1>OIDplus initialization error</h1>"; |
||
28 | echo '<p>'.htmlentities($exception->getMessage()).'</p>'; |
||
29 | echo '<p>Please check <b>includes/config.inc.php</b>'; |
||
30 | if (is_dir(__DIR__ . '/setup')) { |
||
31 | echo ' or run <a href="'.OIDplus::getSystemUrl().'setup/">setup</a> again'; |
||
32 | } |
||
33 | echo '</p>'; |
||
34 | } else { |
||
35 | echo "<h1>OIDplus error</h1>"; |
||
36 | echo '<p>'.htmlentities($exception->getMessage()).'</p>'; |
||
37 | echo '<p><b>Technical information about the problem:</b></p>'; |
||
38 | echo '<pre>'; |
||
39 | echo get_class($exception)."\n"; |
||
40 | echo 'at '.$exception->getFile().'('.$exception->getLine().")\n"; |
||
41 | echo "Stacktrace:\n"; |
||
42 | echo $exception->getTraceAsString(); |
||
43 | echo '</pre>'; |
||
44 | } |
||
45 | } |
||
46 | |||
207 | daniel-mar | 47 | ob_start(); // allow cookie headers to be sent |
48 | |||
120 | daniel-mar | 49 | OIDplus::init(true); |
50 | |||
51 | $static_node_id = isset($_REQUEST['goto']) ? $_REQUEST['goto'] : 'oidplus:system'; |
||
52 | $static = OIDplus::gui()::generateContentPage($static_node_id); |
||
53 | $static_title = $static['title']; |
||
54 | $static_icon = $static['icon']; |
||
55 | $static_content = $static['text']; |
||
56 | |||
57 | function combine_systemtitle_and_pagetitle($systemtitle, $pagetitle) { |
||
58 | if ($systemtitle == $pagetitle) { |
||
59 | return $systemtitle; |
||
60 | } else { |
||
61 | return $systemtitle . ' - ' . $pagetitle; |
||
62 | } |
||
5 | daniel-mar | 63 | } |
120 | daniel-mar | 64 | |
227 | daniel-mar | 65 | $sysid_oid = OIDplus::getSystemId(true); |
120 | daniel-mar | 66 | if (!$sysid_oid) $sysid_oid = 'unknown'; |
67 | header('X-OIDplus-SystemID:'.$sysid_oid); |
||
68 | |||
227 | daniel-mar | 69 | $sys_url = OIDplus::getSystemUrl(); |
120 | daniel-mar | 70 | header('X-OIDplus-SystemURL:'.$sys_url); |
71 | |||
72 | $sys_ver = OIDplus::getVersion(); |
||
73 | if (!$sys_ver) $sys_ver = 'unknown'; |
||
74 | header('X-OIDplus-SystemVersion:'.$sys_ver); |
||
75 | |||
170 | daniel-mar | 76 | $sys_install_type = OIDplus::getInstallType(); |
77 | header('X-OIDplus-SystemInstallType:'.$sys_install_type); |
||
78 | |||
120 | daniel-mar | 79 | $sys_title = OIDplus::config()->systemTitle(); |
80 | header('X-OIDplus-SystemTitle:'.$sys_title); |
||
81 | |||
142 | daniel-mar | 82 | if (class_exists('OIDplusPageAdminColors')) { |
83 | $css = 'oidplus.min.css.php?h_shift='.(OIDplus::config()->getValue('color_hue_shift')/360).'&s_shift='.(OIDplus::config()->getValue('color_sat_shift')/100).'&v_shift='.(OIDplus::config()->getValue('color_val_shift')/100); |
||
84 | } else { |
||
85 | $css = 'oidplus.min.css.php'; |
||
86 | } |
||
87 | |||
218 | daniel-mar | 88 | $js = 'oidplus.min.js.php'; |
89 | |||
120 | daniel-mar | 90 | ?><!DOCTYPE html> |
91 | <html lang="en"> |
||
92 | |||
93 | <head> |
||
94 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
||
95 | <meta name="OIDplus-SystemID" content="<?php echo htmlentities($sysid_oid); ?>"> |
||
96 | <meta name="OIDplus-SystemURL" content="<?php echo htmlentities($sys_url); ?>"> |
||
97 | <meta name="OIDplus-SystemVersion" content="<?php echo htmlentities($sys_ver); ?>"> |
||
170 | daniel-mar | 98 | <meta name="OIDplus-SystemInstallType" content="<?php echo htmlentities($sys_install_type); ?>"> |
215 | daniel-mar | 99 | <meta name="OIDplus-SystemTitle" content="<?php echo htmlentities($sys_title); /* Do not remove. This meta tag is acessed by oidplus_base.js */ ?>"> |
120 | daniel-mar | 100 | <meta name="theme-color" content="#A9DCF0"> |
101 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||
102 | |||
103 | <title><?php echo combine_systemtitle_and_pagetitle(OIDplus::config()->systemTitle(), $static_title); ?></title> |
||
104 | |||
218 | daniel-mar | 105 | <script src="<?php echo htmlentities($js); ?>"></script> |
215 | daniel-mar | 106 | |
142 | daniel-mar | 107 | <link rel="stylesheet" href="<?php echo htmlentities($css); ?>"> |
120 | daniel-mar | 108 | <link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico"> |
109 | </head> |
||
110 | |||
111 | <body> |
||
112 | |||
113 | <div id="frames"> |
||
126 | daniel-mar | 114 | <div id="content_window" class="borderbox"> |
115 | <?php |
||
116 | $static_content = preg_replace_callback( |
||
117 | '|<a\s([^>]*)href="mailto:([^"]+)"([^>]*)>([^<]*)</a>|ismU', |
||
118 | function ($treffer) { |
||
119 | $email = $treffer[2]; |
||
120 | $text = $treffer[4]; |
||
121 | return secure_email($email, $text, 1); // AntiSpam |
||
122 | }, $static_content); |
||
123 | |||
124 | echo '<h1 id="real_title">'; |
||
127 | daniel-mar | 125 | if ($static_icon != '') echo '<img src="'.htmlentities($static_icon).'" width="48" height="48" alt=""> '; |
126 | daniel-mar | 126 | echo htmlentities($static_title).'</h1>'; |
127 | echo '<div id="real_content">'.$static_content.'</div>'; |
||
128 | if ($_SERVER['REQUEST_METHOD'] == 'GET') { |
||
129 | echo '<br><p><img src="img/share.png" width="15" height="15" alt="Share"> <a href="?goto='.htmlentities($static_node_id).'" id="static_link" class="gray_footer_font">Static link to this page</a>'; |
||
130 | echo '</p>'; |
||
131 | } |
||
132 | echo '<br>'; |
||
133 | ?> |
||
134 | </div> |
||
135 | |||
120 | daniel-mar | 136 | <div id="system_title_bar"> |
122 | daniel-mar | 137 | <div id="system_title_menu" onclick="mobileNavButtonClick(this)" onmouseenter="mobileNavButtonHover(this)" onmouseleave="mobileNavButtonHover(this)"> |
120 | daniel-mar | 138 | <div id="bar1"></div> |
139 | <div id="bar2"></div> |
||
140 | <div id="bar3"></div> |
||
141 | </div> |
||
142 | |||
122 | daniel-mar | 143 | <div id="system_title_text"> |
120 | daniel-mar | 144 | <a <?php echo oidplus_link('oidplus:system'); ?>> |
145 | <span id="system_title_1">ViaThinkSoft OIDplus 2.0</span><br> |
||
146 | <span id="system_title_2"><?php echo htmlentities(OIDplus::config()->systemTitle()); ?></span> |
||
147 | </a> |
||
148 | </div> |
||
185 | daniel-mar | 149 | </div> |
183 | daniel-mar | 150 | |
186 | daniel-mar | 151 | <div id="gotobox"> |
152 | <input type="text" name="goto" id="gotoedit" value="<?php echo htmlentities($static_node_id); ?>"> |
||
153 | <input type="button" value="Go" onclick="gotoButtonClicked()" id="gotobutton"> |
||
154 | </div> |
||
155 | |||
120 | daniel-mar | 156 | <div id="oidtree" class="borderbox"> |
122 | daniel-mar | 157 | <!-- <noscript> |
120 | daniel-mar | 158 | <p><b>Please enable JavaScript to use all features</b></p> |
122 | daniel-mar | 159 | </noscript> --> |
120 | daniel-mar | 160 | <?php OIDplusTree::nonjs_menu(); ?> |
161 | </div> |
||
162 | </div> |
||
163 | |||
164 | </body> |
||
165 | </html> |
||
166 | <?php |
||
167 | |||
168 | $cont = ob_get_contents(); |
||
169 | ob_end_clean(); |
||
170 | |||
171 | echo $cont; |