Subversion Repositories oidplus

Rev

Rev 21 | Rev 61 | 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. ?><!DOCTYPE html>
  46. <html lang="en">
  47. <head>
  48.         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  49.         <title><?php echo combine_systemtitle_and_pagetitle(OIDplus::config()->systemTitle(), $static_title); ?></title>
  50.         <link rel="stylesheet" href="3p/jstree/themes/default/style.min.css">
  51.  
  52.         <!-- 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 -->
  53.         <script src="3p/jquery/jquery-2.2.1.min.js"></script>
  54.         <script src="3p/bootstrap/js/bootstrap.min.js"></script>
  55.         <script src="3p/jstree/jstree.min.js"></script>
  56.         <script src='3p/tinymce/tinymce.min.js'></script>
  57.         <script src="3p/jquery-ui/jquery-ui.js"></script>
  58.         <script src="3p/layout/jquery.layout.min.js"></script>
  59.         <script src="3p/spamspan/spamspan.js"></script>
  60.         <script src='https://www.google.com/recaptcha/api.js'></script>
  61.  
  62.         <script src="oidplus.js"></script>
  63.         <?php
  64.         $ary = glob(__DIR__ . '/plugins/publicPages/'.'*'.'/script.js');
  65.         sort($ary);
  66.         foreach ($ary as $a) {
  67.                 echo '<script src="'.str_replace(__DIR__ . '/', '', $a).'"></script>';
  68.         }
  69.         $ary = glob(__DIR__ . '/plugins/adminPages/'.'*'.'/script.js');
  70.         sort($ary);
  71.         foreach ($ary as $a) {
  72.                 echo '<script src="'.str_replace(__DIR__ . '/', '', $a).'"></script>';
  73.         }
  74.         $ary = glob(__DIR__ . '/plugins/raPages/'.'*'.'/script.js');
  75.         sort($ary);
  76.         foreach ($ary as $a) {
  77.                 echo '<script src="'.str_replace(__DIR__ . '/', '', $a).'"></script>';
  78.         }
  79.         ?>
  80.  
  81.         <link rel="stylesheet" href="oidplus.css">
  82.         <?php
  83.         $ary = glob(__DIR__ . '/plugins/publicPages/'.'*'.'/style.css');
  84.         sort($ary);
  85.         foreach ($ary as $a) {
  86.                 echo '<link rel="stylesheet" href="'.str_replace(__DIR__ . '/', '', $a).'">';
  87.         }
  88.         $ary = glob(__DIR__ . '/plugins/adminPages/'.'*'.'/style.css');
  89.         sort($ary);
  90.         foreach ($ary as $a) {
  91.                 echo '<link rel="stylesheet" href="'.str_replace(__DIR__ . '/', '', $a).'">';
  92.         }
  93.         $ary = glob(__DIR__ . '/plugins/raPages/'.'*'.'/style.css');
  94.         sort($ary);
  95.         foreach ($ary as $a) {
  96.                 echo '<link rel="stylesheet" href="'.str_replace(__DIR__ . '/', '', $a).'">';
  97.         }
  98.         ?>
  99.         <link rel="stylesheet" href="3p/bootstrap/css/bootstrap.min.css">
  100.  
  101.         <link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">
  102.  
  103.         <script>
  104.         system_title = <?php echo js_escape(OIDplus::config()->systemTitle()); ?>; // TODO: Is that timing OK or is that a race condition?
  105.         </script>
  106.  
  107. <!-- https://cookieconsent.insites.com -->
  108. <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.0/cookieconsent.min.css" />
  109. <script src="https://cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.0/cookieconsent.min.js"></script>
  110. <script>
  111. window.addEventListener("load", function(){
  112. window.cookieconsent.initialise({
  113.         "palette": {
  114.                 "popup": {
  115.                         "background": "#edeff5",
  116.                         "text": "#838391"
  117.                 },
  118.                 "button": {
  119.                         "background": "#4b81e8"
  120.                 }
  121.         },
  122.         "position": "bottom-right"
  123. })});
  124. </script>
  125.  
  126. </head>
  127. <body>
  128.         <div id="system_title_bar" class="ui-layout-north">
  129.                 <a href="?goto=oidplus:system">
  130.                         <span id="system_title_1">ViaThinkSoft OIDplus 2.0</span><br>
  131.                         <span id="system_title_2"><?php echo htmlentities(OIDplus::config()->systemTitle()); ?></span>
  132.                 </a>
  133.         </div>
  134.  
  135.         <div id="oidtree" class="borderbox ui-layout-west">
  136.                 <noscript>
  137.                         <p><b>Please enable JavaScript to use all features</b></p>
  138.                 </noscript>
  139.                 <?php OIDplusTree::nonjs_menu($static_node_id); ?> <!-- TODO: NonJS menu: Horizontal Scrol bar missing -->
  140.         </div>
  141.  
  142.         <div id="content_window" class="borderbox ui-layout-center">
  143.                 <?php
  144.                 $static_content = preg_replace_callback(
  145.                         '|<a\s([^>]*)href="mailto:(.+)"([^>]*)>([^<]*)</a>|ismU',
  146.                         function ($treffer) {
  147.                                 $email = $treffer[2];
  148.                                 $text = $treffer[4];
  149.                                 return secure_email($email, $text, 1); // AntiSpam
  150.                         }, $static_content);
  151.  
  152.                 echo '<h1 id="real_title"><img src="'.htmlentities($static_icon).'" width="48" height="48" alt="'.htmlentities($static_title).'"> '.htmlentities($static_title).'</h1>';
  153.                 echo '<div id="real_content">'.$static_content.'</div>';
  154.                 echo '<br><p><a href="?goto='.htmlentities($static_node_id).'" id="static_link"><img src="img/share.png" width="15" height="15" alt="Share"> Static link to this page</a></p>';
  155.                 echo '<br>';
  156.                 ?>
  157.         </div>
  158. </body>
  159. </html>
  160. <?php
  161.  
  162. $cont = ob_get_contents();
  163. ob_end_clean();
  164.  
  165. echo $cont;
  166.