From 494d2bbfdcd33e49ee35eca62f5222b90a21720b Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 7 Jan 2003 15:42:13 +0000 Subject: [PATCH] updates for modified session handling --- lib/control.inc | 46 ++++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/lib/control.inc b/lib/control.inc index 17af0dc..07c9d69 100644 --- a/lib/control.inc +++ b/lib/control.inc @@ -9,7 +9,7 @@ * Licensed under the GNU GPL. For full terms see the file COPYING. * @version $Revision$ * @author jam dms team - * @package + * @package dmslib */ /** @@ -19,26 +19,40 @@ */ function redirect($url) { // everything is relative to the root url - $url = $url . $default->owl_root_url . "/"; - // if we have a session - if (isset($uid->sessdata["sessid"])) { - // check url for parameters and add sessid accordingly - if (strstr($url, "?")) { - $url = $url . "&sess=". $uid->sessdata["sessid"]; - } else { - $url = $url . "?sess=". $uid->sessdata["sessid"]; - } - } + $url = $default->owl_root_url . $url; header("Location: $url"); } /** - * Redirects to login if no session is present + * Generates a link via the control page, with the passed action + * + * @param $action + * the controller action to generate a link for + * @return the generated href + */ + //TODO: maybe this should just be the url? +function generateLink($action) { + return ""; +} + +/** + * Validates the session. + * + * @param $sessionID + * the session ID to validate + * @return + * true if the session is valid, else false. */ -function checkSession($sessionID) { - $sessionStatus = Owl_Session::verify($sessionID); +function checkSession() { + $sessionStatus = Session::verify(); + // TODO: error handling in here with appropriate actions + // error messages are in $sessionStatus["errorMessage"] switch ($sessionStatus["status"]) { - + case 1 : // session verified, update lastused time + return true; + break; + case 2 : // session timed out + case 3 : // session already in use + return false; } } - -- libgit2 0.21.4