Internationalization of the filter plugin.
authorphilippe_mingo <philippe_mingo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 8 Nov 2001 10:23:34 +0000 (10:23 +0000)
committerphilippe_mingo <philippe_mingo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 8 Nov 2001 10:23:34 +0000 (10:23 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1698 7612ce4b-ef26-0410-bec9-ea0150e637f0

plugins/filters/CHANGES
plugins/filters/filters.php
plugins/filters/options.php
plugins/filters/setup.php
plugins/filters/sqimap_read_data.php
po/squirrelmail.po
po/xgetpo

index e762423..3a65fde 100644 (file)
@@ -1,6 +1,7 @@
 Changes since 0.8.3
 -------------------
-Just changed include() calls to require_once() calls.
+Changed include() calls to require_once() calls.
+Internationalization of the plugin.
 
 Changes since 0.8.2
 -------------------
index 7fe9783..eb0640d 100644 (file)
       $filters['MAPS RBL']['link'] = 'http://www.mail-abuse.org/rbl/';
       $filters['MAPS RBL']['dns'] = 'blackholes.mail-abuse.org';
       $filters['MAPS RBL']['comment'] = 
-'COMMERCIAL - This list contains servers that are verified spam senders.
-It is a pretty reliable list to scan spam from.';
+_("COMMERCIAL - This list contains servers that are verified spam senders. It is a pretty reliable list to scan spam from.");
       
       $filters['MAPS RSS']['prefname'] = 'filters_spam_maps_rss';
       $filters['MAPS RSS']['name'] = 'MAPS Relay Spam Stopper';
       $filters['MAPS RSS']['link'] = 'http://www.mail-abuse.org/rss/';
       $filters['MAPS RSS']['dns'] = 'relays.mail-abuse.org';
       $filters['MAPS RSS']['comment'] =
-'COMMERCIAL - Servers that are configured (or misconfigured) to allow spam to
-be relayed through their system will be banned with this.  Another good one to
-use.';
+_("COMMERCIAL - Servers that are configured (or misconfigured) to allow spam to be relayed through their system will be banned with this.  Another good one to use.");
 
       $filters['MAPS DUL']['prefname'] = 'filters_spam_maps_dul';
       $filters['MAPS DUL']['name'] = 'MAPS Dial-Up List';
       $filters['MAPS DUL']['link'] = 'http://www.mail-abuse.org/dul/';
       $filters['MAPS DUL']['dns'] = 'dialups.mail-abuse.org';
       $filters['MAPS DUL']['comment'] =
-'COMMERCIAL - Dial-up users are often filtered out since they should use their
-ISP\'s mail servers to send mail.  Spammers typically get a dial-up account
-and send spam directly from there.';
+_("COMMERCIAL - Dial-up users are often filtered out since they should use their ISP\'s mail servers to send mail.  Spammers typically get a dial-up account and send spam directly from there.");
 
       $filters['MAPS RBLplus']['prefname'] = 'filters_spam_maps_rblplus';
       $filters['MAPS RBLplus']['name'] = 'MAPS RBL+ List';
       $filters['MAPS RBLplus']['link'] = 'http://www.mail-abuse.org/';
       $filters['MAPS RBLplus']['dns'] = 'rbl-plus.mail-abuse.org';
       $filters['MAPS RBLplus']['comment'] =
-'COMMERCIAL - RBL+ is a combination of RSS, DUL, and RBL.';
+_("COMMERCIAL - RBL+ is a combination of RSS, DUL, and RBL.");
 
       $filters['Osirusoft']['prefname'] = 'filters_spam_maps_osirusoft';
       $filters['Osirusoft']['name'] = 'Osirusoft List';
       $filters['Osirusoft']['link'] = 'http://relays.osirusoft.com/';
       $filters['Osirusoft']['dns'] = 'relays.osirusoft.com';
       $filters['Osirusoft']['comment'] =
-'FREE - Osirusoft - Very thorough, but also rejects replies from many
-ISP\'s abuse@domain.name email messages for some reason.';
+_("FREE - Osirusoft - Very thorough, but also rejects replies from many ISP\'s abuse@domain.name email messages for some reason.");
 
       $filters['ORDB']['prefname'] = 'filters_spam_ordb';
       $filters['ORDB']['name'] = 'Open Relay Database List';
       $filters['ORDB']['link'] = 'http://www.ordb.org/';
       $filters['ORDB']['dns'] = 'relays.ordb.org';
       $filters['ORDB']['comment'] =
-'FREE - ORDB was born when ORBS went off the air. It seems to have fewer false
-positives than ORBS did though.';
+_("FREE - ORDB was born when ORBS went off the air. It seems to have fewer false positives than ORBS did though.");
       
       $filters['ORBZ']['prefname'] = 'filters_spam_orbz';
       $filters['ORBZ']['name'] = 'ORBZ List';
       $filters['ORBZ']['link'] = 'http://www.orbz.org/';
       $filters['ORBZ']['dns'] = 'inputs.orbz.org';
       $filters['ORBZ']['comment'] =
-'FREE - Another ORBS replacement (just the INPUTS database used here).';
+_("FREE - Another ORBS replacement (just the INPUTS database used here).");
       
       $filters['Five-Ten']['prefname'] = 'filters_spam_fiveten';
       $filters['Five-Ten']['name'] = 'Five-Ten-sg.com Lists';
       $filters['Five-Ten']['link'] = 'http://www.five-ten-sg.com/blackhole.php';
       $filters['Five-Ten']['dns'] = 'blackholes.five-ten-sg.com';
       $filters['Five-Ten']['comment'] =
-'FREE - Five-Ten-sg.com has SPAM source, OpenRelay, and and Dialup IPs.';
+_("FREE - Five-Ten-sg.com has SPAM source, OpenRelay, and and Dialup IPs.");
       
       $filters['Dorkslayers']['prefname'] = 'filters_spam_dorks';
       $filters['Dorkslayers']['name'] = 'Dorkslayers Lists';
       $filters['Dorkslayers']['link'] = 'http://www.dorkslayers.com';
       $filters['Dorkslayers']['dns'] = 'orbs.dorkslayers.com';
       $filters['Dorkslayers']['comment'] =
-'FREE - Dorkslayers appears to include only really bad open relays outside
-the US to avoid being sued. Interestingly enough, their website recommends
-you NOT use their service.';
+_("FREE - Dorkslayers appears to include only really bad open relays outside the US to avoid being sued. Interestingly enough, their website recommends you NOT use their service.");
       
       $filters['ORBL']['prefname'] = 'filters_spam_orbl';
       $filters['ORBL']['name'] = 'ORBL Lists';
       $filters['ORBL']['link'] = 'http://www.orbl.org';
       $filters['ORBL']['dns'] = 'or.orbl.org';
       $filters['ORBL']['comment'] =
-'FREE - ORBL is another ORBS spinoff formed after ORBS shut down. May be
-SLOOOOOOW!';
+_("'FREE - ORBL is another ORBS spinoff formed after ORBS shut down. May be SLOOOOOOW!");
       
       $filters['ORBZ-UK']['prefname'] = 'filters_spam_orbzuk';
       $filters['ORBZ-UK']['name'] = 'ORBZ-UK Lists';
       $filters['ORBZ-UK']['link'] = 'http://orbz.gst-group.co.uk';
       $filters['ORBZ-UK']['dns'] = 'orbz.gst-group.co.uk';
       $filters['ORBZ-UK']['comment'] =
-'FREE - orbz.gst-group.co.uk lists not only open relays, but also mailservers
-that refuse or bounce email addressed to postmaster@<theirdomain>.';
+_("FREE - orbz.gst-group.co.uk lists not only open relays, but also mailservers that refuse or bounce email addressed to postmaster@<theirdomain>.");
       
       foreach ($filters as $Key => $Value) {
           $filters[$Key]['enabled'] = getPref($data_dir, $username,
index b53ef1a..00b7f9d 100644 (file)
@@ -1,6 +1,6 @@
 <?php
    /*
-    *  Message and Spam Filter Plugin 
+    *  Message and Spam Filter Plugin
     *  By Luke Ehresman <luke@squirrelmail.org>
     *     Tyler Akins
     *     Brent Bice
     *  Also view plugins/README.plugins for more information.
     *
     */
-   chdir ("..");
+   chdir('..');
    require_once('../src/validate.php');
-   require_once ("../functions/page_header.php");
-   require_once ("../functions/imap.php");
-   require_once ("../src/load_prefs.php");
+   require_once('../functions/page_header.php');
+   require_once('../functions/imap.php');
+   require_once('../src/load_prefs.php');
 
    global $AllowSpamFilters;
 
-   displayPageHeader($color, "None");   
+   displayPageHeader($color, 'None');
 
    if (isset($filter_submit)) {
       if (!isset($theid)) $theid = 0;
-      $filter_what = ereg_replace(",", " ", $filter_what);
+      $filter_what = str_replace(',', ' ', $filter_what);
       $filter_what = str_replace("\\\\", "\\", $filter_what);
       $filter_what = str_replace("\\\"", "\"", $filter_what);
       $filter_what = str_replace("\"", "&quot;", $filter_what);
 
-      setPref($data_dir, $username, "filter".$theid, $filter_where.",".$filter_what.",".$filter_folder);
-      $filters[$theid]["where"] = $filter_where;
-      $filters[$theid]["what"] = $filter_what;
-      $filters[$theid]["folder"] = $filter_folder;
+      setPref($data_dir, $username, 'filter'.$theid, $filter_where.','.$filter_what.','.$filter_folder);
+      $filters[$theid]['where'] = $filter_where;
+      $filters[$theid]['what'] = $filter_what;
+      $filters[$theid]['folder'] = $filter_folder;
    } elseif (isset($spam_submit) && $AllowSpamFilters) {
       $spam_filters = load_spam_filters();
       setPref($data_dir, $username, 'filters_spam_folder', $filters_spam_folder_set);
           setPref($data_dir, $username, $spam_filters[$Key]['prefname'],
               $$input);
       }
-   } elseif (isset($action) && $action == "delete") {
+   } elseif (isset($action) && $action == 'delete') {
       remove_filter($theid);
-   } elseif (isset($action) && $action == "move_up") {
+   } elseif (isset($action) && $action == 'move_up') {
       filter_swap($theid, $theid - 1);
-   } elseif (isset($action) && $action == "move_down") {
+   } elseif (isset($action) && $action == 'move_down') {
       filter_swap($theid, $theid + 1);
    }
 
    }
    $filters = load_filters();
 
-   ?>
-      <br>
-      <table width=95% align=center border=0 cellpadding=2 cellspacing=0><tr><td bgcolor="<?php echo $color[0] ?>">
-         <center><b><?php echo _("Options") ?> - Message Filtering</b></center>
-      </td></tr></table>
-      <br><center>[<a href="options.php?action=add">New</a>] - [<a href="../../src/options.php">Done</a>]</center><br>
-      <table border=0 cellpadding=3 cellspacing=0 align=center>
-         <?php
-            for ($i=0; $i < count($filters); $i++) {
-               if ($i % 2 == 0) $clr = $color[0];
-               else $clr = $color[9];
-
-               $fdr = ($folder_prefix)?str_replace($folder_prefix, "", $filters[$i]["folder"]):$filters[$i]["folder"];
-
-?>
-<tr bgcolor="<?PHP echo $clr ?>"><td><small>
-[<a href="options.php?theid=<?PHP echo $i ?>&action=edit">Edit</a>]
-</small></td><td><small>
-[<a href="options.php?theid=<?PHP echo $i ?>&action=delete">Delete</a>]
-</small></td><td align=center><small>
-[<?PHP if (isset($filters[$i + 1])) {
-?><a href="options.php?theid=<?PHP echo $i ?>&action=move_down">Down</a><?PHP 
-if ($i > 0) echo ' | ';
-}
-if ($i > 0) {
-?><a href="options.php?theid=<?PHP echo $i ?>&action=move_up">Up</a><?PHP 
-} ?>]</small></td><td>
-- If <b><?PHP echo $filters[$i]['where'] ?></b> contains <b><?PHP
-echo $filters[$i]['what'] ?></b> then move to <b><?PHP echo $fdr ?></b>
-</td></tr>
-<?PHP
+   echo '<br>' .
+        '<table width=95% align=center border=0 cellpadding=2 cellspacing=0>'.
+        "<tr><td bgcolor=\"$color[0]\">".
+        '<center><b>' . _("Options") . ' -  ' . _("Message Filtering") . '</b></center>'.
+        '</td></tr></table>'.
+        '<br><center>[<a href="options.php?action=add">' . _("New") .
+        '</a>] - [<a href="../../src/options.php">' . _("Done") . '</a>]</center><br>' .
+        '<table border=0 cellpadding=3 cellspacing=0 align=center>';
 
+        for ($i=0; $i < count($filters); $i++) {
+            if ($i % 2 == 0) {
+                $clr = $color[0];
+            } else {
+                $clr = $color[9];
             }
-         ?>
-      </table>
-      
-      <table width=80% align=center border=0 cellpadding=2 cellspacing=0">
-        <tr><td>&nbsp</td></tr>
-      </table>
-      
-      <?PHP if ($AllowSpamFilters) { ?>
-      
-      <table width=95% align=center border=0 cellpadding=2 cellspacing=0 bgcolor="<?php echo $color[0] ?>">
-        <tr><th align=center>Spam Filtering</th></tr>
-      </table>
-      <?PHP if (! isset($action) || $action != 'spam') { ?>
-      <p align=center>[<a href="options.php?action=spam">Edit</a>]<br>
-      Spam is sent to <b><?PHP 
-         if ($filters_spam_folder) 
-         {
-            echo $filters_spam_folder;
-         }
-         else
-         {
-            echo '[<i>not set yet</i>]';
-         }
-      ?></b><br>Spam scan is limited to <b><?PHP
-         if ($filters_spam_scan == 'new')
-         {
-            echo 'New Messages Only';
-         }
-         else
-         {
-            echo 'All Messages';
-         }
-      ?></b></p>
-      
-      <table border=0 cellpadding=3 cellspacing=0 align=center bgcolor="<?PHP echo $color[0] ?>">
-        <?PHP
-        
-          $spam_filters = load_spam_filters();
-          
-          foreach ($spam_filters as $Key => $Value)
-          {
-              echo '<tr><th align=center>';
-              
-              if ($spam_filters[$Key]['enabled'])
-              {
-                  echo 'ON';
-              }
-              else
-              {
-                  echo 'OFF';
-              }
-              
-              echo '</th><td>&nbsp;-&nbsp;</td><td>';
-              
-              if ($spam_filters[$Key]['link'])
-              {
-                  echo '<a href="';
-                  echo $spam_filters[$Key]['link'];
-                  echo '" target="_blank">';
-              }
-              
-              echo $spam_filters[$Key]['name'];
-              if ($spam_filters[$Key]['link'])
-              {
-                  echo '</a>';
-              }
-              echo "</td></tr>\n";
-          }
-          
-        ?>
-      </table>
-   <?php
-         }
-      }
-      
-      if (isset($action) && ($action == "add" || $action == "edit")) {
-         $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
-         $boxes = sqimap_mailbox_list($imapConnection);
-         sqimap_logout($imapConnection);
-         if (!isset($theid))
+
+            $fdr = ($folder_prefix)?str_replace($folder_prefix, "", $filters[$i]["folder"]):$filters[$i]["folder"];
+
+            echo "<tr bgcolor=\"$clr\"><td><small>".
+                 "[<a href=\"options.php?theid=$i&action=edit\">" . _("Edit") . '</a>]'.
+                 '</small></td><td><small>'.
+                 "[<a href=\"options.php?theid=$i&action=delete\">" . _("Delete") . '</a>]'.
+                 '</small></td><td align=center><small>';
+
+            if (isset($filters[$i + 1])) {
+                echo "<a href=\"options.php?theid=$i&action=move_down\">" . _("Down") . '</a>';
+                if ($i > 0) {
+                    echo ' | ';
+                }
+            }
+            if ($i > 0) {
+                echo "<a href=\"options.php?theid=$i&action=move_up\">" . _("Up") . '</a>';
+            }
+            echo ']</small></td><td> - ';
+            printf( _("If <b>%s</b> contains <b>%s</b> then move to <b>%s</b>"), $filters[$i]['where'], $filters[$i]['what'], $fdr );
+            echo '</td></tr>';
+
+        }
+
+        echo '</table>'.
+             '<table width=80% align=center border=0 cellpadding=2 cellspacing=0">'.
+                '<tr><td>&nbsp</td></tr>'.
+             '</table>';
+
+        if ($AllowSpamFilters) {
+
+            echo "<table width=95% align=center border=0 cellpadding=2 cellspacing=0 bgcolor=\"$color[0]\">".
+                    '<tr><th align=center>' . _("Spam Filtering") . '</th></tr>'.
+                 '</table>';
+            if (! isset($action) || $action != 'spam') {
+
+                echo '<p align=center>[<a href="options.php?action=spam">' . _("Edit") . '</a>]<br>';
+                printf( _("Spam is sent to <b>%s</b>"), ($filters_spam_folder?$filters_spam_folder:_("[<i>not set yet</i>]") ) );
+                echo '<br>';
+                printf( _("Spam scan is limited to <b>%s</b>"), (($filters_spam_scan == 'new')?_("New Messages Only"):_("All Messages") ) );
+                echo '</p>'.
+                     "<table border=0 cellpadding=3 cellspacing=0 align=center bgcolor=\"$color[0]\">";
+
+                $spam_filters = load_spam_filters();
+
+                foreach ($spam_filters as $Key => $Value) {
+                    echo '<tr><th align=center>';
+
+                    if ($spam_filters[$Key]['enabled']) {
+                        echo _("ON");
+                    } else {
+                        echo _("OFF");
+                    }
+
+                    echo '</th><td>&nbsp;-&nbsp;</td><td>';
+
+                    if ($spam_filters[$Key]['link']) {
+                      echo '<a href="' .
+                           $spam_filters[$Key]['link'] .
+                           '" target="_blank">';
+                    }
+
+                    echo $spam_filters[$Key]['name'];
+                    if ($spam_filters[$Key]['link']) {
+                      echo '</a>';
+                    }
+                    echo "</td></tr>\n";
+                }
+                echo '</table>';
+            }
+    }
+
+    if (isset($action) && ($action == 'add' || $action == 'edit')) {
+        $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+        $boxes = sqimap_mailbox_list($imapConnection);
+        sqimap_logout($imapConnection);
+        if ( !isset($theid) ) {
             $theid = count($filters);
+        }
+        echo '<center>'.
+             '<form action="options.php" method=post>'.
+             '<br><table cellpadding=2 cellspacing=0 border=0>'.
+               '<tr>'.
+                  '<td>&nbsp;</td>'.
+                  '<td>'.
+                     '<select name=filter_where>';
 
-         ?>
-            <center>
-            <form action="options.php" method=post>
-            <br><table cellpadding=2 cellspacing=0 border=0>
-               <tr>
-                  <td>
-                    &nbsp;
-                  </td>
-                  <td>
-                     <select name=filter_where>
-                        <?php
-                          if (! isset($filters[$theid]['where'])) $L = false;
-                          else $L = true;
-                           if ($L && $filters[$theid]["where"] == "From") echo "<option value=\"From\" selected> From\n";
-                           else                                     echo "<option value=\"From\"> From\n";
-
-                           if ($L && $filters[$theid]["where"] == "To")   echo "<option value=\"To\" selected> To\n";
-                           else                                     echo "<option value=\"To\"> To\n";
-
-                           if ($L && $filters[$theid]["where"] == "Cc")   echo "<option value=\"Cc\" selected> Cc\n";
-                           else                                     echo "<option value=\"Cc\"> Cc\n";
-
-                           if ($L && $filters[$theid]["where"] == "To or Cc")   echo "<option value=\"To or Cc\" selected> To or Cc\n";
-                           else                                     echo "<option value=\"To or Cc\"> To or Cc\n";
-
-                           if ($L && $filters[$theid]["where"] == "Subject")   echo "<option value=\"Subject\" selected> Subject\n";
-                           else                                     echo "<option value=\"Subject\"> Subject\n";
-                        ?>
-                     </select>
-                  </td>
-               </tr>
-               <tr>
-                  <td align=right>
-                     Contains:
-                  </td>
-                  <td>
-                     <input type=text size=32 name=filter_what value="<?php
-if (isset($filters[$theid]['what'])) echo $filters[$theid]["what"]; ?>">
-                  </td>
-               </tr>
-               <tr>
-                  <td>
-                     Move to:
-                  </td>
-                  <td>
-                     <tt>
-                     <select name=filter_folder>
-      <?php
-      for ($i = 0; $i < count($boxes); $i++) {
-         if (! in_array('noselect', $boxes[$i]['flags'])) {
-            $box = $boxes[$i]["unformatted"];
-            $box2 = str_replace(' ', '&nbsp;', $boxes[$i]["formatted"]);
-            if (isset($filters[$theid]['folder']) && 
-               $filters[$theid]["folder"] == $box)
-               echo "         <OPTION VALUE=\"$box\" SELECTED>$box2\n";
-            else
-               echo "         <OPTION VALUE=\"$box\">$box2\n";
-         }       
-      }
-      ?>
-                     </tt>
-                     </select>
-                  </td>
-               </tr>
-            </table>   
-            <input type=submit name=filter_submit value=Submit>
-            <input type=hidden name=theid value=<?php echo $theid ?>>
-            </form>
-            </center>
-         <?php
-      }
-      else if (isset($action) && $action == 'spam' && $AllowSpamFilters)
-      {
-         $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
-         $boxes = sqimap_mailbox_list($imapConnection);
-         sqimap_logout($imapConnection);
-         for ($i = 0; $i < count($boxes) && $filters_spam_folder == ''; $i++) {
-            if ($boxes[$i]["flags"][0] != "noselect" && $boxes[$i]["flags"][1] != "noselect" && $boxes[$i]["flags"][2] != "noselect") {
-               $filters_spam_folder = $boxes[$i]['unformatted'];
-            }       
-         }
-         
-         ?><form method=post action="options.php">
-         <center>
-         <table width=85% cellpadding=2 cellspacing=0 border=0>
-           <tr>
-             <th align=right nowrap>Move spam to:</th>
-             <td><select name="filters_spam_folder_set">
-         <?PHP
-            for ($i = 0; $i < count($boxes); $i++) {
-               if (! in_array('noselect', $boxes[$i]['flags'])) {
-                  $box = $boxes[$i]["unformatted"];
-                  $box2 = str_replace(' ', '&nbsp;', $boxes[$i]["formatted"]);
-                  if ($filters_spam_folder == $box)
-                     echo "<OPTION VALUE=\"$box\" SELECTED>$box2</OPTION>\n";
-                  else
-                     echo "<OPTION VALUE=\"$box\">$box2</OPTION>\n";
-               }       
+        $L = isset($filters[$theid]['where']);
+
+        $sel = (($L && $filters[$theid]['where'] == 'From')?'selected':'');
+        echo "<option value=\"From\" $sel>" . _ ("From") . '</option>';
+        
+        $sel = (($L && $filters[$theid]['where'] == 'To')?'selected':'');
+        echo "<option value=\"To\" $sel>" . _ ("To") . '</option>';
+
+        $sel = (($L && $filters[$theid]['where'] == 'Cc')?'selected':'');
+        echo "<option value=\"Cc\" $sel>" . _ ("Cc") . '</option>';
+
+        $sel = (($L && $filters[$theid]['where'] == 'To or Cc')?'selected':'');
+        echo "<option value=\"To or Cc\" $sel>" . _ ("To or Cc") . '</option>';
+
+        $sel = (($L && $filters[$theid]['where'] == 'Subject')?'selected':'');
+        echo "<option value=\"Subject\" $sel>" . _ ("Subject") . '</option>';
+
+        echo         '</select>'.
+                  '</td>'.
+               '</tr>'.
+               '<tr>'.
+                  '<td align=right>'.
+                     _("Contains:").
+                  '</td>'.
+                  '<td>'.
+                     '<input type=text size=32 name=filter_what value="';
+        if (isset($filters[$theid]['what'])) {
+            echo $filters[$theid]["what"]; 
+        }
+        echo '">'.
+                  '</td>'.
+               '</tr>'.
+               '<tr>'.
+                  '<td>'.
+                     _("Move to:").
+                  '</td>'.
+                  '<td>'.
+                     '<tt>'.
+                     '<select name=filter_folder>';
+
+        for ($i = 0; $i < count($boxes); $i++) {
+            if (! in_array('noselect', $boxes[$i]['flags'])) {
+                $box = $boxes[$i]['unformatted'];
+                $box2 = str_replace(' ', '&nbsp;', $boxes[$i]['formatted']);
+                if (isset($filters[$theid]['folder']) &&
+                    $filters[$theid]['folder'] == $box)
+                   echo "<OPTION VALUE=\"$box\" SELECTED>$box2</option>";
+                else
+                   echo "<OPTION VALUE=\"$box\">$box2</option>";
             }
-         ?>
-               </select>
-             </td>
-           </tr>
-           <tr><td></td><td>Moving spam directly to the trash may not be a good idea at first,
-             since messages from friends and mailing lists might accidentally be marked as spam.
-             Whatever folder you set this to, make sure that it gets cleaned out periodically,
-             so that you don't have an excessively large mailbox hanging around.
-             </td></tr>
-           <tr>
-             <th align=right nowrap>What to Scan:</th>
-             <td><select name="filters_spam_scan_set">
-               <option value=''<?PHP
-                   if ($filters_spam_scan == '') echo ' SELECTED';
-               ?>>All messages</option>
-               <option value='new'<?PHP
-                   if ($filters_spam_scan == 'new') echo ' SELECTED';
-               ?>>Only unread messages</option>
-             </select>
-             </td>
-           </tr>
-           <tr>
-             <td></td><td>The more messages you scan, the longer it takes.  I would suggest
-             that you scan only new messages.  If you make a change to your filters, I
-             would set it to scan all messages, then go view my INBOX, then come back and
-             set it to scan only new messages.  That way, your new spam filters will be
-             applied and you'll scan even the spam you read with the new filters.</td>
-           </tr>
-         <?PHP
-           $spam_filters = load_spam_filters();
-           
-           foreach ($spam_filters as $Key => $Value)
-           {
-               echo "<tr><th align=right nowrap>$Key</th>\n";
-               echo '<td><input type=checkbox name="';
-               echo $spam_filters[$Key]['prefname'];
-               echo '_set"';
-               if ($spam_filters[$Key]['enabled'])
-                   echo ' CHECKED';
-               echo '> - ';
-               if ($spam_filters[$Key]['link'])
-               {
-                   echo '<a href="';
-                   echo $spam_filters[$Key]['link'];
-                   echo '" target="_blank">';
-               }
-               echo $spam_filters[$Key]['name'];
-               if ($spam_filters[$Key]['link'])
-               {
-                   echo '</a>';
-               }
-               echo '</td></tr><tr><td></td><td>';
-               echo $spam_filters[$Key]['comment'];
-               echo "</td></tr>\n";
-           }
-         ?>
-           <tr><td colspan=2 align=center><input type=submit name="spam_submit" value="Save"></td></tr>
-           </table>
-           </center>
-           </form>
-         <?PHP
-         
-         sqimap_logout($imapConnection);
-      }
-?>
+        }
+        echo         '</tt>'.
+                     '</select>'.
+                  '</td>'.
+               '</tr>'.
+            '</table>'.
+            '<input type=submit name=filter_submit value=' . _("Submit") . '>'.
+            "<input type=hidden name=theid value=$theid>".
+            '</form>'.
+            '</center>';
+
+    } else if (isset($action) && $action == 'spam' && $AllowSpamFilters) {
+        $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+        $boxes = sqimap_mailbox_list($imapConnection);
+        sqimap_logout($imapConnection);
+        for ($i = 0; $i < count($boxes) && $filters_spam_folder == ''; $i++) {
+            if ($boxes[$i]['flags'][0] != 'noselect' && 
+                $boxes[$i]['flags'][1] != 'noselect' && 
+                $boxes[$i]['flags'][2] != 'noselect') {
+                $filters_spam_folder = $boxes[$i]['unformatted'];
+            }
+        }
+
+        echo '<form method=post action="options.php">'.
+             '<center>'.
+             '<table width=85% cellpadding=2 cellspacing=0 border=0>'.
+                '<tr>'.
+                   '<th align=right nowrap>' . _("Move spam to:") . '</th>'.
+                   '<td><select name="filters_spam_folder_set">';
+                   
+        for ($i = 0; $i < count($boxes); $i++) {
+            if (! in_array('noselect', $boxes[$i]['flags'])) {
+                $box = $boxes[$i]['unformatted'];
+                $box2 = str_replace(' ', '&nbsp;', $boxes[$i]['formatted']);
+                if ($filters_spam_folder == $box)
+                 echo "<OPTION VALUE=\"$box\" SELECTED>$box2</OPTION>\n";
+                else
+                 echo "<OPTION VALUE=\"$box\">$box2</OPTION>\n";
+            }
+        }
+        echo    '</select>'.
+               '</td>'.
+             '</tr>'.
+             '<tr><td></td><td>' .
+             _("Moving spam directly to the trash may not be a good idea at first, since messages from friends and mailing lists might accidentally be marked as spam. Whatever folder you set this to, make sure that it gets cleaned out periodically, so that you don't have an excessively large mailbox hanging around.") .
+             '</td></tr>'.
+             '<tr>'.
+                '<th align=right nowrap>' . _("What to Scan:") . '</th>'.
+                '<td><select name="filters_spam_scan_set">'.
+                   '<option value=""';
+        if ($filters_spam_scan == '') 
+            echo ' SELECTED';
+        echo '>' . _("All messages") . '</option>'.
+                   '<option value="new"';
+        if ($filters_spam_scan == 'new') 
+            echo ' SELECTED';
+        echo '>' . _("Only unread messages") . '</option>' .
+                '</select>'.
+             '</td>'.
+           '</tr>'.
+           '<tr>'.
+             '<td></td><td>'.
+             _("The more messages you scan, the longer it takes.  I would suggest that you scan only new messages.  If you make a change to your filters, I would set it to scan all messages, then go view my INBOX, then come back and set it to scan only new messages.  That way, your new spam filters will be applied and you'll scan even the spam you read with the new filters.").
+             '</td></tr>';
+
+        $spam_filters = load_spam_filters();
+
+        foreach ($spam_filters as $Key => $Value) {
+            echo "<tr><th align=right nowrap>$Key</th>\n" .
+                 '<td><input type=checkbox name="' .
+                 $spam_filters[$Key]['prefname'] .
+                 '_set"';
+            if ($spam_filters[$Key]['enabled'])
+               echo ' CHECKED';
+            echo '> - ';
+            if ($spam_filters[$Key]['link']) {
+               echo '<a href="' .
+                    $spam_filters[$Key]['link'] .
+                    '" target="_blank">';
+            }
+            echo $spam_filters[$Key]['name'];
+            if ($spam_filters[$Key]['link']) {
+               echo '</a>';
+            }
+            echo '</td></tr><tr><td></td><td>' .
+                 $spam_filters[$Key]['comment'] .
+                 "</td></tr>\n";
+        }
+        echo '<tr><td colspan=2 align=center><input type=submit name="spam_submit" value="' . _("Save") . '"></td></tr>'.
+             '</table>'.
+             '</center>'.
+             '</form>';
+
+        sqimap_logout($imapConnection);
+    }
+?>
\ No newline at end of file
index 152afe5..1905739 100644 (file)
@@ -1,6 +1,6 @@
 <?php
    /*
-    *  Message and Spam Filter Plugin 
+    *  Message and Spam Filter Plugin
     *  By Luke Ehresman <luke@squirrelmail.org>
     *     Tyler Akins
     *     Brent Bice
    //        Seems to be related to UW
    global $UseSeparateImapConnection;
    $UseSeparateImapConnection = false;
-   
+
    // Set this to false if you do not want the user to be able to enable
    // spam filters
    global $AllowSpamFilters;
    $AllowSpamFilters = true;
-   
+
    // Set this to a string containing something unique to the line in the
    // header you want me to find IPs to scan the databases with.  For example,
    // All the email coming IN from the internet to my site has a line in
    $SpamFilters_YourHop = 'by firewall.persistence.com';
 
    // A cache of IPs we've already checked or are known bad boys or good boys
-   // ie. $SpamFilters_DNScache["210.54.220.18"] = true; 
+   // ie. $SpamFilters_DNScache["210.54.220.18"] = true;
    // would tell filters to not even bother doing the DNS queries for that
    // IP and any email coming from it are SPAM - false would mean that any
    // email coming from it would NOT be SPAM
    global $SpamFilters_DNScache;
 
-   require_once ("../plugins/filters/filters.php");
+   require_once ('../plugins/filters/filters.php');
 
    function squirrelmail_plugin_init_filters() {
       global $squirrelmail_plugin_hooks;
       global $mailbox, $imap_stream, $imapConnection;
 
-      $squirrelmail_plugin_hooks["left_main_before"]["filters"] = "start_filters";
-      if ($mailbox == "INBOX")
-         $squirrelmail_plugin_hooks["right_main_after_header"]["filters"] = "start_filters";
-      $squirrelmail_plugin_hooks["options_register"]["filters"] = "squirrelmail_plugin_register";
+      $squirrelmail_plugin_hooks['left_main_before']['filters'] = 'start_filters';
+      if ($mailbox == 'INBOX')
+         $squirrelmail_plugin_hooks["right_main_after_header"]['filters'] = 'start_filters';
+      $squirrelmail_plugin_hooks['options_register']['filters'] = 'squirrelmail_plugin_register';
    }
 
    function squirrelmail_plugin_register() {
       global $optionpages;
 
       $optionpages[] = array(
-         'name' => 'Message Filters',
+         'name' => _("Message Filters"),
          'url'  => '../plugins/filters/options.php',
-         'desc' => 'Filtering enables messages with different criteria to
-                    be automatically filtered into different folders for
-                    easier organization.',
+         'desc' => _("Filtering enables messages with different criteria to be automatically filtered into different folders for easier organization."),
          'js'   => false
       );
    }
-?>
+?>
\ No newline at end of file
index 840a4bf..686b9e6 100644 (file)
@@ -78,8 +78,4 @@
       }
 
       return $data;
-   }
-
-
-
-
+   }
\ No newline at end of file
index 2ea9850..bf25807 100644 (file)
@@ -6,7 +6,7 @@
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
-"POT-Creation-Date: 2001-11-07 14:41+0100\n"
+"POT-Creation-Date: 2001-11-08 11:06+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -171,6 +171,7 @@ msgid "Original Message"
 msgstr ""
 
 #: squirrelmail/functions/mailbox_display.php:568
+#: squirrelmail/plugins/filters/options.php:188
 #: squirrelmail/src/compose.php:102 squirrelmail/src/download.php:120
 #: squirrelmail/src/download.php:126 squirrelmail/src/options_order.php:42
 #: squirrelmail/src/search.php:58 squirrelmail/src/search.php:59
@@ -178,6 +179,7 @@ msgid "Subject"
 msgstr ""
 
 #: squirrelmail/functions/mailbox_display.php:554
+#: squirrelmail/plugins/filters/options.php:176
 #: squirrelmail/src/compose.php:103 squirrelmail/src/download.php:121
 #: squirrelmail/src/download.php:128 squirrelmail/src/options_order.php:40
 #: squirrelmail/src/search.php:61 squirrelmail/src/search.php:62
@@ -185,6 +187,7 @@ msgid "From"
 msgstr ""
 
 #: squirrelmail/functions/mailbox_display.php:552
+#: squirrelmail/plugins/filters/options.php:179
 #: squirrelmail/src/compose.php:104 squirrelmail/src/download.php:122
 #: squirrelmail/src/download.php:130 squirrelmail/src/search.php:67
 #: squirrelmail/src/search.php:68
@@ -345,6 +348,7 @@ msgid "Delete Folder"
 msgstr ""
 
 #: squirrelmail/functions/mailbox_display.php:524
+#: squirrelmail/plugins/filters/options.php:92
 #: squirrelmail/src/folders.php:103 squirrelmail/src/read_body.php:372
 msgid "Delete"
 msgstr ""
@@ -402,6 +406,7 @@ msgid "New name:"
 msgstr ""
 
 #: squirrelmail/functions/options.php:94
+#: squirrelmail/plugins/filters/options.php:229
 #: squirrelmail/src/folders_rename_getname.php:46
 #: squirrelmail/src/options_highlight.php:330
 msgid "Submit"
@@ -486,7 +491,8 @@ msgstr ""
 msgid "No messages were selected."
 msgstr ""
 
-#: squirrelmail/functions/page_header.php:67 squirrelmail/src/options.php:34
+#: squirrelmail/functions/page_header.php:67
+#: squirrelmail/plugins/filters/options.php:74 squirrelmail/src/options.php:34
 #: squirrelmail/src/options_display.php:27
 #: squirrelmail/src/options_folder.php:30
 #: squirrelmail/src/options_highlight.php:49
@@ -740,10 +746,12 @@ msgstr ""
 msgid "Message Highlighting"
 msgstr ""
 
+#: squirrelmail/plugins/filters/options.php:76
 #: squirrelmail/src/options_highlight.php:53
 msgid "New"
 msgstr ""
 
+#: squirrelmail/plugins/filters/options.php:77
 #: squirrelmail/src/options_highlight.php:54
 msgid "Done"
 msgstr ""
@@ -1082,7 +1090,8 @@ msgstr ""
 msgid "Everywhere"
 msgstr ""
 
-#: squirrelmail/src/search.php:64 squirrelmail/src/search.php:65
+#: squirrelmail/plugins/filters/options.php:182 squirrelmail/src/search.php:64
+#: squirrelmail/src/search.php:65
 msgid "Cc"
 msgstr ""
 
@@ -1343,18 +1352,22 @@ msgstr ""
 #: squirrelmail/functions/imap_messages.php:143
 #: squirrelmail/functions/imap_messages.php:152
 #: squirrelmail/functions/imap_messages.php:264
+#: squirrelmail/plugins/filters/sqimap_read_data.php:64
 msgid "ERROR : Could not complete request."
 msgstr ""
 
 #: squirrelmail/functions/imap_general.php:126
+#: squirrelmail/plugins/filters/sqimap_read_data.php:66
 msgid "Reason Given: "
 msgstr ""
 
 #: squirrelmail/functions/imap_general.php:133
+#: squirrelmail/plugins/filters/sqimap_read_data.php:73
 msgid "ERROR : Bad or malformed request."
 msgstr ""
 
 #: squirrelmail/functions/imap_general.php:135
+#: squirrelmail/plugins/filters/sqimap_read_data.php:75
 msgid "Server responded: "
 msgstr ""
 
@@ -1503,3 +1516,181 @@ msgstr ""
 #: squirrelmail/functions/prefs.php:124
 msgid "Error opening "
 msgstr ""
+
+#: squirrelmail/plugins/filters/filters.php:258
+msgid ""
+"COMMERCIAL - This list contains servers that are verified spam senders. It "
+"is a pretty reliable list to scan spam from."
+msgstr ""
+
+#: squirrelmail/plugins/filters/filters.php:265
+msgid ""
+"COMMERCIAL - Servers that are configured (or misconfigured) to allow spam to "
+"be relayed through their system will be banned with this.  Another good one "
+"to use."
+msgstr ""
+
+#: squirrelmail/plugins/filters/filters.php:272
+msgid ""
+"COMMERCIAL - Dial-up users are often filtered out since they should use "
+"their ISP's mail servers to send mail.  Spammers typically get a dial-up "
+"account and send spam directly from there."
+msgstr ""
+
+#: squirrelmail/plugins/filters/filters.php:279
+msgid "COMMERCIAL - RBL+ is a combination of RSS, DUL, and RBL."
+msgstr ""
+
+#: squirrelmail/plugins/filters/filters.php:286
+msgid ""
+"FREE - Osirusoft - Very thorough, but also rejects replies from many ISP's "
+"abuse@domain.name email messages for some reason."
+msgstr ""
+
+#: squirrelmail/plugins/filters/filters.php:293
+msgid ""
+"FREE - ORDB was born when ORBS went off the air. It seems to have fewer "
+"false positives than ORBS did though."
+msgstr ""
+
+#: squirrelmail/plugins/filters/filters.php:300
+msgid "FREE - Another ORBS replacement (just the INPUTS database used here)."
+msgstr ""
+
+#: squirrelmail/plugins/filters/filters.php:307
+msgid "FREE - Five-Ten-sg.com has SPAM source, OpenRelay, and and Dialup IPs."
+msgstr ""
+
+#: squirrelmail/plugins/filters/filters.php:314
+msgid ""
+"FREE - Dorkslayers appears to include only really bad open relays outside "
+"the US to avoid being sued. Interestingly enough, their website recommends "
+"you NOT use their service."
+msgstr ""
+
+#: squirrelmail/plugins/filters/filters.php:321
+msgid ""
+"'FREE - ORBL is another ORBS spinoff formed after ORBS shut down. May be "
+"SLOOOOOOW!"
+msgstr ""
+
+#: squirrelmail/plugins/filters/filters.php:328
+msgid ""
+"FREE - orbz.gst-group.co.uk lists not only open relays, but also mailservers "
+"that refuse or bounce email addressed to postmaster@<theirdomain>."
+msgstr ""
+
+#: squirrelmail/plugins/filters/options.php:74
+msgid "Message Filtering"
+msgstr ""
+
+#: squirrelmail/plugins/filters/options.php:90
+msgid "Edit"
+msgstr ""
+
+#: squirrelmail/plugins/filters/options.php:96
+msgid "Down"
+msgstr ""
+
+#: squirrelmail/plugins/filters/options.php:102
+msgid "Up"
+msgstr ""
+
+#: squirrelmail/plugins/filters/options.php:105
+#, c-format
+msgid "If <b>%s</b> contains <b>%s</b> then move to <b>%s</b>"
+msgstr ""
+
+#: squirrelmail/plugins/filters/options.php:118
+msgid "Spam Filtering"
+msgstr ""
+
+#: squirrelmail/plugins/filters/options.php:123
+#, c-format
+msgid "Spam is sent to <b>%s</b>"
+msgstr ""
+
+#: squirrelmail/plugins/filters/options.php:123
+msgid "[<i>not set yet</i>]"
+msgstr ""
+
+#: squirrelmail/plugins/filters/options.php:125
+#, c-format
+msgid "Spam scan is limited to <b>%s</b>"
+msgstr ""
+
+#: squirrelmail/plugins/filters/options.php:125
+msgid "New Messages Only"
+msgstr ""
+
+#: squirrelmail/plugins/filters/options.php:125
+msgid "All Messages"
+msgstr ""
+
+#: squirrelmail/plugins/filters/options.php:135
+msgid "ON"
+msgstr ""
+
+#: squirrelmail/plugins/filters/options.php:137
+msgid "OFF"
+msgstr ""
+
+#: squirrelmail/plugins/filters/options.php:185
+msgid "To or Cc"
+msgstr ""
+
+#: squirrelmail/plugins/filters/options.php:195
+msgid "Contains:"
+msgstr ""
+
+#: squirrelmail/plugins/filters/options.php:207
+msgid "Move to:"
+msgstr ""
+
+#: squirrelmail/plugins/filters/options.php:250
+msgid "Move spam to:"
+msgstr ""
+
+#: squirrelmail/plugins/filters/options.php:267
+msgid ""
+"Moving spam directly to the trash may not be a good idea at first, since "
+"messages from friends and mailing lists might accidentally be marked as "
+"spam. Whatever folder you set this to, make sure that it gets cleaned out "
+"periodically, so that you don't have an excessively large mailbox hanging "
+"around."
+msgstr ""
+
+#: squirrelmail/plugins/filters/options.php:270
+msgid "What to Scan:"
+msgstr ""
+
+#: squirrelmail/plugins/filters/options.php:275
+msgid "All messages"
+msgstr ""
+
+#: squirrelmail/plugins/filters/options.php:279
+msgid "Only unread messages"
+msgstr ""
+
+#: squirrelmail/plugins/filters/options.php:285
+msgid ""
+"The more messages you scan, the longer it takes.  I would suggest that you "
+"scan only new messages.  If you make a change to your filters, I would set "
+"it to scan all messages, then go view my INBOX, then come back and set it to "
+"scan only new messages.  That way, your new spam filters will be applied and "
+"you'll scan even the spam you read with the new filters."
+msgstr ""
+
+#: squirrelmail/plugins/filters/options.php:311
+msgid "Save"
+msgstr ""
+
+#: squirrelmail/plugins/filters/setup.php:77
+msgid "Message Filters"
+msgstr ""
+
+#: squirrelmail/plugins/filters/setup.php:79
+msgid ""
+"Filtering enables messages with different criteria to be automatically "
+"filtered into different folders for easier organization."
+msgstr ""
index 12605e7..6c606da 100755 (executable)
--- a/po/xgetpo
+++ b/po/xgetpo
@@ -11,4 +11,10 @@ xgettext --keyword=_ -keyword=N_  --default-domain=squirrelmail \
     -C squirrelmail/src/*.php --output-dir=squirrelmail/po/
 xgettext --keyword=_ -keyword=N_  --default-domain=squirrelmail -j \
     -C squirrelmail/functions/*.php --output-dir=squirrelmail/po/
+    
+# ** Plugins
+    
+xgettext --keyword=_ -keyword=N_  --default-domain=squirrelmail -j \
+    -C squirrelmail/plugins/filters/*.php --output-dir=squirrelmail/po/
+
 cd squirrelmail/po
\ No newline at end of file