Subversion Repositories oidplus

Rev

Rev 360 | Rev 366 | 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
360 daniel-mar 5
 * Copyright 2019-2020 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
 
240 daniel-mar 24
set_exception_handler('html_exception_handler');
25
function html_exception_handler($exception) {
26
        if ($exception instanceof OIDplusConfigInitializationException) {
360 daniel-mar 27
                echo '<h1>'._L('OIDplus initialization error').'</h1>';
349 daniel-mar 28
                echo '<p>'.htmlentities($exception->getMessage(), ENT_SUBSTITUTE).'</p>';
360 daniel-mar 29
                echo '<p>'._L('Please check file %1','<b>userdata/baseconfig/config.inc.php</b>');
240 daniel-mar 30
                if (is_dir(__DIR__ . '/setup')) {
360 daniel-mar 31
                        echo ' '._L('or run <a href="%1">setup</a> again',OIDplus::getSystemUrl().'setup/');
240 daniel-mar 32
                }
33
                echo '</p>';
34
        } else {
360 daniel-mar 35
                echo '<h1>'._L('OIDplus error').'</h1>';
242 daniel-mar 36
                // ENT_SUBSTITUTE because ODBC drivers might return ANSI instead of UTF-8 stuff
37
                echo '<p>'.htmlentities($exception->getMessage(), ENT_SUBSTITUTE).'</p>';
360 daniel-mar 38
                echo '<p><b>'._L('Technical information about the problem').':</b></p>';
240 daniel-mar 39
                echo '<pre>';
40
                echo get_class($exception)."\n";
360 daniel-mar 41
                var_dump($exception->getFile());
42
                var_dump($exception->getLine());
43
                echo _L('at file %1 (line %2)',$exception->getFile(),"".$exception->getLine())."\n";
44
                echo _L('Stacktrace').":\n";
240 daniel-mar 45
                echo $exception->getTraceAsString();
46
                echo '</pre>';
47
        }
48
}
49
 
207 daniel-mar 50
ob_start(); // allow cookie headers to be sent
51
 
120 daniel-mar 52
OIDplus::init(true);
53
 
54
$static_node_id = isset($_REQUEST['goto']) ? $_REQUEST['goto'] : 'oidplus:system';
55
$static = OIDplus::gui()::generateContentPage($static_node_id);
56
$static_title = $static['title'];
57
$static_icon = $static['icon'];
58
$static_content = $static['text'];
59
 
362 daniel-mar 60
OIDplus::handleLangArgument();
61
 
120 daniel-mar 62
function combine_systemtitle_and_pagetitle($systemtitle, $pagetitle) {
309 daniel-mar 63
        // Please also change the function in oidplus_base.js
120 daniel-mar 64
        if ($systemtitle == $pagetitle) {
65
                return $systemtitle;
66
        } else {
309 daniel-mar 67
                return $pagetitle . ' - ' . $systemtitle;
120 daniel-mar 68
        }
5 daniel-mar 69
}
120 daniel-mar 70
 
227 daniel-mar 71
$sysid_oid = OIDplus::getSystemId(true);
360 daniel-mar 72
if (!$sysid_oid) $sysid_oid = 'unknown'; // do not translate
120 daniel-mar 73
header('X-OIDplus-SystemID:'.$sysid_oid);
74
 
227 daniel-mar 75
$sys_url = OIDplus::getSystemUrl();
120 daniel-mar 76
header('X-OIDplus-SystemURL:'.$sys_url);
77
 
78
$sys_ver = OIDplus::getVersion();
360 daniel-mar 79
if (!$sys_ver) $sys_ver = 'unknown'; // do not translate
120 daniel-mar 80
header('X-OIDplus-SystemVersion:'.$sys_ver);
81
 
170 daniel-mar 82
$sys_install_type = OIDplus::getInstallType();
83
header('X-OIDplus-SystemInstallType:'.$sys_install_type);
84
 
257 daniel-mar 85
$sys_title = OIDplus::config()->getValue('system_title');
120 daniel-mar 86
header('X-OIDplus-SystemTitle:'.$sys_title);
87
 
142 daniel-mar 88
if (class_exists('OIDplusPageAdminColors')) {
286 daniel-mar 89
        $css = 'oidplus.min.css.php?invert='.(OIDplus::config()->getValue('color_invert')).'&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);
142 daniel-mar 90
} else {
91
        $css = 'oidplus.min.css.php';
92
}
93
 
218 daniel-mar 94
$js = 'oidplus.min.js.php';
95
 
120 daniel-mar 96
?><!DOCTYPE html>
97
<html lang="en">
98
 
