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.

90 lines
2.6 KiB

15 years ago
15 years ago
15 years ago
15 years ago
15 years ago
  1. <?php
  2. /**
  3. * @file index.php
  4. * This file is part of MOVIM.
  5. *
  6. * @brief Prepares all the needed fixtures and fires up the main request
  7. * handler.
  8. *
  9. * @author Movim Project <movim@movim.eu>
  10. *
  11. * Copyright (C)2010 Movim Project
  12. *
  13. * This program is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License as published by
  15. * the Free Software Foundation, either version 3 of the License, or
  16. * (at your option) any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU Affero General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU Affero General Public License
  24. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  25. */
  26. /**
  27. * @mainpage
  28. *
  29. * Movim is an XMPP-based communication platform. It uses a widget-based UI
  30. * system. A widget is a combination of server-side and client-side scripts that
  31. * interact though a custom xmlrpc protocol.
  32. *
  33. * Movim's core is designed to ease the implementation of XMPP web-based clients,
  34. * using massively asynchronous javascript and abstracting XMPP calls into an
  35. * events-based API.
  36. */
  37. define('DOCUMENT_ROOT', dirname(__FILE__));
  38. require_once(DOCUMENT_ROOT.'/bootstrap.php');
  39. try {
  40. if((isset($_GET['q']) && $_GET['q'] == 'admin') ||
  41. (isset($_GET['query']) && $_GET['query'] == 'admin')
  42. )
  43. define('FAIL_SAFE', true);
  44. else
  45. define('FAIL_SAFE', false);
  46. $bootstrap = new Bootstrap();
  47. $bootstrap->boot();
  48. $rqst = new ControllerMain();
  49. $rqst->handle();
  50. WidgetWrapper::getInstance(false);
  51. // Closing stuff
  52. WidgetWrapper::destroyInstance();
  53. } catch (Exception $e) {
  54. //manage errors
  55. \system\Logs\Logger::displayDebugCSS();
  56. if (ENVIRONMENT === 'development' && !FAIL_SAFE) {
  57. ?>
  58. <div id="final_exception" class="error debug">
  59. <h2>An error happened</h2>
  60. <p><?php print $e->getMessage();?></p>
  61. </div>
  62. <?php
  63. } elseif(!FAIL_SAFE) {
  64. ?>
  65. <div class="carreful">
  66. <h2> Oops... something went wrong.</h2>
  67. <p>But don't panic. The NSA is on the case.</p>
  68. </div>
  69. <?php
  70. }
  71. if(FAIL_SAFE) {
  72. $r = new Route;
  73. $rqst = new ControllerMain();
  74. $rqst->handle();
  75. }
  76. }
  77. //display only if not already done and if there is something to display
  78. \system\Logs\Logger::displayFooterDebug();