Use <plugin>_info() function if at all possible instead of <plugin>_version()
[squirrelmail.git] / plugins / filters / spamoptions.php
index 583c7211138d22e08a51e7d771caafeb936fb0e9..bcef8e51addffabfce244b1c75aba5bdb9f4ef8a 100644 (file)
@@ -1,49 +1,25 @@
 <?php
+
 /**
  * Message and Spam Filter Plugin - Spam Options
  *
- * This plugin filters your inbox into different folders based upon given
- * criteria.  It is most useful for people who are subscibed to mailing lists
- * to help organize their messages.  The argument stands that filtering is
- * not the place of the client, which is why this has been made a plugin for
- * SquirrelMail.  You may be better off using products such as Sieve or
- * Procmail to do your filtering so it happens even when SquirrelMail isn't
- * running.
- *
- * If you need help with this, or see improvements that can be made, please
- * email me directly at the address above.  I definately welcome suggestions
- * and comments.  This plugin, as is the case with all SquirrelMail plugins,
- * is not directly supported by the developers.  Please come to me off the
- * mailing list if you have trouble with it.
- *
- * Also view plugins/README.plugins for more information.
- *
- * @version $Id$
- * @copyright (c) 1999-2004 The SquirrelMail Project Team
+ * @copyright &copy; 1999-2007 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id$
  * @package plugins
  * @subpackage filters
  */
 
 /**
- * Path for SquirrelMail required files.
- * @ignore
+ * Include the SquirrelMail initialization file.
  */
-define('SM_PATH','../../');
+require('../../include/init.php');
 
-/* SquirrelMail required files. */
-require_once(SM_PATH . 'include/validate.php');
-require_once(SM_PATH . 'functions/page_header.php');
-require_once(SM_PATH . 'functions/imap.php');
-require_once(SM_PATH . 'include/load_prefs.php');
-require_once(SM_PATH . 'functions/html.php');
-require_once(SM_PATH . 'plugins/filters/filters.php');
-global $AllowSpamFilters;
+include_once(SM_PATH . 'functions/imap_general.php');
+include_once(SM_PATH . 'functions/imap_messages.php');
+include_once(SM_PATH . 'plugins/filters/filters.php');
 
 /* get globals */
-sqgetGlobalVar('username', $username, SQ_SESSION);
-sqgetGlobalVar('key', $key, SQ_COOKIE);
-sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
 sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
 
 sqgetGlobalVar('action', $action, SQ_GET);
@@ -101,7 +77,7 @@ if ($SpamFilters_YourHop == ' ') {
 
 
 if (isset($action) && $action == 'spam') {
-    $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+    $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
     $boxes = sqimap_mailbox_list($imapConnection);
     sqimap_logout($imapConnection);
     $numboxes = count($boxes);
@@ -115,10 +91,10 @@ if (isset($action) && $action == 'spam') {
     }
 
     echo '<form method="post" action="spamoptions.php">'.
-        '<center>'.
+        '<div style="text-align: center;">'.
         html_tag( 'table', '', '', '', 'width="85%" border="0" cellpadding="2" cellspacing="0"' ) .
             html_tag( 'tr' ) .
-                html_tag( 'th', _("Move spam to:"), 'right', '', 'nowrap' ) .
+                html_tag( 'th', _("Move spam to:"), 'right', '', 'style="white-space: nowrap;"' ) .
                 html_tag( 'td', '', 'left' ) .
                     '<select name="filters_spam_folder_set">';
 
@@ -136,7 +112,7 @@ if (isset($action) && $action == 'spam') {
             'left' )
         ) .
         html_tag( 'tr' ) .
-            html_tag( 'th', _("What to Scan:"), 'right', '', 'nowrap' ) .
+            html_tag( 'th', _("What to Scan:"), 'right', '', 'style="white-space: nowrap;"' ) .
             html_tag( 'td' ) .
             '<select name="filters_spam_scan_set">'.
             '<option value=""';
@@ -163,7 +139,7 @@ if (isset($action) && $action == 'spam') {
 
     foreach ($spam_filters as $Key => $Value) {
         echo html_tag( 'tr' ) .
-                   html_tag( 'th', $Key, 'right', '', 'nowrap' ) ."\n" .
+                   html_tag( 'th', $Key, 'right', '', 'style="white-space: nowrap;"' ) ."\n" .
                    html_tag( 'td' ) .
             '<input type="checkbox" name="' .
             $spam_filters[$Key]['prefname'] .
@@ -192,14 +168,14 @@ if (isset($action) && $action == 'spam') {
         html_tag( 'td', '<input type="submit" name="spam_submit" value="' . _("Save") . '" />', 'center', '', 'colspan="2"' )
     ) . "\n" .
         '</table>'.
-        '</center>'.
+        '</div>'.
         '</form>';
 } else {
     // action is not set or action is not spam
     echo html_tag( 'p', '', 'center' ) .
          '[<a href="spamoptions.php?action=spam">' . _("Edit") . '</a>]' .
-         ' - [<a href="../../src/options.php">' . _("Done") . '</a>]</center><br /><br />';
-    printf( _("Spam is sent to %s."), ($filters_spam_folder?'<b>'.imap_utf7_decode_local($filters_spam_folder).'</b>':'[<i>'._("not set yet").'</i>]' ) );
+         ' - [<a href="../../src/options.php">' . _("Done") . '</a>]</div><br /><br />';
+    printf( _("Spam is sent to %s."), ($filters_spam_folder?'<b>'.htmlspecialchars(imap_utf7_decode_local($filters_spam_folder)).'</b>':'[<i>'._("not set yet").'</i>]' ) );
     echo '<br />';
     printf( _("Spam scan is limited to %s."), '<b>' . ( ($filters_spam_scan == 'new')?_("Unread messages only"):_("All messages") ) . '</b>' );
     echo '</p>'.
@@ -236,4 +212,4 @@ if (isset($action) && $action == 'spam') {
     echo '</table>';
 }
 ?>
-</body></html>
\ No newline at end of file
+</body></html>