ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
inc.pwassist_session_handler.php File Reference

Go to the source code of this file.

Functions

 db_pwassist_session_open ($save_path, $name)
 Database Session Handling for the password assistance use case. More...
 
 db_pwassist_session_close ()
 close session More...
 
 db_pwassist_create_id ()
 
 db_pwassist_session_read ($pwassist_id)
 
 db_pwassist_session_find ($user_id)
 
 db_pwassist_session_write ($pwassist_id, $maxlifetime, $user_id)
 Writes serialized session data to the database. More...
 
 db_pwassist_session_destroy ($pwassist_id)
 destroy session More...
 
 db_pwassist_session_gc ()
 removes all expired sessions More...
 

Function Documentation

◆ db_pwassist_create_id()

db_pwassist_create_id ( )

Definition at line 67 of file inc.pwassist_session_handler.php.

68{
69 // #26009 we use ilSession to duplicate the existing session
70 return \ilSession::_duplicate(session_id());
71}

◆ db_pwassist_session_close()

db_pwassist_session_close ( )

close session

for a db nothing has to be done here

Definition at line 53 of file inc.pwassist_session_handler.php.

54{
55 return true;
56}

◆ db_pwassist_session_destroy()

db_pwassist_session_destroy (   $pwassist_id)

destroy session

Parameters
integer$pwassist_idsecure id

Definition at line 152 of file inc.pwassist_session_handler.php.

153{
154 global $DIC;
155
156 $ilDB = $DIC->database();
157
158 $q = "DELETE FROM usr_pwassist " .
159 "WHERE pwassist_id = " . $ilDB->quote($pwassist_id, "text");
160 $ilDB->manipulate($q);
161
162 return true;
163}
global $DIC
Definition: saml.php:7
global $ilDB

References $DIC, and $ilDB.

Referenced by ilPasswordAssistanceGUI\submitAssignPasswordForm(), and ilSessionTest\testPasswordAssisstanceSession().

+ Here is the caller graph for this function:

◆ db_pwassist_session_find()

db_pwassist_session_find (   $user_id)

Definition at line 102 of file inc.pwassist_session_handler.php.

103{
104 global $DIC;
105
106 $ilDB = $DIC->database();
107
108 $q = "SELECT * FROM usr_pwassist " .
109 "WHERE user_id = " . $ilDB->quote($user_id, "integer");
110 $r = $ilDB->query($q);
111 $data = $ilDB->fetchAssoc($r);
112
113 return $data;
114}
$r
Definition: example_031.php:79
$data
Definition: bench.php:6

References $data, $DIC, $ilDB, and $r.

Referenced by ilSessionTest\testPasswordAssisstanceSession().

+ Here is the caller graph for this function:

◆ db_pwassist_session_gc()

db_pwassist_session_gc ( )

removes all expired sessions

Definition at line 169 of file inc.pwassist_session_handler.php.

170{
171 global $DIC;
172
173 $ilDB = $DIC->database();
174
175 $q = "DELETE FROM usr_pwassist " .
176 "WHERE expires < " . $ilDB->quote(time(), "integer");
177 $ilDB->manipulate($q);
178
179 return true;
180}

References $DIC, and $ilDB.

Referenced by ilSessionTest\testPasswordAssisstanceSession().

+ Here is the caller graph for this function:

◆ db_pwassist_session_open()

db_pwassist_session_open (   $save_path,
  $name 
)

Database Session Handling for the password assistance use case.

@module inc.db_pwassist_session_handler.php @modulegroup iliascore

Version
$Id$

Definition at line 43 of file inc.pwassist_session_handler.php.

44{
45 return true;
46}

◆ db_pwassist_session_read()

db_pwassist_session_read (   $pwassist_id)

Definition at line 80 of file inc.pwassist_session_handler.php.

81{
82 global $DIC;
83
84 $ilDB = $DIC->database();
85
86 $q = "SELECT * FROM usr_pwassist " .
87 "WHERE pwassist_id = " . $ilDB->quote($pwassist_id, "text");
88 $r = $ilDB->query($q);
89 $data = $ilDB->fetchAssoc($r);
90
91 return $data;
92}

References $data, $DIC, $ilDB, and $r.

Referenced by ilPasswordAssistanceGUI\showAssignPasswordForm(), ilPasswordAssistanceGUI\submitAssignPasswordForm(), and ilSessionTest\testPasswordAssisstanceSession().

+ Here is the caller graph for this function:

◆ db_pwassist_session_write()

db_pwassist_session_write (   $pwassist_id,
  $maxlifetime,
  $user_id 
)

Writes serialized session data to the database.

Parameters
integer$pwassist_idsecure id
integer$maxlifetimesession max lifetime in seconds
integer$user_iduser id

Definition at line 123 of file inc.pwassist_session_handler.php.

124{
125 global $DIC;
126
127 $ilDB = $DIC->database();
128
129 $q = "DELETE FROM usr_pwassist " .
130 "WHERE pwassist_id = " . $ilDB->quote($pwassist_id, "text") . " " .
131 "OR user_id = " . $ilDB->quote($user_id, 'integer');
132 $ilDB->manipulate($q);
133
134 $ctime = time();
135 $expires = $ctime + $maxlifetime;
136 $ilDB->manipulateF(
137 "INSERT INTO usr_pwassist " .
138 "(pwassist_id, expires, user_id, ctime) " .
139 "VALUES (%s,%s,%s,%s)",
140 array("text", "integer", "integer", "integer"),
141 array($pwassist_id, $expires, $user_id, $ctime)
142 );
143
144 return true;
145}

References $DIC, and $ilDB.

Referenced by ilSessionTest\testPasswordAssisstanceSession().

+ Here is the caller graph for this function: