aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/annotations.php
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-09 16:32:30 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-09 16:32:30 +0000
commit2330e92ff935a9fb14147d37ce227c40e3d7c257 (patch)
treeeef08277f13357d746236468a5ea3bb313256e70 /engine/lib/annotations.php
parentb0a6431c355a9b1126db281f4e65bdb1f424e05f (diff)
downloadelgg-2330e92ff935a9fb14147d37ce227c40e3d7c257.tar.gz
elgg-2330e92ff935a9fb14147d37ce227c40e3d7c257.tar.bz2
Added the 'annotate' event on entities.
git-svn-id: https://code.elgg.org/elgg/trunk@2694 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/annotations.php')
-rw-r--r--engine/lib/annotations.php23
1 files changed, 14 insertions, 9 deletions
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php
index bfac0d557..7a9f2e3c6 100644
--- a/engine/lib/annotations.php
+++ b/engine/lib/annotations.php
@@ -160,6 +160,8 @@
{
global $CONFIG;
+ $result = false;
+
$entity_guid = (int)$entity_guid;
//$name = sanitise_string(trim($name));
//$value = sanitise_string(trim($value));
@@ -180,16 +182,19 @@
if (!$name) return false;
$entity = get_entity($entity_guid);
- system_log($entity, 'annotate');
- // If ok then add it
- $result = insert_data("INSERT into {$CONFIG->dbprefix}annotations (entity_guid, name_id, value_id, value_type, owner_guid, time_created, access_id) VALUES ($entity_guid,'$name',$value,'$value_type', $owner_guid, $time, $access_id)");
- if ($result!==false) {
- $obj = get_annotation($result);
- if (trigger_elgg_event('create', 'annotation', $obj)) {
- return true;
- } else {
- delete_annotation($result);
+ if (trigger_elgg_event('annotate',$entity->type,$entity)) {
+ system_log($entity, 'annotate');
+
+ // If ok then add it
+ $result = insert_data("INSERT into {$CONFIG->dbprefix}annotations (entity_guid, name_id, value_id, value_type, owner_guid, time_created, access_id) VALUES ($entity_guid,'$name',$value,'$value_type', $owner_guid, $time, $access_id)");
+ if ($result!==false) {
+ $obj = get_annotation($result);
+ if (trigger_elgg_event('create', 'annotation', $obj)) {
+ return true;
+ } else {
+ delete_annotation($result);
+ }
}
}