Revision 546
Added by doc almost 17 years ago
class.login.php | ||
---|---|---|
165 | 165 |
$this->user_id = $user_id; |
166 | 166 |
$_SESSION['USER_ID'] = $user_id; |
167 | 167 |
$_SESSION['GROUP_ID'] = $results_array['group_id']; |
168 |
$_SESSION['GROUPS_ID'] = $results_array['groups_id']; |
|
168 | 169 |
$_SESSION['USERNAME'] = $results_array['username']; |
169 | 170 |
$_SESSION['DISPLAY_NAME'] = $results_array['display_name']; |
170 | 171 |
$_SESSION['EMAIL'] = $results_array['email']; |
... | ... | |
199 | 200 |
$_SESSION['USE_DEFAULT_TIME_FORMAT'] = true; |
200 | 201 |
} |
201 | 202 |
// Get group information |
202 |
$query = "SELECT * FROM ".$this->GROUPS_TABLE." WHERE group_id = '".$this->get_session('GROUP_ID')."'"; |
|
203 |
$results = $database->query($query); |
|
204 |
$results_array = $results->fetchRow(); |
|
205 |
$_SESSION['GROUP_NAME'] = $results_array['name']; |
|
206 |
// Set system permissions |
|
207 |
if($results_array['system_permissions'] != '') { |
|
208 |
$_SESSION['SYSTEM_PERMISSIONS'] = explode(',', $results_array['system_permissions']); |
|
209 |
} else { |
|
210 |
$_SESSION['SYSTEM_PERMISSIONS'] = array(); |
|
211 |
} |
|
212 |
// Set module permissions |
|
213 |
if($results_array['module_permissions'] != '') { |
|
214 |
$_SESSION['MODULE_PERMISSIONS'] = explode(',', $results_array['module_permissions']); |
|
215 |
} else { |
|
216 |
$_SESSION['MODULE_PERMISSIONS'] = array(); |
|
217 |
} |
|
218 |
// Set template permissions |
|
219 |
if($results_array['template_permissions'] != '') { |
|
220 |
$_SESSION['TEMPLATE_PERMISSIONS'] = explode(',', $results_array['template_permissions']); |
|
221 |
} else { |
|
222 |
$_SESSION['TEMPLATE_PERMISSIONS'] = array(); |
|
223 |
} |
|
203 |
// $query = "SELECT * FROM ".$this->GROUPS_TABLE." WHERE group_id = '".$this->get_session('GROUP_ID')."'"; |
|
204 |
// $results = $database->query($query); |
|
205 |
// $results_array = $results->fetchRow(); |
|
206 |
// $_SESSION['GROUP_NAME'] = $results_array['name']; |
|
207 |
// // Set system permissions |
|
208 |
// if($results_array['system_permissions'] != '') { |
|
209 |
// $_SESSION['SYSTEM_PERMISSIONS'] = explode(',', $results_array['system_permissions']); |
|
210 |
// } else { |
|
211 |
// $_SESSION['SYSTEM_PERMISSIONS'] = array(); |
|
212 |
// } |
|
213 |
// // Set module permissions |
|
214 |
// if($results_array['module_permissions'] != '') { |
|
215 |
// $_SESSION['MODULE_PERMISSIONS'] = explode(',', $results_array['module_permissions']); |
|
216 |
// } else { |
|
217 |
// $_SESSION['MODULE_PERMISSIONS'] = array(); |
|
218 |
// } |
|
219 |
// // Set template permissions |
|
220 |
// if($results_array['template_permissions'] != '') { |
|
221 |
// $_SESSION['TEMPLATE_PERMISSIONS'] = explode(',', $results_array['template_permissions']); |
|
222 |
// } else { |
|
223 |
// $_SESSION['TEMPLATE_PERMISSIONS'] = array(); |
|
224 |
// } |
|
225 |
|
|
226 |
$_SESSION['SYSTEM_PERMISSIONS'] = array(); |
|
227 |
$_SESSION['MODULE_PERMISSIONS'] = array(); |
|
228 |
$_SESSION['TEMPLATE_PERMISSIONS'] = array(); |
|
229 |
$_SESSION['GROUP_NAME'] = array(); |
|
230 |
|
|
231 |
|
|
232 |
foreach (split(",", $this->get_session('GROUPS_ID')) as $cur_group_id) { |
|
233 |
$query = "SELECT * FROM ".$this->GROUPS_TABLE." WHERE group_id = '".$cur_group_id."'"; |
|
234 |
$results = $database->query($query); |
|
235 |
$results_array = $results->fetchRow(); |
|
236 |
$_SESSION['GROUP_NAME'][$cur_group_id] = $results_array['name']; |
|
237 |
// Set system permissions |
|
238 |
if($results_array['system_permissions'] != '') { |
|
239 |
$_SESSION['SYSTEM_PERMISSIONS'] = array_merge($_SESSION['SYSTEM_PERMISSIONS'], explode(',', $results_array['system_permissions'])); |
|
240 |
} |
|
241 |
// Set module permissions |
|
242 |
if($results_array['module_permissions'] != '') { |
|
243 |
$_SESSION['MODULE_PERMISSIONS'] = array_merge($_SESSION['MODULE_PERMISSIONS'], explode(',', $results_array['module_permissions'])); |
|
244 |
} |
|
245 |
// Set template permissions |
|
246 |
if($results_array['template_permissions'] != '') { |
|
247 |
$_SESSION['TEMPLATE_PERMISSIONS'] = array_merge($_SESSION['TEMPLATE_PERMISSIONS'], explode(',', $results_array['template_permissions'])); |
|
248 |
} |
|
249 |
} |
|
250 |
|
|
224 | 251 |
// Update the users table with current ip and timestamp |
225 | 252 |
$get_ts = mktime(); |
226 | 253 |
$get_ip = $_SERVER['REMOTE_ADDR']; |
Also available in: Unified diff
added the "users in multiple groups" feature (closes parts of ticket #546)