99
<head>
100
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
101
        <meta name="OIDplus-SystemID" content="<?php echo htmlentities($sysid_oid); ?>">
102
        <meta name="OIDplus-SystemURL" content="<?php echo htmlentities($sys_url); ?>">
103
        <meta name="OIDplus-SystemVersion" content="<?php echo htmlentities($sys_ver); ?>">
170 daniel-mar 104
        <meta name="OIDplus-SystemInstallType" content="<?php echo htmlentities($sys_install_type); ?>">
215 daniel-mar 105
        <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 106
        <meta name="theme-color" content="#A9DCF0">
107
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
108
 
257 daniel-mar 109
        <title><?php echo combine_systemtitle_and_pagetitle(OIDplus::config()->getValue('system_title'), $static_title); ?></title>
120 daniel-mar 110
 
218 daniel-mar 111
        <script src="<?php echo htmlentities($js); ?>"></script>
215 daniel-mar 112
 
142 daniel-mar 113
        <link rel="stylesheet" href="<?php echo htmlentities($css); ?>">
314 daniel-mar 114
        <link rel="shortcut icon" type="image/x-icon" href="favicon.ico.php">
120 daniel-mar 115
</head>
116
 
117
<body>
118
 
119
<div id="frames">
126 daniel-mar 120
        <div id="content_window" class="borderbox">
121
                <?php
122
                $static_content = preg_replace_callback(
123
                        '|<a\s([^>]*)href="mailto:([^"]+)"([^>]*)>([^<]*)</a>|ismU',
124
                        function ($treffer) {
125
                                $email = $treffer[2];
126
                                $text = $treffer[4];
250 daniel-mar 127
                                return OIDplus::mailUtils()->secureEmailAddress($email, $text, 1); // AntiSpam
126 daniel-mar 128
                        }, $static_content);
129
 
130
                echo '<h1 id="real_title">';
127 daniel-mar 131
                if ($static_icon != '') echo '<img src="'.htmlentities($static_icon).'" width="48" height="48" alt=""> ';
126 daniel-mar 132
                echo htmlentities($static_title).'</h1>';
133
                echo '<div id="real_content">'.$static_content.'</div>';
315 daniel-mar 134
                if ((!isset($_SERVER['REQUEST_METHOD'])) || ($_SERVER['REQUEST_METHOD'] == 'GET')) {
360 daniel-mar 135
                        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 136
                        echo '</p>';
137
                }
138
                echo '<br>';
139
                ?>
140
        </div>
141
 
120 daniel-mar 142
        <div id="system_title_bar">
360 daniel-mar 143
                <?php
144
                echo '<div id="system_title_menu" onclick="mobileNavButtonClick(this)" onmouseenter="mobileNavButtonHover(this)" onmouseleave="mobileNavButtonHover(this)">';
145
                echo '  <div id="bar1"></div>';
146
                echo '  <div id="bar2"></div>';
147
                echo '  <div id="bar3"></div>';
148
                echo '</div>';
149
                echo '';
150
                echo '<div id="system_title_text">';
151
                echo '  <a '.OIDplus::gui()->link('oidplus:system').'>';
152
                echo '          <span id="system_title_1">'._L('ViaThinkSoft OIDplus 2.0').'</span><br>';
153
                echo '          <span id="system_title_2">'.htmlentities(OIDplus::config()->getValue('system_title')).'</span>';
154
                echo '  </a>';
155
                echo '</div>';
156
                ?>
185 daniel-mar 157
        </div>
183 daniel-mar 158
 
362 daniel-mar 159
        <?php
160
        echo OIDplusGui::getLanguageBox($static_node_id, true);
161
        ?>
355 daniel-mar 162
 
186 daniel-mar 163
        <div id="gotobox">
360 daniel-mar 164
                <?php
165
                echo '<input type="text" name="goto" id="gotoedit" value="'.htmlentities($static_node_id).'">';
166
                echo '<input type="button" value="'._L('Go').'" onclick="gotoButtonClicked()" id="gotobutton">';
167
                ?>
186 daniel-mar 168
        </div>
169
 
120 daniel-mar 170
        <div id="oidtree" class="borderbox">
122 daniel-mar 171
                <!-- <noscript>
360 daniel-mar 172
                        <p><b><?php echo _L('Please enable JavaScript to use all features'); ?></b></p>
122 daniel-mar 173
                </noscript> -->
250 daniel-mar 174
                <?php OIDplus::menuUtils()->nonjs_menu(); ?>
120 daniel-mar 175
        </div>
176
</div>
177
 
178
</body>
179
</html>
180
<?php
181
 
182
$cont = ob_get_contents();
183
ob_end_clean();
184
 
360 daniel-mar 185
echo $cont;