Allow plugins to require CORE plugins
[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
551c7b53 38 global $oTemplate, $nbsp;
09b143cc 39 $output = makeInternalLink('plugins/bug_report/bug_report.php', _("Bug"), '')
40 . $nbsp . $nbsp;
41 return array('menuline' => $output);
15e6162e 42}
43
2a880038 44/**
2a880038 45 * Loads bug report options
46 * @access private
47 */
d79e01f5 48function bug_report_load() {
49 global $username, $data_dir;
50 global $bug_report_visible;
15e6162e 51
e1df9174 52 $bug_report_visible = (bool) getPref($data_dir, $username, 'bug_report_visible',false);
15e6162e 53}
54
2a880038 55/**
e1df9174 56 * Register bug report option block
57 * @since 1.5.1
2a880038 58 * @access private
59 */
e1df9174 60function bug_report_block() {
2329d86d 61 include_once(SM_PATH.'plugins/bug_report/functions.php');
62 if (bug_report_check_user()) {
63 global $optpage_data;
64 $optpage_data['grps']['bug_report'] = _("Bug Reports");
65 $optionValues = array();
66 // FIXME: option needs refresh in SMOPT_REFRESH_RIGHT
67 // (menulink is processed before options are saved/loaded)
68 $optionValues[] = array(
69 'name' => 'bug_report_visible',
70 'caption' => _("Show button in toolbar"),
71 'type' => SMOPT_TYPE_BOOLEAN,
72 'refresh' => SMOPT_REFRESH_ALL,
73 'initial_value' => false
74 );
75 $optpage_data['vals']['bug_report'] = $optionValues;
76 }
15e6162e 77}