ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
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\sendPasswordAssistanceMail().

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

References $ilDB.

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

151 {
152  global $ilDB;
153 
154  $q = "DELETE FROM usr_pwassist ".
155  "WHERE pwassist_id = ".$ilDB->quote($pwassist_id, "text");
156  $ilDB->manipulate($q);
157 
158  return true;
159 }
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\sendPasswordAssistanceMail(), 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 }
global $ilDB
$r
+ Here is the caller graph for this function:

◆ db_pwassist_session_gc()

db_pwassist_session_gc ( )

removes all expired sessions

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

References $ilDB.

Referenced by ilSessionTest\testPasswordAssisstanceSession().

166 {
167  global $pear_session_db,$ilDB;
168 
169  $q = "DELETE FROM usr_pwassist ".
170  "WHERE expires < ".$ilDB->quote(time(), "integer");
171  $ilDB->manipulate($q);
172 
173  return true;
174 }
global $ilDB
+ 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 }
global $ilDB
$r
+ 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.

Referenced by ilPasswordAssistanceGUI\sendPasswordAssistanceMail(), 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("INSERT INTO usr_pwassist ".
137  "(pwassist_id, expires, user_id, ctime) ".
138  "VALUES (%s,%s,%s,%s)",
139  array("text", "integer", "integer", "integer"),
140  array($pwassist_id, $expires, $user_id, $ctime));
141 
142  return true;
143 }
global $ilDB
+ Here is the caller graph for this function: