bug_report.php 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <?php
  2. /**
  3. * bug_report.php
  4. *
  5. * This generates the bug report data, gives information about where
  6. * it will be sent to and what people will do with it, and provides
  7. * a button to show the bug report mail message in order to actually
  8. * send it.
  9. *
  10. * Copyright (c) 1999-2002 The SquirrelMail development team
  11. * Licensed under the GNU GPL. For full terms see the file COPYING.
  12. *
  13. * This is a standard Squirrelmail-1.2 API for plugins.
  14. *
  15. * $Id$
  16. */
  17. chdir('..');
  18. session_start();
  19. require_once('../config/config.php');
  20. require_once('../functions/strings.php');
  21. require_once('../functions/page_header.php');
  22. require_once('../functions/display_messages.php');
  23. require_once('../functions/imap.php');
  24. require_once('../functions/array.php');
  25. require_once('../functions/i18n.php');
  26. require_once('../src/load_prefs.php');
  27. displayPageHeader($color, 'None');
  28. function Show_Array($array) {
  29. foreach ($array as $key => $value) {
  30. if ($key != 0 || $value != '') {
  31. $str .= " * $key = $value\n";
  32. }
  33. }
  34. if ($str == '') {
  35. return " * Nothing listed\n";
  36. }
  37. return $str;
  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. " $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 ($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. $body .= "\nMy IMAP server information:\n" .
  76. " Server type: $imap_server_type\n";
  77. $imap_stream = fsockopen ($imapServerAddress, $imapPort, $error_number, $error_string);
  78. $server_info = fgets ($imap_stream, 1024);
  79. if ($imap_stream) {
  80. // SUPRESS HOST NAME
  81. $list = explode(' ', $server_info);
  82. $list[2] = '[HIDDEN]';
  83. $server_info = implode(' ', $list);
  84. $body .= " Server info: $server_info";
  85. fputs ($imap_stream, "a001 CAPABILITY\r\n");
  86. $read = fgets($imap_stream, 1024);
  87. $list = explode(' ', $read);
  88. array_shift($list);
  89. array_shift($list);
  90. $read = implode(' ', $list);
  91. $body .= " Cabailities: $read";
  92. fputs ($imap_stream, "a002 LOGOUT\r\n");
  93. fclose($imap_stream);
  94. } else {
  95. $body .= " Unable to connect to IMAP server to get information.\n";
  96. $warning = 1;
  97. $warnings['imap'] = "Unable to connect to IMAP server";
  98. $corrections['imap'][] = "Make sure you specified the correct mail server";
  99. $corrections['imap'][] = "Make sure the mail server is running IMAP, not POP";
  100. $corrections['imap'][] = "Make sure the server responds to port $imapPort";
  101. }
  102. $warning_num = 0;
  103. if ($warning) {
  104. foreach ($warnings as $key => $value) {
  105. if ($warning_num == 0) {
  106. $body_top .= "WARNINGS WERE REPORTED WITH YOUR SETUP:\n";
  107. $body_top = "WARNINGS WERE REPORTED WITH YOUR SETUP -- SEE BELOW\n\n$body_top";
  108. $warning_html = "<h1>Warnings were reported with your setup:</h1>\n<dl>\n";
  109. }
  110. $warning_num ++;
  111. $warning_html .= "<dt><b>$value</b></dt>\n";
  112. $body_top .= "\n$value\n";
  113. foreach ($corrections[$key] as $corr_val) {
  114. $body_top .= " * $corr_val\n";
  115. $warning_html .= "<dd>* $corr_val</dd>\n";
  116. }
  117. }
  118. $warning_html .= "</dl>\n<p>$warning_num warning(s) reported.</p>\n<hr>\n";
  119. $body_top .= "\n$warning_num warning(s) reported.\n";
  120. $body_top .= "----------------------------------------------\n";
  121. }
  122. $body = htmlspecialchars($body_top . $body);
  123. ?>
  124. <br>
  125. <table width=95% align=center border=0 cellpadding=2 cellspacing=0><tr><td bgcolor="<?php echo $color[0] ?>">
  126. <center><b>Submit a Bug Report</b></center>
  127. </td></tr></table>
  128. <?PHP echo $warning_html; ?>
  129. <p><font size="+1">Before you send your bug report</font>, please make sure to
  130. check this checklist for any common problems.</p>
  131. <ul>
  132. <li>Make sure that you are running the most recent copy of
  133. <a href="http://www.squirrelmail.org/">SquirrelMail</a>. You are currently
  134. using version <?PHP echo $version ?>.</li>
  135. <li>Check to see if you bug is already listed in the
  136. <a href="http://sourceforge.net/bugs/?group_id=311">Bug List</a> on SourceForge.
  137. If it is, we already know about it and are trying to fix it.</li>
  138. <li>Try to make sure that you can repeat it. If the bug happens
  139. sporatically, try to document what you did when it happened. If it
  140. always occurs when you view a specific message, keep that message around
  141. so maybe we can see it.</li>
  142. <li>If there were warnings displayed above, try to resolve them yourself.
  143. Read the guides in the <tt>doc/</tt> directory where SquirrelMail was
  144. installed.</li>
  145. </ul>
  146. <p>Pressing the button below will start a mail message to the developers
  147. of SquirrelMail that will contain a lot of information about your system,
  148. your browser, how SquirrelMail is set up, and your IMAP server. It will
  149. also prompt you for information. Just fill out the sections at the top.
  150. If you like, you can scroll down in the message to see what else is being
  151. sent.</p>
  152. <p>Please make sure to fill out as much information as you possibly can to
  153. give everyone a good chance of finding and removing the bug. Submitting
  154. your bug like this will not have it automatically added to the bug list on
  155. SourceForge, but someone who gets your message may add it for you.</p>
  156. <form action="../../src/compose.php" method=post>
  157. <table align=center border=0>
  158. <tr>
  159. <td>
  160. This bug involves: <select name="send_to">
  161. <option value="squirrelmail-users@lists.sourceforge.net">the general program</option>
  162. <option value="squirrelmail-plugins@lists.sourceforge.net">a specific plugin</option>
  163. </select>
  164. </td>
  165. </tr>
  166. <tr>
  167. <td align=center>
  168. <input type="hidden" name="send_to_cc" value="">
  169. <input type="hidden" name="send_to_bcc" value="">
  170. <input type="hidden" name="subject" value="Bug Report">
  171. <input type="hidden" name="body" value="<?PHP echo $body ?>">
  172. <input type="submit" value="Start Bug Report Form">
  173. </td>
  174. </tr>
  175. </table>
  176. </form>
  177. </body></html>