Fix test that was never working, and was further confused by the change to the PAGE_N...
[squirrelmail.git] / plugins / bug_report / setup.php
CommitLineData
15e6162e 1<?php
15e6162e 2/**
2329d86d 3 * Bug Report plugin - setup script
15e6162e 4 *
4b5049de 5 * @copyright &copy; 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 17function squirrelmail_plugin_init_bug_report() {
18 global $squirrelmail_plugin_hooks;
19
09b143cc 20 $squirrelmail_plugin_hooks['template_construct_page_header.tpl']['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 30function 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
09b143cc 38 global $oTemplate;
39 $nbsp = $oTemplate->fetch('non_breaking_space.tpl');
40 $output = makeInternalLink('plugins/bug_report/bug_report.php', _("Bug"), '')
41 . $nbsp . $nbsp;
42 return array('menuline' => $output);
15e6162e 43}
44
2a880038 45/**
46 * Loads bug report options
47 * @access private
48 */
d79e01f5 49function bug_report_load() {
50 global $username, $data_dir;
51 global $bug_report_visible;
15e6162e 52
e1df9174 53 $bug_report_visible = (bool) getPref($data_dir, $username, 'bug_report_visible',false);
15e6162e 54}
55
2a880038 56/**
e1df9174 57 * Register bug report option block
58 * @since 1.5.1
2a880038 59 * @access private
60 */
e1df9174 61function bug_report_block() {
2329d86d 62 include_once(SM_PATH.'plugins/bug_report/functions.php');
63 if (bug_report_check_user()) {
64 global $optpage_data;
65 $optpage_data['grps']['bug_report'] = _("Bug Reports");
66 $optionValues = array();
67 // FIXME: option needs refresh in SMOPT_REFRESH_RIGHT
68 // (menulink is processed before options are saved/loaded)
69 $optionValues[] = array(
70 'name' => 'bug_report_visible',
71 'caption' => _("Show button in toolbar"),
72 'type' => SMOPT_TYPE_BOOLEAN,
73 'refresh' => SMOPT_REFRESH_ALL,
74 'initial_value' => false
75 );
76 $optpage_data['vals']['bug_report'] = $optionValues;
77 }
15e6162e 78}