3 * This script gathers system specification details for use with bug reporting
4 * and anyone else who needs it.
6 * @copyright © 1999-2006 The SquirrelMail Project Team
7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
10 * @subpackage bug_report
14 if (!defined('SM_PATH')) define('SM_PATH','../../');
17 * load required libraries
19 include_once(SM_PATH
. 'include/validate.php');
20 include_once(SM_PATH
. 'functions/imap.php');
21 global $body, $username;
25 * converts array to string
27 * @param array $array array that has to be displayed
31 function Show_Array($array) {
33 foreach ($array as $key => $value) {
34 if ($key != 0 ||
$value != '') {
35 $str .= " * $key = $value\n";
39 return " * Nothing listed\n";
45 * converts plugin's array to string and adds version numbers
46 * @return string preformated text with installed plugin's information
49 function br_show_plugins() {
52 if (is_array($plugins) && $plugins!=array()) {
53 foreach ($plugins as $key => $value) {
54 if ($key != 0 ||
$value != '') {
55 $str .= " * $key = $value";
57 if (function_exists($value . '_version')) {
58 $str.= ' ' . call_user_func($value . '_version');
63 // compatibility plugin can be used without need to enable it in sm config
64 if (file_exists(SM_PATH
. 'plugins/compatibility/setup.php')
65 && ! in_array('compatibility',$plugins)) {
66 $str.= ' * compatibility';
67 include_once(SM_PATH
. 'plugins/compatibility/setup.php');
68 if (function_exists('compatibility_version')) {
69 $str.= ' ' . call_user_func('compatibility_version');
75 return " * Nothing listed\n";
80 $browscap = ini_get('browscap');
81 if(!empty($browscap)) {
82 $browser = get_browser();
85 sqgetGlobalVar('HTTP_USER_AGENT', $HTTP_USER_AGENT, SQ_SERVER
);
86 if ( ! sqgetGlobalVar('HTTP_USER_AGENT', $HTTP_USER_AGENT, SQ_SERVER
) )
87 $HTTP_USER_AGENT="Browser information is not available.";
89 $body_top = "My browser information:\n" .
90 ' '.$HTTP_USER_AGENT . "\n" ;
92 $body_top .= " get_browser() information (List)\n" .
93 Show_Array((array) $browser);
95 $body_top .= "\nMy web server information:\n" .
96 " PHP Version " . phpversion() . "\n" .
97 " PHP Extensions (List)\n" .
98 Show_Array(get_loaded_extensions()) .
99 "\nSquirrelMail-specific information:\n" .
100 " Version: $version\n" .
101 " Plugins (List)\n" .
103 if (isset($ldap_server) && $ldap_server[0] && ! extension_loaded('ldap')) {
105 $warnings['ldap'] = "LDAP server defined in SquirrelMail config, " .
106 "but the module is not loaded in PHP";
107 $corrections['ldap'][] = "Reconfigure PHP with the option '--with-ldap'";
108 $corrections['ldap'][] = "Then recompile PHP and reinstall";
109 $corrections['ldap'][] = "-- OR --";
110 $corrections['ldap'][] = "Reconfigure SquirrelMail to not use LDAP";
113 $body = "\nMy IMAP server information:\n" .
114 " Server type: $imap_server_type\n";
116 $imapServerAddress = sqimap_get_user_server($imapServerAddress, $username);
117 $imap_stream = sqimap_create_stream($imapServerAddress, $imapPort, $use_imap_tls);
119 $body.= ' Capabilities: ';
120 if ($imap_capabilities = sqimap_capability($imap_stream)) {
121 foreach ($imap_capabilities as $capability => $value) {
122 $body.= $capability . (is_bool($value) ?
' ' : "=$value ");
126 sqimap_logout($imap_stream);
128 $body .= " Unable to connect to IMAP server to get information.\n";
130 $warnings['imap'] = "Unable to connect to IMAP server";
131 $corrections['imap'][] = "Make sure you specified the correct mail server";
132 $corrections['imap'][] = "Make sure the mail server is running IMAP, not POP";
133 $corrections['imap'][] = "Make sure the server responds to port $imapPort";
137 if (isset($warning) && $warning) {
138 foreach ($warnings as $key => $value) {
139 if ($warning_num == 0) {
140 $body_top .= "WARNINGS WERE REPORTED WITH YOUR SETUP:\n";
141 $body_top = "WARNINGS WERE REPORTED WITH YOUR SETUP -- SEE BELOW\n\n$body_top";
142 $warning_html = "<h1>Warnings were reported with your setup:</h1>\n<dl>\n";
145 $warning_html .= "<dt><b>$value</b></dt>\n";
146 $body_top .= "\n$value\n";
147 foreach ($corrections[$key] as $corr_val) {
148 $body_top .= " * $corr_val\n";
149 $warning_html .= "<dd>* $corr_val</dd>\n";
152 $warning_html .= "</dl>\n<p>$warning_num warning(s) reported.</p>\n<hr />\n";
153 $body_top .= "\n$warning_num warning(s) reported.\n";
154 $body_top .= "----------------------------------------------\n";
157 $body = htmlspecialchars($body_top . $body);