From 1a219da922df1afc87719d4e8d8110c65cf09446 Mon Sep 17 00:00:00 2001
From: pdontthink
Date: Tue, 11 Mar 2008 04:15:58 +0000
Subject: [PATCH] Bug Report plugin: general cleanup per SM plugin specs,
elimination of HTML output from the core, make it show SM version number
again...
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@13028 7612ce4b-ef26-0410-bec9-ea0150e637f0
---
plugins/bug_report/README | 42 +++--
plugins/bug_report/bug_report.php | 121 ++++--------
plugins/bug_report/config_default.php | 2 +-
plugins/bug_report/functions.php | 114 ++++++++---
plugins/bug_report/index.php | 3 +-
plugins/bug_report/setup.php | 87 +++++----
plugins/bug_report/show_system_specs.php | 49 ++---
plugins/bug_report/system_specs.php | 178 ++++++++++--------
.../bug_report/templates/default/index.php | 18 ++
.../templates/default/system_specs.tpl | 34 ++++
.../bug_report/templates/default/usage.tpl | 129 +++++++++++++
plugins/bug_report/templates/index.php | 18 ++
12 files changed, 531 insertions(+), 264 deletions(-)
create mode 100644 plugins/bug_report/templates/default/index.php
create mode 100644 plugins/bug_report/templates/default/system_specs.tpl
create mode 100644 plugins/bug_report/templates/default/usage.tpl
create mode 100644 plugins/bug_report/templates/index.php
diff --git a/plugins/bug_report/README b/plugins/bug_report/README
index 1804d017..89cf9e99 100644
--- a/plugins/bug_report/README
+++ b/plugins/bug_report/README
@@ -1,4 +1,4 @@
-Bug Reporter
+Bug Reporter Plugin For SquirrelMail
Need to submit a bug? Need to know valuable system information? Need
to be accurate? This should do it for you.
@@ -35,23 +35,35 @@ Future Work
Installation
============
-You must configure plugin before you enable it in your SquirrelMail
-installation. Plugin's configuration is stored in
-config/bug_report_config.php or plugins/bug_report/config.php files.
-Configuration options can be found in plugins/bug_report/config_default.php
-file.
+You must configure this plugin before you enable it in your SquirrelMail
+installation. The plugin's configuration is stored in one of the
+following files:
-If both configuration files are present, plugin uses the one in
-config/ directory.
+ config/bug_report_config.php
+ plugins/bug_report/config.php files.
-By default plugin is visible only to users listed in
-plugins/bug_report/admins or config/admins file or only to user
-that owns main SquirrelMail configuration file. Other users can use
-bug_report plugin, if you set administrator's email in plugin's
-configuration and set $bug_report_allow_users option to true.
+The default configuration options can be found in (copy this file to
+one of the above locations and then edit it to suit you):
+
+ plugins/bug_report/config_default.php
+
+If both configuration files are present, this plugin uses the one in
+the config/ directory.
+
+By default, the plugin will only be visible to users listed in the
+following files:
+
+ plugins/bug_report/admins
+ config/admins
+
+... or only to the user that owns the main SquirrelMail configuration
+file. Other users can use the bug_report plugin if you set a value for
+the administrator's email address in the plugin configuration file and
+set $bug_report_allow_users option to TRUE.
+
+Once the plugin is configured, go back to the main SquirrelMail
+directory, run "configure" and enable the plugin.
-Once plugin is configured, go back to the main directory, run configure
-and enable the plugin.
Credits
=======
diff --git a/plugins/bug_report/bug_report.php b/plugins/bug_report/bug_report.php
index 9b24726a..2e4354c1 100644
--- a/plugins/bug_report/bug_report.php
+++ b/plugins/bug_report/bug_report.php
@@ -7,7 +7,7 @@
* a button to show the bug report mail message in order to actually
* send it.
*
- * @copyright © 1999-2007 The SquirrelMail Project Team
+ * @copyright © 1999-2008 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @package plugins
@@ -15,27 +15,38 @@
*/
-/**
- * Include the SquirrelMail initialization file.
- */
+// This is the bug_report options page
+//
+define('PAGE_NAME', 'bug_report_options');
+
+
+// Include the SquirrelMail initialization file.
+//
require('../../include/init.php');
-/** load form functions */
-require_once(SM_PATH . 'functions/forms.php');
-/** load plugin functions */
+
+
+// load plugin functions
+//
require_once(SM_PATH . 'plugins/bug_report/functions.php');
+
displayPageHeader($color);
-/** is bug_report plugin disabled or called by wrong user */
+
+// error out when bug_report plugin is disabled
+// or is called by the wrong user
+//
if (! is_plugin_enabled('bug_report') || ! bug_report_check_user()) {
error_box(_("Plugin is disabled."));
$oTemplate->display('footer.tpl');
exit();
}
-/** get system specs */
+
+// get system specs
+//
require_once(SM_PATH . 'plugins/bug_report/system_specs.php');
-global $body;
+list($body, $warnings, $corrections) = get_system_specs();
$body_top = "I am subscribed to the this mailing list.\n" .
" (applies when you are sending email to SquirrelMail mailing list)\n".
@@ -53,82 +64,18 @@ $body_top = "I am subscribed to the this mailing list.\n" .
"(Optional) I got really bored and here's a fix:\n\n\n" .
"----------------------------------------------\n\n";
-$body = htmlspecialchars($body_top) . $body;
+$body = $body_top . $body;
-?>
-
-
- '._("Submit a Bug Report").'','center',$color[0]); ?>
-
+global $oTemplate, $bug_report_admin_email;
+if (!empty($bug_report_admin_email)) {
+ $oTemplate->assign('admin_email', $bug_report_admin_email);
+}
+$oTemplate->assign('message_body', $body);
+$oTemplate->assign('title_bg_color', $color[0]);
+$oTemplate->assign('warning_messages', $warnings);
+$oTemplate->assign('correction_messages', $corrections);
+$oTemplate->assign('warning_count', sizeof($warnings));
+$oTemplate->assign('version', SM_VERSION);
+$oTemplate->display('plugins/bug_report/usage.tpl');
+$oTemplate->display('footer.tpl');
-';
-echo _("Show System Specifications");
-echo "
\n\n";
-echo '';
-echo _("Before you send your bug report, please make sure to check this checklist for any common problems.");
-echo "
\n";
-
-echo '';
-echo '- ';
-printf(_("Make sure that you are running the most recent copy of %s. You are currently using version %s."), 'SquirrelMail', $version);
-echo "
\n";
-
-echo '- ';
-printf(_("Check to see if your bug is already listed in the %sBug List%s on SourceForge. If it is, we already know about it and are trying to fix it."), '', '');
-echo "
\n";
-
-echo '- ';
-echo _("Try to make sure that you can repeat it. If the bug happens sporatically, try to document what you did when it happened. If it always occurs when you view a specific message, keep that message around so maybe we can see it.");
-echo "
\n";
-
-echo '- ';
-printf(_("If there were warnings displayed above, try to resolve them yourself. Read the guides in the %s directory where SquirrelMail was installed."), 'doc/');
-echo "
\n";
-echo "
\n";
-
-echo '';
-echo _("Pressing the button below will start a mail message to the developers of SquirrelMail that will contain a lot of information about your system, your browser, how SquirrelMail is set up, and your IMAP server. It will also prompt you for information. Just fill out the sections at the top. If you like, you can scroll down in the message to see what else is being sent.");
-echo "
\n";
-
-echo '';
-echo _("Please make sure to fill out as much information as you possibly can to give everyone a good chance of finding and removing the bug. Submitting your bug like this will not have it automatically added to the bug list on SourceForge, but someone who gets your message may add it for you.");
-echo "
\n";
-?>
-
-
-