fixed not working redirect to index url of app, if etemplate session is lost (tested with mail app)

This commit is contained in:
Ralf Becker 2014-01-27 16:30:34 +00:00
parent 99ce5b41f9
commit 56ea1da5aa
2 changed files with 16 additions and 4 deletions

View File

@ -174,12 +174,24 @@ class etemplate_request
}
if (!$request) // eT2 request/session expired
{
/* redirect to index-url of app does not work, opens eTemplate tab in Stylite/Pixelegg template :-(
list($app) = explode('.', $_GET['menuaction']);
$index_url = isset($GLOBALS['egw_info']['apps'][$app]['index']) ?
'/index.php?menuaction='.$GLOBALS['egw_info']['apps'][$app]['index'] : '/'.$app.'/index.php';
egw_framework::redirect_link($index_url); */
error_log(__METHOD__."('$id', ...) eT2 request not found / expired!");
error_log(__METHOD__."('$id', ...) eT2 request not found / expired --> redirecting app $app to $index_url (_GET[menuaction]=$_GET[menuaction], isJSONRequest()=".array2string(egw_json_request::isJSONRequest()).')');
if (egw_json_request::isJSONRequest())
{
// we must not redirect ajax_destroy_session calls, as they might originate from our own redirect!
if (strpos($_GET['menuaction'], '.ajax_destroy_session.etemplate') === false)
{
$response = egw_json_response::get();
$response->redirect($index_url, false, $app);
common::egw_exit();
}
}
else
{
egw_framework::redirect_link($index_url);
}
}
return $request;
}

View File

@ -136,7 +136,7 @@ class etemplate_request_cache extends etemplate_request
// if half of expiration time is over, save it anyway, to restart expiration time
isset($this->data['last_saved']) && (time()-$this->data['last_saved']) > self::EXPIRATION/2))
{
//error_log(__METHOD__."() saving $this->id");
//error_log(__METHOD__."() saving $this->id".($this->data_modified?'':' data NOT modified, just keeping session alife'));
$this->data['last_saved'] = time();
if (!egw_cache::setTree($GLOBALS['egw_info']['server']['install_id'].'_etemplate', $this->id, $this->data, self::EXPIRATION))
{