diff options
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/annotations.php | 28 | ||||
-rw-r--r-- | engine/lib/elgglib.php | 18 | ||||
-rw-r--r-- | engine/lib/entities.php | 2 |
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}");
}
}
}
|