Initial groundwork to use phpdocumentor.
[squirrelmail.git] / plugins / filters / spamoptions.php
index e4769cae0751f9059d801027ccdc727a0f15ee9e..97670bafa3d6732813f391df23b9f1127d1918ef 100644 (file)
@@ -2,7 +2,7 @@
 /**
  * Message and Spam Filter Plugin
  *
- * Copyright (c) 1999-2002 The SquirrelMail Project Team
+ * Copyright (c) 1999-2003 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * This plugin filters your inbox into different folders based upon given
  * Also view plugins/README.plugins for more information.
  *
  * $Id$
+ * @package plugins
+ * @subpackage filters
  */
 
-/* Path for SquirrelMail required files. */
+/** Path for SquirrelMail required files. */
 define('SM_PATH','../../');
 
 /* SquirrelMail required files. */
@@ -36,14 +38,14 @@ require_once(SM_PATH . 'functions/html.php');
 require_once(SM_PATH . 'plugins/filters/filters.php');
 global $AllowSpamFilters;
 
-$username = $_SESSION['username'];
-$key = $_COOKIE['key'];
-$onetimepad = $_SESSION['onetimepad'];
-$delimiter = $_SESSION['delimiter'];
+/* get globals */
+sqgetGlobalVar('username', $username, SQ_SESSION);
+sqgetGlobalVar('key', $key, SQ_COOKIE);
+sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
+sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
 
-if (isset($_GET['action'])) {
-    $action = $_GET['action'];
-}
+sqgetGlobalVar('action', $action, SQ_GET);
+/* end globals */
 
 displayPageHeader($color, 'None');
 
@@ -104,17 +106,10 @@ if (isset($action) && $action == 'spam') {
                 html_tag( 'td', '', 'left' ) .
                     '<select name="filters_spam_folder_set">';
 
-    for ($i = 0; $i < $numboxes; $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";
-            }
-        }
-    }
+        $selected = 0;
+        if ( isset($filters_spam_folder) )
+          $selected = array(strtolower($filters_spam_folder));
+        echo sqimap_mailbox_option_list(0, $selected, 0, $boxes);
     echo    '</select>'.
         '</td>'.
         '</tr>'.