diff options
Diffstat (limited to 'engine/lib')
| -rw-r--r-- | engine/lib/entities.php | 2 | ||||
| -rw-r--r-- | engine/lib/sessions.php | 14 | ||||
| -rw-r--r-- | engine/lib/users.php | 12 | 
3 files changed, 16 insertions, 12 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 66f421a6d..2270b1909 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -40,7 +40,7 @@  			$this->attributes['guid'] = "";  			$this->attributes['type'] = "";  			$this->attributes['subtype'] = ""; -			$this->attributes['owner_guid'] = 0; +			$this->attributes['owner_guid'] = $_SESSION['guid'];  			$this->attributes['access_id'] = 0;  			$this->attributes['time_created'] = "";  			$this->attributes['time_updated'] = ""; diff --git a/engine/lib/sessions.php b/engine/lib/sessions.php index f93f2f294..5b12f69ab 100644 --- a/engine/lib/sessions.php +++ b/engine/lib/sessions.php @@ -102,7 +102,7 @@  	 * 
  	 * This function looks for:
  	 * 
 -	 * 1. $_SESSION['id'] - if not present, we're logged out, and this is set to -1
 +	 * 1. $_SESSION['id'] - if not present, we're logged out, and this is set to 0
  	 * 2. The cookie 'elggperm' - if present, checks it for an authentication token, validates it, and potentially logs the user in 
  	 *
  	 * @uses $_SESSION
 @@ -125,12 +125,12 @@                          $_SESSION['guid'] = $_SESSION['id'];
                          $_SESSION['code'] = $_COOKIE['elggperm'];
  	                } else {
 -	                    $_SESSION['id'] = -1;
 -	                    $_SESSION['guid'] = -1;
 +	                    $_SESSION['id'] = 0;
 +	                    $_SESSION['guid'] = 0;
  	                }
  	            } else {
 -	                $_SESSION['id'] = -1;
 -	                $_SESSION['guid'] = -1;
 +	                $_SESSION['id'] = 0;
 +	                $_SESSION['guid'] = 0;
  	            }
  	        } else {
  	            if (!empty($_SESSION['code'])) {
 @@ -140,8 +140,8 @@  	                } else {
  	                }
  	            } else {
 -	            	$_SESSION['guid'] = -1;
 -	                $_SESSION['id'] = -1;
 +	            	$_SESSION['guid'] = 0;
 +	                $_SESSION['id'] = 0;
  	            }
  	        }
  	        if ($_SESSION['id'] > 0) {
 diff --git a/engine/lib/users.php b/engine/lib/users.php index 59754fee6..c371a7db2 100644 --- a/engine/lib/users.php +++ b/engine/lib/users.php @@ -466,7 +466,7 @@  	 * @param string $email Their email address
  	 * @return int|false The new user's GUID; false on failure
  	 */
 -	function register_user(string $username, string $password, string $name, string $email) {
 +	function register_user($username, $password, $name, $email) {
  		// Load the configuration
  			global $CONFIG;
 @@ -475,8 +475,9 @@  			if (empty($username)
  				|| empty($password)
  				|| empty($name)
 -				|| empty($email))
 -				return false;			
 +				|| empty($email)) {
 +					return false;
 +				}	
  		// Check to see if $username exists already
  			if ($user = get_user_by_username($username)) {
 @@ -489,7 +490,10 @@  			$user->password = md5($password);
  			$user->email = $email;
  			$user->name = $name;
 -			return $user->save();
 +			$user->save();
 +			
 +			return $user->getGUID();
 +			
  	}
  | 
