You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
209 lines
6.1 KiB
209 lines
6.1 KiB
<?php
|
|
/*
|
|
Copyright Intermesh 2003
|
|
Author: Merijn Schering <mschering@intermesh.nl>
|
|
Version: 1.0 Release date: 08 July 2003
|
|
|
|
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.
|
|
*/
|
|
require_once("Group-Office.php");
|
|
$config_file = $GO_CONFIG->get_config_file();
|
|
|
|
/*Uncomment with release!
|
|
if(file_exists('install'))
|
|
{
|
|
echo 'Install directory exists. Click <a href="install/install.php">here</a> to install or '.
|
|
'upgrade your installation or remove the install directory for security reasons. ';
|
|
exit();
|
|
}elseif(is_writable($config_file))
|
|
{
|
|
echo '<font color="red"><b>\''.$config_file.'\' is writable please chmod 755
|
|
'.$config_file.' and change the ownership to any other user then the
|
|
webserver user.</b></font>';
|
|
|
|
exit();
|
|
}*/
|
|
|
|
|
|
$task = isset($_REQUEST['task']) ? $_REQUEST['task'] : '';
|
|
require_once($GO_LANGUAGE->get_base_language_file('login'));
|
|
|
|
if ($task == "logout")
|
|
{
|
|
|
|
/* zed -- for bookmarks */
|
|
# reset cookies
|
|
setcookie("BM4U_ROOT", "", 0, "/");
|
|
setcookie("BM4U_USER", "", 0, "/");
|
|
setcookie("BM4U_UID", "", 0, "/");
|
|
setcookie("BM4U_TIME", "", 0, "/");
|
|
setcookie("BM4U_TOKEN", "", 0, "/");
|
|
setcookie("BM4U_GUSER", "", 0, "/");
|
|
setcookie("BM4U_GUID", "", 0, "/");
|
|
setcookie("BM4U_GTIME", "", 0, "/");
|
|
setcookie("BM4U_GTOKEN", "", 0, "/");
|
|
setcookie("BM4U_GUEST_MODE", "", 0, "/");
|
|
setcookie("BM4U_CLIPBRD", "", 0, "/");
|
|
setcookie("BM4U_SEARCHES", "", 0, "/");
|
|
# echo "<script type='text/javascript' src='javascript/avw_common.js'></script>";
|
|
# echo "<script>open_win('modules/bookmarks/index.php','extra');</script>";
|
|
SetCookie("GO_UN","",time()-3600,"/","",0);
|
|
SetCookie("GO_PW","",time()-3600,"/","",0);
|
|
unset($_SESSION);
|
|
unset($_COOKIE);
|
|
|
|
/* zed - delete _webChat.html file */
|
|
$f_path = $HTTP_SESSION_VARS['f_path'];
|
|
$if_path = $HTTP_SESSION_VARS['if_path'];
|
|
|
|
if(file_exists($if_path)) {
|
|
//echo "here".$_SERVER['HTTP_REFERER'].$if_path; die();
|
|
// fclose($if_path);
|
|
if(!unlink($if_path)) die();
|
|
}
|
|
|
|
if(file_exists($f_path)) {
|
|
// fclose($f_path);
|
|
if(!unlink($f_path)) die();
|
|
}
|
|
|
|
$GO_SECURITY->logout();
|
|
}
|
|
|
|
//when the user is logged in redirect him.
|
|
if ($GO_SECURITY->logged_in == true)
|
|
{
|
|
$start_module = $GO_MODULES->get_module(
|
|
$_SESSION['GO_SESSION']['start_module']);
|
|
if (isset($_REQUEST['return_to']))
|
|
{
|
|
$link = $_REQUEST['return_to'];
|
|
}elseif ( $start_module && ( $GO_SECURITY->has_permission(
|
|
$GO_SECURITY->user_id, $start_module['acl_read']) ||
|
|
$GO_SECURITY->has_permission($GO_SECURITY->user_id,
|
|
$start_module['acl_write']) ) )
|
|
{
|
|
$link = $start_module['url'];
|
|
}else
|
|
{
|
|
$link = $GO_CONFIG->host.'configuration/';
|
|
}
|
|
|
|
require_once($GO_THEME->theme_path."frames.inc");
|
|
|
|
exit();
|
|
}
|
|
|
|
//if form was posted user wants to login
|
|
//set cookies to remember login before headers are sent
|
|
if ( $_SERVER['REQUEST_METHOD'] == "POST" || (isset($_COOKIE['GO_UN'])
|
|
&& isset($_COOKIE['GO_PW'])) )
|
|
{
|
|
if ($_SERVER['REQUEST_METHOD'] != "POST")
|
|
{
|
|
$remind = true;
|
|
$password = smart_addslashes($_COOKIE['GO_PW']);
|
|
$username = smart_addslashes($_COOKIE['GO_UN']);
|
|
} else {
|
|
$remind = isset($_POST['remind']) ? true : false;
|
|
$username = smart_addslashes($_POST['username']);
|
|
$password = smart_addslashes($_POST['password']);
|
|
}
|
|
|
|
//check if both fields were filled
|
|
if (!$username)// || !$password)
|
|
{
|
|
$feedback = "<p class=\"Error\">".$login_missing_field."</p>";
|
|
} else {
|
|
SetCookie("GO_AUTH_SOURCE_KEY",
|
|
$_REQUEST['auth_source_key'], time()+3600*24*30,"/",'',0);
|
|
$_COOKIE['GO_AUTH_SOURCE_KEY'] = $_REQUEST['auth_source_key'];
|
|
|
|
//attempt login using security class inherited from index.php
|
|
//$params = isset( $auth_sources[$auth_source]) ? $auth_sources[$auth_source] : false;
|
|
if ($GO_AUTH->login($username, $password, $_SESSION['auth_source']))
|
|
{
|
|
//login is correct final check if login registration was ok
|
|
if ($GO_SECURITY->logged_in == true)
|
|
{
|
|
if ($remind)
|
|
{
|
|
SetCookie("GO_UN",$username,time()+3600*24*30,"/",'',0);
|
|
SetCookie("GO_PW",$password,time()+3600*24*30,"/",'',0);
|
|
}
|
|
|
|
//update language
|
|
if(isset($_POST['SET_LANGUAGE']) &&
|
|
$_POST['SET_LANGUAGE'] != $_SESSION['GO_SESSION']['language']['id'])
|
|
{
|
|
$GO_USERS->set_language($GO_SECURITY->user_id, $_POST['SET_LANGUAGE']);
|
|
}
|
|
|
|
if ($_SESSION['GO_SESSION']['first_name'] == '' ||
|
|
$_SESSION['GO_SESSION']['last_name'] == '' ||
|
|
$_SESSION['GO_SESSION']['email'] == '')
|
|
{
|
|
header("Location: ".$GO_CONFIG->host.
|
|
"configuration/index.php");
|
|
exit();
|
|
}else
|
|
{
|
|
// echo "value is ".$username;
|
|
//exit;
|
|
|
|
$_SESSION["uname"]= $username;
|
|
$_SESSION['pw']= $password;
|
|
$start_module = $GO_MODULES->get_module($_SESSION['GO_SESSION']['start_module']);
|
|
#echo("there");exit();
|
|
|
|
|
|
if(!$start_module ||
|
|
(!$GO_SECURITY->has_permission($GO_SECURITY->user_id,$start_module['acl_read']) &&
|
|
!$GO_SECURITY->has_permission($GO_SECURITY->user_id,$start_module['acl_wrtite'])))
|
|
{
|
|
if($modules = $GO_MODULES->get_modules_with_locations())
|
|
{
|
|
while($module = array_shift($modules))
|
|
{
|
|
if($GO_SECURITY->has_permission($GO_SECURITY->user_id, $module['acl_read']) ||
|
|
$GO_SECURITY->has_permission($GO_SECURITY->user_id, $module['acl_write']))
|
|
{
|
|
$start_module = $module;
|
|
$GO_USERS->set_start_module($GO_SECURITY->user_id, $module['id']);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (isset($_REQUEST['return_to']))
|
|
{
|
|
$link = $_REQUEST['return_to'];
|
|
} elseif ($start_module)
|
|
{
|
|
$link = $start_module['url'];
|
|
} else
|
|
{
|
|
$link = $GO_CONFIG->host.'configuration/index.php?account=look.inc';
|
|
}
|
|
//redefine theme
|
|
$GO_THEME = new GO_THEME();
|
|
require_once($GO_THEME->theme_path."frames.inc");
|
|
exit();
|
|
}
|
|
}else
|
|
{
|
|
$feedback = "<p class=\"Error\">".$login_registration_fail."</p>";
|
|
}
|
|
}else
|
|
{
|
|
$feedback = "<p class=\"Error\">".$login_bad_login."</p>";
|
|
}
|
|
}
|
|
}
|
|
require_once('login_screens/'.$GO_CONFIG->login_screen.'/login.inc');
|
|
//print 'login_screens/'.$GO_CONFIG->login_screen.'/login.inc';
|
|
?>
|
|
|