Do not turn references and in-reply-to headers into links.
[squirrelmail.git] / config / conf.pl
index ccdc4e1a3d271472360f6dfa0ad2383ad4515f42..99bb4c5a9cedbb6b0e76ea3533da036e0e00b765 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,13 +1764,13 @@ 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 "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";
@@ -1779,10 +1779,13 @@ sub command215 {
         print "mail to also contain folders.\n";
         print "Deleting folders will bypass the trash folder and";
         print "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 { 
+        print "Should folders selected for deletion bypass the Trash folder?\n\n";
         if ( lc($delete_folder) eq "true" ) {
             $default_value = "y";
         } else {
@@ -1856,18 +1859,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 +2883,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"; }
@@ -3020,9 +3011,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 +3029,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 +3048,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 +3083,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 +3166,11 @@ sub detect_auth_support {
        close $sock;
        return 'YES';
 }
+
+sub clear_screen() {
+    if ( $^O =~ /^mswin/i) {
+        system "cls";
+    } else {
+        system "clear";
+    }
+}