From f1ba6ec14130a5480653745b22de6a001112bddb Mon Sep 17 00:00:00 2001 From: dave Date: Mon, 21 Sep 2009 14:50:23 +0000 Subject: New river code added to allow user comment to be pulled out and displayed git-svn-id: http://code.elgg.org/elgg/trunk@3490 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/annotations.php | 2 +- engine/lib/river2.php | 18 ++++++------------ 2 files changed, 7 insertions(+), 13 deletions(-) (limited to 'engine/lib') diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index 49ffc7840..028c33006 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -191,7 +191,7 @@ if ($result!==false) { $obj = get_annotation($result); if (trigger_elgg_event('create', 'annotation', $obj)) { - return true; + return $result; } else { delete_annotation($result); } diff --git a/engine/lib/river2.php b/engine/lib/river2.php index 1a982e6a4..510ec7b8c 100644 --- a/engine/lib/river2.php +++ b/engine/lib/river2.php @@ -23,14 +23,8 @@ * @param int $posted The UNIX epoch timestamp of the river item (default: now) * @return true|false Depending on success */ - function add_to_river( - $view, - $action_type, - $subject_guid, - $object_guid, - $access_id = "", - $posted = 0 - ) { + function add_to_river($view,$action_type,$subject_guid,$object_guid,$access_id = "",$posted = 0, $annotation_id = 0) + { // Sanitise variables if (!elgg_view_exists($view)) return false; @@ -39,10 +33,9 @@ if (empty($action_type)) return false; if ($posted == 0) $posted = time(); if ($access_id === "") $access_id = $object->access_id; - + $annotation_id = (int)$annotation_id; $type = $object->getType(); $subtype = $object->getSubtype(); - $action_type = sanitise_string($action_type); // Load config @@ -57,7 +50,8 @@ " view = '{$view}', " . " subject_guid = {$subject_guid}, " . " object_guid = {$object_guid}, " . - " posted = {$posted} "); + " posted = {$posted}, " . + " annotation_id = {$annotation_id} "); } @@ -217,7 +211,7 @@ $whereclause = implode(' and ', $where); // Construct main SQL - $sql = "select id,type,subtype,action_type,access_id,view,subject_guid,object_guid,posted from {$CONFIG->dbprefix}river where {$whereclause} order by posted desc limit {$offset},{$limit}"; + $sql = "select id,type,subtype,action_type,access_id,view,subject_guid,object_guid,posted,annotation_id from {$CONFIG->dbprefix}river where {$whereclause} order by posted desc limit {$offset},{$limit}"; // Get data return get_data($sql); -- cgit v1.2.3