595848f9 |
1 | <?php |
595848f9 |
2 | /** |
3 | * This gathers system specification details for use with bug reporting |
4 | * and anyone else who needs it. |
5 | * |
9eb3fcb3 |
6 | * Copyright (c) 1999-2005 The SquirrelMail Project Team |
595848f9 |
7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
8 | * |
598294a7 |
9 | * This is a standard SquirrelMail 1.2 API for plugins. |
595848f9 |
10 | * |
3b43404b |
11 | * @version $Id$ |
12 | * @package plugins |
13 | * @subpackage bug_report |
595848f9 |
14 | */ |
15 | |
3b43404b |
16 | /** |
17 | * load required libraries |
18 | */ |
595848f9 |
19 | include_once(SM_PATH . 'include/validate.php'); |
20 | global $body; |
21 | |
22 | |
23 | /** |
24 | * converts array to string |
25 | * |
26 | * @param array $array array that has to be displayed |
27 | * @return string |
28 | * @access private |
29 | */ |
30 | function Show_Array($array) { |
31 | $str = ''; |
32 | foreach ($array as $key => $value) { |
33 | if ($key != 0 || $value != '') { |
34 | $str .= " * $key = $value\n"; |
35 | } |
36 | } |
37 | if ($str == '') { |
38 | return " * Nothing listed\n"; |
39 | } |
40 | return $str; |
41 | } |
42 | |
38b88e48 |
43 | /** |
44 | * converts plugin's array to string and adds version numbers |
45 | * @return string preformated text with installed plugin's information |
46 | * @access private |
47 | */ |
48 | function br_show_plugins() { |
49 | global $plugins; |
50 | $str = ''; |
51 | if (is_array($plugins) && $plugins!=array()) { |
52 | foreach ($plugins as $key => $value) { |
53 | if ($key != 0 || $value != '') { |
54 | $str .= " * $key = $value"; |
55 | // add plugin version |
56 | if (function_exists($value . '_version')) { |
57 | $str.= ' ' . call_user_func($value . '_version'); |
58 | } |
59 | $str.="\n"; |
60 | } |
61 | } |
62 | // compatibility plugin can be used without need to enable it in sm config |
63 | if (file_exists(SM_PATH . 'plugins/compatibility/setup.php') |
64 | && ! in_array('compatibility',$plugins)) { |
65 | $str.= ' * compatibility'; |
66 | include_once(SM_PATH . 'plugins/compatibility/setup.php'); |
67 | if (function_exists('compatibility_version')) { |
68 | $str.= ' ' . call_user_func('compatibility_version'); |
69 | } |
70 | $str.="\n"; |
71 | } |
72 | } |
73 | if ($str == '') { |
74 | return " * Nothing listed\n"; |
75 | } |
76 | return $str; |
77 | } |
78 | |
595848f9 |
79 | $browscap = ini_get('browscap'); |
80 | if(!empty($browscap)) { |
81 | $browser = get_browser(); |
82 | } |
83 | |
84 | sqgetGlobalVar('HTTP_USER_AGENT', $HTTP_USER_AGENT, SQ_SERVER); |
85 | if ( ! sqgetGlobalVar('HTTP_USER_AGENT', $HTTP_USER_AGENT, SQ_SERVER) ) |
86 | $HTTP_USER_AGENT="Browser information is not available."; |
87 | |
88 | $body_top = "My browser information:\n" . |
89 | ' '.$HTTP_USER_AGENT . "\n" ; |
90 | if(isset($browser)) { |
91 | $body_top .= " get_browser() information (List)\n" . |
92 | Show_Array((array) $browser); |
93 | } |
94 | $body_top .= "\nMy web server information:\n" . |
95 | " PHP Version " . phpversion() . "\n" . |
96 | " PHP Extensions (List)\n" . |
97 | Show_Array(get_loaded_extensions()) . |
98 | "\nSquirrelMail-specific information:\n" . |
99 | " Version: $version\n" . |
100 | " Plugins (List)\n" . |
38b88e48 |
101 | br_show_plugins(); |
595848f9 |
102 | if (isset($ldap_server) && $ldap_server[0] && ! extension_loaded('ldap')) { |
103 | $warning = 1; |
104 | $warnings['ldap'] = "LDAP server defined in SquirrelMail config, " . |
105 | "but the module is not loaded in PHP"; |
106 | $corrections['ldap'][] = "Reconfigure PHP with the option '--with-ldap'"; |
107 | $corrections['ldap'][] = "Then recompile PHP and reinstall"; |
108 | $corrections['ldap'][] = "-- OR --"; |
109 | $corrections['ldap'][] = "Reconfigure SquirrelMail to not use LDAP"; |
110 | } |
111 | |
112 | $body = "\nMy IMAP server information:\n" . |
113 | " Server type: $imap_server_type\n"; |
114 | $imap_stream = fsockopen ($imapServerAddress, $imapPort, $error_number, $error_string); |
115 | $server_info = fgets ($imap_stream, 1024); |
116 | if ($imap_stream) { |
117 | // SUPRESS HOST NAME |
118 | $list = explode(' ', $server_info); |
119 | $list[2] = '[HIDDEN]'; |
120 | $server_info = implode(' ', $list); |
121 | $body .= " Server info: $server_info"; |
122 | fputs ($imap_stream, "a001 CAPABILITY\r\n"); |
123 | $read = fgets($imap_stream, 1024); |
124 | $list = explode(' ', $read); |
125 | array_shift($list); |
126 | array_shift($list); |
127 | $read = implode(' ', $list); |
128 | $body .= " Capabilities: $read"; |
129 | fputs ($imap_stream, "a002 LOGOUT\r\n"); |
130 | fclose($imap_stream); |
131 | } else { |
132 | $body .= " Unable to connect to IMAP server to get information.\n"; |
133 | $warning = 1; |
134 | $warnings['imap'] = "Unable to connect to IMAP server"; |
135 | $corrections['imap'][] = "Make sure you specified the correct mail server"; |
136 | $corrections['imap'][] = "Make sure the mail server is running IMAP, not POP"; |
137 | $corrections['imap'][] = "Make sure the server responds to port $imapPort"; |
138 | } |
139 | $warning_html = ''; |
140 | $warning_num = 0; |
141 | if (isset($warning) && $warning) { |
142 | foreach ($warnings as $key => $value) { |
143 | if ($warning_num == 0) { |
144 | $body_top .= "WARNINGS WERE REPORTED WITH YOUR SETUP:\n"; |
145 | $body_top = "WARNINGS WERE REPORTED WITH YOUR SETUP -- SEE BELOW\n\n$body_top"; |
146 | $warning_html = "<h1>Warnings were reported with your setup:</h1>\n<dl>\n"; |
147 | } |
148 | $warning_num ++; |
149 | $warning_html .= "<dt><b>$value</b></dt>\n"; |
150 | $body_top .= "\n$value\n"; |
151 | foreach ($corrections[$key] as $corr_val) { |
152 | $body_top .= " * $corr_val\n"; |
153 | $warning_html .= "<dd>* $corr_val</dd>\n"; |
154 | } |
155 | } |
3c621ba1 |
156 | $warning_html .= "</dl>\n<p>$warning_num warning(s) reported.</p>\n<hr />\n"; |
595848f9 |
157 | $body_top .= "\n$warning_num warning(s) reported.\n"; |
158 | $body_top .= "----------------------------------------------\n"; |
159 | } |
160 | |
161 | $body = htmlspecialchars($body_top . $body); |
162 | |
3c621ba1 |
163 | ?> |