From 4e06bd2292a1bc7eef3dd742149a577ea09fcf5e Mon Sep 17 00:00:00 2001 From: ben Date: Wed, 12 Mar 2008 11:55:25 +0000 Subject: Language updates git-svn-id: https://code.elgg.org/elgg/trunk@184 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/objects.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'engine/lib/objects.php') diff --git a/engine/lib/objects.php b/engine/lib/objects.php index ccfc6b8b1..71488009e 100644 --- a/engine/lib/objects.php +++ b/engine/lib/objects.php @@ -81,12 +81,13 @@ * @return true|false Depending on success */ function save() { - if (!empty($this->id)) { + if (isset($this->id)) { return update_object($this->id, $this->title, $this->description, $this->type, $this->owner_id, $this->access_id, $this->site_id); } else if ($id = create_object($this->title,$this->description,$this->type,$this->owner_id,$this->access_id,$this->site_id)) { $this->id = $id; return true; } + return false; } /** @@ -314,15 +315,15 @@ // We can't let non-logged in users create data // We also need the access restriction to be valid - if ($owner > 0 && in_array($access_id,get_access_array())) { + if (in_array($access_id,get_access_array())) { $type_id = get_object_type_id($type); $query = " insert into {$CONFIG->dbprefix}objects "; $query .= "(`title`,`description`,`type_id`,`owner_id`,`site_id`,`access_id`) values "; - $query .= "('{$title}','{$description}', {$type_id}, {$owner}, {$site_id}, {$access_id}"; + $query .= "('{$title}','{$description}', {$type_id}, {$owner}, {$site_id}, {$access_id})"; return insert_data($query); - + } return false; @@ -345,7 +346,6 @@ function update_object($id, $title = null, $description = null, $type = null, $owner_id = null, $access_id = null, $site_id = null) { global $CONFIG; - $id = (int) $id; if ($title != null) $title = sanitise_string($title); if ($description != null) $description = sanitise_string($description); @@ -357,7 +357,7 @@ // We can't let non-logged in users create data // We also need the access restriction to be valid - if ($owner > 0 && in_array($access_id,get_access_array())) { + if ($owner == $_SESSION['id'] && in_array($access_id,get_access_array())) { $type_id = get_object_type_id($type); -- cgit v1.2.3