setup.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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['menuline']['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. displayInternalLink('plugins/bug_report/bug_report.php', _("Bug"), '');
  33. echo "&nbsp;&nbsp;\n";
  34. }
  35. /**
  36. * Loads bug report options
  37. * @access private
  38. */
  39. function bug_report_load() {
  40. global $username, $data_dir;
  41. global $bug_report_visible;
  42. $bug_report_visible = (bool) getPref($data_dir, $username, 'bug_report_visible',false);
  43. }
  44. /**
  45. * Register bug report option block
  46. * @since 1.5.1
  47. * @access private
  48. */
  49. function bug_report_block() {
  50. include_once(SM_PATH.'plugins/bug_report/functions.php');
  51. if (bug_report_check_user()) {
  52. global $optpage_data;
  53. $optpage_data['grps']['bug_report'] = _("Bug Reports");
  54. $optionValues = array();
  55. // FIXME: option needs refresh in SMOPT_REFRESH_RIGHT
  56. // (menulink is processed before options are saved/loaded)
  57. $optionValues[] = array(
  58. 'name' => 'bug_report_visible',
  59. 'caption' => _("Show button in toolbar"),
  60. 'type' => SMOPT_TYPE_BOOLEAN,
  61. 'refresh' => SMOPT_REFRESH_ALL,
  62. 'initial_value' => false
  63. );
  64. $optpage_data['vals']['bug_report'] = $optionValues;
  65. }
  66. }