Fix for E_ALL error that can appear with get_browser(): 'browscap ini directive not...
[squirrelmail.git] / plugins / bug_report / bug_report.php
CommitLineData
15e6162e 1<?php
2
3/**
4 * bug_report.php
5 *
6 * This generates the bug report data, gives information about where
7 * it will be sent to and what people will do with it, and provides
8 * a button to show the bug report mail message in order to actually
9 * send it.
10 *
76911253 11 * Copyright (c) 1999-2003 The SquirrelMail development team
15e6162e 12 * Licensed under the GNU GPL. For full terms see the file COPYING.
13 *
14 * This is a standard Squirrelmail-1.2 API for plugins.
15 *
16 * $Id$
ea5f4b8e 17 * @package plugins
18 * @subpackage bug_report
15e6162e 19 */
d79e01f5 20
ea5f4b8e 21/**
22 * @ignore
23 */
8d6a115b 24define('SM_PATH','../../');
d79e01f5 25
04f6008a 26require_once(SM_PATH . 'include/validate.php');
27
0b0e96c5 28displayPageHeader($color, 'None');
d79e01f5 29
30
31function Show_Array($array) {
07aeb697 32 $str = '';
d79e01f5 33 foreach ($array as $key => $value) {
34 if ($key != 0 || $value != '') {
35 $str .= " * $key = $value\n";
36 }
37 }
38 if ($str == '') {
39 return " * Nothing listed\n";
40 }
41 return $str;
42}
43
24a7c964 44$browscap = ini_get('browscap');
45if(!empty($browscap)) {
46 $browser = get_browser();
47}
07aeb697 48$body_top = "I subscribe to the squirrelmail-users mailing list.\n" .
d79e01f5 49 " [ ] True - No need to CC me when replying\n" .
50 " [ ] False - Please CC me when replying\n" .
51 "\n" .
52 "This bug occurs when I ...\n" .
53 " ... view a particular message\n" .
54 " ... use a specific plugin/function\n" .
55 " ... try to do/view/use ....\n" .
56 "\n\n\n" .
57 "The description of the bug:\n\n\n" .
58 "I can reproduce the bug by:\n\n\n" .
59 "(Optional) I got bored and found the bug occurs in:\n\n\n" .
60 "(Optional) I got really bored and here's a fix:\n\n\n" .
61 "----------------------------------------------\n" .
62 "\nMy browser information:\n" .
24a7c964 63 ' '.$_SERVER['HTTP_USER_AGENT'] . "\n" ;
64 if(isset($browser)) {
65 $body_top .= " get_browser() information (List)\n" .
66 Show_Array((array) $browser);
67 }
68 $body_top .= "\nMy web server information:\n" .
d79e01f5 69 " PHP Version " . phpversion() . "\n" .
70 " PHP Extensions (List)\n" .
71 Show_Array(get_loaded_extensions()) .
72 "\nSquirrelMail-specific information:\n" .
73 " Version: $version\n" .
74 " Plugins (List)\n" .
75 Show_Array($plugins);
07aeb697 76if (isset($ldap_server) && $ldap_server[0] && ! extension_loaded('ldap')) {
d79e01f5 77 $warning = 1;
78 $warnings['ldap'] = "LDAP server defined in SquirrelMail config, " .
79 "but the module is not loaded in PHP";
80 $corrections['ldap'][] = "Reconfigure PHP with the option '--with-ldap'";
81 $corrections['ldap'][] = "Then recompile PHP and reinstall";
82 $corrections['ldap'][] = "-- OR --";
83 $corrections['ldap'][] = "Reconfigure SquirrelMail to not use LDAP";
84}
85
07aeb697 86$body = "\nMy IMAP server information:\n" .
d79e01f5 87 " Server type: $imap_server_type\n";
7a0d72ee 88$imap_stream = fsockopen ($imapServerAddress, $imapPort, $error_number, $error_string);
d79e01f5 89$server_info = fgets ($imap_stream, 1024);
90if ($imap_stream) {
91 // SUPRESS HOST NAME
92 $list = explode(' ', $server_info);
93 $list[2] = '[HIDDEN]';
94 $server_info = implode(' ', $list);
95 $body .= " Server info: $server_info";
96 fputs ($imap_stream, "a001 CAPABILITY\r\n");
97 $read = fgets($imap_stream, 1024);
98 $list = explode(' ', $read);
99 array_shift($list);
100 array_shift($list);
101 $read = implode(' ', $list);
102 $body .= " Cabailities: $read";
103 fputs ($imap_stream, "a002 LOGOUT\r\n");
104 fclose($imap_stream);
105} else {
106 $body .= " Unable to connect to IMAP server to get information.\n";
107 $warning = 1;
108 $warnings['imap'] = "Unable to connect to IMAP server";
109 $corrections['imap'][] = "Make sure you specified the correct mail server";
110 $corrections['imap'][] = "Make sure the mail server is running IMAP, not POP";
111 $corrections['imap'][] = "Make sure the server responds to port $imapPort";
112}
07aeb697 113$warning_html = '';
d79e01f5 114$warning_num = 0;
07aeb697 115if (isset($warning) && $warning) {
d79e01f5 116 foreach ($warnings as $key => $value) {
117 if ($warning_num == 0) {
118 $body_top .= "WARNINGS WERE REPORTED WITH YOUR SETUP:\n";
119 $body_top = "WARNINGS WERE REPORTED WITH YOUR SETUP -- SEE BELOW\n\n$body_top";
120 $warning_html = "<h1>Warnings were reported with your setup:</h1>\n<dl>\n";
121 }
122 $warning_num ++;
123 $warning_html .= "<dt><b>$value</b></dt>\n";
124 $body_top .= "\n$value\n";
125 foreach ($corrections[$key] as $corr_val) {
126 $body_top .= " * $corr_val\n";
127 $warning_html .= "<dd>* $corr_val</dd>\n";
128 }
129 }
130 $warning_html .= "</dl>\n<p>$warning_num warning(s) reported.</p>\n<hr>\n";
131 $body_top .= "\n$warning_num warning(s) reported.\n";
132 $body_top .= "----------------------------------------------\n";
133}
134
135$body = htmlspecialchars($body_top . $body);
15e6162e 136
137?>
138 <br>
876efbe1 139 <table width=95% align=center border=0 cellpadding=2 cellspacing=0><tr>
140 <?php echo html_tag('td',"<b>"._("Submit a Bug Report")."</b>",'center',$color[0]); ?>
141 </tr></table>
142
143 <?PHP echo $warning_html;
144
145 echo "<p><font size=\"+1\">";
146 echo _("Before you send your bug report, please make sure to check this checklist for any common problems.");
147 echo "</font></p>";
148
149 echo "<ul>";
150 echo "<li>";
151 echo _("Make sure that you are running the most recent copy of <a href=\"http://www.squirrelmail.org/\">SquirrelMail</a>.");
152 echo sprintf(_("You are currently using version %s."),$version);
153 echo "</li>\n";
154
155 echo "<li>";
156 echo _("Check to see if you bug is already listed in the <a href=\"http://sourceforge.net/bugs/?group_id=311\">Bug List</a> on SourceForge. If it is, we already know about it and are trying to fix it.");
157 echo "</li>\n";
158
159 echo "<li>";
160 echo _("Try to make sure that you can repeat it. If the bug happens sporatically, try to document what you did when it happened. If it always occurs when you view a specific message, keep that message around so maybe we can see it.");
161 echo "</li>\n";
162
163 echo "<li>";
164 echo _("If there were warnings displayed above, try to resolve them yourself. Read the guides in the <tt>doc/</tt> directory where SquirrelMail was installed.");
165 echo "</li>\n";
166 echo "</ul>\n";
167
168 echo "<p>";
169 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.");
170 echo "</p>\n";
171
172 echo "<p>";
173 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.");
174 echo "</p>\n";
175?>
15e6162e 176 <form action="../../src/compose.php" method=post>
177 <table align=center border=0>
178 <tr>
179 <td>
876efbe1 180 <?php echo _("This bug involves"); ?>: <select name="send_to">
181 <option value="squirrelmail-users@lists.sourceforge.net">
182 <?php echo _("the general program"); ?></option>
183 <option value="squirrelmail-plugins@lists.sourceforge.net">
184 <?php echo _("a specific plugin"); ?></option>
15e6162e 185 </select>
186 </td>
187 </tr>
188 <tr>
189 <td align=center>
190 <input type="hidden" name="send_to_cc" value="">
191 <input type="hidden" name="send_to_bcc" value="">
192 <input type="hidden" name="subject" value="Bug Report">
193 <input type="hidden" name="body" value="<?PHP echo $body ?>">
876efbe1 194 <input type="submit" value="<?php echo _("Start Bug Report Form"); ?>">
15e6162e 195 </td>
196 </tr>
197 </table>
198 </form>
7a0d72ee 199</body></html>