Initial groundwork to use phpdocumentor.
[squirrelmail.git] / plugins / bug_report / bug_report.php
index 0c85c8c9a213914d51d81770c85f859526745740..2be94e778bf817efe58a6a19518d74290ba25914 100644 (file)
@@ -8,30 +8,28 @@
  * a button to show the bug report mail message in order to actually
  * send it.
  *
- * Copyright (c) 1999-2002 The SquirrelMail development team
+ * Copyright (c) 1999-2003 The SquirrelMail development team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * This is a standard Squirrelmail-1.2 API for plugins.
  *
  * $Id$
+ * @package plugins
+ * @subpackage bug_report
  */
 
-chdir('..');
+/**
+ * @ignore
+ */
+define('SM_PATH','../../');
 
-session_start();
+require_once(SM_PATH . 'include/validate.php');
 
-require_once('../config/config.php');
-require_once('../functions/strings.php');
-require_once('../functions/page_header.php');
-require_once('../functions/display_messages.php');
-require_once('../functions/imap.php');
-require_once('../functions/array.php');
-require_once('../functions/i18n.php');
-require_once('../src/load_prefs.php');
-displayPageHeader($color, "None");
+displayPageHeader($color, 'None');
 
 
 function Show_Array($array) {
+    $str = '';
     foreach ($array as $key => $value) {
         if ($key != 0 || $value != '') {
         $str .= "    * $key = $value\n";
@@ -44,7 +42,7 @@ function Show_Array($array) {
 }
 
 $browser = get_browser();
-$body_top .= "I subscribe to the squirrelmail-list mailing list.\n" .
+$body_top = "I subscribe to the squirrelmail-users mailing list.\n" .
                 "  [ ]  True - No need to CC me when replying\n" .
                 "  [ ]  False - Please CC me when replying\n" .
                 "\n" .
@@ -59,7 +57,7 @@ $body_top .= "I subscribe to the squirrelmail-list mailing list.\n" .
                 "(Optional) I got really bored and here's a fix:\n\n\n" .
                 "----------------------------------------------\n" .
             "\nMy browser information:\n" .
-            "  $HTTP_USER_AGENT\n" .
+            '  '.$_SERVER['HTTP_USER_AGENT'] . "\n" .
             "  get_browser() information (List)\n" .
             Show_Array((array) $browser) .
             "\nMy web server information:\n" .
@@ -70,7 +68,7 @@ $body_top .= "I subscribe to the squirrelmail-list mailing list.\n" .
             "  Version:  $version\n" .
             "  Plugins (List)\n" .
             Show_Array($plugins);
-if ($ldap_server[0] && ! extension_loaded('ldap')) {
+if (isset($ldap_server) && $ldap_server[0] && ! extension_loaded('ldap')) {
     $warning = 1;
     $warnings['ldap'] = "LDAP server defined in SquirrelMail config, " .
         "but the module is not loaded in PHP";
@@ -80,9 +78,9 @@ if ($ldap_server[0] && ! extension_loaded('ldap')) {
     $corrections['ldap'][] = "Reconfigure SquirrelMail to not use LDAP";
 }
 
-$body .= "\nMy IMAP server information:\n" .
+$body = "\nMy IMAP server information:\n" .
             "  Server type:  $imap_server_type\n";
-$imap_stream = fsockopen ($imapServerAddress, $imapPort, &$error_number, &$error_string);
+$imap_stream = fsockopen ($imapServerAddress, $imapPort, $error_number, $error_string);
 $server_info = fgets ($imap_stream, 1024);
 if ($imap_stream) {
     // SUPRESS HOST NAME
@@ -107,9 +105,9 @@ if ($imap_stream) {
     $corrections['imap'][] = "Make sure the mail server is running IMAP, not POP";
     $corrections['imap'][] = "Make sure the server responds to port $imapPort";
 }
-
+$warning_html = '';
 $warning_num = 0;
-if ($warning) {
+if (isset($warning) && $warning) {
     foreach ($warnings as $key => $value) {
         if ($warning_num == 0) {
             $body_top .= "WARNINGS WERE REPORTED WITH YOUR SETUP:\n";
@@ -133,50 +131,52 @@ $body = htmlspecialchars($body_top . $body);
 
 ?>
    <br>
-   <table width=95% align=center border=0 cellpadding=2 cellspacing=0><tr><td bgcolor="<?php echo $color[0] ?>">
-      <center><b>Submit a Bug Report</b></center>
-   </td></tr></table>
-
-   <?PHP echo $warning_html; ?>
-
-   <p><font size="+1">Before you send your bug report</font>, please make sure to
-   check this checklist for any common problems.</p>
-
-   <ul>
-   <li>Make sure that you are running the most recent copy of
-     <a href="http://www.squirrelmail.org/">SquirrelMail</a>.  You are currently
-     using version <?PHP echo $version ?>.</li>
-   <li>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.</li>
-   <li>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.</li>
-   <li>If there were warnings displayed above, try to resolve them yourself.
-     Read the guides in the <tt>doc/</tt> directory where SquirrelMail was
-     installed.</li>
-   </ul>
-
-   <p>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.</p>
-
-   <p>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.</p>
-
+   <table width=95% align=center border=0 cellpadding=2 cellspacing=0><tr>
+      <?php echo html_tag('td',"<b>"._("Submit a Bug Report")."</b>",'center',$color[0]); ?>
+   </tr></table>
+
+   <?PHP echo $warning_html; 
+
+   echo "<p><font size=\"+1\">";
+   echo _("Before you send your bug report, please make sure to check this checklist for any common problems.");
+   echo "</font></p>";
+
+   echo "<ul>";
+   echo "<li>";
+   echo _("Make sure that you are running the most recent copy of <a href=\"http://www.squirrelmail.org/\">SquirrelMail</a>.");
+   echo sprintf(_("You are currently using version %s."),$version);
+   echo "</li>\n";
+
+   echo "<li>";
+   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.");
+   echo "</li>\n";
+   
+   echo "<li>";
+   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.");
+   echo "</li>\n";
+
+   echo "<li>";
+   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.");
+   echo "</li>\n";
+   echo "</ul>\n";
+
+   echo "<p>";
+   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.");
+   echo "</p>\n";
+
+   echo "<p>";
+   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.");
+   echo "</p>\n";
+?>
    <form action="../../src/compose.php" method=post>
    <table align=center border=0>
    <tr>
      <td>
-       This bug involves: <select name="send_to">
-         <option value="squirrelmail-list@lists.sourceforge.net">the general program</option>
-         <option value="squirrelmail-plugins@lists.sourceforge.net">a specific plugin</option>
+       <?php echo _("This bug involves"); ?>: <select name="send_to">
+         <option value="squirrelmail-users@lists.sourceforge.net">
+        <?php echo _("the general program"); ?></option>
+         <option value="squirrelmail-plugins@lists.sourceforge.net">
+        <?php echo _("a specific plugin"); ?></option>
        </select>
      </td>
    </tr>
@@ -186,7 +186,7 @@ $body = htmlspecialchars($body_top . $body);
        <input type="hidden" name="send_to_bcc" value="">
        <input type="hidden" name="subject" value="Bug Report">
        <input type="hidden" name="body" value="<?PHP echo $body ?>">
-       <input type="submit" value="Start Bug Report Form">
+       <input type="submit" value="<?php echo _("Start Bug Report Form"); ?>">
      </td>
    </tr>
    </table>