Added images used for $advanced_tree=true in src/left_main.php
[squirrelmail.git] / config / conf.pl
index ccdc4e1a3d271472360f6dfa0ad2383ad4515f42..b601f4772572722203a2d6e7d1c5c8f47af9186a 100755 (executable)
@@ -69,7 +69,7 @@ if ( -e "config.php" ) {
     close(FILE);
 
     if ( $config_version ne $conf_pl_version ) {
-        system "clear";
+        clear_screen();
         print $WHT. "WARNING:\n" . $NRM;
         print "  The file \"config/config.php\" was found, but it is for\n";
         print "  an older version of SquirrelMail. It is possible to still\n";
@@ -122,7 +122,7 @@ if ( -e "config.php" ) {
     close(FILE);
 
     if ( $config_version ne $conf_pl_version ) {
-        system "clear";
+        clear_screen();
         print $WHT. "WARNING:\n" . $NRM;
         print "  You are trying to use a 'config_default.php' from an older\n";
         print "  version of SquirrelMail. This is HIGHLY unrecommended. You\n";
@@ -246,7 +246,7 @@ while ( $line = <FILE> ) {
     }
 }
 close FILE;
-if ( $useSendmail ne "true" ) {
+if ( lc($useSendmail) ne "true" ) {
     $useSendmail = "false";
 }
 if ( !$sendmail_path ) {
@@ -382,7 +382,7 @@ if ( $config_use_color == 1 ) {
 }
 
 while ( ( $command ne "q" ) && ( $command ne "Q" ) ) {
-    system "clear";
+    clear_screen();
     print $WHT. "SquirrelMail Configuration : " . $NRM;
     if    ( $config == 1 ) { print "Read: config.php"; }
     elsif ( $config == 2 ) { print "Read: config_default.php"; }
@@ -1764,36 +1764,43 @@ sub command214 {
 
 # Automatically delete folders 
 sub command215 {
-    print "Should folders selected for deletion bypass the Trash folder?\n\n";
-
-    if ( $imap_server_type == "courier" ) {
-        print "Courier(or Courier-IMAP) IMAP servers do not support ";
-        print "subfolders of Trash. \n";
-        print "Deleting folders will bypass the trash folder and ";
-        print "be immediately deleted.\n\n";
-        print "Press any key to continue...\n";
-        $new_delete = <STDIN>;
-        $delete_folder = "true";
-    } elsif ( $imap_server_type == "uw" ) {
-        print "UW IMAP servers will not allow folders containing";
-        print "mail to also contain folders.\n";
-        print "Deleting folders will bypass the trash folder and";
-        print "be immediately deleted\n\n";
+    if ( $imap_server_type eq "uw" ) {
+        print "UW IMAP servers will not allow folders containing mail to also contain folders.\n";
+        print "Deleting folders will bypass the trash folder and be immediately deleted\n\n";
+        print "If this is not the correct value for your server,\n";
+        print "please use option D on the Main Menu to configure your server correctly.\n\n";
         print "Press any key to continue...\n";
         $new_delete = <STDIN>;
         $delete_folder = "true";
     } else { 
+        if ( $imap_server_type eq "courier" ) {
+            print "Courier (or Courier-IMAP) IMAP servers may not support ";
+            print "subfolders of Trash. \n";
+            print "Specifically, if Courier is set to always move messages to Trash, \n";
+            print "Trash will be treated by Courier as a special folder that does not \n";
+            print "allow subfolders. \n\n";
+            print "Please verify your Courier configuration, and test folder deletion \n";
+            print "when changing this setting.\n\n";                                                             
+        }
+
+        print "Are subfolders of the Trash supported by your IMAP server?\n";
+        print "If so, should deleted folders be sent to Trash?\n";
+        print "If not, say no (deleted folders should not be sent to Trash)\n\n";
+        # reversal of logic.
+        # question was: Should folders be automatically deleted instead of sent to trash..
+        # we've changed the question to make it more clear, 
+        # and are here handling that to avoid changing the answers.. 
         if ( lc($delete_folder) eq "true" ) {
-            $default_value = "y";
-        } else {
             $default_value = "n";
+        } else {
+            $default_value = "y";
         }
-        print "Auto delete folders? (y/n) [$WHT$default_value$NRM]: $WHT";
+        print "Send deleted folders to Trash? (y/n) [$WHT$default_value$NRM]: $WHT";
         $new_delete = <STDIN>;
         if ( ( $new_delete =~ /^y\n/i ) || ( ( $new_delete =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
-            $delete_folder = "true";
-        } else {
             $delete_folder = "false";
+        } else {
+            $delete_folder = "true";
         }
     }
     return $delete_folder;
@@ -1856,18 +1863,6 @@ sub command33a {
     print "in an alternate location of your choice. \n";
     print "\n";
 
-    print "[$WHT$data_dir$NRM]: $WHT";
-    $new_data_dir = <STDIN>;
-    if ( $new_data_dir eq "\n" ) {
-        $new_data_dir = $data_dir;
-    } else {
-        $new_data_dir =~ s/[\r|\n]//g;
-    }
-    print "under the web server's root directory (ex: /home/httpd/html).\n";
-    print "For this reason, it is recommended to put the data directory\n";
-    print "in an alternate location of your choice. \n";
-    print "\n";
-
     print "[$WHT$data_dir$NRM]: $WHT";
     $new_data_dir = <STDIN>;
     if ( $new_data_dir eq "\n" ) {
@@ -2892,7 +2887,7 @@ sub save_data {
 }
 
 sub set_defaults {
-    system "clear";
+    clear_screen();
     print $WHT. "SquirrelMail Configuration : " . $NRM;
     if    ( $config == 1 ) { print "Read: config.php"; }
     elsif ( $config == 2 ) { print "Read: config_default.php"; }
@@ -2934,6 +2929,7 @@ sub set_defaults {
             $show_contain_subfolders_option = false;
             $optional_delimiter             = ".";
             $disp_default_folder_prefix     = "<none>";
+            $force_username_lowercase       = false;
 
             $continue = 1;
         } elsif ( $server eq "uw" ) {
@@ -2948,6 +2944,7 @@ sub set_defaults {
             $optional_delimiter             = "/";
             $disp_default_folder_prefix     = $default_folder_prefix;
             $delete_folder                  = true;
+            $force_username_lowercase       = true;
             
             $continue = 1;
         } elsif ( $server eq "exchange" ) {
@@ -2961,6 +2958,7 @@ sub set_defaults {
             $show_contain_subfolders_option = false;
             $optional_delimiter             = "detect";
             $disp_default_folder_prefix     = "<none>";
+            $force_username_lowercase       = true;
 
             $continue = 1;
         } elsif ( $server eq "courier" ) {
@@ -2975,6 +2973,7 @@ sub set_defaults {
             $optional_delimiter             = ".";
             $disp_default_folder_prefix     = $default_folder_prefix;
             $delete_folder                  = true;
+            $force_username_lowercase       = false;
             
             $continue = 1;
         } elsif ( $server eq "macosx" ) {
@@ -3009,8 +3008,9 @@ sub set_defaults {
         print "show_contain_subfolders_option = $show_contain_subfolders_option\n";
         print "            optional_delimiter = $optional_delimiter\n";
         print "                 delete_folder = $delete_folder\n";
+        print "      force_username_lowercase = $force_username_lowercase\n";
     }
-    print "\nPress any key to continue...";
+    print "\nPress enter to continue...";
     $tmp = <STDIN>;
 }
 
@@ -3020,9 +3020,11 @@ sub set_defaults {
 # prepended to the path, if not, then the path will be
 # converted to an absolute path, e.g.
 #   '../images/logo.gif'      --> SM_PATH . 'images/logo.gif'
+#   '../../someplace/data'    --> '/absolute/path/someplace/data'
 #   'images/logo.gif'         --> SM_PATH . 'config/images/logo.gif'
 #   '/absolute/path/logo.gif' --> '/absolute/path/logo.gif'
 #   'http://whatever/'        --> 'http://whatever'
+#   $some_var/path            --> "$some_var/path"
 sub change_to_SM_path() {
     my ($old_path) = @_;
     my $new_path = '';
@@ -3036,7 +3038,16 @@ sub change_to_SM_path() {
     return "\'" . $old_path . "\'"  if ( $old_path =~ /^\w:\// );
     return $old_path                if ( $old_path =~ /^\'(\/|http)/ );
     return $old_path                if ( $old_path =~ /^\'\w:\// );
-    return $old_path                if ( $old_path =~ /^(\$|SM_PATH)/);
+    return $old_path                if ( $old_path =~ /^SM_PATH/);
+   
+    if ( $old_path =~ /^\$/ ) {
+        # check if it's a single var, or a $var/path combination
+        # if it's $var/path, enclose in ""
+        if ( $old_path =~ /\// ) {
+            return '"'.$old_path.'"';
+        }
+        return $old_path;
+    }
     
     # Remove remaining '
     $old_path =~ s/\'//g;
@@ -3046,6 +3057,14 @@ sub change_to_SM_path() {
 
     if ( $#rel_path > 1 ) {
         # more than two levels away. Make it absolute.
+        @abs_path = split(/\//, $dir);
+        
+        # Lop off the relative pieces of the absolute path..
+        for ( $i = 0; $i <= $#rel_path; $i++ ) {
+            pop @abs_path;
+            shift @rel_path;
+        }
+        push @abs_path, @rel_path;
         $new_path = "\'" . join('/', @abs_path) . "\'";
     } elsif ( $#rel_path > 0 ) {
         # it's within the SM tree, prepend SM_PATH
@@ -3073,7 +3092,7 @@ sub change_to_rel_path() {
 
     if ( $old_path =~ /^SM_PATH/ ) {
         $new_path =~ s/^SM_PATH . \'/\.\.\//;
-       $new_path =~ s/\.\.\/config\///;
+        $new_path =~ s/\.\.\/config\///;
     }
 
     return $new_path;
@@ -3156,3 +3175,11 @@ sub detect_auth_support {
        close $sock;
        return 'YES';
 }
+
+sub clear_screen() {
+    if ( $^O =~ /^mswin/i) {
+        system "cls";
+    } else {
+        system "clear";
+    }
+}