mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-28 00:39:19 +01:00
send the redirect to login,if the session can not be verified, via xajax
This commit is contained in:
parent
b12b8ada8b
commit
f970ef346f
45
xajax.php
45
xajax.php
@ -10,10 +10,25 @@
|
|||||||
\**************************************************************************/
|
\**************************************************************************/
|
||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
/* $Source$ */
|
|
||||||
|
|
||||||
require_once('./phpgwapi/inc/xajax.inc.php');
|
require_once('./phpgwapi/inc/xajax.inc.php');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* callback if the session-check fails, redirects via xajax to login.php
|
||||||
|
*
|
||||||
|
* @param array &$anon_account anon account_info with keys 'login', 'passwd' and optional 'passwd_type'
|
||||||
|
* @return boolean/string true if we allow anon access and anon_account is set, a sessionid or false otherwise
|
||||||
|
*/
|
||||||
|
function xajax_redirect(&$anon_account)
|
||||||
|
{
|
||||||
|
$response =& new xajaxResponse();
|
||||||
|
$response->addScript("location.href='".$GLOBALS['egw_info']['server']['webserver_url'].'/login.php?cd=10'."';");
|
||||||
|
|
||||||
|
header('Content-type: text/xml; charset='.$GLOBALS['egw']->translation->charset());
|
||||||
|
echo $response->getXML();
|
||||||
|
$GLOBALS['egw']->common->egw_exit();
|
||||||
|
}
|
||||||
|
|
||||||
function doXMLHTTP()
|
function doXMLHTTP()
|
||||||
{
|
{
|
||||||
$numargs = func_num_args();
|
$numargs = func_num_args();
|
||||||
@ -28,26 +43,26 @@
|
|||||||
if(substr($className,0,4) != 'ajax' && $arg0 != 'etemplate.etemplate.process_exec' && substr($functionName,0,4) != 'ajax')
|
if(substr($className,0,4) != 'ajax' && $arg0 != 'etemplate.etemplate.process_exec' && substr($functionName,0,4) != 'ajax')
|
||||||
{
|
{
|
||||||
// stopped for security reasons
|
// stopped for security reasons
|
||||||
error_log($_SERVER["PHP_SELF"]. ' stopped for security reason. className '.$className.' is not valid. className must start with ajax!!!');
|
error_log($_SERVER['PHP_SELF']. ' stopped for security reason. '.$arg0.' is not valid. class- or function-name must start with ajax!!!');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$GLOBALS['egw_info'] = array();
|
$GLOBALS['egw_info'] = array(
|
||||||
$GLOBALS['egw_info']['flags'] = array(
|
'flags' => array(
|
||||||
'currentapp' => $appName,
|
'currentapp' => $appName,
|
||||||
'noheader' => True,
|
'noheader' => True,
|
||||||
'disable_Template_class' => True,
|
'disable_Template_class' => True,
|
||||||
|
'autocreate_session_callback' => 'xajax_redirect',
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
include('./header.inc.php');
|
include('./header.inc.php');
|
||||||
|
|
||||||
$ajaxClass = CreateObject("$appName.$className");
|
$ajaxClass =& CreateObject($appName.'.'.$className);
|
||||||
$argList = $GLOBALS['egw']->translation->convert($argList, 'utf-8');
|
$argList = $GLOBALS['egw']->translation->convert($argList, 'utf-8');
|
||||||
return call_user_func_array(array(&$ajaxClass, $functionName), $argList );
|
|
||||||
|
return call_user_func_array(array(&$ajaxClass, $functionName), $argList );
|
||||||
}
|
}
|
||||||
|
|
||||||
$xajax = new xajax($_SERVER["PHP_SELF"]);
|
$xajax = new xajax($_SERVER['PHP_SELF']);
|
||||||
$xajax->registerFunction("doXMLHTTP");
|
$xajax->registerFunction('doXMLHTTP');
|
||||||
$xajax->processRequests();
|
$xajax->processRequests();
|
||||||
?>
|
|
||||||
|
Loading…
Reference in New Issue
Block a user