Allow double quote to be used in MOTD (#1276959), patch by Tomas from bug log.
[squirrelmail.git] / config / conf.pl
index 24626032cf949f41b35847b1137cec261a88f607..5c7a1e9afb047f56e418256b10515f8c7fa38ff0 100755 (executable)
@@ -360,6 +360,9 @@ $abook_global_file_listing = 'true'     if ( !$abook_global_file_listing );
 $encode_header_key = ''                 if ( !$encode_header_key );
 $hide_auth_header = 'false'             if ( !$hide_auth_header );
 $time_zone_type = '0'                   if ( !$time_zone_type );
+$prefs_user_size = 128                  if ( !$prefs_user_size );
+$prefs_key_size = 64                    if ( !$prefs_key_size );
+$prefs_val_size = 65536                 if ( !$prefs_val_size );
 
 if ( $ARGV[0] eq '--install-plugin' ) {
     print "Activating plugin " . $ARGV[1] . "\n";
@@ -608,9 +611,9 @@ while ( ( $command ne "q" ) && ( $command ne "Q" ) && ( $command ne ":q" ) ) {
         print "\n";
         print "3.  DSN for Preferences    : $WHT$prefs_dsn$NRM\n";
         print "4.  Table for Preferences  : $WHT$prefs_table$NRM\n";
-        print "5.  Field for username     : $WHT$prefs_user_field$NRM\n";
-        print "6.  Field for prefs key    : $WHT$prefs_key_field$NRM\n";
-        print "7.  Field for prefs value  : $WHT$prefs_val_field$NRM\n";
+        print "5.  Field for username     : $WHT$prefs_user_field$NRM ($prefs_user_size)\n";
+        print "6.  Field for prefs key    : $WHT$prefs_key_field$NRM ($prefs_key_size)\n";
+        print "7.  Field for prefs value  : $WHT$prefs_val_field$NRM ($prefs_val_size)\n";
         print "\n";
         print "8.  DSN for Global Address Book            : $WHT$addrbook_global_dsn$NRM\n";
         print "9.  Table for Global Address Book          : $WHT$addrbook_global_table$NRM\n";
@@ -1425,7 +1428,7 @@ sub command71 {
             $line =~ s/  /\ \ /g;
             $line =~ s/\t/\ \ \ \ /g;
             $line =~ s/$/ /;
-            $line =~ s/\"/"/g;
+            $line =~ s/\"/\\\"/g;
 
             $new_motd = $new_motd . $line;
         }
@@ -1921,9 +1924,10 @@ sub command216 {
 # Data directory
 sub command33a {
     print "Specify the location for your data directory.\n";
+    print "You need to create this directory yourself.\n";
     print "The path name can be absolute or relative (to the config directory).\n";
-    print "It doesn't matter.  Here are two examples:\n";
-    print "  Absolute:    /var/lib/squirrelmail/data/\n";
+    print "Here are two examples:\n";
+    print "  Absolute:    /var/local/squirrelmail/data/\n";
     print "  Relative:    ../data/\n";
     print "Relative paths to directories outside of the SquirrelMail distribution\n";
     print "will be converted to their absolute path equivalents in config.php.\n\n";
@@ -1952,9 +1956,9 @@ sub command33a {
 # Attachment directory
 sub command33b {
     print "Path to directory used for storing attachments while a mail is\n";
-    print "being sent. The path name can be absolute or relative (to the config directory).\n";
-    print "It doesn't matter.  Here are two examples:\n";
-    print "  Absolute:    /var/spool/squirrelmail/attach/\n";
+    print "being composed. The path name can be absolute or relative (to the\n";
+    print "config directory). Here are two examples:\n";
+    print "  Absolute:    /var/local/squirrelmail/attach/\n";
     print "  Relative:    ../attach/\n";
     print "Relative paths to directories outside of the SquirrelMail distribution\n";
     print "will be converted to their absolute path equivalents in config.php.\n\n";
@@ -2963,6 +2967,7 @@ sub command95 {
     } else {
         $new_field =~ s/[\r\n]//g;
     }
+    $prefs_user_size = db_pref_size($prefs_user_size);
     return $new_field;
 }
 
@@ -2977,6 +2982,7 @@ sub command96 {
     } else {
         $new_field =~ s/[\r\n]//g;
     }
+    $prefs_key_size = db_pref_size($prefs_key_size);
     return $new_field;
 }
 
@@ -2991,9 +2997,26 @@ sub command97 {
     } else {
         $new_field =~ s/[\r\n]//g;
     }
+    $prefs_val_size = db_pref_size($prefs_val_size);
     return $new_field;
 }
 
+# routine is used to set database field limits
+# it needs one argument
+sub db_pref_size() {
+    my ($size) = $_[0];
+    print "\nDatabase fields have size limits.\n";
+    print "\n";
+    print "What limit is set for this field? [$WHT$size$NRM]: $WHT";
+    $new_size = <STDIN>;
+    if ( $new_size eq "\n" ) {
+        $new_size = $size;
+    } else {
+        $new_size =~ s/[\r\n]//g;
+    }
+    return $new_size;
+}
+
 sub command98 {
     print "If you want to store your global address book in a database then\n";
     print "you need to set this DSN to a valid value. The format for this is:\n";
@@ -3582,10 +3605,16 @@ sub save_data {
         print CF "\$prefs_table = '$prefs_table';\n";
     # string
         print CF "\$prefs_user_field = '$prefs_user_field';\n";
+    # integer
+        print CF "\$prefs_user_size = $prefs_user_size;\n";
     # string
         print CF "\$prefs_key_field = '$prefs_key_field';\n";
+    # integer
+        print CF "\$prefs_key_size = $prefs_key_size;\n";
     # string
-        print CF "\$prefs_val_field = '$prefs_val_field';\n\n";
+        print CF "\$prefs_val_field = '$prefs_val_field';\n";
+    # integer
+        print CF "\$prefs_val_size = $prefs_val_size;\n\n";
     # string
         print CF "\$addrbook_global_dsn = '$addrbook_global_dsn';\n";
     # string
@@ -3675,6 +3704,7 @@ sub set_defaults {
     $continue = 0;
     while ( $continue != 1 ) {
         print "Please select your IMAP server:\n";
+        print "    bincimap    = Binc IMAP server\n";
         print "    courier     = Courier IMAP server\n";
         print "    cyrus       = Cyrus IMAP server\n";
         print "    dovecot     = Dovecot Secure IMAP server\n";
@@ -3690,6 +3720,9 @@ sub set_defaults {
         $server = <STDIN>;
         $server =~ s/[\r\n]//g;
 
+        # variable is used to display additional messages.
+        $message = "";
+
         print "\n";
         if ( $server eq "cyrus" ) {
             $imap_server_type               = "cyrus";
@@ -3807,6 +3840,24 @@ sub set_defaults {
             $optional_delimiter             = "detect";
             $disp_default_folder_prefix     = "<none>";
 
+            $continue = 1;
+        } elsif ( $server eq "bincimap" ) {
+            $imap_server_type               = "bincimap";
+            $default_folder_prefix          = "INBOX/";
+            $trash_folder                   = "Trash";
+            $sent_folder                    = "Sent";
+            $draft_folder                   = "Drafts";
+            $show_prefix_option             = false;
+            $default_sub_of_inbox           = false;
+            $show_contain_subfolders_option = false;
+            $delete_folder                  = true;
+            $force_username_lowercase       = false;
+            $optional_delimiter             = "detect";
+            $disp_default_folder_prefix     = $default_folder_prefix;
+
+            # Default folder prefix depends on used depot.
+            $message = "\nIf you use IMAPdir depot, you must set default folder prefix to empty string.\n";
+
             $continue = 1;
         } elsif ( $server eq "quit" ) {
             $continue = 1;
@@ -3827,6 +3878,8 @@ sub set_defaults {
         print "            optional_delimiter = $optional_delimiter\n";
         print "                 delete_folder = $delete_folder\n";
         print "      force_username_lowercase = $force_username_lowercase\n";
+
+        print "$message";
     }
     print "\nPress enter to continue...";
     $tmp = <STDIN>;