aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-04-07 15:14:19 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-04-07 15:14:19 +0000
commit110f0fa670a03bcd7f95a2d45a42d8a891d70544 (patch)
treeb5bcdae6990f9692ff549f1718a60f63c877f3e5
parent94a18aa796feef027cd33ec41ad4f955c7c991e3 (diff)
downloadelgg-110f0fa670a03bcd7f95a2d45a42d8a891d70544.tar.gz
elgg-110f0fa670a03bcd7f95a2d45a42d8a891d70544.tar.bz2
Further delete and event trigger fixes
git-svn-id: https://code.elgg.org/elgg/trunk@412 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--engine/lib/annotations.php28
-rw-r--r--engine/lib/elgglib.php18
-rw-r--r--engine/lib/entities.php2
3 files changed, 29 insertions, 19 deletions
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php
index f2b9e16fb..7e8caaab6 100644
--- a/engine/lib/annotations.php
+++ b/engine/lib/annotations.php
@@ -397,18 +397,24 @@
$guid = (int)$guid;
$name = get_metastring_id($name);
+
+ $entity_guid = (int)$entity_guid;
+ if ($entity = get_entity($entity_guid)) {
+ if ($entity->canEdit()) {
- $where = array();
-
- if ($name != "")
- $where[] = " name_id='$name'";
-
- $query = "DELETE from {$CONFIG->dbprefix}annotations where entity_guid=$guid and ";
- foreach ($where as $w)
- $query .= " $w and ";
- $query .= "(access_id in {$access} or (access_id = 0 and owner_guid = {$_SESSION['id']}))";
-
- return delete_data();
+ $where = array();
+
+ if ($name != "")
+ $where[] = " name_id='$name'";
+
+ $query = "DELETE from {$CONFIG->dbprefix}annotations where entity_guid=$guid ";
+ foreach ($where as $w)
+ $query .= " and $w";
+
+ return delete_data($query);
+
+ }
+ }
}
/**
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 3da5652c1..bbb0f7579 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -654,13 +654,17 @@
* @return true|false Depending on success
*/
function trigger_event($event, $object_type, $object = null) {
- if (events($event, $object_type, "", null, true, $object)
- && events('all', $object_type, "", null, true, $object)
- && events($event, 'all', "", null, true, $object)
- && events('all', 'all', "", null, true, $object)) {
- return true;
- }
- return false;
+
+ $return = true;
+ $return1 = events($event, $object_type, "", null, true, $object);
+ if (!is_null($return1)) $return = $return1;
+ $return2 = events('all', $object_type, "", null, true, $object);
+ if (!is_null($return2)) $return = $return2;
+ $return3 = events($event, 'all', "", null, true, $object);
+ if (!is_null($return3)) $return = $return3;
+ $return4 = events('all', 'all', "", null, true, $object);
+ if (!is_null($return4)) $return = $return4;
+ return $return;
}
/**
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index 169d87eb9..1d77760e8 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -693,7 +693,7 @@
if ($entity->canEdit()) {
$entity->clearMetadata();
$entity->clearAnnotations();
- return delete_data("DELETE from {$CONFIG->dbprefix}entities where where guid={$guid}");
+ return delete_data("DELETE from {$CONFIG->dbprefix}entities where guid={$guid}");
}
}
}