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