ensure rather than check for session

darcs-hash:20080517193520-84dde-e0e0ad44fa0b87e7964fa36375b656e7cfabf865.gz
This commit is contained in:
Evan Prodromou 2008-05-17 15:35:20 -04:00
parent 6b308f0d1a
commit 30d4b7f791

View File

@ -227,13 +227,12 @@ function common_set_user($nickname) {
function common_current_user() {
static $user = NULL; # FIXME: global memcached
if (is_null($user)) {
if (common_have_session()) {
common_ensure_session();
$id = $_SESSION['userid'];
if ($id) {
$user = User::staticGet($id);
}
}
}
return $user;
}