Subversion Repositories oidplus

Rev

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