Subversion Repositories oidplus

Rev

Rev 472 | Rev 532 | 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 - 2021 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. $add_css_args = array();
  48. if (class_exists('OIDplusPageAdminColors')) {
  49.         // Usually, such things would be done using "features" (implementsFeature),
  50.         // but there are following reasons why we DON'T do it:
  51.         // 1. Just having a "CSS URL parameter feature" would change the URL parameter,
  52.         //    but it would not affect the custom code in oidplus.min.css.php
  53.         // 2. The JS function test_color_theme() has an hardcoded set of parameters
  54.         //    and does not follow the arguments that might be set by other plugins.
  55.         $add_css_args[] = 'theme='.urlencode(OIDplus::config()->getValue('design'));
  56.         $add_css_args[] = 'invert='.urlencode(OIDplus::config()->getValue('color_invert'));
  57.         $add_css_args[] = 'h_shift='.urlencode(OIDplus::config()->getValue('color_hue_shift')/360);
  58.         $add_css_args[] = 's_shift='.urlencode(OIDplus::config()->getValue('color_sat_shift')/100);
  59.         $add_css_args[] = 'v_shift='.urlencode(OIDplus::config()->getValue('color_val_shift')/100);
  60. }
  61. $add_css_args = count($add_css_args) > 0 ? '?'.implode('&',$add_css_args) : '';
  62.  
  63. ?><!DOCTYPE html>
  64. <html lang="<?php echo substr(OIDplus::getCurrentLang(),0,2); ?>">
  65.  
  66. <head>
  67.         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  68.         <meta name="OIDplus-SystemTitle" content="<?php echo htmlentities(OIDplus::config()->getValue('system_title')); /* Do not remove. This meta tag is acessed by oidplus_base.js */ ?>">
  69.         <meta name="theme-color" content="#A9DCF0">
  70.         <meta name="viewport" content="width=device-width, initial-scale=1.0">
  71.  
  72.         <title><?php echo htmlentities(combine_systemtitle_and_pagetitle(OIDplus::config()->getValue('system_title'), $static_title)); ?></title>
  73.  
  74.         <script src="polyfill.min.js.php"></script>
  75.         <?php
  76.         if (OIDplus::baseConfig()->getValue('RECAPTCHA_ENABLED', false) == true) {
  77.                 echo '<script src="https://www.google.com/recaptcha/api.js"></script>';
  78.         }
  79.         ?>
  80.         <script src="oidplus.min.js.php"></script>
  81.  
  82.         <link rel="stylesheet" href="oidplus.min.css.php<?php echo htmlentities($add_css_args); ?>">
  83.         <link rel="shortcut icon" type="image/x-icon" href="favicon.ico.php">
  84. </head>
  85.  
  86. <body>
  87.  
  88. <div id="frames">
  89.         <div id="content_window" class="borderbox">
  90.                 <?php
  91.                 $static_content = preg_replace_callback(
  92.                         '|<a\s([^>]*)href="mailto:([^"]+)"([^>]*)>([^<]*)</a>|ismU',
  93.                         function ($treffer) {
  94.                                 $email = $treffer[2];
  95.                                 $text = $treffer[4];
  96.                                 return OIDplus::mailUtils()->secureEmailAddress($email, $text, 1); // AntiSpam
  97.                         }, $static_content);
  98.  
  99.                 echo '<h1 id="real_title">';
  100.                 if ($static_icon != '') echo '<img src="'.htmlentities($static_icon).'" width="48" height="48" alt=""> ';
  101.                 echo htmlentities($static_title).'</h1>';
  102.                 echo '<div id="real_content">'.$static_content.'</div>';
  103.                 if ((!isset($_SERVER['REQUEST_METHOD'])) || ($_SERVER['REQUEST_METHOD'] == 'GET')) {
  104.                         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>';
  105.                         echo '</p>';
  106.                 }
  107.                 echo '<br>';
  108.                 ?>
  109.         </div>
  110.  
  111.         <div id="system_title_bar">
  112.                 <?php
  113.                 echo '<div id="system_title_menu" onclick="mobileNavButtonClick(this)" onmouseenter="mobileNavButtonHover(this)" onmouseleave="mobileNavButtonHover(this)">';
  114.                 echo '  <div id="bar1"></div>';
  115.                 echo '  <div id="bar2"></div>';
  116.                 echo '  <div id="bar3"></div>';
  117.                 echo '</div>';
  118.                 echo '';
  119.                 echo '<div id="system_title_text">';
  120.                 echo '  <a '.OIDplus::gui()->link('oidplus:system').' id="system_title_a">';
  121.                 echo '          <span id="system_title_logo"></span>';
  122.                 echo '          <span id="system_title_1">'._L('ViaThinkSoft OIDplus 2.0').'</span><br>';
  123.                 echo '          <span id="system_title_2">'.htmlentities(OIDplus::config()->getValue('system_title')).'</span>';
  124.                 echo '  </a>';
  125.                 echo '</div>';
  126.                 ?>
  127.         </div>
  128.  
  129.         <?php
  130.         echo OIDplusGui::getLanguageBox($static_node_id, true);
  131.         ?>
  132.  
  133.         <div id="gotobox">
  134.                 <?php
  135.                 echo '<input type="text" name="goto" id="gotoedit" value="'.htmlentities($static_node_id).'">';
  136.                 echo '<input type="button" value="'._L('Go').'" onclick="gotoButtonClicked()" id="gotobutton">';
  137.                 ?>
  138.         </div>
  139.  
  140.         <div id="oidtree" class="borderbox">
  141.                 <?php
  142.                 //echo '<noscript>';
  143.                 //echo '<p><b>'._L('Please enable JavaScript to use all features').'</b></p>';
  144.                 //echo '</noscript>';
  145.                 OIDplus::menuUtils()->nonjs_menu();
  146.                 ?>
  147.         </div>
  148. </div>
  149.  
  150. </body>
  151. </html>
  152. <?php
  153.  
  154. $cont = ob_get_contents();
  155. ob_end_clean();
  156.  
  157. echo $cont;
  158.