Rev 639 | Rev 767 | 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 |
||
511 | daniel-mar | 5 | * Copyright 2019 - 2021 Daniel Marschall, ViaThinkSoft |
2 | daniel-mar | 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 | |||
366 | daniel-mar | 24 | set_exception_handler(array('OIDplusGui', 'html_exception_handler')); |
240 | daniel-mar | 25 | |
207 | daniel-mar | 26 | ob_start(); // allow cookie headers to be sent |
27 | |||
120 | daniel-mar | 28 | OIDplus::init(true); |
29 | |||
30 | $static_node_id = isset($_REQUEST['goto']) ? $_REQUEST['goto'] : 'oidplus:system'; |
||
558 | daniel-mar | 31 | $static = OIDplus::gui()->generateContentPage($static_node_id); |
120 | daniel-mar | 32 | $static_title = $static['title']; |
33 | $static_icon = $static['icon']; |
||
34 | $static_content = $static['text']; |
||
35 | |||
564 | daniel-mar | 36 | if (!isset($_COOKIE['csrf_token'])) { |
37 | // This is the main CSRF token used for AJAX. |
||
38 | $token = OIDplus::authUtils()->genCSRFToken(); |
||
39 | OIDplus::cookieUtils()->setcookie('csrf_token', $token, 0, false); |
||
40 | unset($token); |
||
41 | } |
||
42 | |||
43 | if (!isset($_COOKIE['csrf_token_weak'])) { |
||
44 | // This CSRF token is created with SameSite=Lax and must be used |
||
45 | // for OAuth 2.0 redirects or similar purposes. |
||
46 | $token = OIDplus::authUtils()->genCSRFToken(); |
||
47 | OIDplus::cookieUtils()->setcookie('csrf_token_weak', $token, 0, false, 'Lax'); |
||
48 | unset($token); |
||
49 | } |
||
50 | |||
362 | daniel-mar | 51 | OIDplus::handleLangArgument(); |
52 | |||
120 | daniel-mar | 53 | function combine_systemtitle_and_pagetitle($systemtitle, $pagetitle) { |
309 | daniel-mar | 54 | // Please also change the function in oidplus_base.js |
120 | daniel-mar | 55 | if ($systemtitle == $pagetitle) { |
56 | return $systemtitle; |
||
57 | } else { |
||
309 | daniel-mar | 58 | return $pagetitle . ' - ' . $systemtitle; |
120 | daniel-mar | 59 | } |
5 | daniel-mar | 60 | } |
120 | daniel-mar | 61 | |
448 | daniel-mar | 62 | $add_css_args = array(); |
142 | daniel-mar | 63 | if (class_exists('OIDplusPageAdminColors')) { |
453 | daniel-mar | 64 | // Usually, such things would be done using "features" (implementsFeature), |
65 | // but there are following reasons why we DON'T do it: |
||
66 | // 1. Just having a "CSS URL parameter feature" would change the URL parameter, |
||
67 | // but it would not affect the custom code in oidplus.min.css.php |
||
549 | daniel-mar | 68 | // 2. The JS function OIDplusPageAdminColors.test_color_theme() has an hardcoded set of parameters |
453 | daniel-mar | 69 | // and does not follow the arguments that might be set by other plugins. |
70 | $add_css_args[] = 'theme='.urlencode(OIDplus::config()->getValue('design')); |
||
71 | $add_css_args[] = 'invert='.urlencode(OIDplus::config()->getValue('color_invert')); |
||
592 | daniel-mar | 72 | $add_css_args[] = 'h_shift='.urlencode(number_format(OIDplus::config()->getValue('color_hue_shift')/360,5,'.','')); |
73 | $add_css_args[] = 's_shift='.urlencode(number_format(OIDplus::config()->getValue('color_sat_shift')/100,5,'.','')); |
||
74 | $add_css_args[] = 'v_shift='.urlencode(number_format(OIDplus::config()->getValue('color_val_shift')/100,5,'.','')); |
||
142 | daniel-mar | 75 | } |
448 | daniel-mar | 76 | $add_css_args = count($add_css_args) > 0 ? '?'.implode('&',$add_css_args) : ''; |
142 | daniel-mar | 77 | |
120 | daniel-mar | 78 | ?><!DOCTYPE html> |
434 | daniel-mar | 79 | <html lang="<?php echo substr(OIDplus::getCurrentLang(),0,2); ?>"> |
120 | daniel-mar | 80 | |
81 | <head> |
||
82 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
||
472 | daniel-mar | 83 | <meta name="OIDplus-SystemTitle" content="<?php echo htmlentities(OIDplus::config()->getValue('system_title')); /* Do not remove. This meta tag is acessed by oidplus_base.js */ ?>"> |
120 | daniel-mar | 84 | <meta name="theme-color" content="#A9DCF0"> |
85 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||
86 | |||
395 | daniel-mar | 87 | <title><?php echo htmlentities(combine_systemtitle_and_pagetitle(OIDplus::config()->getValue('system_title'), $static_title)); ?></title> |
120 | daniel-mar | 88 | |
375 | daniel-mar | 89 | <script src="polyfill.min.js.php"></script> |
376 | daniel-mar | 90 | <?php |
702 | daniel-mar | 91 | echo OIDplus::getActiveCaptchaPlugin()->captchaDomHead(); |
376 | daniel-mar | 92 | ?> |
366 | daniel-mar | 93 | <script src="oidplus.min.js.php"></script> |
215 | daniel-mar | 94 | |
366 | daniel-mar | 95 | <link rel="stylesheet" href="oidplus.min.css.php<?php echo htmlentities($add_css_args); ?>"> |
314 | daniel-mar | 96 | <link rel="shortcut icon" type="image/x-icon" href="favicon.ico.php"> |
120 | daniel-mar | 97 | </head> |
98 | |||
99 | <body> |
||
100 | |||
532 | daniel-mar | 101 | <div id="loading" style="display:none">Loading…</div> |
102 | |||
120 | daniel-mar | 103 | <div id="frames"> |
126 | daniel-mar | 104 | <div id="content_window" class="borderbox"> |
105 | <?php |
||
106 | $static_content = preg_replace_callback( |
||
107 | '|<a\s([^>]*)href="mailto:([^"]+)"([^>]*)>([^<]*)</a>|ismU', |
||
108 | function ($treffer) { |
||
109 | $email = $treffer[2]; |
||
110 | $text = $treffer[4]; |
||
250 | daniel-mar | 111 | return OIDplus::mailUtils()->secureEmailAddress($email, $text, 1); // AntiSpam |
126 | daniel-mar | 112 | }, $static_content); |
113 | |||
114 | echo '<h1 id="real_title">'; |
||
127 | daniel-mar | 115 | if ($static_icon != '') echo '<img src="'.htmlentities($static_icon).'" width="48" height="48" alt=""> '; |
126 | daniel-mar | 116 | echo htmlentities($static_title).'</h1>'; |
117 | echo '<div id="real_content">'.$static_content.'</div>'; |
||
315 | daniel-mar | 118 | if ((!isset($_SERVER['REQUEST_METHOD'])) || ($_SERVER['REQUEST_METHOD'] == 'GET')) { |
360 | daniel-mar | 119 | echo '<br><p><img src="img/share.png" width="15" height="15" alt="'._L('Share').'"> <a href="?goto='.htmlentities($static_node_id).'" id="static_link" class="gray_footer_font">'._L('Static link to this page').'</a>'; |
126 | daniel-mar | 120 | echo '</p>'; |
121 | } |
||
122 | echo '<br>'; |
||
123 | ?> |
||
124 | </div> |
||
125 | |||
120 | daniel-mar | 126 | <div id="system_title_bar"> |
360 | daniel-mar | 127 | <?php |
128 | echo '<div id="system_title_menu" onclick="mobileNavButtonClick(this)" onmouseenter="mobileNavButtonHover(this)" onmouseleave="mobileNavButtonHover(this)">'; |
||
129 | echo ' <div id="bar1"></div>'; |
||
130 | echo ' <div id="bar2"></div>'; |
||
131 | echo ' <div id="bar3"></div>'; |
||
132 | echo '</div>'; |
||
133 | echo ''; |
||
134 | echo '<div id="system_title_text">'; |
||
451 | daniel-mar | 135 | echo ' <a '.OIDplus::gui()->link('oidplus:system').' id="system_title_a">'; |
136 | echo ' <span id="system_title_logo"></span>'; |
||
360 | daniel-mar | 137 | echo ' <span id="system_title_1">'._L('ViaThinkSoft OIDplus 2.0').'</span><br>'; |
138 | echo ' <span id="system_title_2">'.htmlentities(OIDplus::config()->getValue('system_title')).'</span>'; |
||
139 | echo ' </a>'; |
||
140 | echo '</div>'; |
||
141 | ?> |
||
185 | daniel-mar | 142 | </div> |
183 | daniel-mar | 143 | |
362 | daniel-mar | 144 | <?php |
564 | daniel-mar | 145 | echo OIDplus::gui()->getLanguageBox($static_node_id, true); |
362 | daniel-mar | 146 | ?> |
355 | daniel-mar | 147 | |
186 | daniel-mar | 148 | <div id="gotobox"> |
360 | daniel-mar | 149 | <?php |
150 | echo '<input type="text" name="goto" id="gotoedit" value="'.htmlentities($static_node_id).'">'; |
||
151 | echo '<input type="button" value="'._L('Go').'" onclick="gotoButtonClicked()" id="gotobutton">'; |
||
152 | ?> |
||
186 | daniel-mar | 153 | </div> |
154 | |||
120 | daniel-mar | 155 | <div id="oidtree" class="borderbox"> |
374 | daniel-mar | 156 | <?php |
157 | //echo '<noscript>'; |
||
158 | //echo '<p><b>'._L('Please enable JavaScript to use all features').'</b></p>'; |
||
159 | //echo '</noscript>'; |
||
160 | OIDplus::menuUtils()->nonjs_menu(); |
||
161 | ?> |
||
120 | daniel-mar | 162 | </div> |
163 | </div> |
||
164 | |||
165 | </body> |
||
166 | </html> |
||
167 | <?php |
||
168 | |||
169 | $cont = ob_get_contents(); |
||
170 | ob_end_clean(); |
||
171 | |||
639 | daniel-mar | 172 | OIDplus::invoke_shutdown(); |
173 | |||
366 | daniel-mar | 174 | echo $cont; |