implemented automatical forwarding into eGW after a login was necessary, because no session existed

This commit is contained in:
Ralf Becker 2004-04-14 11:52:16 +00:00
parent b7890a9ba4
commit dfdfaad414
4 changed files with 25 additions and 39 deletions

View File

@ -38,19 +38,6 @@
include('header.inc.php'); include('header.inc.php');
$GLOBALS['phpgw_info']['flags']['app_header']=lang('home'); $GLOBALS['phpgw_info']['flags']['app_header']=lang('home');
if ($_GET['phpgw_forward'])
{
foreach($_GET as $name => $value)
{
if (ereg('phpgw_',$name))
{
$extra_vars .= '&' . $name . '=' . urlencode($value);
}
}
$GLOBALS['phpgw']->redirect_link($_GET['phpgw_forward'],$extra_vars);
exit;
}
// anonymous user should never get a home-page // anonymous user should never get a home-page
if ($GLOBALS['phpgw']->session->session_flags == 'A') if ($GLOBALS['phpgw']->session->session_flags == 'A')
{ {

View File

@ -21,7 +21,8 @@
$GLOBALS['sessionid'] = isset($_GET['sessionid']) ? $_GET['sessionid'] : @$_COOKIE['sessionid']; $GLOBALS['sessionid'] = isset($_GET['sessionid']) ? $_GET['sessionid'] : @$_COOKIE['sessionid'];
if(!$GLOBALS['sessionid']) if(!$GLOBALS['sessionid'])
{ {
Header('Location: login.php'); Header('Location: login.php'.
(isset($_SERVER['QUERY_STRING']) ? '?phpgw_forward='.urlencode('/index.php?'.$_SERVER['QUERY_STRING']):''));
exit; exit;
} }

View File

@ -54,15 +54,15 @@
$deny_msg=lang('Oops! You caught us in the middle of system maintainance.<br/> $deny_msg=lang('Oops! You caught us in the middle of system maintainance.<br/>
Please, check back with us shortly.'); Please, check back with us shortly.');
$tmpl->set_file(array $tmpl->set_file(array
( (
'login_form' => 'login_denylogin.tpl' 'login_form' => 'login_denylogin.tpl'
)); ));
$tmpl->set_var('template_set','default'); $tmpl->set_var('template_set','default');
$tmpl->set_var('deny_msg',$deny_msg); $tmpl->set_var('deny_msg',$deny_msg);
$tmpl->pfp('loginout','login_form'); $tmpl->pfp('loginout','login_form');
exit; exit;
} }
$tmpl->set_file(array('login_form' => 'login.tpl')); $tmpl->set_file(array('login_form' => 'login.tpl'));
@ -224,25 +224,18 @@
{ {
$GLOBALS['phpgw']->preferences->add('common','lang',$_POST['lang'],'session'); $GLOBALS['phpgw']->preferences->add('common','lang',$_POST['lang'],'session');
} }
$forward = get_var('phpgw_forward', array('GET', 'POST'), 0);
if($forward)
{
$extra_vars['phpgw_forward'] = $forward;
foreach($_GET as $name => $value)
{
if(ereg('phpgw_',$name))
{
$extra_vars[$name] = urlencode($value);
}
}
}
if(!$GLOBALS['phpgw_info']['server']['disable_autoload_langfiles']) if(!$GLOBALS['phpgw_info']['server']['disable_autoload_langfiles'])
{ {
$GLOBALS['phpgw']->translation->autoload_changed_langfiles(); $GLOBALS['phpgw']->translation->autoload_changed_langfiles();
} }
$extra_vars['cd'] = 'yes'; $forward = isset($_GET['phpgw_forward']) ? urldecode($_GET['phpgw_forward']) : @$_POST['phpgw_forward'];
if (!$forward)
$GLOBALS['phpgw']->redirect_link('/home.php', $extra_vars); {
$extra_vars['cd'] = 'yes';
$forward = '/home.php';
}
$GLOBALS['phpgw']->redirect_link($forward,$extra_vars);
} }
} }
else else
@ -325,7 +318,7 @@
if($extra_vars) if($extra_vars)
{ {
$extra_vars = '?' . substr($extra_vars,1,strlen($extra_vars)); $extra_vars = '?' . substr($extra_vars,1);
} }
/********************************************************\ /********************************************************\

View File

@ -293,7 +293,12 @@
{ {
if (! $GLOBALS['phpgw']->session->verify()) if (! $GLOBALS['phpgw']->session->verify())
{ {
$GLOBALS['phpgw']->redirect_link('/login.php','cd=10'); list(,$relpath) = explode($GLOBALS['phpgw_info']['server']['webserver_url'],$_SERVER['PHP_SELF'],2);
$args = array(
'cd' => 10,
'phpgw_forward' => urlencode('/'.$relpath.(isset($_SERVER['QUERY_STRING']) ? '?'.$_SERVER['QUERY_STRING'] : ''))
);
$GLOBALS['phpgw']->redirect_link('/login.php',$args);
} }
$GLOBALS['phpgw']->datetime = CreateObject('phpgwapi.datetime'); $GLOBALS['phpgw']->datetime = CreateObject('phpgwapi.datetime');