aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-04-01 15:01:50 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-04-01 15:01:50 +0000
commit65c9c360797e4788adba8455834897acedfb6b8e (patch)
tree74186b67aa639ed13fd4100f0695230940d121a7 /engine/lib
parentb2c2318dc8dfb0a02c74fb4d35ed71fbf3dc31ab (diff)
downloadelgg-65c9c360797e4788adba8455834897acedfb6b8e.tar.gz
elgg-65c9c360797e4788adba8455834897acedfb6b8e.tar.bz2
Registration, login, logout work. Victory!
git-svn-id: https://code.elgg.org/elgg/trunk@313 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/entities.php2
-rw-r--r--engine/lib/sessions.php14
-rw-r--r--engine/lib/users.php12
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();
+
}