KXStudio Website https://kx.studio/
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.

49 lines
1.7KB

  1. <?php
  2. if (version_compare(PHP_VERSION, "5.2.0", "<"))
  3. exit("Chyrp requires PHP 5.2.0 or greater.");
  4. require_once "includes/common.php";
  5. # Prepare the controller.
  6. $main = MainController::current();
  7. # Parse the route.
  8. $route = Route::current($main);
  9. # Check if the user can view the site.
  10. if (!$visitor->group->can("view_site") and
  11. !in_array($route->action, array("login", "logout", "register", "lost_password")))
  12. if ($trigger->exists("can_not_view_site"))
  13. $trigger->call("can_not_view_site");
  14. else
  15. show_403(__("Access Denied"), __("You are not allowed to view this site."));
  16. # Execute the appropriate Controller responder.
  17. $route->init();
  18. # If the route failed or nothing was displayed, check for:
  19. # 1. Module-provided pages.
  20. # 2. Feather-provided pages.
  21. # 3. Theme-provided pages.
  22. if (!$route->success and !$main->displayed) {
  23. $displayed = false;
  24. foreach ($config->enabled_modules as $module)
  25. if (file_exists(MODULES_DIR."/".$module."/pages/".$route->action.".php"))
  26. $displayed = require MODULES_DIR."/".$module."/pages/".$route->action.".php";
  27. if (!$displayed)
  28. foreach ($config->enabled_feathers as $feather)
  29. if (file_exists(FEATHERS_DIR."/".$feather."/pages/".$route->action.".php"))
  30. $displayed = require FEATHERS_DIR."/".$feather."/pages/".$route->action.".php";
  31. if (!$displayed and $theme->file_exists("pages/".$route->action))
  32. $main->display("pages/".$route->action);
  33. elseif (!$displayed)
  34. show_404();
  35. }
  36. $trigger->call("end", $route);
  37. ob_end_flush();