Subversion Repositories oidplus

Rev

Rev 183 | Rev 186 | 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
 
120 daniel-mar 20
require_once __DIR__ . '/includes/oidplus.inc.php';
2 daniel-mar 21
 
120 daniel-mar 22
ob_start(); // allow cookie headers to be sent
23
 
24
header('Content-Type:text/html; charset=UTF-8');
25
 
135 daniel-mar 26
if (!function_exists('gmp_init')) {
27
        // Required for uuid_functions.inc.php and ipv6_functions.inc.php
138 daniel-mar 28
        die('<h1>OIDplus Installation</h1><p>ERROR: The extension <b>gmp</b> is not installed.</p><p>Install it using <code>sudo aptitude update && sudo aptitude install php-gmp && sudo service apache2 restart</code> on Linux systems.</p>');
135 daniel-mar 29
}
30
 
138 daniel-mar 31
if (!function_exists('mb_substr')) {
32
        // Required for includes/classes/OIDplusSessionHandler.class.php, includes/oid_utils.inc.php, 3p/minify/path-converter/Converter.php, 3p/0xbb/Sha3.class.php
33
        die('<h1>OIDplus Installation</h1><p>ERROR: The extension <b>php-mbstring</b> is not installed.</p><p>Install it using <code>sudo aptitude update && sudo aptitude install php-mbstring && sudo service apache2 restart</code> on Linux systems.</p>');
34
}
35
 
120 daniel-mar 36
OIDplus::init(true);
37
 
38
$static_node_id = isset($_REQUEST['goto']) ? $_REQUEST['goto'] : 'oidplus:system';
39
$static = OIDplus::gui()::generateContentPage($static_node_id);
40
$static_title = $static['title'];
41
$static_icon = $static['icon'];
42
$static_content = $static['text'];
43
 
44
function combine_systemtitle_and_pagetitle($systemtitle, $pagetitle) {
45
        if ($systemtitle == $pagetitle) {
46
                return $systemtitle;
47
        } else {
48
                return $systemtitle . ' - ' . $pagetitle;
49
        }
5 daniel-mar 50
}
120 daniel-mar 51
 
52
$sysid_oid = OIDplus::system_id(true);
53
if (!$sysid_oid) $sysid_oid = 'unknown';
54
header('X-OIDplus-SystemID:'.$sysid_oid);
55
 
56
$sys_url = OIDplus::system_url();
57
header('X-OIDplus-SystemURL:'.$sys_url);
58
 
59
$sys_ver = OIDplus::getVersion();
60
if (!$sys_ver) $sys_ver = 'unknown';
61
header('X-OIDplus-SystemVersion:'.$sys_ver);
62
 
170 daniel-mar 63
$sys_install_type = OIDplus::getInstallType();
64
header('X-OIDplus-SystemInstallType:'.$sys_install_type);
65
 
120 daniel-mar 66
$sys_title = OIDplus::config()->systemTitle();
67
header('X-OIDplus-SystemTitle:'.$sys_title);
68
 
142 daniel-mar 69
if (class_exists('OIDplusPageAdminColors')) {
70
        $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);
71
} else {
72
        $css = 'oidplus.min.css.php';
73
}
74
 
120 daniel-mar 75
?><!DOCTYPE html>
76
<html lang="en">
77
 
78
<head>
79
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
80
        <meta name="OIDplus-SystemID" content="<?php echo htmlentities($sysid_oid); ?>">
81
        <meta name="OIDplus-SystemURL" content="<?php echo htmlentities($sys_url); ?>">
82
        <meta name="OIDplus-SystemVersion" content="<?php echo htmlentities($sys_ver); ?>">
170 daniel-mar 83
        <meta name="OIDplus-SystemInstallType" content="<?php echo htmlentities($sys_install_type); ?>">
120 daniel-mar 84
        <meta name="OIDplus-SystemTitle" content="<?php echo htmlentities($sys_title); /* Do not remove. This meta tag is acessed via JS */ ?>">
85
        <meta name="theme-color" content="#A9DCF0">
86
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
87
 
88
        <title><?php echo combine_systemtitle_and_pagetitle(OIDplus::config()->systemTitle(), $static_title); ?></title>
89
 
90
        <!-- We are using jQuery 2.2.1, because 3.3.1 seems to be incompatible with jsTree (HTML content will not be loaded into jsTree!) TODO: File bug report -->
91
        <script src="3p/jquery/jquery-2.2.1.min.js"></script>
92
        <script src="3p/bootstrap/js/bootstrap.min.js"></script>
93
        <script src="3p/jstree/jstree.min.js"></script>
94
        <script src='3p/tinymce/tinymce.min.js'></script>
95
        <script src="3p/jquery-ui/jquery-ui.min.js"></script>
96
        <script src="3p/layout/jquery.layout.min.js"></script>
