aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/sessions.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-08 19:11:48 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-08 19:11:48 +0000
commit9074f002ad0603014c90b12aaaf2c51d740638e9 (patch)
tree14fd0e7602ab43a7160e10531248d82a443bbf9a /engine/lib/sessions.php
parent872a5469da80557721e32b22e93af531c2a279fa (diff)
downloadelgg-9074f002ad0603014c90b12aaaf2c51d740638e9.tar.gz
elgg-9074f002ad0603014c90b12aaaf2c51d740638e9.tar.bz2
Deprecated isadminloggedin(), isloggedin(), get_loggedin_user(), and get_loggedin_userid() because they melt my brain each time I see them. This commit breaks trunk. Wait for the incoming commit to fix it.
git-svn-id: http://code.elgg.org/elgg/trunk@8077 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/sessions.php')
-rw-r--r--engine/lib/sessions.php25
1 files changed, 11 insertions, 14 deletions
diff --git a/engine/lib/sessions.php b/engine/lib/sessions.php
index 46912a152..d91ede9f5 100644
--- a/engine/lib/sessions.php
+++ b/engine/lib/sessions.php
@@ -20,7 +20,7 @@ global $SESSION;
*
* @return ElggUser|NULL
*/
-function get_loggedin_user() {
+function elgg_get_logged_in_user_entity() {
global $SESSION;
if (isset($SESSION)) {
@@ -33,11 +33,11 @@ function get_loggedin_user() {
/**
* Return the current logged in user by id.
*
- * @see get_loggedin_user()
+ * @see elgg_get_logged_in_user_entity()
* @return int
*/
-function get_loggedin_userid() {
- $user = get_loggedin_user();
+function elgg_get_logged_in_user_guid() {
+ $user = elgg_get_logged_in_user_entity();
if ($user) {
return $user->guid;
}
@@ -50,9 +50,8 @@ function get_loggedin_userid() {
*
* @return bool
*/
-function isloggedin() {
-
- $user = get_loggedin_user();
+function elgg_is_logged_in() {
+ $user = elgg_get_logged_in_user_entity();
if ((isset($user)) && ($user instanceof ElggUser) && ($user->guid > 0)) {
return true;
@@ -64,14 +63,12 @@ function isloggedin() {
/**
* Returns whether or not the user is currently logged in and that they are an admin user.
*
- * @uses isloggedin()
* @return bool
*/
-function isadminloggedin() {
-
- $user = get_loggedin_user();
+function elgg_is_admin_logged_in() {
+ $user = elgg_get_logged_in_user_entity();
- if ((isloggedin()) && $user->isAdmin()) {
+ if ((elgg_is_logged_in()) && $user->isAdmin()) {
return TRUE;
}
@@ -176,7 +173,7 @@ function pam_auth_userpass($credentials = NULL) {
if ($user->password !== generate_user_password($user, $credentials['password'])) {
log_login_failure($user->guid);
throw new LoginException(elgg_echo('LoginException:PasswordFailure'));
- }
+ }
return true;
}
@@ -347,7 +344,7 @@ function logout() {
unset($_SESSION['guid']);
unset($_SESSION['id']);
unset($_SESSION['user']);
-
+
setcookie("elggperm", "", (time() - (86400 * 30)), "/");
// pass along any messages