- added documentation

This commit is contained in:
steinm 2011-01-14 19:40:12 +00:00
parent a2027563b1
commit 3de58ab8bc

View File

@ -1,6 +1,10 @@
<?php <?php
/** /**
* Implementation of the user object in the document management system * Implementation of a simple session management.
*
* LetoDMS uses its own simple session management, storing sessions
* into the database. A session holds the currently logged in user,
* the theme and the language.
* *
* @category DMS * @category DMS
* @package LetoDMS * @package LetoDMS
@ -12,7 +16,12 @@
*/ */
/** /**
* Class to represent a user in the document management system * Class to represent a session
*
* This class provides some very basic methods to load, save and delete
* sessions. It does not set or retrieve a cockie. This is up to the
* application. The class basically provides access to the session database
* table.
* *
* @category DMS * @category DMS
* @package LetoDMS * @package LetoDMS
@ -51,7 +60,7 @@ class LetoDMS_Session {
} /* }}} */ } /* }}} */
/** /**
* Load session by its id * Load session by its id from database
* *
* @param string $id id of session * @param string $id id of session
* @return boolean true if successful otherwise false * @return boolean true if successful otherwise false
@ -70,7 +79,7 @@ class LetoDMS_Session {
} /* }}} */ } /* }}} */
/** /**
* Create a new session and saving the given data * Create a new session and saving the given data into the database
* *
* @param array $data data saved in session (the only fields supported * @param array $data data saved in session (the only fields supported
* are userid, theme, language) * are userid, theme, language)
@ -90,18 +99,18 @@ class LetoDMS_Session {
} /* }}} */ } /* }}} */
/** /**
* Delete old sessions older than a given time * Delete sessions older than a given time from the database
* *
* @param integer $sec maximum number of seconds a session may live * @param integer $sec maximum number of seconds a session may live
* @return boolean true if successful otherwise false * @return boolean true if successful otherwise false
*/ */
function deleteByTime($sec) { function deleteByTime($sec) { /* {{{ */
$queryStr = "DELETE FROM tblSessions WHERE " . mktime() . " - lastAccess > ".$sec; $queryStr = "DELETE FROM tblSessions WHERE " . mktime() . " - lastAccess > ".$sec;
if (!$this->db->getResult($queryStr)) { if (!$this->db->getResult($queryStr)) {
return false; return false;
} }
return true; return true;
} } /* }}} */
/** /**
* Delete session by its id * Delete session by its id