Commit cbbb63a9d50b0a0c8a6d7f274d91b86fccda9df6

Authored by kevin_fourie
1 parent 2c9c825a

Merged in from DEV trunk...

KTS-3420
"When session expires and I do logout then I have to login twice"
Fixed. The logout action redirects via control where the session is checked, causing a session timeout on the logout action. You then has to log back in before you can logout. I've changed it so it now goes directly to the logout without going through control.php.

Committed by: Megan Watson
Reviewed by: Conrad Vermeulen


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/trunk@8597 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/templating/kt3template.inc.php
@@ -168,22 +168,12 @@ class KTPage { @@ -168,22 +168,12 @@ class KTPage {
168 function initMenu() { 168 function initMenu() {
169 // FIXME: we lost the getDefaultAction stuff - do we care? 169 // FIXME: we lost the getDefaultAction stuff - do we care?
170 // note that key == action. this is _important_, since we crossmatch the breadcrumbs against this for "active" 170 // note that key == action. this is _important_, since we crossmatch the breadcrumbs against this for "active"
171 - global $default;  
172 - $rootUrl = $default->rootUrl;  
173 - $bSSL = $default->sslEnabled;  
174 -  
175 - $sProtocol = ($bSSL) ? 'https' : 'http';  
176 - $sBaseUrl = $sProtocol.'://'.$_SERVER['HTTP_HOST'].$rootUrl; 171 + $sBaseUrl = KTUtil::kt_url();
177 172
178 $this->menu = array(); 173 $this->menu = array();
179 $this->menu['dashboard'] = array('label' => _kt("Dashboard"), 'url' => $sBaseUrl.'/dashboard.php'); 174 $this->menu['dashboard'] = array('label' => _kt("Dashboard"), 'url' => $sBaseUrl.'/dashboard.php');
180 $this->menu['browse'] = array('label' => _kt("Browse Documents"), 'url' => $sBaseUrl.'/browse.php'); 175 $this->menu['browse'] = array('label' => _kt("Browse Documents"), 'url' => $sBaseUrl.'/browse.php');
181 $this->menu['administration'] = array('label' => _kt("DMS Administration"), 'url' => $sBaseUrl.'/admin.php'); 176 $this->menu['administration'] = array('label' => _kt("DMS Administration"), 'url' => $sBaseUrl.'/admin.php');
182 - /*  
183 - $this->menu = array("dashboard" => $this->_actionHelper(array("name" => _kt("Dashboard"), "action" => "dashboard", "active" => 0)),  
184 - "browse" => $this->_actionHelper(array("name" => _kt("Browse Documents"), "action" => "browse", "active" => 0)),  
185 - "administration" => $this->_actionHelper(array("name" => _kt("DMS Administration"), "action" => "administration", "active" => 0)),);  
186 - */  
187 } 177 }
188 178
189 179
@@ -385,21 +375,23 @@ class KTPage { @@ -385,21 +375,23 @@ class KTPage {
385 375
386 $this->userMenu = array(); 376 $this->userMenu = array();
387 if (!(PEAR::isError($this->user) || is_null($this->user) || $this->user->isAnonymous())) { 377 if (!(PEAR::isError($this->user) || is_null($this->user) || $this->user->isAnonymous())) {
  378 + $sBaseUrl = KTUtil::kt_url();
  379 +
388 if ($oConfig->get("user_prefs/restrictPreferences", false) && !Permission::userIsSystemAdministrator($this->user->getId())) { 380 if ($oConfig->get("user_prefs/restrictPreferences", false) && !Permission::userIsSystemAdministrator($this->user->getId())) {
389 - $this->userMenu = array("logout" => $this->_actionHelper(array("name" => _kt("Logout"), "action" => "logout", "active" => 0)),); 381 + $this->userMenu['logout'] = array('label' => _kt('Logout'), 'url' => $sBaseUrl.'/presentation/logout.php');
390 } else { 382 } else {
391 - $this->userMenu = array("preferences" => $this->_actionHelper(array("name" => _kt("Preferences"), "action" => "preferences", "active" => 0)),  
392 - "aboutkt" => $this->_actionhelper(array("name" => _kt("About"), "action" => "aboutkt", "active" => 0)),  
393 - "logout" => $this->_actionHelper(array("name" => _kt("Logout"), "action" => "logout", "active" => 0)),); 383 + $this->userMenu['preferences'] = array('label' => _kt('Preferences'), 'url' => $sBaseUrl.'/preferences.php');
  384 + $this->userMenu['aboutkt'] = array('label' => _kt('About'), 'url' => $sBaseUrl.'/about.php');
  385 + $this->userMenu['logout'] = array('label' => _kt('Logout'), 'url' => $sBaseUrl.'/presentation/logout.php');
394 } 386 }
395 } else { 387 } else {
396 - $this->userMenu = array("login" => $this->_actionHelper(array("name" => _kt("Login"), "action" => "login")),); 388 + $this->userMenu['login'] = array('label' => _kt('Login'), 'url' => $sBaseUrl.'/login.php');
397 } 389 }
398 390
399 // FIXME we need a more complete solution to navigation restriction 391 // FIXME we need a more complete solution to navigation restriction
400 if (!is_null($this->menu['administration']) && !is_null($this->user)) { 392 if (!is_null($this->menu['administration']) && !is_null($this->user)) {
401 if (!Permission::userIsSystemAdministrator($this->user->getId())) { 393 if (!Permission::userIsSystemAdministrator($this->user->getId())) {
402 - unset($this->menu['administration']); 394 + unset($this->menu['administration']);
403 } 395 }
404 } 396 }
405 397
@@ -419,7 +411,7 @@ class KTPage { @@ -419,7 +411,7 @@ class KTPage {
419 "page" => $this, 411 "page" => $this,
420 "systemversion" => $default->systemVersion, 412 "systemversion" => $default->systemVersion,
421 "versionname" => $default->versionName, 413 "versionname" => $default->versionName,
422 - 'smallVersion' => substr($default->versionName, 0, 3), 414 + 'smallVersion' => substr($default->versionName, -17),
423 'savedSearches'=> $savedSearches); 415 'savedSearches'=> $savedSearches);
424 if ($oConfig->get("ui/automaticRefresh", false)) { 416 if ($oConfig->get("ui/automaticRefresh", false)) {
425 $aTemplateData['refreshTimeout'] = (int)$oConfig->get("session/sessionTimeout") + 3; 417 $aTemplateData['refreshTimeout'] = (int)$oConfig->get("session/sessionTimeout") + 3;