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