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");
|
2014-12-08 13:47:32 +00:00
|
|
|
include("../inc/inc.LogInit.php");
|
2011-01-11 09:08:04 +00:00
|
|
|
include("../inc/inc.Utils.php");
|
|
|
|
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");
|
2010-10-29 13:19:51 +00:00
|
|
|
include("../inc/inc.DBInit.php");
|
2011-01-11 09:08:04 +00:00
|
|
|
include("../inc/inc.ClassUI.php");
|
2013-07-23 15:33:40 +00:00
|
|
|
include("../inc/inc.ClassController.php");
|
2011-01-11 09:08:04 +00:00
|
|
|
|
2013-02-03 07:25:12 +00:00
|
|
|
include $settings->_rootDir . "languages/" . $settings->_language . "/lang.inc";
|
|
|
|
|
2019-01-11 07:53:04 +00:00
|
|
|
function _printMessage($message) { /* {{{ */
|
2018-09-05 05:15:12 +00:00
|
|
|
global $session, $dms, $theme;
|
|
|
|
|
|
|
|
header("Location:../out/out.Login.php?msg=".urlencode($message));
|
|
|
|
exit;
|
2016-08-10 06:04:52 +00:00
|
|
|
} /* }}} */
|
2011-01-11 09:08:04 +00:00
|
|
|
|
2013-07-23 15:33:40 +00:00
|
|
|
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
2018-04-23 13:27:23 +00:00
|
|
|
$controller = Controller::factory($tmp[1], array('dms'=>$dms));
|
2013-07-23 15:33:40 +00:00
|
|
|
|
2019-01-11 07:53:04 +00:00
|
|
|
$sesstheme = '';
|
2013-02-26 08:44:50 +00:00
|
|
|
if (isset($_REQUEST["sesstheme"]) && strlen($_REQUEST["sesstheme"])>0 && is_numeric(array_search($_REQUEST["sesstheme"],UI::getStyles())) ) {
|
|
|
|
$theme = $_REQUEST["sesstheme"];
|
2019-01-11 07:53:04 +00:00
|
|
|
$sesstheme = $_REQUEST["sesstheme"];
|
2013-02-26 08:44:50 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 21:35:42 +00:00
|
|
|
if (isset($_REQUEST["login"])) {
|
2011-12-02 18:44:42 +00:00
|
|
|
$login = $_REQUEST["login"];
|
2011-01-11 09:08:04 +00:00
|
|
|
$login = str_replace("*", "", $login);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!isset($login) || strlen($login)==0) {
|
2019-01-11 07:53:04 +00:00
|
|
|
_printMessage(getMLText("login_not_given")."\n");
|
2011-01-11 09:08:04 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2014-07-24 05:53:08 +00:00
|
|
|
$pwd = '';
|
|
|
|
if(isset($_POST['pwd'])) {
|
|
|
|
$pwd = (string) $_POST["pwd"];
|
|
|
|
if (get_magic_quotes_gpc()) {
|
|
|
|
$pwd = stripslashes($pwd);
|
|
|
|
}
|
2011-01-11 09:08:04 +00:00
|
|
|
}
|
|
|
|
|
2019-04-17 06:29:19 +00:00
|
|
|
$lang = '';
|
|
|
|
if(isset($_REQUEST["lang"]) && strlen($_REQUEST["lang"])>0 && is_numeric(array_search($_REQUEST["lang"],getLanguages())) ) {
|
|
|
|
$lang = (string) $_REQUEST["lang"];
|
|
|
|
}
|
|
|
|
|
2013-02-14 11:10:53 +00:00
|
|
|
$session = new SeedDMS_Session($db);
|
2011-01-11 09:08:04 +00:00
|
|
|
|
2016-04-04 06:49:50 +00:00
|
|
|
// TODO: by the PHP manual: The superglobals $_GET and $_REQUEST are already decoded.
|
2010-10-29 13:19:51 +00:00
|
|
|
// Using urldecode() on an element in $_GET or $_REQUEST could have unexpected and dangerous results.
|
2011-01-11 09:08:04 +00:00
|
|
|
|
2020-08-26 09:39:42 +00:00
|
|
|
$referuri = '';
|
2011-01-11 09:08:04 +00:00
|
|
|
if (isset($_POST["referuri"]) && strlen($_POST["referuri"])>0) {
|
2014-03-21 07:11:12 +00:00
|
|
|
$referuri = trim(urldecode($_POST["referuri"]));
|
2011-01-11 09:08:04 +00:00
|
|
|
}
|
|
|
|
else if (isset($_GET["referuri"]) && strlen($_GET["referuri"])>0) {
|
2014-03-21 07:11:12 +00:00
|
|
|
$referuri = trim(urldecode($_GET["referuri"]));
|
2010-10-29 13:19:51 +00:00
|
|
|
}
|
|
|
|
|
2018-08-17 12:40:10 +00:00
|
|
|
add_log_line();
|
|
|
|
|
2019-01-11 07:53:04 +00:00
|
|
|
$controller->setParam('login', $login);
|
|
|
|
$controller->setParam('pwd', $pwd);
|
|
|
|
$controller->setParam('lang', $lang);
|
|
|
|
$controller->setParam('sesstheme', $sesstheme);
|
2020-08-26 09:39:42 +00:00
|
|
|
$controller->setParam('referuri', $referuri);
|
2013-07-23 15:33:40 +00:00
|
|
|
$controller->setParam('session', $session);
|
2019-01-11 07:53:04 +00:00
|
|
|
if(!$controller->run()) {
|
2019-01-14 09:11:50 +00:00
|
|
|
add_log_line("login failed", PEAR_LOG_ERR);
|
2019-01-11 07:53:04 +00:00
|
|
|
_printMessage(getMLText($controller->getErrorMsg()), getMLText($controller->getErrorMsg())."\n");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
$user = $controller->getUser();
|
2013-07-23 15:33:40 +00:00
|
|
|
|
2011-01-11 09:08:04 +00:00
|
|
|
if (isset($referuri) && strlen($referuri)>0) {
|
2017-08-23 11:46:07 +00:00
|
|
|
// header("Location: http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'] . $referuri);
|
|
|
|
header("Location: " . $referuri);
|
2011-01-11 09:08:04 +00:00
|
|
|
}
|
|
|
|
else {
|
2015-06-11 12:09:50 +00:00
|
|
|
header("Location: ".$settings->_httpRoot.(isset($settings->_siteDefaultPage) && strlen($settings->_siteDefaultPage)>0 ? $settings->_siteDefaultPage : "out/out.ViewFolder.php?folderid=".($user->getHomeFolder() ? $user->getHomeFolder() : $settings->_rootFolderID)));
|
2011-01-11 09:08:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|