copyright update
[squirrelmail.git] / plugins / bug_report / setup.php
1 <?php
2 /**
3 * Bug Report plugin - setup script
4 *
5 * @copyright &copy; 1999-2006 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 /**
13 * Initialize the bug report plugin
14 * @return void
15 * @access private
16 */
17 function squirrelmail_plugin_init_bug_report() {
18 global $squirrelmail_plugin_hooks;
19
20 $squirrelmail_plugin_hooks['menuline']['bug_report'] = 'bug_report_button';
21 $squirrelmail_plugin_hooks['loading_prefs']['bug_report'] = 'bug_report_load';
22 $squirrelmail_plugin_hooks['optpage_loadhook_display']['bug_report'] = 'bug_report_block';
23 }
24
25
26 /**
27 * Show the button in the main bar
28 * @access private
29 */
30 function bug_report_button() {
31 include_once(SM_PATH.'plugins/bug_report/functions.php');
32 global $bug_report_visible;
33
34 if (! $bug_report_visible || ! bug_report_check_user()) {
35 return;
36 }
37
38 displayInternalLink('plugins/bug_report/bug_report.php', _("Bug"), '');
39 echo "&nbsp;&nbsp;\n";
40 }
41
42 /**
43 * Loads bug report options
44 * @access private
45 */
46 function bug_report_load() {
47 global $username, $data_dir;
48 global $bug_report_visible;
49
50 $bug_report_visible = (bool) getPref($data_dir, $username, 'bug_report_visible',false);
51 }
52
53 /**
54 * Register bug report option block
55 * @since 1.5.1
56 * @access private
57 */
58 function bug_report_block() {
59 include_once(SM_PATH.'plugins/bug_report/functions.php');
60 if (bug_report_check_user()) {
61 global $optpage_data;
62 $optpage_data['grps']['bug_report'] = _("Bug Reports");
63 $optionValues = array();
64 // FIXME: option needs refresh in SMOPT_REFRESH_RIGHT
65 // (menulink is processed before options are saved/loaded)
66 $optionValues[] = array(
67 'name' => 'bug_report_visible',
68 'caption' => _("Show button in toolbar"),
69 'type' => SMOPT_TYPE_BOOLEAN,
70 'refresh' => SMOPT_REFRESH_ALL,
71 'initial_value' => false
72 );
73 $optpage_data['vals']['bug_report'] = $optionValues;
74 }
75 }
76
77 ?>