X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=plugins%2Fbug_report%2Fsetup.php;h=3247ba4d5041983d44d9051d88d44f2190916ecf;hb=811fdb31473e8d0c8ab6bde5299a3560bdab424b;hp=7c9ed9ac7e528d314af6f7ac5f7ffeb2c7f236bb;hpb=04f6008a45f667d2ce38925f5b2dc4b56076d28e;p=squirrelmail.git diff --git a/plugins/bug_report/setup.php b/plugins/bug_report/setup.php index 7c9ed9ac..3247ba4d 100644 --- a/plugins/bug_report/setup.php +++ b/plugins/bug_report/setup.php @@ -3,74 +3,74 @@ /** * setup.php * - * Copyright (c) 1999-2002 The SquirrelMail development team - * Licensed under the GNU GPL. For full terms see the file COPYING. + * This is a standard SquirrelMail 1.2 API for plugins. * - * This is a standard Squirrelmail-1.2 API for plugins. - * - * $Id$ + * @copyright © 1999-2005 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + * @version $Id$ + * @package plugins + * @subpackage bug_report */ -/* This button fills out a form with your setup information already - gathered -- all you have to do is type. */ - - -/* Initialize the bug report plugin */ +/** + * Initialize the bug report plugin + * @return void + * @access private + */ function squirrelmail_plugin_init_bug_report() { global $squirrelmail_plugin_hooks; $squirrelmail_plugin_hooks['menuline']['bug_report'] = 'bug_report_button'; - $squirrelmail_plugin_hooks['options_display_inside']['bug_report'] = 'bug_report_options'; - $squirrelmail_plugin_hooks['options_display_save']['bug_report'] = 'bug_report_save'; $squirrelmail_plugin_hooks['loading_prefs']['bug_report'] = 'bug_report_load'; + $squirrelmail_plugin_hooks['optpage_loadhook_display']['bug_report'] = 'bug_report_block'; } -/* Show the button in the main bar */ +/** + * Show the button in the main bar + * @access private + */ function bug_report_button() { - global $color, $bug_report_visible; + global $bug_report_visible; if (! $bug_report_visible) { return; } - displayInternalLink('plugins/bug_report/bug_report.php', 'Bug', ''); + displayInternalLink('plugins/bug_report/bug_report.php', _("Bug"), ''); echo "  \n"; } - -function bug_report_save() { - global $username,$data_dir; - - if ( (float)substr(PHP_VERSION,0,3) < 4.1 ) { - global $_POST; - } - - if(isset($_POST['bug_report_bug_report_visible'])) { - setPref($data_dir, $username, 'bug_report_visible', '1'); - } else { - setPref($data_dir, $username, 'bug_report_visible', ''); - } -} - - +/** + * Loads bug report options + * @access private + */ function bug_report_load() { global $username, $data_dir; global $bug_report_visible; - $bug_report_visible = getPref($data_dir, $username, 'bug_report_visible'); + $bug_report_visible = (bool) getPref($data_dir, $username, 'bug_report_visible',false); } - -function bug_report_options() { - global $bug_report_visible; - - echo '' . _("Bug Reports:") . "\n" . - ' ' . _("Show button in toolbar") . "\n"; +/** + * Register bug report option block + * @since 1.5.1 + * @access private + */ +function bug_report_block() { + global $optpage_data; + $optpage_data['grps']['bug_report'] = _("Bug Reports"); + $optionValues = array(); + // FIXME: option needs refresh in SMOPT_REFRESH_RIGHT + // (menulink is processed before options are saved/loaded) + $optionValues[] = array( + 'name' => 'bug_report_visible', + 'caption' => _("Show button in toolbar"), + 'type' => SMOPT_TYPE_BOOLEAN, + 'refresh' => SMOPT_REFRESH_ALL, + 'initial_value' => false + ); + $optpage_data['vals']['bug_report'] = $optionValues; } -?> +?> \ No newline at end of file