Add PHP5-style constructor
[squirrelmail.git] / plugins / bug_report / setup.php
index 18be67b65184d295736ff3b3ffe4430e1785a7d0..28a7aca5cc36f83d81f62b219afe92708d50289c 100644 (file)
@@ -1,93 +1,82 @@
 <?php
-
 /**
- * setup.php
- *
- * Copyright (c) 1999-2005 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.
+ * Bug Report plugin - setup script
  *
+ * @copyright 1999-2016 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
+ *
  * @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['template_construct_page_header.tpl']['bug_report']
+        = 'bug_report_button';
+    $squirrelmail_plugin_hooks['optpage_loadhook_display']['bug_report']
+        = 'bug_report_block';
 }
 
 
 /**
  * Show the button in the main bar
+ *
  * @access private
+ *
  */
 function bug_report_button() {
-    global $bug_report_visible;
-
-    if (! $bug_report_visible) {
-        return;
-    }
-
-    displayInternalLink('plugins/bug_report/bug_report.php', _("Bug"), '');
-    echo "&nbsp;&nbsp;\n";
+    include_once(SM_PATH . 'plugins/bug_report/functions.php');
+    return bug_report_button_do();
 }
 
 /**
- * Saves bug report options
+ *
+ * Register bug report option block
+ *
+ * @since 1.5.1
+ *
  * @access private
+ *
  */
-function bug_report_save() {
-    global $username,$data_dir;
-
-    if( sqgetGlobalVar('bug_report_bug_report_visible', $vis, SQ_POST) ) {
-        setPref($data_dir, $username, 'bug_report_visible', '1');
-    } else {
-        setPref($data_dir, $username, 'bug_report_visible', '');
-    }
+function bug_report_block() {
+    include_once(SM_PATH.'plugins/bug_report/functions.php');
+    bug_report_block_do();
 }
 
 /**
- * Loads bug report options
- * @access private
+ * Returns info about this plugin
+ *
  */
-function bug_report_load() {
-    global $username, $data_dir;
-    global $bug_report_visible;
+function bug_report_info() { 
+    return array(
+        'english_name' => 'Bug Report',
+        'authors' => array(
+            'SquirrelMail Team' => array(),
+        ),
+        'version' => 'CORE',
+        'required_sm_version' => 'CORE',
+        'requires_configuration' => 0,
+        'summary' => 'Helps with sending bug reports to the SquirrelMail Developers.  Collects a lot of useful information about your system.',
+        'details' => 'When people stumble across a bug, which may happen in a work-in-progress, often times they would like to help out the software and get rid of the bug.  Sometimes, these people don\'t know much about the system and how it is set up -- they know enough to make the bug happen for them.  This bug report plugin is designed to gather all of the non-private information for the user automatically, so that the user doesn\'t need to know more than how to trigger the bug.',
+    );
+} 
+
 
-    $bug_report_visible = getPref($data_dir, $username, 'bug_report_visible');
-}
 
 /**
- * Adds bug report options to display page
- * @access private
+ * Returns version info about this plugin
+ *
  */
-function bug_report_options() {
-    global $bug_report_visible;
-
-    echo '<tr>' . html_tag('td',_("Bug Reports:"),'right','','style="white-space: nowrap;"') . "\n" .
-         '<td><input name="bug_report_bug_report_visible" type="checkbox"';
-    if ($bug_report_visible) {
-        echo ' checked="checked"';
-    }
-    echo ' /> ' . _("Show button in toolbar") . "</td></tr>\n";
-
-    echo '<tr><td></td>' .
-         '<td><a href="' . SM_PATH . 'plugins/bug_report/show_system_specs.php" target="_blank"><small>' . _("Show system specs") . '</small></a></td></tr>';
-}
-
-?>
\ No newline at end of file
+function bug_report_version() {
+    $info = bug_report_info();
+    return $info['version'];
+}