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.
 
 
 
 
 
 

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