Elgg  Version 1.11
river.php
Go to the documentation of this file.
1 <?php
37 function elgg_create_river_item(array $options = array()) {
38  $view = elgg_extract('view', $options);
39  // use default viewtype for when called from web services api
40  if (empty($view) || !(elgg_view_exists($view, 'default'))) {
41  return false;
42  }
43 
44  $action_type = elgg_extract('action_type', $options);
45  if (empty($action_type)) {
46  return false;
47  }
48 
49  $subject_guid = elgg_extract('subject_guid', $options, 0);
50  if (!($subject = get_entity($subject_guid))) {
51  return false;
52  }
53 
54  $object_guid = elgg_extract('object_guid', $options, 0);
55  if (!($object = get_entity($object_guid))) {
56  return false;
57  }
58 
59  $target_guid = elgg_extract('target_guid', $options, 0);
60  if ($target_guid) {
61  // target_guid is not a required parameter so check
62  // it only if it is included in the parameters
63  if (!($target = get_entity($target_guid))) {
64  return false;
65  }
66  }
67 
68  $access_id = elgg_extract('access_id', $options, $object->access_id);
69 
70  $posted = elgg_extract('posted', $options, time());
71 
72  $annotation_id = elgg_extract('annotation_id', $options, 0);
73  if ($annotation_id) {
74  if (!elgg_get_annotation_from_id($annotation_id)) {
75  return false;
76  }
77  }
78 
79  $values = array(
80  'type' => $object->getType(),
81  'subtype' => $object->getSubtype(),
82  'action_type' => $action_type,
83  'access_id' => $access_id,
84  'view' => $view,
85  'subject_guid' => $subject_guid,
86  'object_guid' => $object_guid,
87  'target_guid' => $target_guid,
88  'annotation_id' => $annotation_id,
89  'posted' => $posted,
90  );
91  $col_types = array(
92  'type' => 'string',
93  'subtype' => 'string',
94  'action_type' => 'string',
95  'access_id' => 'int',
96  'view' => 'string',
97  'subject_guid' => 'int',
98  'object_guid' => 'int',
99  'target_guid' => 'int',
100  'annotation_id' => 'int',
101  'posted' => 'int',
102  );
103 
104  // return false to stop insert
105  $values = elgg_trigger_plugin_hook('creating', 'river', null, $values);
106  if ($values == false) {
107  // inserting did not fail - it was just prevented
108  return true;
109  }
110 
111  $dbprefix = elgg_get_config('dbprefix');
112 
113  // escape values array and build INSERT assignments
114  $assignments = array();
115  foreach ($col_types as $name => $type) {
116  $values[$name] = ($type === 'int') ? (int)$values[$name] : sanitize_string($values[$name]);
117  $assignments[] = "$name = '{$values[$name]}'";
118  }
119 
120  $id = insert_data("INSERT INTO {$dbprefix}river SET " . implode(',', $assignments));
121 
122  // update the entities which had the action carried out on it
123  // @todo shouldn't this be done elsewhere? Like when an annotation is saved?
124  if ($id) {
125  update_entity_last_action($values['object_guid'], $values['posted']);
126 
127  $river_items = elgg_get_river(array('id' => $id));
128  if ($river_items) {
129  elgg_trigger_event('created', 'river', $river_items[0]);
130  }
131  return $id;
132  } else {
133  return false;
134  }
135 }
136 
162 function elgg_delete_river(array $options = array()) {
163  global $CONFIG;
164 
165  $defaults = array(
166  'ids' => ELGG_ENTITIES_ANY_VALUE,
167 
168  'subject_guids' => ELGG_ENTITIES_ANY_VALUE,
169  'object_guids' => ELGG_ENTITIES_ANY_VALUE,
170  'target_guids' => ELGG_ENTITIES_ANY_VALUE,
171  'annotation_ids' => ELGG_ENTITIES_ANY_VALUE,
172 
173  'views' => ELGG_ENTITIES_ANY_VALUE,
174  'action_types' => ELGG_ENTITIES_ANY_VALUE,
175 
176  'types' => ELGG_ENTITIES_ANY_VALUE,
177  'subtypes' => ELGG_ENTITIES_ANY_VALUE,
178  'type_subtype_pairs' => ELGG_ENTITIES_ANY_VALUE,
179 
180  'posted_time_lower' => ELGG_ENTITIES_ANY_VALUE,
181  'posted_time_upper' => ELGG_ENTITIES_ANY_VALUE,
182 
183  'wheres' => array(),
184  'joins' => array(),
185 
186  );
187 
188  $options = array_merge($defaults, $options);
189 
190  $singulars = array('id', 'subject_guid', 'object_guid', 'target_guid', 'annotation_id', 'action_type', 'view', 'type', 'subtype');
192 
193  $wheres = $options['wheres'];
194 
195  $wheres[] = _elgg_get_guid_based_where_sql('rv.id', $options['ids']);
196  $wheres[] = _elgg_get_guid_based_where_sql('rv.subject_guid', $options['subject_guids']);
197  $wheres[] = _elgg_get_guid_based_where_sql('rv.object_guid', $options['object_guids']);
198  $wheres[] = _elgg_get_guid_based_where_sql('rv.target_guid', $options['target_guids']);
199  $wheres[] = _elgg_get_guid_based_where_sql('rv.annotation_id', $options['annotation_ids']);
200  $wheres[] = _elgg_river_get_action_where_sql($options['action_types']);
201  $wheres[] = _elgg_river_get_view_where_sql($options['views']);
202  $wheres[] = _elgg_get_river_type_subtype_where_sql('rv', $options['types'],
203  $options['subtypes'], $options['type_subtype_pairs']);
204 
205  if ($options['posted_time_lower'] && is_int($options['posted_time_lower'])) {
206  $wheres[] = "rv.posted >= {$options['posted_time_lower']}";
207  }
208 
209  if ($options['posted_time_upper'] && is_int($options['posted_time_upper'])) {
210  $wheres[] = "rv.posted <= {$options['posted_time_upper']}";
211  }
212 
213  // see if any functions failed
214  // remove empty strings on successful functions
215  foreach ($wheres as $i => $where) {
216  if ($where === false) {
217  return false;
218  } elseif (empty($where)) {
219  unset($wheres[$i]);
220  }
221  }
222 
223  // remove identical where clauses
224  $wheres = array_unique($wheres);
225 
226  $query = "DELETE rv.* FROM {$CONFIG->dbprefix}river rv ";
227 
228  // remove identical join clauses
229  $joins = array_unique($options['joins']);
230 
231  // add joins
232  foreach ($joins as $j) {
233  $query .= " $j ";
234  }
235 
236  // add wheres
237  $query .= ' WHERE ';
238 
239  foreach ($wheres as $w) {
240  $query .= " $w AND ";
241  }
242  $query .= "1=1";
243 
244  return delete_data($query);
245 }
246 
286 function elgg_get_river(array $options = array()) {
287  global $CONFIG;
288 
289  $defaults = array(
290  'ids' => ELGG_ENTITIES_ANY_VALUE,
291 
292  'subject_guids' => ELGG_ENTITIES_ANY_VALUE,
293  'object_guids' => ELGG_ENTITIES_ANY_VALUE,
294  'target_guids' => ELGG_ENTITIES_ANY_VALUE,
295  'annotation_ids' => ELGG_ENTITIES_ANY_VALUE,
296  'action_types' => ELGG_ENTITIES_ANY_VALUE,
297 
298  'relationship' => null,
299  'relationship_guid' => null,
300  'inverse_relationship' => false,
301 
302  'types' => ELGG_ENTITIES_ANY_VALUE,
303  'subtypes' => ELGG_ENTITIES_ANY_VALUE,
304  'type_subtype_pairs' => ELGG_ENTITIES_ANY_VALUE,
305 
306  'posted_time_lower' => ELGG_ENTITIES_ANY_VALUE,
307  'posted_time_upper' => ELGG_ENTITIES_ANY_VALUE,
308 
309  'limit' => 20,
310  'offset' => 0,
311  'count' => false,
312  'distinct' => true,
313 
314  'order_by' => 'rv.posted desc',
315  'group_by' => ELGG_ENTITIES_ANY_VALUE,
316 
317  'wheres' => array(),
318  'joins' => array(),
319  );
320 
321  $options = array_merge($defaults, $options);
322 
323  $singulars = array('id', 'subject_guid', 'object_guid', 'target_guid', 'annotation_id', 'action_type', 'type', 'subtype');
325 
326  $wheres = $options['wheres'];
327 
328  $wheres[] = _elgg_get_guid_based_where_sql('rv.id', $options['ids']);
329  $wheres[] = _elgg_get_guid_based_where_sql('rv.subject_guid', $options['subject_guids']);
330  $wheres[] = _elgg_get_guid_based_where_sql('rv.object_guid', $options['object_guids']);
331  $wheres[] = _elgg_get_guid_based_where_sql('rv.target_guid', $options['target_guids']);
332  $wheres[] = _elgg_get_guid_based_where_sql('rv.annotation_id', $options['annotation_ids']);
333  $wheres[] = _elgg_river_get_action_where_sql($options['action_types']);
334  $wheres[] = _elgg_get_river_type_subtype_where_sql('rv', $options['types'],
335  $options['subtypes'], $options['type_subtype_pairs']);
336 
337  if ($options['posted_time_lower'] && is_int($options['posted_time_lower'])) {
338  $wheres[] = "rv.posted >= {$options['posted_time_lower']}";
339  }
340 
341  if ($options['posted_time_upper'] && is_int($options['posted_time_upper'])) {
342  $wheres[] = "rv.posted <= {$options['posted_time_upper']}";
343  }
344 
346  $wheres[] = "rv.enabled = 'yes'";
347  }
348 
349  $joins = $options['joins'];
350 
351  $dbprefix = elgg_get_config('dbprefix');
352  $joins[] = "JOIN {$dbprefix}entities oe ON rv.object_guid = oe.guid";
353  // LEFT JOIN is used because all river items do not necessarily have target
354  $joins[] = "LEFT JOIN {$dbprefix}entities te ON rv.target_guid = te.guid";
355 
356  if ($options['relationship_guid']) {
358  'rv.subject_guid',
359  $options['relationship'],
360  $options['relationship_guid'],
361  $options['inverse_relationship']);
362  if ($clauses) {
363  $wheres = array_merge($wheres, $clauses['wheres']);
364  $joins = array_merge($joins, $clauses['joins']);
365  }
366  }
367 
368  // see if any functions failed
369  // remove empty strings on successful functions
370  foreach ($wheres as $i => $where) {
371  if ($where === false) {
372  return false;
373  } elseif (empty($where)) {
374  unset($wheres[$i]);
375  }
376  }
377 
378  // remove identical where clauses
379  $wheres = array_unique($wheres);
380 
381  if (!$options['count']) {
382  $distinct = $options['distinct'] ? "DISTINCT" : "";
383 
384  $query = "SELECT $distinct rv.* FROM {$CONFIG->dbprefix}river rv ";
385  } else {
386  // note: when DISTINCT unneeded, it's slightly faster to compute COUNT(*) than IDs
387  $count_expr = $options['distinct'] ? "DISTINCT rv.id" : "*";
388 
389  $query = "SELECT COUNT($count_expr) as total FROM {$CONFIG->dbprefix}river rv ";
390  }
391 
392  // add joins
393  foreach ($joins as $j) {
394  $query .= " $j ";
395  }
396 
397  // add wheres
398  $query .= ' WHERE ';
399 
400  foreach ($wheres as $w) {
401  $query .= " $w AND ";
402  }
403 
404  // Make sure that user has access to all the entities referenced by each river item
405  $object_access_where = _elgg_get_access_where_sql(array('table_alias' => 'oe'));
406  $target_access_where = _elgg_get_access_where_sql(array('table_alias' => 'te'));
407 
408  // We use LEFT JOIN with entities table but the WHERE clauses are used
409  // regardless if a JOIN is successfully made. The "te.guid IS NULL" is
410  // needed because of this.
411  $query .= "$object_access_where AND ($target_access_where OR te.guid IS NULL) ";
412 
413  if (!$options['count']) {
414  $options['group_by'] = sanitise_string($options['group_by']);
415  if ($options['group_by']) {
416  $query .= " GROUP BY {$options['group_by']}";
417  }
418 
419  $options['order_by'] = sanitise_string($options['order_by']);
420  $query .= " ORDER BY {$options['order_by']}";
421 
422  if ($options['limit']) {
423  $limit = sanitise_int($options['limit']);
424  $offset = sanitise_int($options['offset'], false);
425  $query .= " LIMIT $offset, $limit";
426  }
427 
428  $river_items = get_data($query, '_elgg_row_to_elgg_river_item');
429  _elgg_prefetch_river_entities($river_items);
430 
431  return $river_items;
432  } else {
433  $total = get_data_row($query);
434  return (int)$total->total;
435  }
436 }
437 
444 function _elgg_prefetch_river_entities(array $river_items) {
445  // prefetch objects, subjects and targets
446  $guids = array();
447  foreach ($river_items as $item) {
448  if ($item->subject_guid && !_elgg_retrieve_cached_entity($item->subject_guid)) {
449  $guids[$item->subject_guid] = true;
450  }
451  if ($item->object_guid && !_elgg_retrieve_cached_entity($item->object_guid)) {
452  $guids[$item->object_guid] = true;
453  }
454  if ($item->target_guid && !_elgg_retrieve_cached_entity($item->target_guid)) {
455  $guids[$item->target_guid] = true;
456  }
457  }
458  if ($guids) {
459  // The entity cache only holds 256. We don't want to bump out any plugins.
460  $guids = array_slice($guids, 0, 200, true);
461  // return value unneeded, just priming cache
462  elgg_get_entities(array(
463  'guids' => array_keys($guids),
464  'limit' => 0,
465  'distinct' => false,
466  ));
467  }
468 
469  // prefetch object containers, in case they were not in the targets
470  $guids = array();
471  foreach ($river_items as $item) {
472  $object = $item->getObjectEntity();
473  if ($object->container_guid && !_elgg_retrieve_cached_entity($object->container_guid)) {
474  $guids[$object->container_guid] = true;
475  }
476  }
477  if ($guids) {
478  $guids = array_slice($guids, 0, 200, true);
479  elgg_get_entities(array(
480  'guids' => array_keys($guids),
481  'limit' => 0,
482  'distinct' => false,
483 
484  // Why specify? user containers are likely already loaded via the owners, and
485  // specifying groups allows ege() to auto-join the groups_entity table
486  'type' => 'group',
487  ));
488  }
489 
490  // Note: We've tried combining the above ege() calls into one (pulling containers at the same time).
491  // Although it seems like it would reduce queries, it added some. o_O
492 }
493 
505 function elgg_list_river(array $options = array()) {
506  global $autofeed;
507  $autofeed = true;
508 
509  $defaults = array(
510  'offset' => (int) max(get_input('offset', 0), 0),
511  'limit' => (int) max(get_input('limit', max(20, elgg_get_config('default_limit'))), 0),
512  'pagination' => true,
513  'list_class' => 'elgg-list-river',
514  'no_results' => '',
515  );
516 
517  $options = array_merge($defaults, $options);
518 
519  if (!$options["limit"] && !$options["offset"]) {
520  // no need for pagination if listing is unlimited
521  $options["pagination"] = false;
522  }
523 
524  $options['count'] = true;
526 
527  if ($count > 0) {
528  $options['count'] = false;
530  } else {
531  $items = array();
532  }
533 
534  $options['count'] = $count;
535  $options['items'] = $items;
536 
537  return elgg_view('page/components/list', $options);
538 }
539 
550  if (!($row instanceof \stdClass)) {
551  return null;
552  }
553 
554  return new \ElggRiverItem($row);
555 }
556 
573  // short circuit if nothing is requested
574  if (!$types && !$subtypes && !$pairs) {
575  return '';
576  }
577 
578  $wheres = array();
579  $types_wheres = array();
580  $subtypes_wheres = array();
581 
582  // if no pairs, use types and subtypes
583  if (!is_array($pairs)) {
584  if ($types) {
585  if (!is_array($types)) {
586  $types = array($types);
587  }
588  foreach ($types as $type) {
589  $type = sanitise_string($type);
590  $types_wheres[] = "({$table}.type = '$type')";
591  }
592  }
593 
594  if ($subtypes) {
595  if (!is_array($subtypes)) {
596  $subtypes = array($subtypes);
597  }
598  foreach ($subtypes as $subtype) {
599  $subtype = sanitise_string($subtype);
600  $subtypes_wheres[] = "({$table}.subtype = '$subtype')";
601  }
602  }
603 
604  if (is_array($types_wheres) && count($types_wheres)) {
605  $types_wheres = array(implode(' OR ', $types_wheres));
606  }
607 
608  if (is_array($subtypes_wheres) && count($subtypes_wheres)) {
609  $subtypes_wheres = array('(' . implode(' OR ', $subtypes_wheres) . ')');
610  }
611 
612  $wheres = array(implode(' AND ', array_merge($types_wheres, $subtypes_wheres)));
613 
614  } else {
615  // using type/subtype pairs
616  foreach ($pairs as $paired_type => $paired_subtypes) {
617  $paired_type = sanitise_string($paired_type);
618  if (is_array($paired_subtypes)) {
619  $paired_subtypes = array_map('sanitise_string', $paired_subtypes);
620  $paired_subtype_str = implode("','", $paired_subtypes);
621  if ($paired_subtype_str) {
622  $wheres[] = "({$table}.type = '$paired_type'"
623  . " AND {$table}.subtype IN ('$paired_subtype_str'))";
624  }
625  } else {
626  $paired_subtype = sanitise_string($paired_subtypes);
627  $wheres[] = "({$table}.type = '$paired_type'"
628  . " AND {$table}.subtype = '$paired_subtype')";
629  }
630  }
631  }
632 
633  if (is_array($wheres) && count($wheres)) {
634  $where = implode(' OR ', $wheres);
635  return "($where)";
636  }
637 
638  return '';
639 }
640 
651  if (!$types) {
652  return '';
653  }
654 
655  if (!is_array($types)) {
656  $types = sanitise_string($types);
657  return "(rv.action_type = '$types')";
658  }
659 
660  // sanitize types array
661  $types_sanitized = array();
662  foreach ($types as $type) {
663  $types_sanitized[] = sanitise_string($type);
664  }
665 
666  $type_str = implode("','", $types_sanitized);
667  return "(rv.action_type IN ('$type_str'))";
668 }
669 
680  if (!$views) {
681  return '';
682  }
683 
684  if (!is_array($views)) {
685  $views = sanitise_string($views);
686  return "(rv.view = '$views')";
687  }
688 
689  // sanitize views array
690  $views_sanitized = array();
691  foreach ($views as $view) {
692  $views_sanitized[] = sanitise_string($view);
693  }
694 
695  $view_str = implode("','", $views_sanitized);
696  return "(rv.view IN ('$view_str'))";
697 }
698 
707 function update_river_access_by_object($object_guid, $access_id) {
708  // Sanitise
709  $object_guid = (int) $object_guid;
710  $access_id = (int) $access_id;
711 
712  // Load config
713  global $CONFIG;
714 
715  $query = "UPDATE {$CONFIG->dbprefix}river
716  SET access_id = {$access_id}
717  WHERE object_guid = {$object_guid}";
718  return update_data($query);
719 }
720 
728 function _elgg_river_page_handler($page) {
729  global $CONFIG;
730 
732 
733  // make a URL segment available in page handler script
734  $page_type = elgg_extract(0, $page, 'all');
735  $page_type = preg_replace('[\W]', '', $page_type);
736  if ($page_type == 'owner') {
737  elgg_gatekeeper();
738  $page_username = elgg_extract(1, $page, '');
739  if ($page_username == elgg_get_logged_in_user_entity()->username) {
740  $page_type = 'mine';
741  } else {
742  set_input('subject_username', $page_username);
743  }
744  }
745  set_input('page_type', $page_type);
746 
747  require_once("{$CONFIG->path}pages/river.php");
748  return true;
749 }
750 
755 function _elgg_river_test($hook, $type, $value) {
756  global $CONFIG;
757  $value[] = $CONFIG->path . 'engine/tests/ElggCoreRiverAPITest.php';
758  return $value;
759 }
760 
770 function _elgg_river_disable($event, $type, $entity) {
771 
772  if (!elgg_instanceof($entity)) {
773  return true;
774  }
775 
776  $dbprefix = elgg_get_config('dbprefix');
777  $query = <<<QUERY
778  UPDATE {$dbprefix}river AS rv
779  SET rv.enabled = 'no'
780  WHERE (rv.subject_guid = {$entity->guid} OR rv.object_guid = {$entity->guid} OR rv.target_guid = {$entity->guid});
781 QUERY;
782 
783  update_data($query);
784  return true;
785 }
786 
787 
797 function _elgg_river_enable($event, $type, $entity) {
798 
799  if (!elgg_instanceof($entity)) {
800  return true;
801  }
802 
803  $dbprefix = elgg_get_config('dbprefix');
804  $query = <<<QUERY
805  UPDATE {$dbprefix}river AS rv
806  LEFT JOIN {$dbprefix}entities AS se ON se.guid = rv.subject_guid
807  LEFT JOIN {$dbprefix}entities AS oe ON oe.guid = rv.object_guid
808  LEFT JOIN {$dbprefix}entities AS te ON te.guid = rv.target_guid
809  SET rv.enabled = 'yes'
810  WHERE (
811  (se.enabled = 'yes' OR se.guid IS NULL) AND
812  (oe.enabled = 'yes' OR oe.guid IS NULL) AND
813  (te.enabled = 'yes' OR te.guid IS NULL)
814  )
815  AND (se.guid = {$entity->guid} OR oe.guid = {$entity->guid} OR te.guid = {$entity->guid});
816 QUERY;
817 
818  update_data($query);
819  return true;
820 }
821 
826 function _elgg_river_init() {
827  elgg_register_page_handler('activity', '_elgg_river_page_handler');
828  $item = new \ElggMenuItem('activity', elgg_echo('activity'), 'activity');
830 
831  elgg_register_widget_type('river_widget', elgg_echo('river:widget:title'), elgg_echo('river:widget:description'));
832 
833  elgg_register_action('river/delete', '', 'admin');
834 
835  elgg_register_plugin_hook_handler('unit_test', 'system', '_elgg_river_test');
836 }
837 
838 return function(\Elgg\EventsService $events, \Elgg\HooksRegistrationService $hooks) {
839  $events->registerHandler('init', 'system', '_elgg_river_init');
840  $events->registerHandler('disable:after', 'all', '_elgg_river_disable');
841  $events->registerHandler('enable:after', 'all', '_elgg_river_enable');
842 };
elgg_list_river(array $options=array())
List river items.
Definition: river.php:505
_elgg_river_get_action_where_sql($types)
Get the where clause based on river action type strings.
Definition: river.php:650
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
$view
Definition: crop.php:68
$dbprefix
Definition: index.php:13
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
get_data_row($query, $callback="")
Retrieve a single row from the database.
Definition: database.php:66
$subject
Definition: exceptions.php:25
_elgg_river_init()
Initialize river library private.
Definition: river.php:826
$table
Definition: cron.php:28
$page_type
Definition: river.php:10
if($guid==elgg_get_logged_in_user_guid()) $name
Definition: delete.php:21
_elgg_river_get_view_where_sql($views)
Get the where clause based on river view strings.
Definition: river.php:679
_elgg_retrieve_cached_entity($guid)
Retrieve a entity from the cache.
Definition: entities.php:125
$object
Definition: upgrade.php:12
$defaults
_elgg_river_test($hook, $type, $value)
Register river unit tests private.
Definition: river.php:755
elgg_register_widget_type($handler, $name, $description, $context=array('all'), $multiple=false)
Register a widget type.
Definition: widgets.php:73
_elgg_get_guid_based_where_sql($column, $guids)
Returns SQL where clause for owner and containers.
Definition: entities.php:535
update_entity_last_action($guid, $posted=null)
Update the last_action column in the entities table for $guid.
Definition: entities.php:953
_elgg_prefetch_river_entities(array $river_items)
Prefetch entities that will be displayed in the river.
Definition: river.php:444
$value
Definition: longtext.php:26
elgg_view_exists($view, $viewtype= '', $recurse=true)
Returns whether the specified view exists.
Definition: views.php:318
set_input($variable, $value)
Sets an input value that may later be retrieved by get_input.
Definition: input.php:41
if(!$count) $offset
Definition: pagination.php:25
elgg_extract($key, array $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1246
elgg_register_plugin_hook_handler($hook, $type, $callback, $priority=500)
Definition: elgglib.php:703
delete_data($query)
Remove a row from the database.
Definition: database.php:106
elgg_set_page_owner_guid($guid)
Set the guid of the entity that owns this page.
Definition: pageowner.php:73
update_data($query)
Update a row in the database.
Definition: database.php:93
sanitize_string($string)
Sanitize a string for database use.
Definition: database.php:140
insert_data($query)
Insert a row into the database.
Definition: database.php:80
update_river_access_by_object($object_guid, $access_id)
Sets the access ID on river items for a particular object.
Definition: river.php:707
username
Definition: contents.php:36
elgg_gatekeeper()
Used at the top of a page to mark it as logged in users only.
Definition: pagehandler.php:58
elgg_instanceof($entity, $type=null, $subtype=null, $class=null)
Checks if $entity is an and optionally for type and subtype.
Definition: entities.php:922
$limit
Definition: userpicker.php:31
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_get_annotation_from_id($id)
Get a specific annotation by its id.
Definition: annotations.php:36
elgg_create_river_item(array $options=array())
Adds an item to the river.
Definition: river.php:37
_elgg_row_to_elgg_river_item($row)
Convert a database row to a new .
Definition: river.php:549
$item
Definition: item.php:12
global $CONFIG
elgg menu river
Definition: navigation.php:489
sanitise_string($string)
Wrapper function for alternate English spelling (.
Definition: database.php:150
const ELGG_ENTITIES_ANY_VALUE
Definition: elgglib.php:1967
elgg_get_entities(array $options=array())
Returns an array of entities with optional filtering.
Definition: entities.php:490
elgg_trigger_plugin_hook($hook, $type, $params=null, $returnvalue=null)
Definition: elgglib.php:775
elgg_register_page_handler($identifier, $function)
Registers a page handler for a particular identifier.
Definition: pagehandler.php:34
elgg_get_entity_relationship_where_sql($column, $relationship=null, $relationship_guid=null, $inverse_relationship=false)
Returns SQL appropriate for relationship joins and wheres.
elgg global
Pointer to the global context.
Definition: elgglib.js:12
elgg_register_menu_item($menu_name, $menu_item)
Register an item for an Elgg menu.
Definition: navigation.php:92
elgg_view($view, $vars=array(), $bypass=false, $ignored=false, $viewtype= '')
Return a parsed view.
Definition: views.php:354
access_get_show_hidden_status()
Return current status of showing disabled entities.
Definition: access.php:172
$items
Definition: list.php:11
_elgg_river_enable($event, $type, $entity)
Enable river entries that reference a re-enabled entity as subject/object/target. ...
Definition: river.php:797
$posted
Definition: comment.php:69
$guids
_elgg_river_disable($event, $type, $entity)
Disable river entries that reference a disabled entity as subject/object/target.
Definition: river.php:770
get_data($query, $callback="")
Retrieve rows from the database.
Definition: database.php:50
elgg_get_river(array $options=array())
Get river items.
Definition: river.php:286
$subtypes
elgg_delete_river(array $options=array())
Delete river items.
Definition: river.php:162
if(elgg_in_context('widget')) $count
Definition: pagination.php:20
$row
sanitise_int($int, $signed=true)
Sanitizes an integer for database use.
Definition: database.php:173
elgg_get_logged_in_user_entity()
Return the current logged in user, or null if no user is logged in.
Definition: sessions.php:32
elgg_register_action($action, $filename="", $access= 'logged_in')
Registers an action.
Definition: actions.php:85
$target
Definition: responses.php:19
_elgg_normalize_plural_options_array($options, $singulars)
Normalise the singular keys in an options array to plural keys.
Definition: elgglib.php:1376
$entity
Definition: delete.php:10
_elgg_get_access_where_sql(array $options=array())
Returns the SQL where clause for enforcing read access to data.
Definition: access.php:216
_elgg_river_page_handler($page)
Page handler for activity.
Definition: river.php:728
elgg_trigger_event($event, $object_type, $object=null)
Definition: elgglib.php:570
$subtype
Definition: river.php:12
if(!$collection_name) $id
Definition: add.php:17
$options
Main activity stream list page.
Definition: river.php:6
$type
Definition: river.php:11
elgg_get_logged_in_user_guid()
Return the current logged in user by guid.
Definition: sessions.php:42
_elgg_get_river_type_subtype_where_sql($table, $types, $subtypes, $pairs)
Returns SQL where clause for type and subtype on river table.
Definition: river.php:572
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:382