2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
$result=db_query("SELECT r.rid, r.name FROM {role} r INNER JOIN {users_roles} ur ON ur.rid = r.rid WHERE ur.uid = %d",$user->uid);
while($role=db_fetch_object($result)){
$user->roles[$role->rid]=$role->name;
}
$user->roles+=db_query("SELECT r.rid, r.name FROM {role} r INNER JOIN {users_roles} ur ON ur.rid = r.rid WHERE ur.uid = :uid",array(':uid'=>$user->uid))->fetchAllKeyed(0,1);
}
// We didn't find the client's record (session has expired), or they
// are an anonymous user.
...
...
@@ -136,28 +133,26 @@ function _sess_write($key, $value) {
returnTRUE;
}
$result=db_result(db_query("SELECT COUNT(*) FROM {sessions} WHERE sid = '%s'",$key));
db_merge('sessions')
->key(array('sid'=>$key))
->fields(array(
'uid'=>$user->uid,
'cache'=>isset($user->cache)?$user->cache:0,
'hostname'=>ip_address(),
'session'=>$value,
'timestamp'=>REQUEST_TIME,
))
->execute();
if(!$result){
// Only save session data when when the browser sends a cookie. This keeps
// crawlers out of session table. This reduces memory and server load,
// and gives more useful statistics. We can't eliminate anonymous session
// table rows without breaking "Who's Online" block.