Subversion Repositories oidplus

Rev

Rev 149 | Rev 157 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  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.  
  20. require_once __DIR__ . '/includes/oidplus.inc.php';
  21.  
  22. ob_start(); // allow cookie headers to be sent
  23.  
  24. header('Content-Type:text/html; charset=UTF-8');
  25.  
  26. if (!function_exists('gmp_init')) {
  27.         // Required for uuid_functions.inc.php and ipv6_functions.inc.php
  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>');
  29. }
  30.  
  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.  
  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.         }
  50. }
  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.  
  63. $sys_title = OIDplus::config()->systemTitle();
  64. header('X-OIDplus-SystemTitle:'.$sys_title);
  65.  
  66. if (class_exists('OIDplusPageAdminColors')) {
  67.         $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);
  68. } else {
  69.         $css = 'oidplus.min.css.php';
  70. }
  71.  
  72. ?><!DOCTYPE html>
  73. <html lang="en">
  74.  
  75. <head>
  76.         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  77.         <meta name="OIDplus-SystemID" content="<?php echo htmlentities($sysid_oid); ?>">
  78.         <meta name="OIDplus-SystemURL" content="<?php echo htmlentities($sys_url); ?>">
  79.         <meta name="OIDplus-SystemVersion" content="<?php echo htmlentities($sys_ver); ?>">
  80.         <meta name="OIDplus-SystemTitle" content="<?php echo htmlentities($sys_title); /* Do not remove. This meta tag is acessed via JS */ ?>">
  81.         <meta name="theme-color" content="#A9DCF0">
  82.         <meta name="viewport" content="width=device-width, initial-scale=1.0">
  83.  
  84.         <title><?php echo combine_systemtitle_and_pagetitle(OIDplus::config()->systemTitle(), $static_title); ?></title>
  85.  
  86.         <!-- 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 -->
  87.         <script src="3p/jquery/jquery-2.2.1.min.js"></script>
  88.         <script src="3p/bootstrap/js/bootstrap.min.js"></script>
  89.         <script src="3p/jstree/jstree.min.js"></script>
  90.         <script src='3p/tinymce/tinymce.min.js'></script>
  91.         <script src="3p/jquery-ui/jquery-ui.min.js"></script>
  92.         <script src="3p/layout/jquery.layout.min.js"></script>
  93.         <script src="3p/spamspan/spamspan.js"></script>
  94.         <script src="3p/sha3_js/sha3.js"></script><!-- https://github.com/emn178/js-sha3 -->
  95.         <script src='https://www.google.com/recaptcha/api.js'></script>
  96.         <script src="https://polyfill.io/v3/polyfill.min.js?features=fetch%2CURL"></script><!-- For IE... -->
  97.         <script src="oidplus.min.js.php"></script>
  98.  
  99.         <link rel="stylesheet" href="<?php echo htmlentities($css); ?>">
  100.  
  101.         <link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">
  102.  
  103.         <!-- DM 28 May 2019: Removed CookieConsent temporarily, because it is placed at the beginning of the page and therefore ruins the Google index ... -->
  104.         <!-- We might not need it, because cookies are only set during login, and at the login page we already warn about cookies -->
  105.         <!-- TODO: Bring back? -->
  106.         <!-- <link rel="stylesheet" type="text/css" href="3p/cookieconsent/cookieconsent.min.css">
  107.         <script src="3p/cookieconsent/cookieconsent.min.js"></script>
  108.         <script>
  109.                 window.addEventListener("load", function(){
  110.                 window.cookieconsent.initialise({
  111.                         "palette": {
  112.                                 "popup": {
  113.                                         "background": "#edeff5",
  114.                                         "text": "#838391"
  115.                                 },
  116.                                 "button": {
  117.                                         "background": "#4b81e8"
  118.                                 }
  119.                         },
  120.                         "position": "bottom-right"
  121.                 })});
  122.         </script> -->
  123. </head>
  124.  
  125. <body>
  126.  
  127. <div id="frames">
  128.         <div id="content_window" class="borderbox">
  129.                 <?php
  130.                 $static_content = preg_replace_callback(
  131.                         '|<a\s([^>]*)href="mailto:([^"]+)"([^>]*)>([^<]*)</a>|ismU',
  132.                         function ($treffer) {
  133.                                 $email = $treffer[2];
  134.                                 $text = $treffer[4];
  135.                                 return secure_email($email, $text, 1); // AntiSpam
  136.                         }, $static_content);
  137.  
  138.                 echo '<h1 id="real_title">';
  139.                 if ($static_icon != '') echo '<img src="'.htmlentities($static_icon).'" width="48" height="48" alt=""> ';
  140.                 echo htmlentities($static_title).'</h1>';
  141.                 echo '<div id="real_content">'.$static_content.'</div>';
  142.                 if ($_SERVER['REQUEST_METHOD'] == 'GET') {
  143.                         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>';
  144.                         echo '</p>';
  145.                 }
  146.                 echo '<br>';
  147.                 ?>
  148.         </div>
  149.  
  150.         <div id="system_title_bar">
  151.                 <div id="system_title_menu" onclick="mobileNavButtonClick(this)" onmouseenter="mobileNavButtonHover(this)" onmouseleave="mobileNavButtonHover(this)">
  152.                         <div id="bar1"></div>
  153.                         <div id="bar2"></div>
  154.                         <div id="bar3"></div>
  155.                 </div>
  156.  
  157.                 <div id="system_title_text">
  158.                         <a <?php echo oidplus_link('oidplus:system'); ?>>
  159.                                 <span id="system_title_1">ViaThinkSoft OIDplus 2.0</span><br>
  160.                                 <span id="system_title_2"><?php echo htmlentities(OIDplus::config()->systemTitle()); ?></span>
  161.                         </a>
  162.                 </div>
  163.         </div>
  164.  
  165.         <div id="oidtree" class="borderbox">
  166.                 <!-- <noscript>
  167.                         <p><b>Please enable JavaScript to use all features</b></p>
  168.                 </noscript> -->
  169.                 <?php OIDplusTree::nonjs_menu(); ?>
  170.         </div>
  171. </div>
  172.  
  173. </body>
  174. </html>
  175. <?php
  176.  
  177. $cont = ob_get_contents();
  178. ob_end_clean();
  179.  
  180. echo $cont;
  181.