Skip to content

Loading…

Your UserSession had some unchecked Session keys #14

Merged
merged 2 commits into from

3 participants

@rickosborne

The "authorized" and "lang" keys didn't have proper checking and were throwing warnings.

@acolangelo
WDD Social member

The change to the is_authorized() method is awesome, thanks.

The set() function is a Framework5 function (checks both isset() as well as != ' '), which is why we are using it (probably should add a comment about that).

@acolangelo acolangelo merged commit c3356a1 into WDD-Social:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Showing with 2 additions and 2 deletions.
  1. +2 −2 framework5/wddsocial/controller/UserSession.php
View
4 framework5/wddsocial/controller/UserSession.php
@@ -196,7 +196,7 @@ public static function is_current($userID) {
public static function is_authorized() {
static::session_started();
- if ($_SESSION['authorized'] and isset($_SESSION['user'])) return true;
+ if (isset($_SESSION['authorized']) and isset($_SESSION['user']) and is_bool($_SESSION['authorized']) and $_SESSION['authorized']) return true;
else return false;
}
@@ -281,7 +281,7 @@ public static function user_lang() {
public static function visitor_lang() {
- if (set($_SESSION['lang'])) return $_SESSION['lang'];
+ if (isset($_SESSION['lang'])) return $_SESSION['lang'];
else return 'en';
}
Something went wrong with that request. Please try again.