Subversion Repositories oidplus

Rev

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