logoff.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. // Copyright (C) 2010-2013 Combodo SARL
  3. //
  4. // This file is part of iTop.
  5. //
  6. // iTop is free software; you can redistribute it and/or modify
  7. // it under the terms of the GNU Affero General Public License as published by
  8. // the Free Software Foundation, either version 3 of the License, or
  9. // (at your option) any later version.
  10. //
  11. // iTop is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. // GNU Affero General Public License for more details.
  15. //
  16. // You should have received a copy of the GNU Affero General Public License
  17. // along with iTop. If not, see <http://www.gnu.org/licenses/>
  18. require_once('../approot.inc.php');
  19. require_once(APPROOT.'/application/application.inc.php');
  20. require_once(APPROOT.'/application/itopwebpage.class.inc.php');
  21. require_once(APPROOT.'/application/wizardhelper.class.inc.php');
  22. require_once(APPROOT.'/application/startup.inc.php');
  23. $oAppContext = new ApplicationContext();
  24. $currentOrganization = utils::ReadParam('org_id', '');
  25. $operation = utils::ReadParam('operation', '');
  26. require_once(APPROOT.'/application/loginwebpage.class.inc.php');
  27. $bPortal = utils::ReadParam('portal', false);
  28. $sUrl = utils::GetAbsoluteUrlAppRoot();
  29. if ($bPortal)
  30. {
  31. $sUrl .= 'portal/';
  32. }
  33. else
  34. {
  35. $sUrl .= 'pages/UI.php';
  36. }
  37. if (isset($_SESSION['auth_user']))
  38. {
  39. $sAuthUser = $_SESSION['auth_user'];
  40. UserRights::Login($sAuthUser); // Set the user's language
  41. }
  42. $sLoginMode = isset($_SESSION['login_mode']) ? $_SESSION['login_mode'] : '';
  43. LoginWebPage::ResetSession();
  44. switch($sLoginMode)
  45. {
  46. case 'cas':
  47. $sCASLogoutUrl = MetaModel::GetConfig()->Get('cas_logout_redirect_service');
  48. if (empty($sCASLogoutUrl))
  49. {
  50. $sCASLogoutUrl = $sUrl;
  51. }
  52. utils::InitCASClient();
  53. phpCAS::logoutWithRedirectService($sCASLogoutUrl); // Redirects to the CAS logout page
  54. break;
  55. }
  56. $oPage = LoginWebPage::NewLoginWebPage();
  57. $oPage->no_cache();
  58. $oPage->DisplayLoginHeader();
  59. $oPage->add("<div id=\"login\">\n");
  60. $oPage->add("<h1>".Dict::S('UI:LogOff:ThankYou')."</h1>\n");
  61. $oPage->add("<p><a href=\"$sUrl\">".Dict::S('UI:LogOff:ClickHereToLoginAgain')."</a></p>");
  62. $oPage->add("</div>\n");
  63. $oPage->output();
  64. ?>