start.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * Elgg river auto update plugin
  4. *
  5. *
  6. * Contributor: Hadi Katebi
  7. * Contact: hadi.katebi@gmail.com
  8. */
  9. define("LIMIT", 20); // limit on the number of activities to be loaded
  10. define("REFRESH_RATE", 15000); // refresh rate of the activity page in ms
  11. elgg_register_event_handler('init', 'system', 'river_auto_update_init');
  12. function river_auto_update_init() {
  13. // Register page handler
  14. elgg_unregister_page_handler('activity', 'elgg_river_page_handler');
  15. elgg_register_page_handler('activity', 'river_auto_update_page_handler');
  16. // extend js view
  17. elgg_extend_view("js/elgg", "js/riverautoupdate/functions");
  18. }
  19. function river_auto_update_page_handler($page) {
  20. global $CONFIG;
  21. elgg_set_page_owner_guid(elgg_get_logged_in_user_guid());
  22. // make ajax procedure visible to the activity page
  23. if ($page[0] == "proc") {
  24. include("{$CONFIG->path}mod/riverautoupdate/procedures/" . $page[1] . ".php");
  25. }
  26. else {
  27. $page_type = elgg_extract(0, $page, 'all');
  28. $page_type = preg_replace('[\W]', '', $page_type);
  29. if ($page_type == 'owner') {
  30. $page_type = 'mine';
  31. }
  32. set_input('page_type', $page_type);
  33. }
  34. require_once("{$CONFIG->path}mod/riverautoupdate/pages/river.php");
  35. return true;
  36. }