Converting strings to gettext
[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-2003 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 define('SM_PATH','../../');
20
21 require_once(SM_PATH . 'include/validate.php');
22
23 displayPageHeader($color, 'None');
24
25
26 function Show_Array($array) {
27 $str = '';
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();
40 $body_top = "I subscribe to the squirrelmail-users mailing list.\n" .
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" .
55 ' '.$_SERVER['HTTP_USER_AGENT'] . "\n" .
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);
66 if (isset($ldap_server) && $ldap_server[0] && ! extension_loaded('ldap')) {
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
76 $body = "\nMy IMAP server information:\n" .
77 " Server type: $imap_server_type\n";
78 $imap_stream = fsockopen ($imapServerAddress, $imapPort, $error_number, $error_string);
79 $server_info = fgets ($imap_stream, 1024);
80 if ($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 }
103 $warning_html = '';
104 $warning_num = 0;
105 if (isset($warning) && $warning) {
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);
126
127 ?>
128 <br>
129 <table width=95% align=center border=0 cellpadding=2 cellspacing=0><tr>
130 <?php echo html_tag('td',"<b>"._("Submit a Bug Report")."</b>",'center',$color[0]); ?>
131 </tr></table>
132
133 <?PHP echo $warning_html;
134
135 echo "<p><font size=\"+1\">";
136 echo _("Before you send your bug report, please make sure to check this checklist for any common problems.");
137 echo "</font></p>";
138
139 echo "<ul>";
140 echo "<li>";
141 echo _("Make sure that you are running the most recent copy of <a href=\"http://www.squirrelmail.org/\">SquirrelMail</a>.");
142 echo sprintf(_("You are currently using version %s."),$version);
143 echo "</li>\n";
144
145 echo "<li>";
146 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.");
147 echo "</li>\n";
148
149 echo "<li>";
150 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.");
151 echo "</li>\n";
152
153 echo "<li>";
154 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.");
155 echo "</li>\n";
156 echo "</ul>\n";
157
158 echo "<p>";
159 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.");
160 echo "</p>\n";
161
162 echo "<p>";
163 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.");
164 echo "</p>\n";
165 ?>
166 <form action="../../src/compose.php" method=post>
167 <table align=center border=0>
168 <tr>
169 <td>
170 <?php echo _("This bug involves"); ?>: <select name="send_to">
171 <option value="squirrelmail-users@lists.sourceforge.net">
172 <?php echo _("the general program"); ?></option>
173 <option value="squirrelmail-plugins@lists.sourceforge.net">
174 <?php echo _("a specific plugin"); ?></option>
175 </select>
176 </td>
177 </tr>
178 <tr>
179 <td align=center>
180 <input type="hidden" name="send_to_cc" value="">
181 <input type="hidden" name="send_to_bcc" value="">
182 <input type="hidden" name="subject" value="Bug Report">
183 <input type="hidden" name="body" value="<?PHP echo $body ?>">
184 <input type="submit" value="<?php echo _("Start Bug Report Form"); ?>">
185 </td>
186 </tr>
187 </table>
188 </form>
189 </body></html>