15e6162e |
1 | <?php |
15e6162e |
2 | /** |
2329d86d |
3 | * Bug Report plugin - setup script |
15e6162e |
4 | * |
4b5049de |
5 | * @copyright © 1999-2007 The SquirrelMail Project Team |
4b4abf93 |
6 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
2a880038 |
7 | * @version $Id$ |
ea5f4b8e |
8 | * @package plugins |
9 | * @subpackage bug_report |
15e6162e |
10 | */ |
11 | |
ea5f4b8e |
12 | /** |
13 | * Initialize the bug report plugin |
14 | * @return void |
2a880038 |
15 | * @access private |
ea5f4b8e |
16 | */ |
d79e01f5 |
17 | function squirrelmail_plugin_init_bug_report() { |
18 | global $squirrelmail_plugin_hooks; |
19 | |
20 | $squirrelmail_plugin_hooks['menuline']['bug_report'] = 'bug_report_button'; |
d79e01f5 |
21 | $squirrelmail_plugin_hooks['loading_prefs']['bug_report'] = 'bug_report_load'; |
e1df9174 |
22 | $squirrelmail_plugin_hooks['optpage_loadhook_display']['bug_report'] = 'bug_report_block'; |
15e6162e |
23 | } |
24 | |
25 | |
2a880038 |
26 | /** |
27 | * Show the button in the main bar |
28 | * @access private |
29 | */ |
d79e01f5 |
30 | function bug_report_button() { |
2329d86d |
31 | include_once(SM_PATH.'plugins/bug_report/functions.php'); |
ce68b76b |
32 | global $bug_report_visible; |
d79e01f5 |
33 | |
2329d86d |
34 | if (! $bug_report_visible || ! bug_report_check_user()) { |
d79e01f5 |
35 | return; |
36 | } |
37 | |
2a880038 |
38 | displayInternalLink('plugins/bug_report/bug_report.php', _("Bug"), ''); |
d79e01f5 |
39 | echo " \n"; |
15e6162e |
40 | } |
41 | |
2a880038 |
42 | /** |
43 | * Loads bug report options |
44 | * @access private |
45 | */ |
d79e01f5 |
46 | function bug_report_load() { |
47 | global $username, $data_dir; |
48 | global $bug_report_visible; |
15e6162e |
49 | |
e1df9174 |
50 | $bug_report_visible = (bool) getPref($data_dir, $username, 'bug_report_visible',false); |
15e6162e |
51 | } |
52 | |
2a880038 |
53 | /** |
e1df9174 |
54 | * Register bug report option block |
55 | * @since 1.5.1 |
2a880038 |
56 | * @access private |
57 | */ |
e1df9174 |
58 | function bug_report_block() { |
2329d86d |
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 | } |
15e6162e |
75 | } |