3 * This script gathers system specification details for use with bug reporting
4 * and anyone else who needs it.
6 * @copyright © 1999-2007 The SquirrelMail Project Team
7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
10 * @subpackage bug_report
14 * do not allow to call this file directly
16 if ((isset($_SERVER['SCRIPT_FILENAME']) && $_SERVER['SCRIPT_FILENAME'] == __FILE__
) ||
17 (isset($HTTP_SERVER_SERVER['SCRIPT_FILENAME']) && $HTTP_SERVER_SERVER['SCRIPT_FILENAME'] == __FILE__
) ) {
18 header("Location: ../../src/login.php");
23 * load required libraries
25 include_once(SM_PATH
. 'functions/imap_general.php');
30 * converts array to string
32 * @param array $array array that has to be displayed
36 function Show_Array($array) {
38 foreach ($array as $key => $value) {
39 if ($key != 0 ||
$value != '') {
40 $str .= " * $key = $value\n";
44 return " * Nothing listed\n";
50 * converts plugin's array to string and adds version numbers
51 * @return string preformated text with installed plugin's information
54 function br_show_plugins() {
57 if (is_array($plugins) && $plugins!=array()) {
58 foreach ($plugins as $key => $value) {
59 if ($key != 0 ||
$value != '') {
60 $str .= " * $key = $value";
62 $version_found = FALSE;
63 if (function_exists($value . '_info')) {
64 $info = call_user_func($value . '_info');
65 if (!empty($info['version'])) {
66 $str .= ' ' . $info['version'];
67 $version_found = TRUE;
70 if (!$version_found && function_exists($value . '_version')) {
71 $str.= ' ' . call_user_func($value . '_version');
76 // compatibility plugin can be used without need to enable it in sm config
77 if (file_exists(SM_PATH
. 'plugins/compatibility/setup.php')
78 && ! in_array('compatibility',$plugins)) {
79 $str.= ' * compatibility';
80 include_once(SM_PATH
. 'plugins/compatibility/setup.php');
81 if (function_exists('compatibility_version')) {
82 $str.= ' ' . call_user_func('compatibility_version');
88 return " * Nothing listed\n";
93 $browscap = ini_get('browscap');
94 if(!empty($browscap)) {
95 $browser = get_browser();
98 sqgetGlobalVar('HTTP_USER_AGENT', $HTTP_USER_AGENT, SQ_SERVER
);
99 if ( ! sqgetGlobalVar('HTTP_USER_AGENT', $HTTP_USER_AGENT, SQ_SERVER
) )
100 $HTTP_USER_AGENT="Browser information is not available.";
102 $body_top = "My browser information:\n" .
103 ' '.$HTTP_USER_AGENT . "\n" ;
104 if(isset($browser)) {
105 $body_top .= " get_browser() information (List)\n" .
106 Show_Array((array) $browser);
108 $body_top .= "\nMy web server information:\n" .
109 " PHP Version " . phpversion() . "\n" .
110 " PHP Extensions (List)\n" .
111 Show_Array(get_loaded_extensions()) .
112 "\nSquirrelMail-specific information:\n" .
113 " Version: $version\n" .
114 " Plugins (List)\n" .
116 if (isset($ldap_server) && $ldap_server[0] && ! extension_loaded('ldap')) {
118 $warnings['ldap'] = "LDAP server defined in SquirrelMail config, " .
119 "but the module is not loaded in PHP";
120 $corrections['ldap'][] = "Reconfigure PHP with the option '--with-ldap'";
121 $corrections['ldap'][] = "Then recompile PHP and reinstall";
122 $corrections['ldap'][] = "-- OR --";
123 $corrections['ldap'][] = "Reconfigure SquirrelMail to not use LDAP";
126 $body = "\nMy IMAP server information:\n" .
127 " Server type: $imap_server_type\n";
129 $imapServerAddress = sqimap_get_user_server($imapServerAddress, $username);
130 $imap_stream = sqimap_create_stream($imapServerAddress, $imapPort, $use_imap_tls);
132 $body.= ' Capabilities: ';
133 if ($imap_capabilities = sqimap_capability($imap_stream)) {
134 foreach ($imap_capabilities as $capability => $value) {
135 $body.= $capability . (is_bool($value) ?
' ' : "=$value ");
139 sqimap_logout($imap_stream);
141 $body .= " Unable to connect to IMAP server to get information.\n";
143 $warnings['imap'] = "Unable to connect to IMAP server";
144 $corrections['imap'][] = "Make sure you specified the correct mail server";
145 $corrections['imap'][] = "Make sure the mail server is running IMAP, not POP";
146 $corrections['imap'][] = "Make sure the server responds to port $imapPort";
150 if (isset($warning) && $warning) {
151 foreach ($warnings as $key => $value) {
152 if ($warning_num == 0) {
153 $body_top .= "WARNINGS WERE REPORTED WITH YOUR SETUP:\n";
154 $body_top = "WARNINGS WERE REPORTED WITH YOUR SETUP -- SEE BELOW\n\n$body_top";
155 $warning_html = "<h1>Warnings were reported with your setup:</h1>\n<dl>\n";
158 $warning_html .= "<dt><b>$value</b></dt>\n";
159 $body_top .= "\n$value\n";
160 foreach ($corrections[$key] as $corr_val) {
161 $body_top .= " * $corr_val\n";
162 $warning_html .= "<dd>* $corr_val</dd>\n";
165 $warning_html .= "</dl>\n<p>$warning_num warning(s) reported.</p>\n<hr />\n";
166 $body_top .= "\n$warning_num warning(s) reported.\n";
167 $body_top .= "----------------------------------------------\n";
170 $body = htmlspecialchars($body_top . $body);