Getting ready for 1.2.0 release.
[squirrelmail.git] / plugins / bug_report / bug_report.php
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 *
11 * Copyright (c) 1999-2002 The SquirrelMail development team
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$
17 */
18
19 chdir("..");
20
21 session_start();
22
23 if (!isset($config_php))
24 /* '_once' Added by ri_once */ include_once("../config/config.php");
25 if (!isset($strings_php))
26 /* '_once' Added by ri_once */ include_once("../functions/strings.php");
27 if (!isset($page_header_php))
28 /* '_once' Added by ri_once */ include_once("../functions/page_header.php");
29 if (!isset($display_messages_php))
30 /* '_once' Added by ri_once */ include_once("../functions/display_messages.php");
31 if (!isset($imap_php))
32 /* '_once' Added by ri_once */ include_once("../functions/imap.php");
33 if (!isset($array_php))
34 /* '_once' Added by ri_once */ include_once("../functions/array.php");
35 if (!isset($i18n_php))
36 /* '_once' Added by ri_once */ include_once("../functions/i18n.php");
37
38
39 /* '_once' Added by ri_once */ include_once("../src/load_prefs.php");
40 displayPageHeader($color, "None");
41
42
43 function Show_Array($array)
44 {
45 foreach ($array as $key => $value)
46 {
47 if ($key != 0 || $value != '')
48 {
49 $str .= " * $key = $value\n";
50 }
51 }
52 if ($str == '')
53 return " * Nothing listed\n";
54 return $str;
55 }
56
57 $body_top .= "I subscribe to the squirrelmail-list mailing list.\n";
58 $body_top .= " [ ] True - No need to CC me when replying\n";
59 $body_top .= " [ ] False - Please CC me when replying\n";
60 $body_top .= "\n";
61 $body_top .= "This bug occurs when I ...\n";
62 $body_top .= " ... view a particular message\n";
63 $body_top .= " ... use a specific plugin/function\n";
64 $body_top .= " ... try to do/view/use ....\n";
65 $body_top .= "\n\n\n";
66 $body_top .= "The description of the bug:\n\n\n";
67 $body_top .= "I can reproduce the bug by:\n\n\n";
68 $body_top .= "(Optional) I got bored and found the bug occurs in:\n\n\n";
69 $body_top .= "(Optional) I got really bored and here's a fix:\n\n\n";
70 $body_top .= "----------------------------------------------\n";
71
72
73 $body .= "\nMy browser information:\n";
74 $body .= " $HTTP_USER_AGENT\n";
75 $body .= " get_browser() information (List)\n";
76 $browser = get_browser();
77 $body .= Show_Array((array) $browser);
78
79 $body .= "\nMy web server information:\n";
80 $body .= " PHP Version " . phpversion() . "\n";
81 $body .= " PHP Extensions (List)\n";
82 $body .= Show_Array(get_loaded_extensions());
83 // Apache version?
84
85 $body .= "\nSquirrelMail-specific information:\n";
86 $body .= " Version: $version\n";
87 $body .= " Plugins (List)\n";
88 $body .= Show_Array($plugins);
89 if ($ldap_server[0] && ! extension_loaded('ldap'))
90 {
91 $warning = 1;
92 $warnings['ldap'] = "LDAP server defined in SquirrelMail config, " .
93 "but the module is not loaded in PHP";
94 $corrections['ldap'][] = "Reconfigure PHP with the option '--with-ldap'";
95 $corrections['ldap'][] = "Then recompile PHP and reinstall";
96 $corrections['ldap'][] = "-- OR --";
97 $corrections['ldap'][] = "Reconfigure SquirrelMail to not use LDAP";
98 }
99
100 $body .= "\nMy IMAP server information:\n";
101 $body .= " Server type: $imap_server_type\n";
102 $imap_stream = fsockopen ($imapServerAddress, $imapPort, &$error_number, &$error_string);
103 $server_info = fgets ($imap_stream, 1024);
104 if ($imap_stream)
105 {
106 // SUPRESS HOST NAME
107 $list = explode(' ', $server_info);
108 $list[2] = '[HIDDEN]';
109 $server_info = implode(' ', $list);
110 $body .= " Server info: $server_info";
111 fputs ($imap_stream, "a001 CAPABILITY\r\n");
112 $read = fgets($imap_stream, 1024);
113 $list = explode(' ', $read);
114 array_shift($list);
115 array_shift($list);
116 $read = implode(' ', $list);
117 $body .= " Cabailities: $read";
118 fputs ($imap_stream, "a002 LOGOUT\r\n");
119 fclose($imap_stream);
120 }
121 else
122 {
123 $body .= " Unable to connect to IMAP server to get information.\n";
124 $warning = 1;
125 $warnings['imap'] = "Unable to connect to IMAP server";
126 $corrections['imap'][] = "Make sure you specified the correct mail server";
127 $corrections['imap'][] = "Make sure the mail server is running IMAP, not POP";
128 $corrections['imap'][] = "Make sure the server responds to port $imapPort";
129 }
130
131 $warning_num = 0;
132 if ($warning)
133 {
134 foreach ($warnings as $key => $value)
135 {
136 if ($warning_num == 0)
137 {
138 $body_top .= "WARNINGS WERE REPORTED WITH YOUR SETUP:\n";
139 $body_top = "WARNINGS WERE REPORTED WITH YOUR SETUP -- SEE BELOW\n\n$body_top";
140 $warning_html = "<h1>Warnings were reported with your setup:</h1>\n<dl>\n";
141 }
142 $warning_num ++;
143 $warning_html .= "<dt><b>$value</b></dt>\n";
144 $body_top .= "\n$value\n";
145 foreach ($corrections[$key] as $corr_val)
146 {
147 $body_top .= " * $corr_val\n";
148 $warning_html .= "<dd>* $corr_val</dd>\n";
149 }
150 }
151 $warning_html .= "</dl>\n<p>$warning_num warning(s) reported.</p>\n<hr>\n";
152 $body_top .= "\n$warning_num warning(s) reported.\n";
153 $body_top .= "----------------------------------------------\n";
154 }
155
156 $body = htmlspecialchars($body_top . $body);
157
158 ?>
159 <br>
160 <table width=95% align=center border=0 cellpadding=2 cellspacing=0><tr><td bgcolor="<?php echo $color[0] ?>">
161 <center><b>Submit a Bug Report</b></center>
162 </td></tr></table>
163
164 <?PHP echo $warning_html; ?>
165
166 <p><font size="+1">Before you send your bug report</font>, please make sure to
167 check this checklist for any common problems.</p>
168
169 <ul>
170 <li>Make sure that you are running the most recent copy of
171 <a href="http://www.squirrelmail.org/">SquirrelMail</a>. You are currently
172 using version <?PHP echo $version ?>.</li>
173 <li>Check to see if you bug is already listed in the
174 <a href="http://sourceforge.net/bugs/?group_id=311">Bug List</a> on SourceForge.
175 If it is, we already know about it and are trying to fix it.</li>
176 <li>Try to make sure that you can repeat it. If the bug happens
177 sporatically, try to document what you did when it happened. If it
178 always occurs when you view a specific message, keep that message around
179 so maybe we can see it.</li>
180 <li>If there were warnings displayed above, try to resolve them yourself.
181 Read the guides in the <tt>doc/</tt> directory where SquirrelMail was
182 installed.</li>
183 </ul>
184
185 <p>Pressing the button below will start a mail message to the developers
186 of SquirrelMail that will contain a lot of information about your system,
187 your browser, how SquirrelMail is set up, and your IMAP server. It will
188 also prompt you for information. Just fill out the sections at the top.
189 If you like, you can scroll down in the message to see what else is being
190 sent.</p>
191
192 <p>Please make sure to fill out as much information as you possibly can to
193 give everyone a good chance of finding and removing the bug. Submitting
194 your bug like this will not have it automatically added to the bug list on
195 SourceForge, but someone who gets your message may add it for you.</p>
196
197 <form action="../../src/compose.php" method=post>
198 <table align=center border=0>
199 <tr>
200 <td>
201 This bug involves: <select name="send_to">
202 <option value="squirrelmail-list@lists.sourceforge.net">the general program</option>
203 <option value="squirrelmail-plugins@lists.sourceforge.net">a specific plugin</option>
204 </select>
205 </td>
206 </tr>
207 <tr>
208 <td align=center>
209 <input type="hidden" name="send_to_cc" value="">
210 <input type="hidden" name="send_to_bcc" value="">
211 <input type="hidden" name="subject" value="Bug Report">
212 <input type="hidden" name="body" value="<?PHP echo $body ?>">
213 <input type="submit" value="Start Bug Report Form">
214 </td>
215 </tr>
216 </table>
217 </form>
218 </body></html>