Subversion Repositories oidplus

Rev

Rev 126 | Rev 135 | 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. OIDplus::init(true);
  27.  
  28. OIDplus::db()->set_charset("UTF8");
  29. OIDplus::db()->query("SET NAMES 'utf8'");
  30.  
  31. $static_node_id = isset($_REQUEST['goto']) ? $_REQUEST['goto'] : 'oidplus:system';
  32. $static = OIDplus::gui()::generateContentPage($static_node_id);
  33. $static_title = $static['title'];
  34. $static_icon = $static['icon'];
  35. $static_content = $static['text'];
  36.  
  37. function combine_systemtitle_and_pagetitle($systemtitle, $pagetitle) {
  38.         if ($systemtitle == $pagetitle) {
  39.                 return $systemtitle;
  40.         } else {
  41.                 return $systemtitle . ' - ' . $pagetitle;
  42.         }
  43. }
  44.  
  45. $sysid_oid = OIDplus::system_id(true);
  46. if (!$sysid_oid) $sysid_oid = 'unknown';
  47. header('X-OIDplus-SystemID:'.$sysid_oid);
  48.  
  49. $sys_url = OIDplus::system_url();
  50. header('X-OIDplus-SystemURL:'.$sys_url);
  51.  
  52. $sys_ver = OIDplus::getVersion();
  53. if (!$sys_ver) $sys_ver = 'unknown';
  54. header('X-OIDplus-SystemVersion:'.$sys_ver);
  55.  
  56. $sys_title = OIDplus::config()->systemTitle();
  57. header('X-OIDplus-SystemTitle:'.$sys_title);
  58.  
  59. ?><!DOCTYPE html>
  60. <html lang="en">
  61.  
  62. <head>
  63.         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  64.         <meta name="OIDplus-SystemID" content="<?php echo htmlentities($sysid_oid); ?>">
  65.         <meta name="OIDplus-SystemURL" content="<?php echo htmlentities($sys_url); ?>">
  66.         <meta name="OIDplus-SystemVersion" content="<?php echo htmlentities($sys_ver); ?>">
  67.         <meta name="OIDplus-SystemTitle" content="<?php echo htmlentities($sys_title); /* Do not remove. This meta tag is acessed via JS */ ?>">
  68.         <meta name="theme-color" content="#A9DCF0">
  69.         <meta name="viewport" content="width=device-width, initial-scale=1.0">
  70.  
  71.         <title><?php echo combine_systemtitle_and_pagetitle(OIDplus::config()->systemTitle(), $static_title); ?></title>
  72.  
  73.         <!-- 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 -->
  74.         <script src="3p/jquery/jquery-2.2.1.min.js"></script>
  75.         <script src="3p/bootstrap/js/bootstrap.min.js"></script>
  76.         <script src="3p/jstree/jstree.min.js"></script>
  77.         <script src='3p/tinymce/tinymce.min.js'></script>
  78.         <script src="3p/jquery-ui/jquery-ui.min.js"></script>
  79.         <script src="3p/layout/jquery.layout.min.js"></script>
  80.         <script src="3p/spamspan/spamspan.js"></script>
  81.         <script src='https://www.google.com/recaptcha/api.js'></script>
  82.         <script src="oidplus.min.js.php"></script>
  83.  
  84.         <link rel="stylesheet" href="3p/jstree/themes/default/style.min.css">
  85.         <link rel="stylesheet" href="oidplus.min.css.php">
  86.         <link rel="stylesheet" href="3p/bootstrap/css/bootstrap.min.css">
  87.  
  88.         <link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">
  89.  
  90.         <!-- DM 28 May 2019: Removed CookieConsent temporarily, because it is placed at the beginning of the page and therefore ruins the Google index ... -->
  91.         <!-- We might not need it, because cookies are only set during login, and at the login page we already warn about cookies -->
  92.         <!-- TODO: Bring back? -->
  93.         <!-- <link rel="stylesheet" type="text/css" href="3p/cookieconsent/cookieconsent.min.css">
  94.         <script src="3p/cookieconsent/cookieconsent.min.js"></script>
  95.         <script>
  96.                 window.addEventListener("load", function(){
  97.                 window.cookieconsent.initialise({
  98.                         "palette": {
  99.                                 "popup": {
  100.                                         "background": "#edeff5",
  101.                                         "text": "#838391"
  102.                                 },
  103.                                 "button": {
  104.                                         "background": "#4b81e8"
  105.                                 }
  106.                         },
  107.                         "position": "bottom-right"
  108.                 })});
  109.         </script> -->
  110. </head>
  111.  
  112. <body>
  113.  
  114. <div id="frames">
  115.         <div id="content_window" class="borderbox">
  116.                 <?php
  117.                 $static_content = preg_replace_callback(
  118.                         '|<a\s([^>]*)href="mailto:([^"]+)"([^>]*)>([^<]*)</a>|ismU',
  119.                         function ($treffer) {
  120.                                 $email = $treffer[2];
  121.                                 $text = $treffer[4];
  122.                                 return secure_email($email, $text, 1); // AntiSpam
  123.                         }, $static_content);
  124.  
  125.                 echo '<h1 id="real_title">';
  126.                 if ($static_icon != '') echo '<img src="'.htmlentities($static_icon).'" width="48" height="48" alt=""> ';
  127.                 echo htmlentities($static_title).'</h1>';
  128.                 echo '<div id="real_content">'.$static_content.'</div>';
  129.                 if ($_SERVER['REQUEST_METHOD'] == 'GET') {
  130.                         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>';
  131.                         echo '</p>';
  132.                 }
  133.                 echo '<br>';
  134.                 ?>
  135.         </div>
  136.  
  137.         <div id="system_title_bar">
  138.                 <div id="system_title_menu" onclick="mobileNavButtonClick(this)" onmouseenter="mobileNavButtonHover(this)" onmouseleave="mobileNavButtonHover(this)">
  139.                         <div id="bar1"></div>
  140.                         <div id="bar2"></div>
  141.                         <div id="bar3"></div>
  142.                 </div>
  143.  
  144.                 <div id="system_title_text">
  145.                         <a <?php echo oidplus_link('oidplus:system'); ?>>
  146.                                 <span id="system_title_1">ViaThinkSoft OIDplus 2.0</span><br>
  147.                                 <span id="system_title_2"><?php echo htmlentities(OIDplus::config()->systemTitle()); ?></span>
  148.                         </a>
  149.                 </div>
  150.         </div>
  151.  
  152.         <div id="oidtree" class="borderbox">
  153.                 <!-- <noscript>
  154.                         <p><b>Please enable JavaScript to use all features</b></p>
  155.                 </noscript> -->
  156.                 <?php OIDplusTree::nonjs_menu(); ?>
  157.         </div>
  158. </div>
  159.  
  160. </body>
  161. </html>
  162. <?php
  163.  
  164. $cont = ob_get_contents();
  165. ob_end_clean();
  166.  
  167. echo $cont;
  168.