Subversion Repositories oidplus

Rev

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