ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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.

Referenced by ilPasswordAssistanceGUI\submitAssistanceForm().

68 {
69  // Implementation note: we use the PHP Session id
70  // generation mechanism to create the session id.
71  $old_session_id = session_id();
72  session_regenerate_id();
73  $pwassist_id = session_id();
74  session_id($old_session_id);
75 
76  return $pwassist_id;
77 }
+ Here is the caller graph for this function:

◆ 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.

References $ilDB.

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

153 {
154  global $ilDB;
155 
156  $q = "DELETE FROM usr_pwassist " .
157  "WHERE pwassist_id = " . $ilDB->quote($pwassist_id, "text");
158  $ilDB->manipulate($q);
159 
160  return true;
161 }
global $ilDB
+ Here is the caller graph for this function:

◆ db_pwassist_session_find()

db_pwassist_session_find (   $user_id)

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

References $data, $ilDB, and $r.

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

107 {
108  global $ilDB;
109 
110  $q = "SELECT * FROM usr_pwassist " .
111  "WHERE user_id = " . $ilDB->quote($user_id, "integer");
112  $r = $ilDB->query($q);
113  $data = $ilDB->fetchAssoc($r);
114 
115  return $data;
116 }
$r
Definition: example_031.php:79
global $ilDB
+ Here is the caller graph for this function:

◆ db_pwassist_session_gc()

db_pwassist_session_gc ( )

removes all expired sessions

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

References $ilDB, and time.

Referenced by ilSessionTest\testPasswordAssisstanceSession().

168 {
169  global $pear_session_db,$ilDB;
170 
171  $q = "DELETE FROM usr_pwassist " .
172  "WHERE expires < " . $ilDB->quote(time(), "integer");
173  $ilDB->manipulate($q);
174 
175  return true;
176 }
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ 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.

inc.db_pwassist_session_handler.php 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 86 of file inc.pwassist_session_handler.php.

References $data, $ilDB, and $r.

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

87 {
88  global $ilDB;
89 
90  $q = "SELECT * FROM usr_pwassist " .
91  "WHERE pwassist_id = " . $ilDB->quote($pwassist_id, "text");
92  $r = $ilDB->query($q);
93  $data = $ilDB->fetchAssoc($r);
94 
95  return $data;
96 }
$r
Definition: example_031.php:79
global $ilDB
+ 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 125 of file inc.pwassist_session_handler.php.

References $ilDB, array, and time.

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

126 {
127  global $ilDB;
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 }
Create styles array
The data for the language used.
global $ilDB
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the caller graph for this function: