From 4c640bc40cd428a2e690ff1b0f065c38ebac351c Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Thu, 28 Jan 2010 15:34:35 -0700 Subject: [PATCH] Improved handling/perfomance of current sessions script --- horde/admin/sessions.php | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/horde/admin/sessions.php b/horde/admin/sessions.php index c3a05c1a1..69ef46cf1 100644 --- a/horde/admin/sessions.php +++ b/horde/admin/sessions.php @@ -11,26 +11,22 @@ require_once dirname(__FILE__) . '/../lib/Application.php'; Horde_Registry::appInit('horde', array('admin' => true)); -$type = !empty($conf['sessionhandler']['type']) ? $conf['sessionhandler']['type'] : 'none'; -if ($type == 'external') { - $notification->push(_("Cannot administer external session handlers."), 'horde.error'); -} else { - $sh = Horde_SessionHandler::singleton($type); -} - $title = _("Session Admin"); Horde::addScriptFile('prototype.js', 'horde'); +Horde::addInlineScript(array( + '$$("DIV.sesstoggle").invoke("observe", "click", function() { [ this.nextSiblings(), this.immediateDescendants() ].flatten().compact().invoke("toggle"); })' +), 'dom'); + require HORDE_TEMPLATES . '/common-header.inc'; require HORDE_TEMPLATES . '/admin/menu.inc'; -if (empty($sh)) { - require HORDE_TEMPLATES . '/common-footer.inc'; - exit; -} - echo '

' . _("Current Sessions"); try { - $session_info = $sh->getSessionsInfo(); + if (!isset($registry->sessionHandler)) { + throw new Horde_Exception(_("Session handler does not support listing active sessions.")); + } + + $session_info = $registry->sessionHandler->getSessionsInfo(); echo ' (' . count($session_info) . ')

' . '