-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.
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
=======
* 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
*/
-/**
- * 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".
"(Optional) I got really bored and here's a fix:\n\n\n" .
"----------------------------------------------\n\n";
-$body = htmlspecialchars($body_top) . $body;
+$body = $body_top . $body;
-?>
- <br />
- <table width="95%" align="center" border="0" cellpadding="2" cellspacing="0"><tr>
- <?php echo html_tag('td','<b>'._("Submit a Bug Report").'</b>','center',$color[0]); ?>
- </tr></table>
+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');
-<?php
-echo $warning_html;
-
-echo '<p><a href="show_system_specs.php" target="_blank">';
-echo _("Show System Specifications");
-echo "</a></p>\n\n";
-echo '<p><big>';
-echo _("Before you send your bug report, please make sure to check this checklist for any common problems.");
-echo "</big></p>\n";
-
-echo '<ul>';
-echo '<li>';
-printf(_("Make sure that you are running the most recent copy of %s. You are currently using version %s."), '<a href="http://squirrelmail.org/" target="_blank">SquirrelMail</a>', $version);
-echo "</li>\n";
-
-echo '<li>';
-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."), '<a href="http://sourceforge.net/bugs/?group_id=311" target="_blank">', '</a>');
-echo "</li>\n";
-
-echo '<li>';
-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 "</li>\n";
-
-echo '<li>';
-printf(_("If there were warnings displayed above, try to resolve them yourself. Read the guides in the %s directory where SquirrelMail was installed."), '<tt>doc/</tt>');
-echo "</li>\n";
-echo "</ul>\n";
-
-echo '<p>';
-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 "</p>\n";
-
-echo '<p>';
-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 "</p>\n";
-?>
- <form action="../../src/compose.php" method=post>
- <table align="center" border="0">
- <tr>
- <td>
- <?php echo _("This bug involves:")
- .' <select name="send_to">';
- if (! empty($bug_report_admin_email)) {
- // if admin's email is set - add 'report to admin' option and make it default one
- echo '<option value="' . htmlspecialchars($bug_report_admin_email) .'" selected="selected">'
- ._("my email account") .'</option>';
- }
- ?>
- <option value="squirrelmail-users@lists.sourceforge.net"><?php
- echo _("the general program"); ?></option>
- <option value="squirrelmail-plugins@lists.sourceforge.net"><?php
- echo _("a specific plugin"); ?></option>
- </select>
- </td>
- </tr>
- <tr>
- <td align="center">
-<?php
-echo addHidden("send_to_cc","");
-echo addHidden("send_to_bcc","");
-echo addHidden("subject","Bug Report");
-echo addHidden("body",$body);
-echo addSubmit(_("Start Bug Report Form"));
-?>
- </td>
- </tr>
- </table>
- </form>
- <br />
- </body>
-</html>
* Plugin's site configuration should be stored in config/bug_report_config.php
* or plugins/bug_report/config.php file.
*
- * @copyright © 2005-2007 The SquirrelMail Project Team
+ * @copyright © 2005-2008 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @package plugins
/**
* functions for bug_report plugin
*
- * @copyright © 2004-2007 The SquirrelMail Project Team
+ * @copyright © 2004-2008 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @package plugins
/**
- * do not allow to call this file directly
+ * Initializes the Bug Report plugin
+ *
+ * @return boolean FALSE if the plugin is not correctly configured
+ * or an error in its setup is found; TRUE otherwise
+ *
+ * @since 1.5.2
+ *
*/
-if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__) {
- header("Location: ../../src/login.php");
- die();
-}
+function bug_report_init() {
-/** Declare plugin configuration vars */
-global $bug_report_admin_email, $bug_report_allow_users;
+ // Declare plugin configuration vars
+ //
+ global $bug_report_admin_email, $bug_report_allow_users;
-/** Load default config */
-if (file_exists(SM_PATH . 'plugins/bug_report/config_default.php')) {
- include_once (SM_PATH . 'plugins/bug_report/config_default.php');
-} else {
- // default config was removed.
- $bug_report_admin_email = '';
- $bug_report_allow_users = false;
-}
+ // Load default config
+ //
+ if (file_exists(SM_PATH . 'plugins/bug_report/config_default.php')) {
+ include_once (SM_PATH . 'plugins/bug_report/config_default.php');
+ } else {
+ // default config was removed.
+ $bug_report_admin_email = '';
+ $bug_report_allow_users = false;
+ }
+
+ // Load site config
+ //
+ if (file_exists(SM_PATH . 'config/bug_report_config.php')) {
+ include_once (SM_PATH . 'config/bug_report_config.php');
+ } elseif (file_exists(SM_PATH . 'plugins/bug_report/config.php')) {
+ include_once (SM_PATH . 'plugins/bug_report/config.php');
+ }
-/** Load site config */
-if (file_exists(SM_PATH . 'config/bug_report_config.php')) {
- include_once (SM_PATH . 'config/bug_report_config.php');
-} elseif (file_exists(SM_PATH . 'plugins/bug_report/config.php')) {
- include_once (SM_PATH . 'plugins/bug_report/config.php');
}
+
/**
* Checks if user can use bug_report plugin
+ *
* @return boolean
+ *
* @since 1.5.1
+ *
*/
function bug_report_check_user() {
global $username, $bug_report_allow_users, $bug_report_admin_email;
+ bug_report_init();
+
if (file_exists(SM_PATH . 'plugins/bug_report/admins')) {
$auths = file(SM_PATH . 'plugins/bug_report/admins');
array_walk($auths, 'bug_report_array_trim');
return ($auth);
}
+
/**
* Removes whitespace from array values
+ *
* @param string $value array value that has to be trimmed
* @param string $key array key
+ *
* @since 1.5.1
+ *
* @todo code reuse. create generic sm function.
+ *
* @access private
+ *
*/
function bug_report_array_trim(&$value,$key) {
- $value=trim($value);
+ $value = trim($value);
+}
+
+
+/**
+ * Show the button in the main bar
+ *
+ * @access private
+ *
+ */
+function bug_report_button_do() {
+ global $username, $data_dir;
+ $bug_report_visible = getPref($data_dir, $username, 'bug_report_visible', FALSE);
+
+ if (! $bug_report_visible || ! bug_report_check_user()) {
+ return;
+ }
+
+ global $oTemplate, $nbsp;
+ $output = makeInternalLink('plugins/bug_report/bug_report.php', _("Bug"), '')
+ . $nbsp . $nbsp;
+ return array('menuline' => $output);
+}
+
+
+/**
+ * Register bug report option block
+ *
+ * @since 1.5.1
+ *
+ * @access private
+ *
+ */
+function bug_report_block_do() {
+ if (bug_report_check_user()) {
+ global $username, $data_dir, $optpage_data, $bug_report_visible;
+ $bug_report_visible = getPref($data_dir, $username, 'bug_report_visible', FALSE);
+ $optpage_data['grps']['bug_report'] = _("Bug Reports");
+ $optionValues = array();
+// FIXME: option needs refresh in SMOPT_REFRESH_RIGHT (menulinks are built 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;
+ }
}
+
+
* people to the login screen. At this point no attempt is made to see if the
* person is logged in or not.
*
- * @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
header('Location: ../index.php');
-?>
\ No newline at end of file
/**
* Bug Report plugin - setup script
*
- * @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
/**
* Initialize the bug report plugin
+ *
* @return void
+ *
* @access private
+ *
*/
function squirrelmail_plugin_init_bug_report() {
global $squirrelmail_plugin_hooks;
- $squirrelmail_plugin_hooks['template_construct_page_header.tpl']['bug_report'] = 'bug_report_button';
- $squirrelmail_plugin_hooks['loading_prefs']['bug_report'] = 'bug_report_load';
- $squirrelmail_plugin_hooks['optpage_loadhook_display']['bug_report'] = 'bug_report_block';
+ $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() {
- include_once(SM_PATH.'plugins/bug_report/functions.php');
- global $bug_report_visible;
-
- if (! $bug_report_visible || ! bug_report_check_user()) {
- return;
- }
-
- global $oTemplate, $nbsp;
- $output = makeInternalLink('plugins/bug_report/bug_report.php', _("Bug"), '')
- . $nbsp . $nbsp;
- return array('menuline' => $output);
-}
-
-/**
- * Loads bug report options
- * @access private
- */
-function bug_report_load() {
- global $username, $data_dir;
- global $bug_report_visible;
-
- $bug_report_visible = (bool) getPref($data_dir, $username, 'bug_report_visible',false);
+ include_once(SM_PATH . 'plugins/bug_report/functions.php');
+ return bug_report_button_do();
}
/**
+ *
* Register bug report option block
+ *
* @since 1.5.1
+ *
* @access private
+ *
*/
function bug_report_block() {
include_once(SM_PATH.'plugins/bug_report/functions.php');
- if (bug_report_check_user()) {
- 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;
- }
+ bug_report_block_do();
}
+
+/**
+ * Returns info about this plugin
+ *
+ */
+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.',
+ );
+}
+
+
+
+/**
+ * Returns version info about this plugin
+ *
+ */
+function bug_report_version() {
+ $info = bug_report_info();
+ return $info['version'];
+}
/**
* This script shows system specification details.
*
- * @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
* @subpackage bug_report
*/
-/**
- * Include the SquirrelMail initialization file.
- */
+
+// This is the bug_report show system specs page
+//
+define('PAGE_NAME', 'bug_report_show_system_specs');
+
+
+// Include the SquirrelMail initialization file.
+//
require('../../include/init.php');
-/** load plugin functions */
-include_once(SM_PATH.'plugins/bug_report/functions.php');
-/** is bug_report plugin disabled or called by wrong user */
+// load plugin functions
+//
+require_once(SM_PATH . 'plugins/bug_report/functions.php');
+
+
+// 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();
}
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
-<html>
-<body>
-<pre>
-<?php
-include_once(SM_PATH . 'plugins/bug_report/system_specs.php');
-global $body;
-echo $body;
-?>
-</pre>
-</body>
-</html>
\ No newline at end of file
+// get system specs
+//
+require_once(SM_PATH . 'plugins/bug_report/system_specs.php');
+list($body, $warnings, $corrections) = get_system_specs();
+
+global $oTemplate;
+$oTemplate->assign('body', $body);
+$oTemplate->display('plugins/bug_report/system_specs.tpl');
+$oTemplate->display('footer.tpl');
+
+
* This script gathers system specification details for use with bug reporting
* and anyone else who needs 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
* @subpackage bug_report
*/
-/**
- * do not allow to call this file directly
- */
-if (isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__) {
- header("Location: ../../src/login.php");
- die();
-}
-
-/**
- * load required libraries
- */
-include_once(SM_PATH . 'functions/imap_general.php');
-
-
/**
* converts array to string
global $plugins;
$str = '';
if (is_array($plugins) && $plugins!=array()) {
- foreach ($plugins as $key => $value) {
- if ($key != 0 || $value != '') {
- $str .= " * $key = $value " . get_plugin_version($value, TRUE) . "\n";
+ foreach ($plugins as $key => $plugin_name) {
+
+ // note that some plugins may not have been loaded up by now
+ // so we do that here to make sure... also turn on output
+ // buffering so they don't screw up our output with spacing
+ // or newlines
+ //
+ ob_start();
+ use_plugin($plugin_name);
+ ob_end_clean();
+
+ if ($key != 0 || $plugin_name != '') {
+ $english_name = get_plugin_requirement($plugin_name, 'english_name');
+ $str .= " * $key = " . (!empty($english_name) ? $english_name . " ($plugin_name) " : "$plugin_name ") . get_plugin_version($plugin_name, TRUE) . "\n";
}
}
// compatibility plugin can be used without needing to enable it in sm config
if (file_exists(SM_PATH . 'plugins/compatibility/setup.php')
&& ! in_array('compatibility',$plugins)) {
- $str.= ' * compatibility ' . get_plugin_version('compatibility', TRUE) . "\n";
+ $str.= ' * Compatibility (compatibility) ' . get_plugin_version('compatibility', TRUE) . "\n";
}
}
if ($str == '') {
return $str;
}
-$browscap = ini_get('browscap');
-if(!empty($browscap)) {
- $browser = get_browser();
-}
-sqgetGlobalVar('HTTP_USER_AGENT', $HTTP_USER_AGENT, SQ_SERVER);
-if ( ! sqgetGlobalVar('HTTP_USER_AGENT', $HTTP_USER_AGENT, SQ_SERVER) )
- $HTTP_USER_AGENT="Browser information is not available.";
+/**
+ * Retrieve long text string containing semi-formatted (simple text
+ * with newlines and spaces for indentation) SquirrelMail system
+ * specs
+ *
+ * @return array A three-element array, the first element containing
+ * the string of system specs, the second one containing
+ * a list of any warnings that may have occurred, keyed
+ * by a warning "type" (which is used to key the corrections
+ * array next), and the third element of which is a list
+ * of sub-arrays keyed by warning "type": the sub-arrays
+ * are lists of correction messages associated with the
+ * warnings. The second and third return elements may
+ * be empty arrays if no warnings were found.
+ *
+ * @since 1.5.2
+ *
+ */
+function get_system_specs() {
+//FIXME: configtest and this plugin should be using the same code to generate the basic SM system specifications and setup detection
+
+ global $imapServerAddress, $username, $imapPort, $imap_server_type,
+ $use_imap_tls, $ldap_server;
-$body_top = "My browser information:\n" .
+ // load required libraries
+ //
+ include_once(SM_PATH . 'functions/imap_general.php');
+
+ $browscap = ini_get('browscap');
+ if(!empty($browscap)) {
+ $browser = get_browser();
+ }
+
+ $warnings = array();
+ $corrections = array();
+
+ sqgetGlobalVar('HTTP_USER_AGENT', $HTTP_USER_AGENT, SQ_SERVER);
+ if ( ! sqgetGlobalVar('HTTP_USER_AGENT', $HTTP_USER_AGENT, SQ_SERVER) )
+ $HTTP_USER_AGENT="Browser information is not available.";
+
+ $body_top = "My browser information:\n" .
' '.$HTTP_USER_AGENT . "\n" ;
if(isset($browser)) {
$body_top .= " get_browser() information (List)\n" .
" PHP Extensions (List)\n" .
Show_Array(get_loaded_extensions()) .
"\nSquirrelMail-specific information:\n" .
- " Version: $version\n" .
+ " Version: " . SM_VERSION . "\n" .
" Plugins (List)\n" .
- br_show_plugins();
-if (isset($ldap_server) && $ldap_server[0] && ! extension_loaded('ldap')) {
- $warning = 1;
- $warnings['ldap'] = "LDAP server defined in SquirrelMail config, " .
- "but the module is not loaded in PHP";
- $corrections['ldap'][] = "Reconfigure PHP with the option '--with-ldap'";
- $corrections['ldap'][] = "Then recompile PHP and reinstall";
- $corrections['ldap'][] = "-- OR --";
- $corrections['ldap'][] = "Reconfigure SquirrelMail to not use LDAP";
-}
+ br_show_plugins() . "\n";
+ if (!empty($ldap_server[0]) && $ldap_server[0] && ! extension_loaded('ldap')) {
+ $warnings['ldap'] = "LDAP server defined in SquirrelMail config, " .
+ "but the module is not loaded in PHP";
+ $corrections['ldap'][] = "Reconfigure PHP with the option '--with-ldap'";
+ $corrections['ldap'][] = "Then recompile PHP and reinstall";
+ $corrections['ldap'][] = "-- OR --";
+ $corrections['ldap'][] = "Reconfigure SquirrelMail to not use LDAP";
+ }
-$body = "\nMy IMAP server information:\n" .
+ $body = "\nMy IMAP server information:\n" .
" Server type: $imap_server_type\n";
-$imapServerAddress = sqimap_get_user_server($imapServerAddress, $username);
-$imap_stream = sqimap_create_stream($imapServerAddress, $imapPort, $use_imap_tls);
-if ($imap_stream) {
- $body.= ' Capabilities: ';
- if ($imap_capabilities = sqimap_capability($imap_stream)) {
- foreach ($imap_capabilities as $capability => $value) {
- $body.= $capability . (is_bool($value) ? ' ' : "=$value ");
+ $imapServerAddress = sqimap_get_user_server($imapServerAddress, $username);
+ $imap_stream = sqimap_create_stream($imapServerAddress, $imapPort, $use_imap_tls);
+ if ($imap_stream) {
+ $body.= ' Capabilities: ';
+ if ($imap_capabilities = sqimap_capability($imap_stream)) {
+ foreach ($imap_capabilities as $capability => $value) {
+ $body.= $capability . (is_bool($value) ? ' ' : "=$value ");
+ }
}
+ $body.="\n";
+ sqimap_logout($imap_stream);
+ } else {
+ $body .= " Unable to connect to IMAP server to get information.\n";
+ $warnings['imap'] = "Unable to connect to IMAP server";
+ $corrections['imap'][] = "Make sure you specified the correct mail server";
+ $corrections['imap'][] = "Make sure the mail server is running IMAP, not POP";
+ $corrections['imap'][] = "Make sure the server responds to port $imapPort";
}
- $body.="\n";
- sqimap_logout($imap_stream);
-} else {
- $body .= " Unable to connect to IMAP server to get information.\n";
- $warning = 1;
- $warnings['imap'] = "Unable to connect to IMAP server";
- $corrections['imap'][] = "Make sure you specified the correct mail server";
- $corrections['imap'][] = "Make sure the mail server is running IMAP, not POP";
- $corrections['imap'][] = "Make sure the server responds to port $imapPort";
-}
-$warning_html = '';
-$warning_num = 0;
-if (isset($warning) && $warning) {
- foreach ($warnings as $key => $value) {
- if ($warning_num == 0) {
- $body_top .= "WARNINGS WERE REPORTED WITH YOUR SETUP:\n";
- $body_top = "WARNINGS WERE REPORTED WITH YOUR SETUP -- SEE BELOW\n\n$body_top";
- $warning_html = "<h1>Warnings were reported with your setup:</h1>\n<dl>\n";
- }
- $warning_num ++;
- $warning_html .= "<dt><b>$value</b></dt>\n";
- $body_top .= "\n$value\n";
- foreach ($corrections[$key] as $corr_val) {
- $body_top .= " * $corr_val\n";
- $warning_html .= "<dd>* $corr_val</dd>\n";
+ $warning_num = 0;
+ if (!empty($warnings)) {
+ foreach ($warnings as $key => $value) {
+ if ($warning_num == 0) {
+ $body_top .= "WARNINGS WERE REPORTED WITH YOUR SETUP:\n";
+ $body_top = "WARNINGS WERE REPORTED WITH YOUR SETUP -- SEE BELOW\n\n$body_top";
+ }
+ $warning_num ++;
+ $body_top .= "\n$value\n";
+ foreach ($corrections[$key] as $corr_val) {
+ $body_top .= " * $corr_val\n";
+ }
}
+ $body_top .= "\n$warning_num warning(s) reported.\n";
+ $body_top .= "----------------------------------------------\n";
}
- $warning_html .= "</dl>\n<p>$warning_num warning(s) reported.</p>\n<hr />\n";
- $body_top .= "\n$warning_num warning(s) reported.\n";
- $body_top .= "----------------------------------------------\n";
+
+ $body = $body_top . $body;
+
+ return array($body, $warnings, $corrections);
+
}
-$body = htmlspecialchars($body_top . $body);
+
--- /dev/null
+<?php
+
+/**
+ * index.php
+ *
+ * This file simply takes any attempt to view source files and sends those
+ * people to the login screen. At this point no attempt is made to see if the
+ * person is logged in or not.
+ *
+ * @copyright © 1999-2008 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id: index.php 12128 2007-01-13 20:15:44Z kink $
+ * @package plugins
+ * @subpackage bug_report
+ */
+
+header('Location: ../index.php');
+
--- /dev/null
+<?php
+
+/**
+ * system_specs.tpl
+ *
+ * Template for the system specs display screen for the Bug Report plugin.
+ *
+ * The following variables are available in this template:
+ *
+ * string $body The page content (lightly formatted system specs text
+ * with newlines and spaces for indentation)
+ *
+ * @copyright © 1999-2008 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id$
+ * @package squirrelmail
+ * @subpackage plugins
+ */
+
+
+// retrieve the template vars
+//
+extract($t);
+
+
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
+<html>
+<body>
+<pre>
+<?php echo $body; ?>
+</pre>
+
+
--- /dev/null
+<?php
+
+/**
+ * usage.tpl
+ *
+ * Template for the usage explanation screen for the Bug Report plugin.
+ *
+ * The following variables are available in this template:
+ *
+ * string $message_body The initial template text of the bug report
+ * message
+ * array $warning_messages A list of warning texts, if any occurred
+ * (array keys must be the "type" used to
+ * index the $correction_messages array below)
+ * array $correction_messages A list of arrays keyed by warning type,
+ * wherein arrays of correction messages are
+ * placed
+ * int $warning_count The number of warnings
+ * string $version The current SquirrelMail version string
+ * string $title_bg_color The background color for the page title
+ * string $admin_email The administrator's email address, if any
+ * (possibly empty)
+ *
+ * @copyright © 1999-2008 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id$
+ * @package squirrelmail
+ * @subpackage plugins
+ */
+
+
+// retrieve the template vars
+//
+extract($t);
+
+
+?>
+ <br />
+ <table width="95%" align="center" border="0" cellpadding="2" cellspacing="0"><tr>
+ <td align="center" bgcolor="<?php echo $title_bg_color; ?>"><b>
+ <?php echo _("Submit a Bug Report"); ?>
+ </b></td>
+ </tr></table>
+
+<?php
+
+ // warnings require special layout
+ //
+ if (!empty($warning_messages)) {
+ echo '<h1>' . _("Warnings were reported in your setup:") . '</h1><dl>';
+ foreach ($warning_messages as $warning_type => $warning_text) {
+ echo "<dt><b>$warning_text</b></dt>\n";
+ foreach ($correction_messages[$warning_type] as $correction_text) {
+ echo "<dd>* $correction_text</dd>\n";
+ }
+ }
+ echo "</dl>\n<p>" . sprintf(_("%d warning(s) reported."), $warning_count)
+ . "</p>\n<hr />\n";
+ }
+
+
+echo '<p><a href="show_system_specs.php" target="_blank">'
+ . _("Show System Specifications")
+ . "</a></p>\n\n"
+ . '<p><big>'
+ . _("Before you send your bug report, please make sure to check this checklist for any common problems.")
+ . "</big></p>\n"
+
+ . '<ul>'
+ . '<li>'
+ . sprintf(_("Make sure that you are running the most recent copy of %s. You are currently using version %s."), '<a href="http://squirrelmail.org/" target="_blank">SquirrelMail</a>', $version)
+ . "</li>\n"
+
+ . '<li>'
+ . sprintf(_("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."), '<a href="http://sourceforge.net/bugs/?group_id=311" target="_blank">', '</a>')
+ . "</li>\n"
+
+ . '<li>'
+ . _("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.")
+ . "</li>\n"
+
+ . '<li>'
+ . sprintf(_("If there were warnings displayed above, try to resolve them yourself. Read the guides in the %s directory where SquirrelMail was installed."), '<tt>doc/</tt>')
+ . "</li>\n"
+ . "</ul>\n"
+
+ . '<p>'
+ . _("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.")
+ . "</p>\n"
+
+ . '<p>'
+ . _("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.")
+ . "</p>\n"
+
+ . '<form action="' . $base_uri . 'src/compose.php" method="post">';
+?>
+ <table align="center" border="0">
+ <tr>
+ <td>
+ <?php echo _("This bug involves:")
+ . ' <select name="send_to">';
+
+ // if admin's email is set - add 'report to admin'
+ // option and make it default one
+ //
+ if (! empty($admin_email)) {
+ echo '<option value="' . $admin_email . '" selected="selected">'
+ . _("my email account") . '</option>';
+ }
+ ?>
+ <option value="squirrelmail-users@lists.sourceforge.net"><?php
+ echo _("the general program"); ?></option>
+ <option value="squirrelmail-plugins@lists.sourceforge.net"><?php
+ echo _("a specific plugin"); ?></option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td align="center">
+ <input type="hidden" name="send_to_cc" value="" />
+ <input type="hidden" name="send_to_bcc" value="" />
+ <input type="hidden" name="subject" value="Bug Report" />
+ <input type="hidden" name="body" value="<?php echo $message_body; ?>" />
+ <input type="submit" value="<?php echo _("Start Bug Report Form"); ?>" />
+ </td>
+ </tr>
+ </table>
+ </form>
+ <br />
--- /dev/null
+<?php
+
+/**
+ * index.php
+ *
+ * This file simply takes any attempt to view source files and sends those
+ * people to the login screen. At this point no attempt is made to see if the
+ * person is logged in or not.
+ *
+ * @copyright © 1999-2008 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id: index.php 12128 2007-01-13 20:15:44Z kink $
+ * @package plugins
+ * @subpackage bug_report
+ */
+
+header('Location: ../index.php');
+