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