| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * setup.php |
| 5 | * |
| 6 | * Copyright (c) 1999-2005 The SquirrelMail development team |
| 7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 8 | * |
| 9 | * This is a standard Squirrelmail-1.2 API for plugins. |
| 10 | * |
| 11 | * @version $Id$ |
| 12 | * @package plugins |
| 13 | * @subpackage bug_report |
| 14 | */ |
| 15 | |
| 16 | /* This button fills out a form with your setup information already |
| 17 | gathered -- all you have to do is type. */ |
| 18 | |
| 19 | |
| 20 | /** |
| 21 | * Initialize the bug report plugin |
| 22 | * @return void |
| 23 | * @access private |
| 24 | */ |
| 25 | function squirrelmail_plugin_init_bug_report() { |
| 26 | global $squirrelmail_plugin_hooks; |
| 27 | |
| 28 | $squirrelmail_plugin_hooks['menuline']['bug_report'] = 'bug_report_button'; |
| 29 | $squirrelmail_plugin_hooks['options_display_inside']['bug_report'] = 'bug_report_options'; |
| 30 | $squirrelmail_plugin_hooks['options_display_save']['bug_report'] = 'bug_report_save'; |
| 31 | $squirrelmail_plugin_hooks['loading_prefs']['bug_report'] = 'bug_report_load'; |
| 32 | } |
| 33 | |
| 34 | |
| 35 | /** |
| 36 | * Show the button in the main bar |
| 37 | * @access private |
| 38 | */ |
| 39 | function bug_report_button() { |
| 40 | global $bug_report_visible; |
| 41 | |
| 42 | if (! $bug_report_visible) { |
| 43 | return; |
| 44 | } |
| 45 | |
| 46 | displayInternalLink('plugins/bug_report/bug_report.php', _("Bug"), ''); |
| 47 | echo " \n"; |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Saves bug report options |
| 52 | * @access private |
| 53 | */ |
| 54 | function bug_report_save() { |
| 55 | global $username,$data_dir; |
| 56 | |
| 57 | if( sqgetGlobalVar('bug_report_bug_report_visible', $vis, SQ_POST) ) { |
| 58 | setPref($data_dir, $username, 'bug_report_visible', '1'); |
| 59 | } else { |
| 60 | setPref($data_dir, $username, 'bug_report_visible', ''); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Loads bug report options |
| 66 | * @access private |
| 67 | */ |
| 68 | function bug_report_load() { |
| 69 | global $username, $data_dir; |
| 70 | global $bug_report_visible; |
| 71 | |
| 72 | $bug_report_visible = getPref($data_dir, $username, 'bug_report_visible'); |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * Adds bug report options to display page |
| 77 | * @access private |
| 78 | */ |
| 79 | function bug_report_options() { |
| 80 | global $bug_report_visible; |
| 81 | |
| 82 | echo '<tr>' . html_tag('td',_("Bug Reports:"),'right','','style="white-space: nowrap;"') . "\n" . |
| 83 | '<td><input name="bug_report_bug_report_visible" type="checkbox"'; |
| 84 | if ($bug_report_visible) { |
| 85 | echo ' checked="checked"'; |
| 86 | } |
| 87 | echo ' /> ' . _("Show button in toolbar") . "</td></tr>\n"; |
| 88 | |
| 89 | echo '<tr><td></td>' . |
| 90 | '<td><a href="' . SM_PATH . 'plugins/bug_report/show_system_specs.php" target="_blank"><small>' . _("Show system specs") . '</small></a></td></tr>'; |
| 91 | } |
| 92 | |
| 93 | ?> |