mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 23:00:56 +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$ */
|
||||
/* $Source$ */
|
||||
|
||||
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()
|
||||
{
|
||||
$numargs = func_num_args();
|
||||
@ -28,26 +43,26 @@
|
||||
if(substr($className,0,4) != 'ajax' && $arg0 != 'etemplate.etemplate.process_exec' && substr($functionName,0,4) != 'ajax')
|
||||
{
|
||||
// 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;
|
||||
}
|
||||
|
||||
$GLOBALS['egw_info'] = array();
|
||||
$GLOBALS['egw_info']['flags'] = array(
|
||||
'currentapp' => $appName,
|
||||
'noheader' => True,
|
||||
'disable_Template_class' => True,
|
||||
$GLOBALS['egw_info'] = array(
|
||||
'flags' => array(
|
||||
'currentapp' => $appName,
|
||||
'noheader' => True,
|
||||
'disable_Template_class' => True,
|
||||
'autocreate_session_callback' => 'xajax_redirect',
|
||||
)
|
||||
);
|
||||
|
||||
include('./header.inc.php');
|
||||
|
||||
$ajaxClass = CreateObject("$appName.$className");
|
||||
|
||||
$ajaxClass =& CreateObject($appName.'.'.$className);
|
||||
$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->registerFunction("doXMLHTTP");
|
||||
$xajax = new xajax($_SERVER['PHP_SELF']);
|
||||
$xajax->registerFunction('doXMLHTTP');
|
||||
$xajax->processRequests();
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user