Subversion Repositories oidplus

Rev

Rev 227 | Rev 240 | 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. header('Content-Type:text/html; charset=UTF-8');
  21.  
  22. require_once __DIR__ . '/includes/oidplus.inc.php';
  23.  
  24. ob_start(); // allow cookie headers to be sent
  25.  
  26. OIDplus::init(true);
  27.  
  28. $static_node_id = isset($_REQUEST['goto']) ? $_REQUEST['goto'] : 'oidplus:system';
  29. $static = OIDplus::gui()::generateContentPage($static_node_id);
  30. $static_title = $static['title'];
  31. $static_icon = $static['icon'];
  32. $static_content = $static['text'];
  33.  
  34. function combine_systemtitle_and_pagetitle($systemtitle, $pagetitle) {
  35.         if ($systemtitle == $pagetitle) {
  36.                 return $systemtitle;
  37.         } else {
  38.                 return $systemtitle . ' - ' . $pagetitle;
  39.         }
  40. }
  41.  
  42. $sysid_oid = OIDplus::getSystemId(true);
  43. if (!$sysid_oid) $sysid_oid = 'unknown';
  44. header('X-OIDplus-SystemID:'.$sysid_oid);
  45.  
  46. $sys_url = OIDplus::getSystemUrl();
  47. header('X-OIDplus-SystemURL:'.$sys_url);
  48.  
  49. $sys_ver = OIDplus::getVersion();
  50. if (!$sys_ver) $sys_ver = 'unknown';
  51. header('X-OIDplus-SystemVersion:'.$sys_ver);
  52.  
  53. $sys_install_type = OIDplus::getInstallType();
  54. header('X-OIDplus-SystemInstallType:'.$sys_install_type);
  55.  
  56. $sys_title = OIDplus::config()->systemTitle();
  57. header('X-OIDplus-SystemTitle:'.$sys_title);
  58.  
  59. if (class_exists('OIDplusPageAdminColors')) {
  60.         $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);
  61. } else {
  62.         $css = 'oidplus.min.css.php';
  63. }
  64.  
  65. $js = 'oidplus.min.js.php';
  66.  
  67. ?><!DOCTYPE html>
  68. <html lang="en">
  69.  
  70. <head>
  71.         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  72.         <meta name="OIDplus-SystemID" content="<?php echo htmlentities($sysid_oid); ?>">
  73.         <meta name="OIDplus-SystemURL" content="<?php echo htmlentities($sys_url); ?>">
  74.         <meta name="OIDplus-SystemVersion" content="<?php echo htmlentities($sys_ver); ?>">
  75.         <meta name="OIDplus-SystemInstallType" content="<?php echo htmlentities($sys_install_type); ?>">
  76.         <meta name="OIDplus-SystemTitle" content="<?php echo htmlentities($sys_title); /* Do not remove. This meta tag is acessed by oidplus_base.js */ ?>">
  77.         <meta name="theme-color" content="#A9DCF0">
  78.         <meta name="viewport" content="width=device-width, initial-scale=1.0">
  79.  
  80.         <title><?php echo combine_systemtitle_and_pagetitle(OIDplus::config()->systemTitle(), $static_title); ?></title>
  81.  
  82.         <script src="<?php echo htmlentities($js); ?>"></script>
  83.  
  84.         <link rel="stylesheet" href="<?php echo htmlentities($css); ?>">
  85.         <link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico">
  86. </head>
  87.  
  88. <body>
  89.  
  90. <div id="frames">
  91.         <div id="content_window" class="borderbox">
  92.                 <?php
  93.                 $static_content = preg_replace_callback(
  94.                         '|<a\s([^>]*)href="mailto:([^"]+)"([^>]*)>([^<]*)</a>|ismU',
  95.                         function ($treffer) {
  96.                                 $email = $treffer[2];
  97.                                 $text = $treffer[4];
  98.                                 return secure_email($email, $text, 1); // AntiSpam
  99.                         }, $static_content);
  100.  
  101.                 echo '<h1 id="real_title">';
  102.                 if ($static_icon != '') echo '<img src="'.htmlentities($static_icon).'" width="48" height="48" alt=""> ';
  103.                 echo htmlentities($static_title).'</h1>';
  104.                 echo '<div id="real_content">'.$static_content.'</div>';
  105.                 if ($_SERVER['REQUEST_METHOD'] == 'GET') {
  106.                         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>';
  107.                         echo '</p>';
  108.                 }
  109.                 echo '<br>';
  110.                 ?>
  111.         </div>
  112.  
  113.         <div id="system_title_bar">
  114.                 <div id="system_title_menu" onclick="mobileNavButtonClick(this)" onmouseenter="mobileNavButtonHover(this)" onmouseleave="mobileNavButtonHover(this)">
  115.                         <div id="bar1"></div>
  116.                         <div id="bar2"></div>
  117.                         <div id="bar3"></div>
  118.                 </div>
  119.  
  120.                 <div id="system_title_text">
  121.                         <a <?php echo oidplus_link('oidplus:system'); ?>>
  122.                                 <span id="system_title_1">ViaThinkSoft OIDplus 2.0</span><br>
  123.                                 <span id="system_title_2"><?php echo htmlentities(OIDplus::config()->systemTitle()); ?></span>
  124.                         </a>
  125.                 </div>
  126.         </div>
  127.  
  128.         <div id="gotobox">
  129.                 <input type="text" name="goto" id="gotoedit" value="<?php echo htmlentities($static_node_id); ?>">
  130.                 <input type="button" value="Go" onclick="gotoButtonClicked()" id="gotobutton">
  131.         </div>
  132.  
  133.         <div id="oidtree" class="borderbox">
  134.                 <!-- <noscript>
  135.                         <p><b>Please enable JavaScript to use all features</b></p>
  136.                 </noscript> -->
  137.                 <?php OIDplusTree::nonjs_menu(); ?>
  138.         </div>
  139. </div>
  140.  
  141. </body>
  142. </html>
  143. <?php
  144.  
  145. $cont = ob_get_contents();
  146. ob_end_clean();
  147.  
  148. echo $cont;
  149.