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.

91 lines
2.6 KiB

15 years ago
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 <contact@movim.eu>
  10. *
  11. * Copyright (C)2013 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. use Monolog\Logger;
  40. use Monolog\Handler\SyslogHandler;
  41. try {
  42. if((isset($_GET['q']) && $_GET['q'] == 'admin') ||
  43. (isset($_GET['query']) && $_GET['query'] == 'admin')
  44. )
  45. define('FAIL_SAFE', true);
  46. else
  47. define('FAIL_SAFE', false);
  48. $bootstrap = new Bootstrap();
  49. $bootstrap->boot();
  50. $rqst = new FrontController();
  51. $rqst->handle();
  52. WidgetWrapper::getInstance(false);
  53. // Closing stuff
  54. WidgetWrapper::destroyInstance();
  55. } catch (Exception $e) {
  56. $log = new Logger('movim');
  57. $log->pushHandler(new SyslogHandler('movim'));
  58. $log->addInfo($e->getMessage());
  59. if (ENVIRONMENT === 'development' && !FAIL_SAFE) {
  60. ?>
  61. <div id="final_exception" class="error debug">
  62. <h2>An error happened</h2>
  63. <p><?php print $e->getMessage();?></p>
  64. </div>
  65. <?php
  66. } elseif(!FAIL_SAFE) {
  67. ?>
  68. <div class="carreful">
  69. <h2> Oops... something went wrong.</h2>
  70. <p>But don't panic. The NSA is on the case.</p>
  71. </div>
  72. <?php
  73. }
  74. if(FAIL_SAFE) {
  75. $r = new Route;
  76. $rqst = new FrontController();
  77. $rqst->handle();
  78. }
  79. }