Adding Uighur language support
[squirrelmail.git] / src / folders.php
index 9a183392dcd0dd95cac52149c4677fbc62e70415..7dd930c03dc68d2346cb4090e596c6ef015fbfa8 100644 (file)
@@ -3,17 +3,21 @@
 /**
  * folders.php
  *
- * Copyright (c) 1999-2003 The SquirrelMail Project Team
+ * Copyright (c) 1999-2004 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * Handles all interaction between the user and the other folder
  * scripts which do most of the work. Also handles the Special
  * Folders.
  *
- * $Id$
+ * @version $Id$
+ * @package squirrelmail
  */
 
-/* Path for SquirrelMail required files. */
+/**
+ * Path for SquirrelMail required files.
+ * @ignore
+ */
 define('SM_PATH','../');
 
 /* SquirrelMail required files. */
@@ -21,6 +25,7 @@ require_once(SM_PATH . 'include/validate.php');
 require_once(SM_PATH . 'functions/imap.php');
 require_once(SM_PATH . 'functions/plugin.php');
 require_once(SM_PATH . 'functions/html.php');
+require_once(SM_PATH . 'functions/forms.php');
 
 displayPageHeader($color, 'None');
 
@@ -85,7 +90,7 @@ if ( isset($success) && $success ) {
 echo "\n<br>";
 
 $imapConnection = sqimap_login ($username, $key, $imapServerAddress, $imapPort, 0);
-$boxes = sqimap_mailbox_list($imapConnection);
+$boxes = sqimap_mailbox_list($imapConnection,true);
 
 /** CREATING FOLDERS **/
 echo html_tag( 'table', '', 'center', '', 'width="70%" cellpadding="4" cellspacing="0" border="0"' ) .
@@ -94,11 +99,9 @@ echo html_tag( 'table', '', 'center', '', 'width="70%" cellpadding="4" cellspaci
             ) .
             html_tag( 'tr' ) .
                 html_tag( 'td', '', 'center', $color[0] ) .
-
-     "<FORM NAME=cf ACTION=\"folders_create.php\" METHOD=\"POST\">\n".
-     "<input type=TEXT SIZE=25 NAME=folder_name><BR>\n".
-     _("as a subfolder of").
-     '<BR>'.
+     addForm('folders_create.php', 'POST', 'cf').
+     addInput('folder_name', '', 25).
+     "<BR>\n". _("as a subfolder of"). '<BR>'.
      "<TT><SELECT NAME=subfolder>\n";
 
 $show_selected = array();
@@ -126,7 +129,8 @@ echo sqimap_mailbox_option_list($imapConnection, $show_selected, $skip_folders,
 
 echo "</SELECT></TT>\n";
 if ($show_contain_subfolders_option) {
-    echo '<br><input type=CHECKBOX NAME="contain_subs"> &nbsp;'
+    echo '<br>'.
+         addCheckBox('contain_subs', FALSE, '1') .' &nbsp;'
        . _("Let this folder contain subfolders")
        . '<BR>';
 }
@@ -192,7 +196,7 @@ echo html_tag( 'tr',
         html_tag( 'td', '', 'center', $color[0] );
 
 if ($count_special_folders < count($boxes)) {
-    echo "<FORM ACTION=\"folders_rename_getname.php\" METHOD=\"POST\">\n"
+    echo addForm('folders_rename_getname.php')
        . "<TT><SELECT NAME=old>\n"
        . '         <OPTION VALUE="">[ ' . _("Select a folder") . " ]</OPTION>\n";
 
@@ -224,7 +228,7 @@ echo html_tag( 'tr',
         html_tag( 'td', '', 'center', $color[0] );
 
 if ($count_special_folders < count($boxes)) {
-    echo "<FORM ACTION=\"folders_delete.php\" METHOD=\"POST\">\n"
+    echo addForm('folders_delete.php')
        . "<TT><SELECT NAME=mailbox>\n"
        . '         <OPTION VALUE="">[ ' . _("Select a folder") . " ]</OPTION>\n";
 
@@ -255,7 +259,7 @@ echo html_tag( 'table', '', 'center', '', 'width="70%" cellpadding="4" cellspaci
                 html_tag( 'td', '', 'center', $color[0], 'width="50%"' );
 
 if ($count_special_folders < count($boxes)) {
-    echo "<FORM ACTION=\"folders_subscribe.php?method=unsub\" METHOD=\"POST\">\n"
+    echo addForm('folders_subscribe.php?method=unsub')
        . "<TT><SELECT NAME=\"mailbox[]\" multiple size=8>\n";
     for ($i = 0; $i < count($boxes); $i++) {
         $use_folder = true;
@@ -263,9 +267,9 @@ if ($count_special_folders < count($boxes)) {
             ($boxes[$i]["unformatted"] != $trash_folder) &&
             ($boxes[$i]["unformatted"] != $sent_folder) &&
             ($boxes[$i]["unformatted"] != $draft_folder)) {
-            $box = $boxes[$i]["unformatted-dm"];
+            $box = htmlspecialchars($boxes[$i]["unformatted-dm"]);
             $box2 = str_replace(' ', '&nbsp;',
-                                imap_utf7_decode_local($boxes[$i]["unformatted-disp"]));
+                                htmlspecialchars(imap_utf7_decode_local($boxes[$i]["unformatted-disp"])));
             echo "         <OPTION VALUE=\"$box\">$box2\n";
         }
     }
@@ -297,13 +301,13 @@ if(!$no_list_for_subscribe) {
         }
     }
     if ($use_folder == true) {
-        $box[$q] = $boxes_all[$i]['unformatted-dm'];
-        $box2[$q] = imap_utf7_decode_local($boxes_all[$i]['unformatted-disp']);
+        $box[$q] = htmlspecialchars($boxes_all[$i]['unformatted-dm']);
+        $box2[$q] = htmlspecialchars(imap_utf7_decode_local($boxes_all[$i]['unformatted-disp']));
         $q++;
     }
   }
   if ($box && $box2) {
-    echo "<FORM ACTION=\"folders_subscribe.php?method=sub\" METHOD=\"POST\">\n"
+    echo addForm('folders_subscribe.php?method=sub')
        . '<tt><select name="mailbox[]" multiple size=8>';
 
     for ($q = 0; $q < count($box); $q++) {      
@@ -317,7 +321,7 @@ if(!$no_list_for_subscribe) {
   }
 } else {
   /* don't perform the list action -- this is much faster */
-  echo "<FORM ACTION=\"folders_subscribe.php?method=sub\" METHOD=\"POST\">\n"
+  echo addForm('folders_subscribe.php?method=sub')
      . _("Subscribe to:") . '<br>'
      . '<tt><input type="text" name="mailbox[]" size=35>'
      . '<INPUT TYPE=SUBMIT VALUE="'. _("Subscribe") . "\">\n"