tools.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. /**
  3. * Elgg user tools settings
  4. *
  5. * @package Elgg
  6. * @subpackage Core
  7. */
  8. // Only logged in users
  9. elgg_gatekeeper();
  10. // Make sure we don't open a security hole ...
  11. if ((!elgg_get_page_owner_entity()) || (!elgg_get_page_owner_entity()->canEdit())) {
  12. register_error(elgg_echo('noaccess'));
  13. forward('/');
  14. }
  15. $plugin_id = get_input("plugin_id");
  16. if (empty($plugin_id)) {
  17. register_error(elgg_echo('ElggPlugin:MissingID'));
  18. forward(REFERER);
  19. }
  20. $plugin = elgg_get_plugin_from_id($plugin_id);
  21. if (!$plugin) {
  22. register_error(elgg_echo('PluginException:InvalidID', array($plugin_id)));
  23. forward(REFERER);
  24. }
  25. if (elgg_language_key_exists($plugin_id . ':usersettings:title')) {
  26. $title = elgg_echo($plugin_id . ':usersettings:title');
  27. } else {
  28. $title = $plugin->getManifest()->getName();
  29. }
  30. $content = elgg_view_form('plugins/usersettings/save', array(), array('entity' => $plugin));
  31. $params = array(
  32. 'content' => $content,
  33. 'title' => $title,
  34. );
  35. $body = elgg_view_layout('one_sidebar', $params);
  36. echo elgg_view_page($title, $body);