logoff.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. // Copyright (C) 2010-2012 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. $sLoginMode = isset($_SESSION['login_mode']) ? $_SESSION['login_mode'] : '';
  38. LoginWebPage::ResetSession();
  39. switch($sLoginMode)
  40. {
  41. case 'cas':
  42. $sCASLogoutUrl = MetaModel::GetConfig()->Get('cas_logout_redirect_service');
  43. if (empty($sCASLogoutUrl))
  44. {
  45. $sCASLogoutUrl = $sUrl;
  46. }
  47. utils::InitCASClient();
  48. phpCAS::logoutWithRedirectService($sCASLogoutUrl); // Redirects to the CAS logout page
  49. break;
  50. }
  51. $oPage = new LoginWebPage();
  52. $sVersionShort = Dict::Format('UI:iTopVersion:Short', ITOP_VERSION);
  53. $sIconUrl = Utils::GetConfig()->Get('app_icon_url');
  54. $oPage->add("<div id=\"login-logo\"><a href=\"".htmlentities($sIconUrl, ENT_QUOTES, 'UTF-8')."\"><img title=\"$sVersionShort\" src=\"../images/itop-logo-external.png\"></a></div>\n");
  55. $oPage->add("<div id=\"login\">\n");
  56. $oPage->add("<h1>".Dict::S('UI:LogOff:ThankYou')."</h1>\n");
  57. $oPage->add("<p><a href=\"$sUrl\">".Dict::S('UI:LogOff:ClickHereToLoginAgain')."</a></p>");
  58. $oPage->add("</div>\n");
  59. $oPage->output();
  60. ?>