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 '\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"; -?> -
- - - - - - - -
- '; - if (! empty($bug_report_admin_email)) { - // if admin's email is set - add 'report to admin' option and make it default one - echo ''; - } - ?> - - - -
- -
-
-
- - diff --git a/plugins/bug_report/config_default.php b/plugins/bug_report/config_default.php index fc6e31c2..08870141 100644 --- a/plugins/bug_report/config_default.php +++ b/plugins/bug_report/config_default.php @@ -6,7 +6,7 @@ * 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 diff --git a/plugins/bug_report/functions.php b/plugins/bug_report/functions.php index ba2c2f35..dcae4722 100644 --- a/plugins/bug_report/functions.php +++ b/plugins/bug_report/functions.php @@ -2,7 +2,7 @@ /** * 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 @@ -11,40 +11,54 @@ /** - * 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'); @@ -68,14 +82,70 @@ function bug_report_check_user() { 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; + } } + + diff --git a/plugins/bug_report/index.php b/plugins/bug_report/index.php index 86bf8eaf..90383a61 100644 --- a/plugins/bug_report/index.php +++ b/plugins/bug_report/index.php @@ -7,7 +7,7 @@ * 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 @@ -16,4 +16,3 @@ header('Location: ../index.php'); -?> \ No newline at end of file diff --git a/plugins/bug_report/setup.php b/plugins/bug_report/setup.php index 291707e3..b9bf859f 100644 --- a/plugins/bug_report/setup.php +++ b/plugins/bug_report/setup.php @@ -2,7 +2,7 @@ /** * 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 @@ -11,67 +11,72 @@ /** * 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']; +} diff --git a/plugins/bug_report/show_system_specs.php b/plugins/bug_report/show_system_specs.php index 07ceb50c..426e95fb 100644 --- a/plugins/bug_report/show_system_specs.php +++ b/plugins/bug_report/show_system_specs.php @@ -2,40 +2,47 @@ /** * 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(); } -?> - - - -
-
-
- - \ 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'); + + diff --git a/plugins/bug_report/system_specs.php b/plugins/bug_report/system_specs.php index 7a209995..0914d108 100644 --- a/plugins/bug_report/system_specs.php +++ b/plugins/bug_report/system_specs.php @@ -3,27 +3,13 @@ * 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 @@ -54,15 +40,26 @@ function br_show_plugins() { 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 == '') { @@ -71,16 +68,48 @@ function br_show_plugins() { 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" . @@ -91,61 +120,60 @@ $body_top = "My browser information:\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 = "

Warnings were reported with your setup:

\n
\n"; - } - $warning_num ++; - $warning_html .= "
$value
\n"; - $body_top .= "\n$value\n"; - foreach ($corrections[$key] as $corr_val) { - $body_top .= " * $corr_val\n"; - $warning_html .= "
* $corr_val
\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 .= "
\n

$warning_num warning(s) reported.

\n
\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); + diff --git a/plugins/bug_report/templates/default/index.php b/plugins/bug_report/templates/default/index.php new file mode 100644 index 00000000..37d20f4c --- /dev/null +++ b/plugins/bug_report/templates/default/index.php @@ -0,0 +1,18 @@ + + + + +
+
+
+ + diff --git a/plugins/bug_report/templates/default/usage.tpl b/plugins/bug_report/templates/default/usage.tpl new file mode 100644 index 00000000..4b911648 --- /dev/null +++ b/plugins/bug_report/templates/default/usage.tpl @@ -0,0 +1,129 @@ + +
+ + +
+ +
+ +' . _("Warnings were reported in your setup:") . '
'; + foreach ($warning_messages as $warning_type => $warning_text) { + echo "
$warning_text
\n"; + foreach ($correction_messages[$warning_type] as $correction_text) { + echo "
* $correction_text
\n"; + } + } + echo "
\n

" . sprintf(_("%d warning(s) reported."), $warning_count) + . "

\n
\n"; + } + + +echo '

' + . _("Show System Specifications") + . "

\n\n" + . '

' + . _("Before you send your bug report, please make sure to check this checklist for any common problems.") + . "

\n" + + . '\n" + + . '

' + . _("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.") + . "

\n" + + . '

' + . _("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.") + . "

\n" + + . '
'; +?> + + + + + + + +
+ '; + + // if admin's email is set - add 'report to admin' + // option and make it default one + // + if (! empty($admin_email)) { + echo ''; + } + ?> + + + +
+ + + + + " /> +
+
+
diff --git a/plugins/bug_report/templates/index.php b/plugins/bug_report/templates/index.php new file mode 100644 index 00000000..37d20f4c --- /dev/null +++ b/plugins/bug_report/templates/index.php @@ -0,0 +1,18 @@ +