diff options
Diffstat (limited to 'engine/lib/river.php')
-rw-r--r-- | engine/lib/river.php | 268 |
1 files changed, 0 insertions, 268 deletions
diff --git a/engine/lib/river.php b/engine/lib/river.php index 38197e387..036ceafd4 100644 --- a/engine/lib/river.php +++ b/engine/lib/river.php @@ -505,274 +505,6 @@ function update_river_access_by_object($object_guid, $access_id) { } /** - * Retrieves items from the river. All parameters are optional. - * - * @param int|array $subject_guid Acting entity to restrict to. Default: all - * @param int|array $object_guid Entity being acted on to restrict to. Default: all - * @param string $subject_relationship If set to a relationship type, this will use - * $subject_guid as the starting point and set the - * subjects to be all users this - * entity has this relationship with (eg 'friend'). - * Default: blank - * @param string $type The type of entity to restrict to. Default: all - * @param string $subtype The subtype of entity to restrict to. Default: all - * @param string $action_type The type of river action to restrict to. Default: all - * @param int $limit The number of items to retrieve. Default: 20 - * @param int $offset The page offset. Default: 0 - * @param int $posted_min The minimum time period to look at. Default: none - * @param int $posted_max The maximum time period to look at. Default: none - * - * @return array|false Depending on success - * @deprecated 1.8 - */ -function get_river_items($subject_guid = 0, $object_guid = 0, $subject_relationship = '', -$type = '', $subtype = '', $action_type = '', $limit = 20, $offset = 0, $posted_min = 0, -$posted_max = 0) { - elgg_deprecated_notice("get_river_items deprecated by elgg_get_river", 1.8); - - $options = array(); - - if ($subject_guid) { - $options['subject_guid'] = $subject_guid; - } - - if ($object_guid) { - $options['object_guid'] = $object_guid; - } - - if ($subject_relationship) { - $options['relationship'] = $subject_relationship; - unset($options['subject_guid']); - $options['relationship_guid'] = $subject_guid; - } - - if ($type) { - $options['type'] = $type; - } - - if ($subtype) { - $options['subtype'] = $subtype; - } - - if ($action_type) { - $options['action_type'] = $action_type; - } - - $options['limit'] = $limit; - $options['offset'] = $offset; - - if ($posted_min) { - $options['posted_time_lower'] = $posted_min; - } - - if ($posted_max) { - $options['posted_time_upper'] = $posted_max; - } - - return elgg_get_river($options); -} - -/** - * Returns a human-readable version of the river. - * - * @param int|array $subject_guid Acting entity to restrict to. Default: all - * @param int|array $object_guid Entity being acted on to restrict to. Default: all - * @param string $subject_relationship If set to a relationship type, this will use - * $subject_guid as the starting point and set - * the subjects to be all users this entity has this - * relationship with (eg 'friend'). Default: blank - * @param string $type The type of entity to restrict to. Default: all - * @param string $subtype The subtype of entity to restrict to. Default: all - * @param string $action_type The type of river action to restrict to. Default: all - * @param int $limit The number of items to retrieve. Default: 20 - * @param int $posted_min The minimum time period to look at. Default: none - * @param int $posted_max The maximum time period to look at. Default: none - * @param bool $pagination Show pagination? - * - * @return string Human-readable river. - * @deprecated 1.8 - */ -function elgg_view_river_items($subject_guid = 0, $object_guid = 0, $subject_relationship = '', -$type = '', $subtype = '', $action_type = '', $limit = 20, $posted_min = 0, -$posted_max = 0, $pagination = true) { - elgg_deprecated_notice("elgg_view_river_items deprecated for elgg_list_river", 1.8); - - $river_items = get_river_items($subject_guid, $object_guid, $subject_relationship, - $type, $subtype, $action_type, $limit + 1, $posted_min, $posted_max); - - // Get input from outside world and sanitise it - $offset = (int) get_input('offset', 0); - - // view them - $params = array( - 'items' => $river_items, - 'count' => count($river_items), - 'offset' => $offset, - 'limit' => $limit, - 'pagination' => $pagination, - 'list-class' => 'elgg-river-list', - ); - - return elgg_view('layout/objects/list', $params); -} - -/** - * Construct and execute the query required for the activity stream. - * - * @deprecated 1.8 - */ -function get_activity_stream_data($limit = 10, $offset = 0, $type = "", $subtype = "", -$owner_guid = "", $owner_relationship = "") { - elgg_deprecated_notice("get_activity_stream_data was deprecated", 1.8); - - global $CONFIG; - - $limit = (int)$limit; - $offset = (int)$offset; - - if ($type) { - if (!is_array($type)) { - $type = array(sanitise_string($type)); - } else { - foreach ($type as $k => $v) { - $type[$k] = sanitise_string($v); - } - } - } - - if ($subtype) { - if (!is_array($subtype)) { - $subtype = array(sanitise_string($subtype)); - } else { - foreach ($subtype as $k => $v) { - $subtype[$k] = sanitise_string($v); - } - } - } - - if ($owner_guid) { - if (is_array($owner_guid)) { - foreach ($owner_guid as $k => $v) { - $owner_guid[$k] = (int)$v; - } - } else { - $owner_guid = array((int)$owner_guid); - } - } - - $owner_relationship = sanitise_string($owner_relationship); - - // Get a list of possible views - $activity_events = array(); - $activity_views = array_merge(elgg_view_tree('activity', 'default'), - elgg_view_tree('river', 'default')); - - $done = array(); - - foreach ($activity_views as $view) { - $fragments = explode('/', $view); - $tmp = explode('/', $view, 2); - $tmp = $tmp[1]; - - if ((isset($fragments[0])) && (($fragments[0] == 'river') || ($fragments[0] == 'activity')) - && (!in_array($tmp, $done))) { - - if (isset($fragments[1])) { - $f = array(); - for ($n = 1; $n < count($fragments); $n++) { - $val = sanitise_string($fragments[$n]); - switch($n) { - case 1: $key = 'type'; break; - case 2: $key = 'subtype'; break; - case 3: $key = 'event'; break; - } - $f[$key] = $val; - } - - // Filter result based on parameters - $add = true; - if ($type) { - if (!in_array($f['type'], $type)) { - $add = false; - } - } - if (($add) && ($subtype)) { - if (!in_array($f['subtype'], $subtype)) { - $add = false; - } - } - if (($add) && ($event)) { - if (!in_array($f['event'], $event)) { - $add = false; - } - } - - if ($add) { - $activity_events[] = $f; - } - } - - $done[] = $tmp; - } - } - - $n = 0; - foreach ($activity_events as $details) { - // Get what we're talking about - if ($details['subtype'] == 'default') { - $details['subtype'] = ''; - } - - if (($details['type']) && ($details['event'])) { - if ($n > 0) { - $obj_query .= " or "; - } - - $access = ""; - if ($details['type'] != 'relationship') { - $access = " and " . get_access_sql_suffix('sl'); - } - - $obj_query .= "( sl.object_type='{$details['type']}' - AND sl.object_subtype='{$details['subtype']}' - AND sl.event='{$details['event']}' $access )"; - - $n++; - } - } - - // User - if ((count($owner_guid)) && ($owner_guid[0] != 0)) { - $user = " and sl.performed_by_guid in (" . implode(',', $owner_guid) . ")"; - - if ($owner_relationship) { - $friendsarray = ""; - if ($friends = elgg_get_entities_from_relationship(array( - 'relationship' => $owner_relationship, - 'relationship_guid' => $owner_guid[0], - 'inverse_relationship' => FALSE, - 'types' => 'user', - 'subtypes' => $subtype, - 'limit' => 9999)) - ) { - - $friendsarray = array(); - foreach ($friends as $friend) { - $friendsarray[] = $friend->getGUID(); - } - - $user = " and sl.performed_by_guid in (" . implode(',', $friendsarray) . ")"; - } - } - } - - $query = "SELECT sl.* FROM {$CONFIG->dbprefix}system_log sl - WHERE 1 $user AND ($obj_query) - ORDER BY sl.time_created desc limit $offset, $limit"; - return get_data($query); -} - -/** * Page handler for activiy * * @param array $page |