Converting strings to gettext
[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>
876efbe1 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?>
15e6162e 166 <form action="../../src/compose.php" method=post>
167 <table align=center border=0>
168 <tr>
169 <td>
876efbe1 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>
15e6162e 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 ?>">
876efbe1 184 <input type="submit" value="<?php echo _("Start Bug Report Form"); ?>">
15e6162e 185 </td>
186 </tr>
187 </table>
188 </form>
7a0d72ee 189</body></html>