ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSession Class Reference
+ Collaboration diagram for ilSession:

Static Public Member Functions

static _getData ($a_session_id)
 Get session data from table.
static _writeData ($a_session_id, $a_data)
 Write session data.
static _exists ($a_session_id)
 Check whether session exists.
static _destroy ($a_session_id)
 Destroy session.
static _destroyByUserId ($a_user_id)
 Destroy session.
static _destroyExpiredSessions ()
 Destroy expired sessions.
static _duplicate ($a_session_id)
 Duplicate session.

Detailed Description

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id:$

ilObjUser on usr_session

Definition at line 11 of file class.ilSession.php.

Member Function Documentation

static ilSession::_destroy (   $a_session_id)
static

Destroy session.

Parameters
stringsession id

Definition at line 111 of file class.ilSession.php.

References $ilDB, and $q.

Referenced by db_session_destroy(), and ilSessionTest\testBasicSessionBehaviour().

{
global $ilDB;
$q = "DELETE FROM usr_session WHERE session_id = ".
$ilDB->quote($a_session_id, "text");
$ilDB->manipulate($q);
return true;
}

+ Here is the caller graph for this function:

static ilSession::_destroyByUserId (   $a_user_id)
static

Destroy session.

Parameters
stringsession id

Definition at line 127 of file class.ilSession.php.

References $ilDB, and $q.

Referenced by ilObjUser\delete(), and ilSessionTest\testBasicSessionBehaviour().

{
global $ilDB;
$q = "DELETE FROM usr_session WHERE user_id = ".
$ilDB->quote($a_user_id, "integer");
$ilDB->manipulate($q);
return true;
}

+ Here is the caller graph for this function:

static ilSession::_destroyExpiredSessions ( )
static

Destroy expired sessions.

Definition at line 141 of file class.ilSession.php.

References $ilDB, and $q.

Referenced by db_session_gc(), and ilSessionTest\testBasicSessionBehaviour().

{
global $ilDB;
$q = "DELETE FROM usr_session WHERE expires < ".
$ilDB->quote(time(), "integer");
$ilDB->manipulate($q);
return true;
}

+ Here is the caller graph for this function:

static ilSession::_duplicate (   $a_session_id)
static

Duplicate session.

Parameters
stringsession id
Returns
string new session id

Definition at line 158 of file class.ilSession.php.

References $ilDB, $q, $query, $res, $row, and _writeData().

Referenced by duplicate_session(), and ilSessionTest\testBasicSessionBehaviour().

{
global $ilDB;
// Create new session id
$new_session = $a_session_id;
do
{
$new_session = md5($new_session);
$q ="SELECT * FROM usr_session WHERE ".
"session_id = ".$ilDB->quote($new_session, "text");
$res = $ilDB->query($q);
} while($ilDB->fetchAssoc($res));
$query = "SELECT * FROM usr_session ".
"WHERE session_id = ".$ilDB->quote($a_session_id, "text");
$res = $ilDB->query($query);
while ($row = $ilDB->fetchObject($res))
{
ilSession::_writeData($new_session,$row->data);
return $new_session;
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilSession::_exists (   $a_session_id)
static

Check whether session exists.

Parameters
stringsession id
Returns
boolean true, if session id exists

Definition at line 92 of file class.ilSession.php.

References $ilDB, and $q.

Referenced by _writeData(), ilInitialisation\initILIAS(), and ilSessionTest\testBasicSessionBehaviour().

{
global $ilDB;
$q = "SELECT session_id FROM usr_session WHERE session_id = ".
$ilDB->quote($a_session_id, "text");
$set = $ilDB->query($q);
if ($ilDB->fetchAssoc($set))
{
return true;
}
return false;
}

+ Here is the caller graph for this function:

static ilSession::_getData (   $a_session_id)
static

Get session data from table.

Parameters
stringsession id
Returns
string session data

Definition at line 19 of file class.ilSession.php.

References $ilDB, and $q.

Referenced by db_session_read(), and ilSessionTest\testBasicSessionBehaviour().

{
global $ilDB;
$q = "SELECT data FROM usr_session WHERE session_id = ".
$ilDB->quote($a_session_id, "text");
$set = $ilDB->query($q);
$rec = $ilDB->fetchAssoc($set);
return $rec["data"];
}

+ Here is the caller graph for this function:

static ilSession::_writeData (   $a_session_id,
  $a_data 
)
static

Write session data.

Parameters
stringsession id
stringsession data

Definition at line 37 of file class.ilSession.php.

References $_SESSION, $ilDB, and _exists().

Referenced by _duplicate(), db_session_write(), and ilSessionTest\testBasicSessionBehaviour().

{
global $ilDB;
$expires = time() + ini_get("session.gc_maxlifetime");
if (ilSession::_exists($a_session_id))
{
/*$q = "UPDATE usr_session SET ".
"expires = ".$ilDB->quote($expires, "integer").", ".
"data = ".$ilDB->quote($a_data, "clob").
", ctime = ".$ilDB->quote(time(), "integer").
", user_id = ".$ilDB->quote((int) $_SESSION["AccountId"], "integer").
" WHERE session_id = ".$ilDB->quote($a_session_id, "text");
array("integer", "clob", "integer", "integer", "text");
$ilDB->manipulate($q);*/
$ilDB->update("usr_session", array(
"user_id" => array("integer", (int) $_SESSION["AccountId"]),
"expires" => array("integer", $expires),
"data" => array("clob", $a_data),
"ctime" => array("integer", time())
), array(
"session_id" => array("text", $a_session_id)
));
}
else
{
/*$q = "INSERT INTO usr_session (session_id, expires, data, ctime,user_id) ".
"VALUES(".$ilDB->quote($a_session_id, "text").",".
$ilDB->quote($expires, "integer").",".
$ilDB->quote($a_data, "clob").",".
$ilDB->quote(time(), "integer").",".
$ilDB->quote((int) $_SESSION["AccountId"], "integer").")";
$ilDB->manipulate($q);*/
$ilDB->insert("usr_session", array(
"session_id" => array("text", $a_session_id),
"expires" => array("integer", $expires),
"data" => array("clob", $a_data),
"ctime" => array("integer", time()),
"user_id" => array("integer", (int) $_SESSION["AccountId"])
));
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


The documentation for this class was generated from the following file: