EPESI BIM • Business Information Manager • Cloud CRM/ERP http://epe.si/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

218 lines
7.9 KiB

  1. <?php
  2. /**
  3. * Index file
  4. *
  5. * This file includes all 'include files', loads modules
  6. * and gets output of default module.
  7. * @author Paul Bukowski <pbukowski@telaxus.com>
  8. * @copyright Copyright &copy; 2006, Telaxus LLC
  9. * @license MIT
  10. * @version 1.0
  11. * @package epesi-base
  12. */
  13. if(version_compare(phpversion(), '7.0.0')==-1)
  14. die("You are running an old version of PHP, php 7.0 required.");
  15. if(trim(ini_get("safe_mode")))
  16. die('You cannot use EPESI with PHP safe mode turned on - please disable it. Please notice this feature is deprecated since PHP 5.3 and will be removed in PHP 7.0.');
  17. define('_VALID_ACCESS',1);
  18. define('DATA_DIR','data'); // added by J. Tylek to remove map.php
  19. // Default /data directory location is epesidir/data
  20. // Must be defined here to read config.php
  21. if(!file_exists(DATA_DIR.'/config.php')) {
  22. header('Location: setup.php');
  23. exit();
  24. }
  25. if(!is_writable(DATA_DIR))
  26. die('Cannot write into "'.DATA_DIR.'" directory. Please fix privileges.');
  27. // require_once('include/include_path.php');
  28. require_once('include/config.php');
  29. require_once('include/maintenance_mode.php');
  30. require_once('include/error.php');
  31. require_once('include/misc.php');
  32. require_once('include/database.php');
  33. require_once('include/variables.php');
  34. if(epesi_requires_update()) {
  35. header('Location: update.php');
  36. exit();
  37. }
  38. $tables = DB::MetaTables();
  39. if(!in_array('modules',$tables) || !in_array('variables',$tables) || !in_array('session',$tables))
  40. die('Database structure you are using is apparently out of date or damaged. If you didn\'t perform application update recently you should try to restore the database. Otherwise, please refer to EPESI documentation in order to perform database update.');
  41. ob_start();
  42. if(IPHONE) {
  43. if(!isset($_GET['force_desktop'])) {
  44. ?>
  45. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  46. <html xmlns="http://www.w3.org/1999/xhtml">
  47. <head>
  48. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  49. <meta name="robots" content="NOINDEX, NOARCHIVE">
  50. <meta id="viewport" name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
  51. <title><?php print(EPESI);?></title>
  52. <link rel="stylesheet" href="libs/UiUIKit/stylesheets/iphone.css" />
  53. <link rel="apple-touch-icon" href="images/apple-touch-icon.png" />
  54. <script type="text/javascript" charset="utf-8">
  55. window.onload = function() {
  56. setTimeout(function(){window.scrollTo(0, 1);}, 100);
  57. }
  58. </script>
  59. </head>
  60. <body>
  61. <div id="header">
  62. <h1><?php print(EPESI);?></h1>
  63. </div>
  64. Please choose <?php print(EPESI);?> version:<ul>
  65. <li><a href="mobile.php" class="white button">mobile</a><br>
  66. <li><a href="index.php?force_desktop=1" class="green button">desktop</a>
  67. </ul>
  68. </body>
  69. </html>
  70. <?php
  71. exit();
  72. }
  73. } elseif(detect_mobile_device()) {
  74. header('Location: mobile.php');
  75. exit();
  76. }
  77. ?>
  78. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  79. <html xmlns="http://www.w3.org/1999/xhtml">
  80. <head profile="http://www.w3.org/2005/11/profile">
  81. <link rel="icon" type="image/png" href="images/favicon.png" />
  82. <link rel="apple-touch-icon" href="images/apple-favicon.png" />
  83. <title><?php print(EPESI);?></title>
  84. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  85. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  86. <meta name="SKYPE_TOOLBAR" content="SKYPE_TOOLBAR_PARSER_COMPATIBLE" />
  87. <meta name="robots" content="NOINDEX, NOARCHIVE">
  88. <?php
  89. ini_set('include_path', 'libs/minify' . PATH_SEPARATOR . '.' . PATH_SEPARATOR . 'libs' . PATH_SEPARATOR . ini_get('include_path'));
  90. require_once('Minify/Build.php');
  91. $jquery = DEBUG_JS ? 'libs/jquery-1.11.3.js' : 'libs/jquery-1.11.3.min.js';
  92. $jquery_migrate = DEBUG_JS ? 'libs/jquery-migrate-1.2.1.js' : 'libs/jquery-migrate-1.2.1.min.js';
  93. $jses = array('libs/prototype.js', $jquery, $jquery_migrate, 'libs/jquery-ui-1.10.1.custom.min.js', 'libs/HistoryKeeper.js', 'include/epesi.js');
  94. if(!DEBUG_JS) {
  95. $jsses_build = new Minify_Build($jses);
  96. $jsses_src = $jsses_build->uri('serve.php?' . http_build_query(array('f' => array_values($jses))));
  97. echo("<script type='text/javascript' src='$jsses_src'></script>");
  98. } else {
  99. foreach($jses as $js)
  100. print("<script type='text/javascript' src='$js'></script>");
  101. }
  102. $csses = array('libs/jquery-ui-1.10.1.custom.min.css');
  103. $csses_build = new Minify_Build($csses);
  104. $csses_src = $csses_build->uri('serve.php?'.http_build_query(array('f'=>array_values($csses))));
  105. ?>
  106. <link type="text/css" href="<?php print($csses_src)?>" rel="stylesheet"></link>
  107. <style type="text/css">
  108. <?php if (DIRECTION_RTL) print('body { direction: rtl; }'); ?>
  109. #epesiStatus {
  110. /* Netscape 4, IE 4.x-5.0/Win and other lesser browsers will use this */
  111. position: fixed;
  112. left: 50%; top: 30%;
  113. margin-left: -280px;
  114. /* all */
  115. /*background-color: #e6ecf2;*/
  116. background-color: white;
  117. border: 5px solid #336699;
  118. visibility: hidden;
  119. width: 560px;
  120. text-align: center;
  121. vertical-align: middle;
  122. z-index: 2002;
  123. color: #336699;
  124. overflow: hidden;
  125. /* css3 shadow border*/
  126. -webkit-box-shadow: 1px 1px 15px black;
  127. -moz-box-shadow: 1px 1px 15px black;
  128. box-shadow: 1px 1px 15px black;
  129. /* end css3 shadow border*/
  130. /* border radius */
  131. -webkit-border-radius: 6px;
  132. -moz-border-radius: 6px;
  133. border-radius: 6px;
  134. /* end border radius */
  135. }
  136. #epesiStatus table {
  137. color: #336699;
  138. font-weight: bold;
  139. font-family: Tahoma, Verdana, Vera-Sans, DejaVu-Sans;
  140. font-size: 11px;
  141. border: 5px solid #FFFFFF;
  142. }
  143. </style>
  144. <?php print(TRACKING_CODE); ?>
  145. </head>
  146. <body <?php if (DIRECTION_RTL) print('class="epesi_rtl"'); ?> >
  147. <div id="body_content">
  148. <div id="main_content" style="display:none;"></div>
  149. <div id="debug_content" style="padding-top:97px;display:none;">
  150. <div class="button" onclick="$('error_box').innerHTML='';$('debug_content').style.display='none';">Hide</div>
  151. <div id="debug"></div>
  152. <div id="error_box"></div>
  153. </div>
  154. <div id="epesiStatus">
  155. <table cellspacing="0" cellpadding="0" border="0" style="width: 100%;">
  156. <tr>
  157. <td><img src="images/logo.png" alt="logo" width="550" height="200" border="0"></td>
  158. </tr>
  159. <tr>
  160. <td style="text-align: center; vertical-align: middle; height: 30px;"><span id="epesiStatusText"><?php print(STARTING_MESSAGE);?></span></td>
  161. </tr>
  162. <tr>
  163. <td style="text-align: center; vertical-align: middle; height: 30px;"><img src="images/loader.gif" alt="loader" width="256" height="10" border="0"></td>
  164. </tr>
  165. </table>
  166. </div>
  167. </div>
  168. <?php
  169. /*
  170. * init_js file allows only num_of_clients sessions. If there is image
  171. * with empty src="" browser will load index.php file, so we cannot
  172. * include init_js file directly because num_of_clients request will
  173. * reset our history and restart EPESI.
  174. *
  175. * Check here if request accepts html. If it does we can assume that
  176. * this is request for page and include init_js file which is faster.
  177. * If there is not 'html' in accept use script with src property.
  178. */
  179. if(isset($_SERVER['HTTP_ACCEPT']) && stripos($_SERVER['HTTP_ACCEPT'], 'html') !== false) { ?>
  180. <script type="text/javascript"><?php require_once 'init_js.php'; ?></script>
  181. <?php } else { ?>
  182. <script type="text/javascript" src="init_js.php?<?php print(http_build_query($_GET));?>"></script>
  183. <?php } ?>
  184. <noscript>Please enable JavaScript in your browser and let <?php print(EPESI);?> work!</noscript>
  185. <?php if(IPHONE) { ?>
  186. <script type="text/javascript">var iphone=true;</script>
  187. <?php } ?>
  188. </body>
  189. </html>
  190. <?php
  191. $content = ob_get_contents();
  192. ob_end_clean();
  193. require_once('libs/minify/HTTP/Encoder.php');
  194. $he = new HTTP_Encoder(array('content' => $content));
  195. if (MINIFY_ENCODE)
  196. $he->encode();
  197. $he->sendAll();
  198. ?>