index.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /*
  3. // Use specified session instead
  4. if (isset($_REQUEST['sessionid']))
  5. session_id($_REQUEST['sessionid']);
  6. */
  7. // Use install
  8. if (file_exists("install")) {
  9. header("location: install/index.php");
  10. die();
  11. }
  12. require_once("includes/general.php");
  13. require_once("classes/Utils/Error.php");
  14. require_once("classes/ManagerEngine.php");
  15. $MCErrorHandler = new Moxiecode_Error(false);
  16. set_error_handler("HTMLErrorHandler");
  17. // NOTE: Remove default value
  18. $type = getRequestParam("type");
  19. $page = getRequestParam("page", "index.html");
  20. $domain = getRequestParam("domain");
  21. // Clean up type, only a-z stuff.
  22. $type = preg_replace ("/[^a-z]/i", "", $type);
  23. if (!$type) {
  24. header('location: examples.html');
  25. die();
  26. }
  27. // Include Base and Core and Config.
  28. $man = new Moxiecode_ManagerEngine($type);
  29. require_once($basepath ."CorePlugin.php");
  30. require_once("config.php");
  31. $man->dispatchEvent("onPreInit", array($type));
  32. // Include all plugins
  33. $pluginPaths = $man->getPluginPaths();
  34. foreach ($pluginPaths as $path)
  35. require_once($path);
  36. $config = $man->getConfig();
  37. $suffix = "";
  38. if ($domain)
  39. $suffix .= "?domain=" . $domain;
  40. // Dispatch onInit event
  41. if ($man->isAuthenticated()) {
  42. $man->dispatchEvent("onInit");
  43. header("Location: pages/". $config["general.theme"] ."/" . $page . $suffix);
  44. die();
  45. } else {
  46. header("Location: ". $config["authenticator.login_page"] . "?return_url=" . urlencode($_SERVER['REQUEST_URI']));
  47. die();
  48. }
  49. ?>