setup.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. /**
  3. * Bug Report plugin - setup script
  4. *
  5. * @copyright &copy; 1999-2007 The SquirrelMail Project Team
  6. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  7. * @version $Id$
  8. * @package plugins
  9. * @subpackage bug_report
  10. */
  11. /**
  12. * Initialize the bug report plugin
  13. * @return void
  14. * @access private
  15. */
  16. function squirrelmail_plugin_init_bug_report() {
  17. global $squirrelmail_plugin_hooks;
  18. $squirrelmail_plugin_hooks['template_construct_page_header.tpl']['bug_report'] = 'bug_report_button';
  19. $squirrelmail_plugin_hooks['loading_prefs']['bug_report'] = 'bug_report_load';
  20. $squirrelmail_plugin_hooks['optpage_loadhook_display']['bug_report'] = 'bug_report_block';
  21. }
  22. /**
  23. * Show the button in the main bar
  24. * @access private
  25. */
  26. function bug_report_button() {
  27. include_once(SM_PATH.'plugins/bug_report/functions.php');
  28. global $bug_report_visible;
  29. if (! $bug_report_visible || ! bug_report_check_user()) {
  30. return;
  31. }
  32. global $oTemplate, $nbsp;
  33. $output = makeInternalLink('plugins/bug_report/bug_report.php', _("Bug"), '')
  34. . $nbsp . $nbsp;
  35. return array('menuline' => $output);
  36. }
  37. /**
  38. * Loads bug report options
  39. * @access private
  40. */
  41. function bug_report_load() {
  42. global $username, $data_dir;
  43. global $bug_report_visible;
  44. $bug_report_visible = (bool) getPref($data_dir, $username, 'bug_report_visible',false);
  45. }
  46. /**
  47. * Register bug report option block
  48. * @since 1.5.1
  49. * @access private
  50. */
  51. function bug_report_block() {
  52. include_once(SM_PATH.'plugins/bug_report/functions.php');
  53. if (bug_report_check_user()) {
  54. global $optpage_data;
  55. $optpage_data['grps']['bug_report'] = _("Bug Reports");
  56. $optionValues = array();
  57. // FIXME: option needs refresh in SMOPT_REFRESH_RIGHT
  58. // (menulink is processed before options are saved/loaded)
  59. $optionValues[] = array(
  60. 'name' => 'bug_report_visible',
  61. 'caption' => _("Show button in toolbar"),
  62. 'type' => SMOPT_TYPE_BOOLEAN,
  63. 'refresh' => SMOPT_REFRESH_ALL,
  64. 'initial_value' => false
  65. );
  66. $optpage_data['vals']['bug_report'] = $optionValues;
  67. }
  68. }