Add preview pane to advanced default template. This serves as an example of how...
[squirrelmail.git] / plugins / sent_subfolders / setup.php
index 14427d159397bee42e20081d584ec2f0fe5acb94..5ea8f17281fbba6338ec470b455203669625dab1 100644 (file)
@@ -5,7 +5,7 @@
  *
  * This is a standard SquirrelMail 1.2 API for plugins.
  *
- * @copyright © 1999-2006 The SquirrelMail Project Team
+ * @copyright © 1999-2007 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package plugins
@@ -61,6 +61,7 @@ function sent_subfolders_check_handleAsSent() {
     global $handleAsSent_result, $sent_subfolders_base,
            $use_sent_subfolders;
 
+    // FIXME: hardcoded folder
     $sent_subfolders_base = 'INBOX.Sent';
     $args = func_get_arg(0);
     sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
@@ -101,14 +102,10 @@ function sent_subfolders_load_prefs() {
  * Adds sent_subfolders options in folder preferences
  */
 function sent_subfolders_optpage_loadhook_folders() {
-    global $optpage_data, $imapServerAddress, $imapPort, $show_contain_subfolders_option;
-
-    sqgetGlobalVar('username', $username, SQ_SESSION);
-    sqgetGlobalVar('key', $key, SQ_COOKIE);
+    global $username, $optpage_data, $imapServerAddress, $imapPort, $show_contain_subfolders_option;
 
     /* Get some imap data we need later. */
-    $imapConnection =
-        sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+    $imapConnection = sqimap_login($username, false, $imapServerAddress, $imapPort, 0);
     $boxes = sqimap_mailbox_list($imapConnection);
     sqimap_logout($imapConnection);
 
@@ -191,13 +188,11 @@ function save_option_sent_subfolders_setting($option) {
  * creates required imap folders
  */
 function sent_subfolders_update_sentfolder() {
-    global $sent_folder;
+    global $sent_folder, $username;
     global $sent_subfolders_base, $sent_subfolders_setting;
     global $data_dir, $imapServerAddress, $imapPort, $color;
     global $use_sent_subfolders, $move_to_sent;
 
-    sqgetGlobalVar('username', $username, SQ_SESSION);
-    sqgetGlobalVar('key', $key, SQ_COOKIE);
     sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
 
     if ($use_sent_subfolders || $move_to_sent) {
@@ -246,7 +241,7 @@ function sent_subfolders_update_sentfolder() {
             /* Auto-create folders, if they do not yet exist. */
             if ($sent_subfolder != 'none') {
                 /* Create the imap connection. */
-                $ic = sqimap_login($username, $key, $imapServerAddress, $imapPort, 10);
+                $ic = sqimap_login($username, false, $imapServerAddress, $imapPort, 10);
 
                 $boxes = false;
                 /**
@@ -257,7 +252,7 @@ function sent_subfolders_update_sentfolder() {
                 if (sqimap_mailbox_is_noselect($ic,$sent_subfolder,$boxes) ||
                     ($level==2 && sqimap_mailbox_is_noinferiors($ic,$year_folder,$boxes)) ||
                      sqimap_mailbox_is_noinferiors($ic,$sent_subfolders_base,$boxes)) {
-                    error_box(_("Sent Subfolders plugin is misconfigured."),$color);
+                    error_box(_("Sent Subfolders plugin is misconfigured."));
                 } else {
                     if ($level==2) {
                         /* Auto-create the year folder, if it does not yet exist. */
@@ -277,8 +272,8 @@ function sent_subfolders_update_sentfolder() {
                         sqimap_subscribe($ic, $sent_subfolder);
                     }
                     /* Update sent_folder setting. */
-                    setPref($data_dir, $username, 'sent_folder', $sent_subfolder);
-                    setPref($data_dir, $username, 'move_to_sent', SMPREF_ON);
+                    //setPref($data_dir, $username, 'sent_folder', $sent_subfolder);
+                    //setPref($data_dir, $username, 'move_to_sent', SMPREF_ON);
                     $sent_folder = $sent_subfolder;
                     $move_to_sent = SMPREF_ON;
                 }
@@ -349,4 +344,3 @@ function sent_subfolders_special_mailbox($mb) {
     }
     return 0;
 }
-?>
\ No newline at end of file