2069d2e50e61d8cd8a915e9dfe63b14c1d63212d
[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-2004 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 * @version $Id$
17 * @package plugins
18 * @subpackage bug_report
19 */
20
21 /**
22 * @ignore
23 */
24 define('SM_PATH','../../');
25
26 require_once(SM_PATH . 'include/validate.php');
27
28 // loading form functions
29 require_once(SM_PATH . 'functions/forms.php');
30
31 displayPageHeader($color, 'None');
32
33 /**
34 * converts array to string
35 *
36 * @param array $array array that has to be displayed
37 * @return string
38 * @access private
39 */
40 function Show_Array($array) {
41 $str = '';
42 foreach ($array as $key => $value) {
43 if ($key != 0 || $value != '') {
44 $str .= " * $key = $value\n";
45 }
46 }
47 if ($str == '') {
48 return " * Nothing listed\n";
49 }
50 return $str;
51 }
52
53 $browscap = ini_get('browscap');
54 if(!empty($browscap)) {
55 $browser = get_browser();
56 }
57 $body_top = "I subscribe to the squirrelmail-users mailing list.\n" .
58 " [ ] True - No need to CC me when replying\n" .
59 " [ ] False - Please CC me when replying\n" .
60 "\n" .
61 "This bug occurs when I ...\n" .
62 " ... view a particular message\n" .
63 " ... use a specific plugin/function\n" .
64 " ... try to do/view/use ....\n" .
65 "\n\n\n" .
66 "The description of the bug:\n\n\n" .
67 "I can reproduce the bug by:\n\n\n" .
68 "(Optional) I got bored and found the bug occurs in:\n\n\n" .
69 "(Optional) I got really bored and here's a fix:\n\n\n" .
70 "----------------------------------------------\n" .
71 "\nMy browser information:\n" .
72 ' '.$_SERVER['HTTP_USER_AGENT'] . "\n" ;
73 if(isset($browser)) {
74 $body_top .= " get_browser() information (List)\n" .
75 Show_Array((array) $browser);
76 }
77 $body_top .= "\nMy web server information:\n" .
78 " PHP Version " . phpversion() . "\n" .
79 " PHP Extensions (List)\n" .
80 Show_Array(get_loaded_extensions()) .
81 "\nSquirrelMail-specific information:\n" .
82 " Version: $version\n" .
83 " Plugins (List)\n" .
84 Show_Array($plugins);
85 if (isset($ldap_server) && $ldap_server[0] && ! extension_loaded('ldap')) {
86 $warning = 1;
87 $warnings['ldap'] = "LDAP server defined in SquirrelMail config, " .
88 "but the module is not loaded in PHP";
89 $corrections['ldap'][] = "Reconfigure PHP with the option '--with-ldap'";
90 $corrections['ldap'][] = "Then recompile PHP and reinstall";
91 $corrections['ldap'][] = "-- OR --";
92 $corrections['ldap'][] = "Reconfigure SquirrelMail to not use LDAP";
93 }
94
95 $body = "\nMy IMAP server information:\n" .
96 " Server type: $imap_server_type\n";
97 $imap_stream = fsockopen ($imapServerAddress, $imapPort, $error_number, $error_string);
98 $server_info = fgets ($imap_stream, 1024);
99 if ($imap_stream) {
100 // SUPRESS HOST NAME
101 $list = explode(' ', $server_info);
102 $list[2] = '[HIDDEN]';
103 $server_info = implode(' ', $list);
104 $body .= " Server info: $server_info";
105 fputs ($imap_stream, "a001 CAPABILITY\r\n");
106 $read = fgets($imap_stream, 1024);
107 $list = explode(' ', $read);
108 array_shift($list);
109 array_shift($list);
110 $read = implode(' ', $list);
111 $body .= " Capabilities: $read";
112 fputs ($imap_stream, "a002 LOGOUT\r\n");
113 fclose($imap_stream);
114 } else {
115 $body .= " Unable to connect to IMAP server to get information.\n";
116 $warning = 1;
117 $warnings['imap'] = "Unable to connect to IMAP server";
118 $corrections['imap'][] = "Make sure you specified the correct mail server";
119 $corrections['imap'][] = "Make sure the mail server is running IMAP, not POP";
120 $corrections['imap'][] = "Make sure the server responds to port $imapPort";
121 }
122 $warning_html = '';
123 $warning_num = 0;
124 if (isset($warning) && $warning) {
125 foreach ($warnings as $key => $value) {
126 if ($warning_num == 0) {
127 $body_top .= "WARNINGS WERE REPORTED WITH YOUR SETUP:\n";
128 $body_top = "WARNINGS WERE REPORTED WITH YOUR SETUP -- SEE BELOW\n\n$body_top";
129 $warning_html = "<h1>Warnings were reported with your setup:</h1>\n<dl>\n";
130 }
131 $warning_num ++;
132 $warning_html .= "<dt><b>$value</b></dt>\n";
133 $body_top .= "\n$value\n";
134 foreach ($corrections[$key] as $corr_val) {
135 $body_top .= " * $corr_val\n";
136 $warning_html .= "<dd>* $corr_val</dd>\n";
137 }
138 }
139 $warning_html .= "</dl>\n<p>$warning_num warning(s) reported.</p>\n<hr>\n";
140 $body_top .= "\n$warning_num warning(s) reported.\n";
141 $body_top .= "----------------------------------------------\n";
142 }
143
144 $body = htmlspecialchars($body_top . $body);
145
146 ?>
147 <br>
148 <table width="95%" align="center" border="0" cellpadding="2" cellspacing="0"><tr>
149 <?php echo html_tag('td',"<b>"._("Submit a Bug Report")."</b>",'center',$color[0]); ?>
150 </tr></table>
151
152 <?PHP echo $warning_html;
153
154 echo '<p><big>';
155 echo _("Before you send your bug report, please make sure to check this checklist for any common problems.");
156 echo '</big></p>';
157
158 echo "<ul>";
159 echo "<li>";
160 echo _("Make sure that you are running the most recent copy of <a href=\"http://www.squirrelmail.org/\">SquirrelMail</a>.");
161 echo sprintf(_("You are currently using version %s."),$version);
162 echo "</li>\n";
163
164 echo "<li>";
165 echo _("Check to see if your 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.");
166 echo "</li>\n";
167
168 echo "<li>";
169 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.");
170 echo "</li>\n";
171
172 echo "<li>";
173 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.");
174 echo "</li>\n";
175 echo "</ul>\n";
176
177 echo "<p>";
178 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.");
179 echo "</p>\n";
180
181 echo "<p>";
182 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.");
183 echo "</p>\n";
184 ?>
185 <form action="../../src/compose.php" method=post>
186 <table align=center border=0>
187 <tr>
188 <td>
189 <?php echo _("This bug involves"); ?>: <select name="send_to">
190 <option value="squirrelmail-users@lists.sourceforge.net">
191 <?php echo _("the general program"); ?></option>
192 <option value="squirrelmail-plugins@lists.sourceforge.net">
193 <?php echo _("a specific plugin"); ?></option>
194 </select>
195 </td>
196 </tr>
197 <tr>
198 <td align=center>
199 <?php
200 echo addHidden("send_to_cc","");
201 echo addHidden("send_to_bcc","");
202 echo addHidden("subject","Bug Report");
203 echo addHidden("body",$body);
204 echo addSubmit(_("Start Bug Report Form"));
205 ?>
206 </td>
207 </tr>
208 </table>
209 </form>
210 </body></html>