4 * This gathers system specification details for use with bug reporting
5 * and anyone else who needs it.
7 * This is a standard SquirrelMail 1.2 API for plugins.
9 * @copyright © 1999-2005 The SquirrelMail Project Team
10 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
13 * @subpackage bug_report
17 if (!defined('SM_PATH')) define('SM_PATH','../../');
20 * load required libraries
22 include_once(SM_PATH
. 'include/validate.php');
23 include_once(SM_PATH
. 'functions/imap.php');
24 global $body, $username;
28 * converts array to string
30 * @param array $array array that has to be displayed
34 function Show_Array($array) {
36 foreach ($array as $key => $value) {
37 if ($key != 0 ||
$value != '') {
38 $str .= " * $key = $value\n";
42 return " * Nothing listed\n";
48 * converts plugin's array to string and adds version numbers
49 * @return string preformated text with installed plugin's information
52 function br_show_plugins() {
55 if (is_array($plugins) && $plugins!=array()) {
56 foreach ($plugins as $key => $value) {
57 if ($key != 0 ||
$value != '') {
58 $str .= " * $key = $value";
60 if (function_exists($value . '_version')) {
61 $str.= ' ' . call_user_func($value . '_version');
66 // compatibility plugin can be used without need to enable it in sm config
67 if (file_exists(SM_PATH
. 'plugins/compatibility/setup.php')
68 && ! in_array('compatibility',$plugins)) {
69 $str.= ' * compatibility';
70 include_once(SM_PATH
. 'plugins/compatibility/setup.php');
71 if (function_exists('compatibility_version')) {
72 $str.= ' ' . call_user_func('compatibility_version');
78 return " * Nothing listed\n";
83 $browscap = ini_get('browscap');
84 if(!empty($browscap)) {
85 $browser = get_browser();
88 sqgetGlobalVar('HTTP_USER_AGENT', $HTTP_USER_AGENT, SQ_SERVER
);
89 if ( ! sqgetGlobalVar('HTTP_USER_AGENT', $HTTP_USER_AGENT, SQ_SERVER
) )
90 $HTTP_USER_AGENT="Browser information is not available.";
92 $body_top = "My browser information:\n" .
93 ' '.$HTTP_USER_AGENT . "\n" ;
95 $body_top .= " get_browser() information (List)\n" .
96 Show_Array((array) $browser);
98 $body_top .= "\nMy web server information:\n" .
99 " PHP Version " . phpversion() . "\n" .
100 " PHP Extensions (List)\n" .
101 Show_Array(get_loaded_extensions()) .
102 "\nSquirrelMail-specific information:\n" .
103 " Version: $version\n" .
104 " Plugins (List)\n" .
106 if (isset($ldap_server) && $ldap_server[0] && ! extension_loaded('ldap')) {
108 $warnings['ldap'] = "LDAP server defined in SquirrelMail config, " .
109 "but the module is not loaded in PHP";
110 $corrections['ldap'][] = "Reconfigure PHP with the option '--with-ldap'";
111 $corrections['ldap'][] = "Then recompile PHP and reinstall";
112 $corrections['ldap'][] = "-- OR --";
113 $corrections['ldap'][] = "Reconfigure SquirrelMail to not use LDAP";
116 $body = "\nMy IMAP server information:\n" .
117 " Server type: $imap_server_type\n";
119 $imapServerAddress = sqimap_get_user_server($imapServerAddress, $username);
120 $imap_stream = sqimap_create_stream($imapServerAddress, $imapPort, $use_imap_tls);
122 $body.= ' Capabilities: ';
123 if ($imap_capabilities = sqimap_capability($imap_stream)) {
124 foreach ($imap_capabilities as $capability => $value) {
125 $body.= $capability . (is_bool($value) ?
' ' : "=$value ");
129 sqimap_logout($imap_stream);
131 $body .= " Unable to connect to IMAP server to get information.\n";
133 $warnings['imap'] = "Unable to connect to IMAP server";
134 $corrections['imap'][] = "Make sure you specified the correct mail server";
135 $corrections['imap'][] = "Make sure the mail server is running IMAP, not POP";
136 $corrections['imap'][] = "Make sure the server responds to port $imapPort";
140 if (isset($warning) && $warning) {
141 foreach ($warnings as $key => $value) {
142 if ($warning_num == 0) {
143 $body_top .= "WARNINGS WERE REPORTED WITH YOUR SETUP:\n";
144 $body_top = "WARNINGS WERE REPORTED WITH YOUR SETUP -- SEE BELOW\n\n$body_top";
145 $warning_html = "<h1>Warnings were reported with your setup:</h1>\n<dl>\n";
148 $warning_html .= "<dt><b>$value</b></dt>\n";
149 $body_top .= "\n$value\n";
150 foreach ($corrections[$key] as $corr_val) {
151 $body_top .= " * $corr_val\n";
152 $warning_html .= "<dd>* $corr_val</dd>\n";
155 $warning_html .= "</dl>\n<p>$warning_num warning(s) reported.</p>\n<hr />\n";
156 $body_top .= "\n$warning_num warning(s) reported.\n";
157 $body_top .= "----------------------------------------------\n";
160 $body = htmlspecialchars($body_top . $body);