index.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/prerequisites.inc.php';
  3. if (isset($_SESSION['mailcow_cc_role']) && isset($_SESSION['oauth2_request'])) {
  4. $oauth2_request = $_SESSION['oauth2_request'];
  5. unset($_SESSION['oauth2_request']);
  6. header('Location: ' . $oauth2_request);
  7. exit();
  8. }
  9. elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == 'admin') {
  10. header('Location: /debug');
  11. exit();
  12. }
  13. elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == 'domainadmin') {
  14. header('Location: /mailbox');
  15. exit();
  16. }
  17. elseif (isset($_SESSION['mailcow_cc_role']) && $_SESSION['mailcow_cc_role'] == 'user') {
  18. header('Location: /user');
  19. exit();
  20. }
  21. require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/header.inc.php';
  22. $_SESSION['return_to'] = $_SERVER['REQUEST_URI'];
  23. $_SESSION['index_query_string'] = $_SERVER['QUERY_STRING'];
  24. $template = 'index.twig';
  25. $template_data = [
  26. 'oauth2_request' => @$_SESSION['oauth2_request'],
  27. 'is_mobileconfig' => str_contains($_SESSION['index_query_string'], 'mobileconfig'),
  28. 'login_delay' => @$_SESSION['ldelay'],
  29. ];
  30. $js_minifier->add('/web/js/site/index.js');
  31. require_once $_SERVER['DOCUMENT_ROOT'] . '/inc/footer.inc.php';