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