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