97
        <script src="3p/spamspan/spamspan.js"></script>
150 daniel-mar 98
        <script src="3p/sha3_js/sha3.js"></script><!-- https://github.com/emn178/js-sha3 -->
163 daniel-mar 99
        <?php
100
        if (RECAPTCHA_ENABLED) {
101
        ?>
157 daniel-mar 102
        <script src="https://www.google.com/recaptcha/api.js"></script>
163 daniel-mar 103
        <?php
104
        }
105
        ?>
150 daniel-mar 106
        <script src="https://polyfill.io/v3/polyfill.min.js?features=fetch%2CURL"></script><!-- For IE... -->
120 daniel-mar 107
        <script src="oidplus.min.js.php"></script>
108
 
142 daniel-mar 109
        <link rel="stylesheet" href="<?php echo htmlentities($css); ?>">
120 daniel-mar 110
 
111
        <link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">
112
 
126 daniel-mar 113
        <!-- DM 28 May 2019: Removed CookieConsent temporarily, because it is placed at the beginning of the page and therefore ruins the Google index ... -->
114
        <!-- We might not need it, because cookies are only set during login, and at the login page we already warn about cookies -->
115
        <!-- TODO: Bring back? -->
116
        <!-- <link rel="stylesheet" type="text/css" href="3p/cookieconsent/cookieconsent.min.css">
120 daniel-mar 117
        <script src="3p/cookieconsent/cookieconsent.min.js"></script>
118
        <script>
119
                window.addEventListener("load", function(){
120
                window.cookieconsent.initialise({
121
                        "palette": {
122
                                "popup": {
123
                                        "background": "#edeff5",
124
                                        "text": "#838391"
125
                                },
126
                                "button": {
127
                                        "background": "#4b81e8"
128
                                }
129
                        },
130
                        "position": "bottom-right"
131
                })});
126 daniel-mar 132
        </script> -->
120 daniel-mar 133
</head>
134
 
135
<body>
136
 
137
<div id="frames">
126 daniel-mar 138
        <div id="content_window" class="borderbox">
139
                <?php
140
                $static_content = preg_replace_callback(
141
                        '|<a\s([^>]*)href="mailto:([^"]+)"([^>]*)>([^<]*)</a>|ismU',
142
                        function ($treffer) {
143
                                $email = $treffer[2];
144
                                $text = $treffer[4];
145
                                return secure_email($email, $text, 1); // AntiSpam
146
                        }, $static_content);
147
 
148
                echo '<h1 id="real_title">';
127 daniel-mar 149
                if ($static_icon != '') echo '<img src="'.htmlentities($static_icon).'" width="48" height="48" alt=""> ';
126 daniel-mar 150
                echo htmlentities($static_title).'</h1>';
151
                echo '<div id="real_content">'.$static_content.'</div>';
152
                if ($_SERVER['REQUEST_METHOD'] == 'GET') {
153
                        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>';
154
                        echo '</p>';
155
                }
156
                echo '<br>';
157
                ?>
158
        </div>
159
 
120 daniel-mar 160
        <div id="system_title_bar">
122 daniel-mar 161
                <div id="system_title_menu" onclick="mobileNavButtonClick(this)" onmouseenter="mobileNavButtonHover(this)" onmouseleave="mobileNavButtonHover(this)">
120 daniel-mar 162
                        <div id="bar1"></div>
163
                        <div id="bar2"></div>
164
                        <div id="bar3"></div>
165
                </div>
166
 
122 daniel-mar 167
                <div id="system_title_text">
120 daniel-mar 168
                        <a <?php echo oidplus_link('oidplus:system'); ?>>
169
                                <span id="system_title_1">ViaThinkSoft OIDplus 2.0</span><br>
170
                                <span id="system_title_2"><?php echo htmlentities(OIDplus::config()->systemTitle()); ?></span>
171
                        </a>
172
                </div>
185 daniel-mar 173
        </div>
183 daniel-mar 174
 
175
                <div id="gotobox">
176
                        <input type="text" name="goto" id="gotoedit" value="<?php echo htmlentities($static_node_id); ?>">
177
                        <input type="button" value="Go" onclick="gotoButtonClicked()" id="gotobutton">
178
                </div>
120 daniel-mar 179
        <div id="oidtree" class="borderbox">
122 daniel-mar 180
                <!-- <noscript>
120 daniel-mar 181
                        <p><b>Please enable JavaScript to use all features</b></p>
122 daniel-mar 182
                </noscript> -->
120 daniel-mar 183
                <?php OIDplusTree::nonjs_menu(); ?>
184
        </div>
185
</div>
186
 
187
</body>
188
</html>
189
<?php
190
 
191
$cont = ob_get_contents();
192
ob_end_clean();
193
 
194
echo $cont;