2011-01-11 09:08:04 +00:00
|
|
|
<?php
|
|
|
|
// MyDMS. Document Management System
|
|
|
|
// Copyright (C) 2002-2005 Markus Westphal
|
|
|
|
// Copyright (C) 2006-2008 Malcolm Cowe
|
2016-08-09 05:34:30 +00:00
|
|
|
// Copyright (C) 2010-2016 Uwe Steinmann
|
2011-01-11 09:08:04 +00:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation; either version 2 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
include("../inc/inc.Settings.php");
|
|
|
|
include("../inc/inc.Utils.php");
|
2022-11-09 05:40:50 +00:00
|
|
|
include("../inc/inc.LogInit.php");
|
2023-02-16 10:36:07 +00:00
|
|
|
include("../inc/inc.Language.php");
|
2014-12-08 13:47:32 +00:00
|
|
|
include("../inc/inc.Init.php");
|
|
|
|
include("../inc/inc.Extension.php");
|
2011-01-11 09:08:04 +00:00
|
|
|
include("../inc/inc.ClassSession.php");
|
2013-09-09 07:36:57 +00:00
|
|
|
include("../inc/inc.ClassController.php");
|
2010-10-29 13:19:51 +00:00
|
|
|
include("../inc/inc.DBInit.php");
|
2013-09-11 16:41:36 +00:00
|
|
|
include("../inc/inc.Authentication.php");
|
2011-01-11 09:08:04 +00:00
|
|
|
|
2013-09-09 07:36:57 +00:00
|
|
|
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
2018-03-12 17:34:17 +00:00
|
|
|
$controller = Controller::factory($tmp[1], array('dms'=>$dms, 'user'=>$user));
|
2011-01-11 09:08:04 +00:00
|
|
|
|
2013-09-09 07:36:57 +00:00
|
|
|
// Delete session from database
|
2013-09-11 16:41:36 +00:00
|
|
|
if(isset($_COOKIE['mydms_session'])) {
|
|
|
|
$dms_session = $_COOKIE["mydms_session"];
|
2010-10-29 13:19:51 +00:00
|
|
|
|
2013-09-11 16:41:36 +00:00
|
|
|
$session = new SeedDMS_Session($db);
|
|
|
|
$session->load($dms_session);
|
2013-02-06 17:33:56 +00:00
|
|
|
|
2013-09-11 16:41:36 +00:00
|
|
|
// If setting the user id to 0 worked, it would be a way to logout a
|
|
|
|
// user. It doesn't work because of a foreign constraint in the database
|
|
|
|
// won't allow it. So we keep on deleting the session and the cookie on
|
|
|
|
// logout
|
|
|
|
// $session->setUser(0); does not work because of foreign user constraint
|
2013-02-06 17:33:56 +00:00
|
|
|
|
2013-09-11 16:41:36 +00:00
|
|
|
if(!$session->delete($dms_session)) {
|
|
|
|
UI::exitError(getMLText("logout"),$db->getErrorMsg());
|
|
|
|
}
|
2011-01-11 09:08:04 +00:00
|
|
|
|
2013-09-11 16:41:36 +00:00
|
|
|
// Delete Cookie
|
|
|
|
setcookie("mydms_session", $dms_session, time()-3600, $settings->_httpRoot);
|
2011-01-11 09:08:04 +00:00
|
|
|
|
2013-09-11 16:41:36 +00:00
|
|
|
$controller->setParam('user', $user);
|
|
|
|
$controller->setParam('session', $session);
|
2022-07-29 19:44:04 +00:00
|
|
|
$controller();
|
2013-09-11 16:41:36 +00:00
|
|
|
}
|
2013-09-09 07:36:57 +00:00
|
|
|
|
2011-01-11 09:08:04 +00:00
|
|
|
//Forward to Login-page
|
|
|
|
header("Location: ../out/out.Login.php");
|
|
|
|
?>
|