diff options
author | Andy Staudacher <andy.st@gmail.com> | 2010-02-13 18:03:46 -0800 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2010-02-14 07:15:59 -0800 |
commit | 0f66db51efc427482aaf3b575fff84f015a3a2ab (patch) | |
tree | dbd85bbb0bc6f684c5e8c8e147546e4d1b7b731c /modules/gallery/helpers | |
parent | 64e5d438c7ce291dd030b51d1467fc8736f0aa27 (diff) |
Change JavaScript reauthentication check to check via XHR.
Benefit: Getting the real deadline this way, not interfering with an ongoing maintenance task.
Diffstat (limited to 'modules/gallery/helpers')
-rw-r--r-- | modules/gallery/helpers/gallery_theme.php | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php index 9ffeb911..ec650e1c 100644 --- a/modules/gallery/helpers/gallery_theme.php +++ b/modules/gallery/helpers/gallery_theme.php @@ -92,13 +92,18 @@ class gallery_theme_Core { } // Redirect to the root album when the admin session expires. - $redirect_url = url::abs_site(""); - $admin_area_timeout = 1000 * module::get_var("gallery", "admin_area_timeout"); $admin_session_redirect_check = '<script type="text/javascript"> - var page_loaded_timestamp = new Date(); - setInterval("if (new Date() - page_loaded_timestamp > ' . $admin_area_timeout . - ') document.location = \'' . $redirect_url . '\';", 60 * 1000); - </script>'; + var adminReauthCheck = function() { + $.ajax({url: "' . url::site("admin?reauth_check=1") . '", + dataType: "json", + success: function(data){ + if ("location" in data) { + document.location = data.location; + } + }}); + }; + setInterval("adminReauthCheck();", 60 * 1000); + </script>'; print $admin_session_redirect_check; if ($session->get("l10n_mode", false)) { |