Subversion Repositories oidplus

Rev

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