start.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * This file is included when the plugin starts
  4. */
  5. require_once(dirname(__FILE__) . "/lib/functions.php");
  6. require_once(dirname(__FILE__) . "/lib/events.php");
  7. require_once(dirname(__FILE__) . "/lib/hooks.php");
  8. require_once(dirname(__FILE__) . "/lib/page_handlers.php");
  9. // register default Elgg events
  10. elgg_register_event_handler("init", "system", "security_tools_init");
  11. /**
  12. * Function is called when the Elgg system initializes
  13. *
  14. * @return void
  15. */
  16. function security_tools_init() {
  17. // check if we are running upgrade.php
  18. if (defined("UPGRADING")) {
  19. security_tools_protect_upgrade();
  20. }
  21. // extend views
  22. elgg_extend_view("input/password", "security_tools/input_password", 100);
  23. // register page handlers
  24. elgg_register_page_handler("email_change_confirmation", "security_tools_email_change_confirmation_page_handler");
  25. // register events
  26. elgg_register_event_handler("make_admin", "user", "security_tools_make_admin_handler");
  27. elgg_register_event_handler("remove_admin", "user", "security_tools_remove_admin_handler");
  28. elgg_register_event_handler("ban", "user", "security_tools_ban_user_handler");
  29. elgg_register_event_handler("unban", "user", "security_tools_unban_user_handler");
  30. // register plugin hooks
  31. elgg_unregister_plugin_hook_handler("usersettings:save", "user", "_elgg_set_user_email");
  32. elgg_unregister_plugin_hook_handler("usersettings:save", "user", "_elgg_set_user_password");
  33. elgg_register_plugin_hook_handler("usersettings:save", "user", "security_tools_usersettings_save_handler");
  34. }