+ } elsif ( $input =~ /^\s*\?\s*/ ) {
+ print ".-------------------------.\n";
+ print "| + (add host) |\n";
+ print "| - N (remove host) |\n";
+ print "| l (list hosts) |\n";
+ print "| d (done) |\n";
+ print "`-------------------------'\n";
+ }
+ print "[ldap] command (?=help) > ";
+ $input = <STDIN>;
+ $input =~ s/[\r\n]//g;
+ }
+}
+
+sub command62 {
+ print "Some of our developers have come up with very good javascript interface\n";
+ print "for searching through address books, however, our original goals said\n";
+ print "that we would be 100% HTML. In order to make it possible to use their\n";
+ print "interface, and yet stick with our goals, we have also written a plain\n";
+ print "HTML version of the search. Here, you can choose which version to use.\n";
+ print "\n";
+ print "This is just the default value. It is also a user option that each\n";
+ print "user can configure individually\n";
+ print "\n";
+
+ if ( lc($default_use_javascript_addr_book) eq 'true' ) {
+ $default_value = "y";
+ } else {
+ $default_use_javascript_addr_book = 'false';
+ $default_value = "n";
+ }
+ print "Use javascript version by default (y/n) [$WHT$default_value$NRM]: $WHT";
+ $new_show = <STDIN>;
+ if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
+ $default_use_javascript_addr_book = 'true';
+ } else {
+ $default_use_javascript_addr_book = 'false';
+ }
+ return $default_use_javascript_addr_book;
+}
+
+# global filebased address book
+sub command63 {
+ print "If you want to use global file address book, then you\n";
+ print "must set this option to a valid value. If option does\n";
+ print "not have path elements, system assumes that file is\n";
+ print "stored in data directory. If relative path is set, it is\n";
+ print "relative to main SquirrelMail directory. If value is empty,\n";
+ print "address book is not enabled.\n";
+ print "\n";
+
+ print "[$WHT$abook_global_file$NRM]: $WHT";
+ $new_abook_global_file = <STDIN>;
+ if ( $new_abook_global_file eq "\n" ) {
+ $new_abook_global_file = $abook_global_file;
+ } else {
+ $new_abook_global_file =~ s/[\r\n]//g;
+ }
+ return $new_abook_global_file;
+}
+
+# writing into global filebased abook control
+sub command64 {
+ print "This setting controls writing into global file address\n";
+ print "book options. Address book file must be writeable by\n";
+ print "webserver's user, if you want to enable this option.\n";
+ print "\n";
+
+ if ( lc($abook_global_file_writeable) eq 'true' ) {
+ $default_value = "y";
+ } else {
+ $abook_global_file_writeable = 'false';
+ $default_value = "n";
+ }
+ print "Allow writing into global file address book (y/n) [$WHT$default_value$NRM]: $WHT";
+ $new_show = <STDIN>;
+ if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
+ $abook_global_file_writeable = 'true';
+ } else {
+ $abook_global_file_writeable = 'false';
+ }
+ return $abook_global_file_writeable;
+}
+
+# listing of global filebased abook control
+sub command65 {
+ print "This setting controls listing of global file address\n";
+ print "book in addresses page.\n";
+ print "\n";
+
+ if ( lc($abook_global_file_listing) eq 'true' ) {
+ $default_value = "y";
+ } else {
+ $abook_global_file_listing = 'false';
+ $default_value = "n";
+ }
+ print "Allow listing of global file address book (y/n) [$WHT$default_value$NRM]: $WHT";
+ $new_show = <STDIN>;
+ if ( ( $new_show =~ /^y\n/i ) || ( ( $new_show =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
+ $abook_global_file_listing = 'true';
+ } else {
+ $abook_global_file_listing = 'false';
+ }
+ return $abook_global_file_listing;
+}
+
+sub command91 {
+ print "If you want to store your users address book details in a database then\n";
+ print "you need to set this DSN to a valid value. The format for this is:\n";
+ print "mysql://user:pass\@hostname/dbname\n";
+ print "Where mysql can be one of the databases PHP supports, the most common\n";
+ print "of these are mysql, msql and pgsql\n";
+ print "If the DSN is left empty (hit space and then return) the database\n";
+ print "related code for address books will not be used\n";
+ print "\n";
+
+ if ( $addrbook_dsn eq "" ) {
+ $default_value = "Disabled";
+ } else {
+ $default_value = $addrbook_dsn;
+ }
+ print "[$WHT$addrbook_dsn$NRM]: $WHT";
+ $new_dsn = <STDIN>;
+ if ( $new_dsn eq "\n" ) {
+ $new_dsn = "";
+ } else {
+ $new_dsn =~ s/[\r\n]//g;
+ $new_dsn =~ s/^\s+$//g;
+ }
+ return $new_dsn;
+}
+
+sub command92 {
+ print "This is the name of the table you want to store the address book\n";
+ print "data in, it defaults to 'address'\n";
+ print "\n";
+ print "[$WHT$addrbook_table$NRM]: $WHT";
+ $new_table = <STDIN>;
+ if ( $new_table eq "\n" ) {
+ $new_table = $addrbook_table;
+ } else {
+ $new_table =~ s/[\r\n]//g;
+ }
+ return $new_table;
+}
+
+sub command93 {
+ print "If you want to store your users preferences in a database then\n";
+ print "you need to set this DSN to a valid value. The format for this is:\n";
+ print "mysql://user:pass\@hostname/dbname\n";
+ print "Where mysql can be one of the databases PHP supports, the most common\n";
+ print "of these are mysql, msql and pgsql\n";
+ print "If the DSN is left empty (hit space and then return) the database\n";
+ print "related code for address books will not be used\n";
+ print "\n";
+
+ if ( $prefs_dsn eq "" ) {
+ $default_value = "Disabled";
+ } else {
+ $default_value = $prefs_dsn;
+ }
+ print "[$WHT$prefs_dsn$NRM]: $WHT";
+ $new_dsn = <STDIN>;
+ if ( $new_dsn eq "\n" ) {
+ $new_dsn = "";
+ } else {
+ $new_dsn =~ s/[\r\n]//g;
+ $new_dsn =~ s/^\s+$//g;
+ }
+ return $new_dsn;
+}
+
+sub command94 {
+ print "This is the name of the table you want to store the preferences\n";
+ print "data in, it defaults to 'userprefs'\n";
+ print "\n";
+ print "[$WHT$prefs_table$NRM]: $WHT";
+ $new_table = <STDIN>;
+ if ( $new_table eq "\n" ) {
+ $new_table = $prefs_table;
+ } else {
+ $new_table =~ s/[\r\n]//g;
+ }
+ return $new_table;
+}
+
+sub command95 {
+ print "This is the name of the field in which you want to store the\n";
+ print "username of the person the prefs are for. It default to 'user'\n";
+ print "which clashes with a reserved keyword in PostgreSQL so this\n";
+ print "will need to be changed for that database at least\n";
+ print "\n";
+ print "[$WHT$prefs_user_field$NRM]: $WHT";
+ $new_field = <STDIN>;
+ if ( $new_field eq "\n" ) {
+ $new_field = $prefs_user_field;
+ } else {
+ $new_field =~ s/[\r\n]//g;
+ }
+ $prefs_user_size = db_pref_size($prefs_user_size);
+ return $new_field;
+}
+
+sub command96 {
+ print "This is the name of the field in which you want to store the\n";
+ print "preferences keyword. It defaults to 'prefkey'\n";
+ print "\n";
+ print "[$WHT$prefs_key_field$NRM]: $WHT";
+ $new_field = <STDIN>;
+ if ( $new_field eq "\n" ) {
+ $new_field = $prefs_key_field;
+ } else {
+ $new_field =~ s/[\r\n]//g;
+ }
+ $prefs_key_size = db_pref_size($prefs_key_size);
+ return $new_field;
+}
+
+sub command97 {
+ print "This is the name of the field in which you want to store the\n";
+ print "preferences value. It defaults to 'prefval'\n";
+ print "\n";
+ print "[$WHT$prefs_val_field$NRM]: $WHT";
+ $new_field = <STDIN>;
+ if ( $new_field eq "\n" ) {
+ $new_field = $prefs_val_field;
+ } 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";
+ print "mysql://user:pass\@hostname/dbname\n";
+ print "Where mysql can be one of the databases PHP supports, the most common\n";
+ print "of these are mysql, msql and pgsql\n";
+ print "If the DSN is left empty (hit space and then return) the database\n";
+ print "related code for global SQL address book will not be used\n";
+ print "\n";
+
+ if ( $addrbook_global_dsn eq "" ) {
+ $default_value = "Disabled";
+ } else {
+ $default_value = $addrbook_global_dsn;
+ }
+ print "[$WHT$addrbook_global_dsn$NRM]: $WHT";
+ $new_dsn = <STDIN>;
+ if ( $new_dsn eq "\n" ) {
+ $new_dsn = "";
+ } else {
+ $new_dsn =~ s/[\r\n]//g;
+ $new_dsn =~ s/^\s+$//g;
+ }
+ return $new_dsn;
+}
+
+sub command99 {
+ print "This is the name of the table you want to store the global address book\n";
+ print "data in. Default table name is 'global_abook'. Address book uses same\n";
+ print "database format as personal address book.\n";
+ print "\n";
+ print "[$WHT$addrbook_global_table$NRM]: $WHT";
+ $new_table = <STDIN>;
+ if ( $new_table eq "\n" ) {
+ $new_table = $addrbook_global_table;
+ } else {
+ $new_table =~ s/[\r\n]//g;
+ }
+ return $new_table;
+}
+
+sub command910 {
+ print "This option controls users\' ability to add or modify records stored \n";
+ print "in global address book\n";
+
+ if ( lc($addrbook_global_writeable) eq 'true' ) {
+ $default_value = "y";
+ } else {
+ $default_value = "n";
+ }
+ print "Allow writing into global address book? (y/n) [$WHT$default_value$NRM]: $WHT";
+ $addrbook_global_writeable = <STDIN>;
+ if ( ( $addrbook_global_writeable =~ /^y\n/i ) || ( ( $addrbook_global_writeable =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
+ $addrbook_global_writeable = 'true';
+ } else {
+ $addrbook_global_writeable = 'false';
+ }
+ return $addrbook_global_writeable;
+}
+
+sub command911 {
+ print "Enable this option if you want to see listing of addresses stored \n";
+ print "in global address book\n";
+
+ if ( lc($addrbook_global_listing) eq 'true' ) {
+ $default_value = "y";
+ } else {
+ $default_value = "n";
+ }
+ print "Allow listing of global address book? (y/n) [$WHT$default_value$NRM]: $WHT";
+ $addrbook_global_listing = <STDIN>;
+ if ( ( $addrbook_global_listing =~ /^y\n/i ) || ( ( $addrbook_global_listing =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
+ $addrbook_global_listing = 'true';
+ } else {
+ $addrbook_global_listing = 'false';
+ }
+ return $addrbook_global_listing;
+}
+
+
+# Default language
+sub commandA1 {
+ print "SquirrelMail attempts to set the language in many ways. If it\n";
+ print "can not figure it out in another way, it will default to this\n";
+ print "language. Please use the code for the desired language.\n";
+ print "\n";
+ print "[$WHT$squirrelmail_default_language$NRM]: $WHT";
+ $new_squirrelmail_default_language = <STDIN>;
+ if ( $new_squirrelmail_default_language eq "\n" ) {
+ $new_squirrelmail_default_language = $squirrelmail_default_language;
+ } else {
+ $new_squirrelmail_default_language =~ s/[\r\n]//g;
+ $new_squirrelmail_default_language =~ s/^\s+$//g;
+ }
+ return $new_squirrelmail_default_language;
+}
+# Default Charset
+sub commandA2 {
+ print "This option controls what character set is used when sending\n";
+ print "mail and when sending HTML to the browser. Option works only\n";
+ print "with US English (en_US) translation. Other translations use\n";
+ print "charsets that are set in translation settings.\n";
+ print "\n";
+
+ print "[$WHT$default_charset$NRM]: $WHT";
+ $new_default_charset = <STDIN>;
+ if ( $new_default_charset eq "\n" ) {
+ $new_default_charset = $default_charset;
+ } else {
+ $new_default_charset =~ s/[\r\n]//g;
+ }
+ return $new_default_charset;
+}
+# Alternative language names
+sub commandA3 {
+ print "Enable this option if you want to see localized language names in\n";
+ print "language selection box. Note, that this option can trigger\n";
+ print "installation of foreign language support modules in some browsers.\n";
+ print "\n";
+
+ if ( lc($show_alternative_names) eq 'true' ) {
+ $default_value = "y";
+ } else {
+ $default_value = "n";
+ }
+ print "Show alternative language names? (y/n) [$WHT$default_value$NRM]: $WHT";
+ $show_alternative_names = <STDIN>;
+ if ( ( $show_alternative_names =~ /^y\n/i ) || ( ( $show_alternative_names =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
+ $show_alternative_names = 'true';
+ } else {
+ $show_alternative_names = 'false';
+ }
+ return $show_alternative_names;
+}
+
+# Aggressive decoding
+sub commandA4 {
+ print "Enable this option if you want to use CPU and memory intensive decoding\n";
+ print "functions. This option allows reading multibyte charset, that are used\n";
+ print "in Eastern Asia. SquirrelMail will try to use recode functions here,\n";
+ print "even when you have disabled use of recode in Tweaks section.\n";
+ print "\n";
+
+ if ( lc($aggressive_decoding) eq 'true' ) {
+ $default_value = "y";
+ } else {
+ $default_value = "n";
+ }
+ print "Enable aggressive decoding? (y/n) [$WHT$default_value$NRM]: $WHT";
+ $aggressive_decoding = <STDIN>;
+ if ( ( $aggressive_decoding =~ /^y\n/i ) || ( ( $aggressive_decoding =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
+ $aggressive_decoding = 'true';
+ } else {
+ $aggressive_decoding = 'false';
+ }
+ return $aggressive_decoding;
+}
+
+# Lossy encoding
+sub commandA5 {
+ print "Enable this option if you want to allow lossy charset encoding in message\n";
+ print "composition pages. This option allows charset conversions when output\n";
+ print "charset does not support all symbols used in original charset. Symbols\n";
+ print "unsupported by output charset will be replaced with question marks.\n";
+ print "\n";
+
+ if ( lc($lossy_encoding) eq 'true' ) {
+ $default_value = "y";
+ } else {
+ $default_value = "n";
+ }
+ print "Enable lossy encoding? (y/n) [$WHT$default_value$NRM]: $WHT";
+ $lossy_encoding = <STDIN>;
+ if ( ( $lossy_encoding =~ /^y\n/i ) || ( ( $lossy_encoding =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
+ $lossy_encoding = 'true';
+ } else {
+ $lossy_encoding = 'false';
+ }
+ return $lossy_encoding;
+}
+
+# display html emails in iframe
+sub commandB2 {
+ print "This option can enable html email rendering inside iframe.\n";
+ print "Inline frames are used in order to provide sandbox environment";
+ print "for html code included in html formated emails.";
+ print "Option is experimental and might have glitches in some parts of code.";
+ print "\n";
+
+ if ( lc($use_iframe) eq 'true' ) {
+ $default_value = "y";
+ } else {
+ $default_value = "n";
+ }
+ print "Display html emails in iframe? (y/n) [$WHT$default_value$NRM]: $WHT";
+ $use_iframe = <STDIN>;
+ if ( ( $use_iframe =~ /^y\n/i ) || ( ( $use_iframe =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
+ $use_iframe = 'true';
+ } else {
+ $use_iframe = 'false';
+ }
+ return $use_iframe;
+}
+# use icons
+sub commandB3 {
+ print "Enabling this option will cause icons to be used instead of text\n";
+ print "markers next to each message in mailbox lists that represent\n";
+ print "new, read, flagged, and deleted messages, as well as those that\n";
+ print "have been replied to and forwarded. Icons are also used next to\n";
+ print "(un)expanded folders in the folder list (Oldway = false). These\n";
+ print "icons are quite small, but will obviously be more of a resource\n";
+ print "drain than text markers.\n";
+ print "\n";
+
+ if ( lc($use_icons) eq 'true' ) {
+ $default_value = "y";
+ } else {
+ $default_value = "n";
+ }
+ print "Use icons? (y/n) [$WHT$default_value$NRM]: $WHT";
+ $use_icons = <STDIN>;
+ if ( ( $use_icons =~ /^y\n/i ) || ( ( $use_icons =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
+ $use_icons = 'true';
+ } else {
+ $use_icons = 'false';
+ }
+ return $use_icons;
+}
+# php recode
+sub commandB4 {
+ print "Enable this option if you want to use php recode functions to read\n";
+ print "emails written in charset that differs from the one that is set in\n";
+ print "translation selected by user. Code is experimental, it might cause\n";
+ print "errors, if email contains charset unsupported by recode or if your\n";
+ print "php does not have recode support.\n";
+ print "\n";
+
+ if ( lc($use_php_recode) eq 'true' ) {
+ $default_value = "y";
+ } else {
+ $default_value = "n";
+ }
+ print "Use php recode functions? (y/n) [$WHT$default_value$NRM]: $WHT";
+ $use_php_recode = <STDIN>;
+ if ( ( $use_php_recode =~ /^y\n/i ) || ( ( $use_php_recode =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
+ $use_php_recode = 'true';
+ } else {
+ $use_php_recode = 'false';
+ }
+ return $use_php_recode;
+}
+# php iconv
+sub commandB5 {
+ print "Enable this option if you want to use php iconv functions to read\n";
+ print "emails written in charset that differs from the one that is set in\n";
+ print "translation selected by user. Code is experimental, it works only\n";
+ print "with translations that use utf-8 charset. Code might cause errors,\n";
+ print "if email contains charset unsupported by iconv or if your php does\n";
+ print "not have iconv support.\n";
+ print "\n";
+
+ if ( lc($use_php_iconv) eq 'true' ) {
+ $default_value = "y";
+ } else {
+ $default_value = "n";
+ }
+ print "Use php iconv functions? (y/n) [$WHT$default_value$NRM]: $WHT";
+ $use_php_iconv = <STDIN>;
+ if ( ( $use_php_iconv =~ /^y\n/i ) || ( ( $use_php_iconv =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
+ $use_php_iconv = 'true';
+ } else {
+ $use_php_iconv = 'false';
+ }
+ return $use_php_iconv;
+}
+
+# configtest block
+sub commandB6 {
+ print "Enable this option if you want to check SquirrelMail configuration\n";
+ print "remotely with configtest.php script.\n";
+ print "\n";
+
+ if ( lc($allow_remote_configtest) eq 'true' ) {
+ $default_value = "y";
+ } else {
+ $default_value = "n";
+ }
+ print "Allow remote configuration tests? (y/n) [$WHT$default_value$NRM]: $WHT";
+ $allow_remote_configtest = <STDIN>;
+ if ( ( $allow_remote_configtest =~ /^y\n/i ) || ( ( $allow_remote_configtest =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
+ $allow_remote_configtest = 'true';
+ } else {
+ $allow_remote_configtest = 'false';
+ }
+ return $allow_remote_configtest;
+}
+
+
+
+sub save_data {
+ $tab = " ";
+ if ( open( CF, ">config.php" ) ) {
+ print CF "<?php\n";
+ print CF "\n";
+
+ print CF "/**\n";
+ print CF " * SquirrelMail Configuration File\n";
+ print CF " * Created using the configure script, conf.pl\n";
+ print CF " */\n";
+ print CF "\n";
+ print CF "global \$version;\n";
+
+ if ($print_config_version) {
+ print CF "\$config_version = '$print_config_version';\n";
+ }
+ # integer
+ print CF "\$config_use_color = $config_use_color;\n";
+ print CF "\n";
+
+ # string
+ print CF "\$org_name = \"$org_name\";\n";
+ # string
+ print CF "\$org_logo = " . &change_to_SM_path($org_logo) . ";\n";
+ $org_logo_width |= 0;
+ $org_logo_height |= 0;
+ # string
+ print CF "\$org_logo_width = '$org_logo_width';\n";
+ # string
+ print CF "\$org_logo_height = '$org_logo_height';\n";
+ # string that can contain variables.
+ print CF "\$org_title = \"$org_title\";\n";
+ # string
+ print CF "\$signout_page = " . &change_to_SM_path($signout_page) . ";\n";
+ # string
+ print CF "\$frame_top = '$frame_top';\n";
+ print CF "\n";
+
+ print CF "\$provider_uri = '$provider_uri';\n";
+ print CF "\n";
+
+ print CF "\$provider_name = '$provider_name';\n";
+ print CF "\n";
+
+ # string that can contain variables
+ print CF "\$motd = \"$motd\";\n";
+ print CF "\n";
+
+ # string
+ print CF "\$squirrelmail_default_language = '$squirrelmail_default_language';\n";
+ # string
+ print CF "\$default_charset = '$default_charset';\n";
+ # boolean
+ print CF "\$show_alternative_names = $show_alternative_names;\n";
+ # boolean
+ print CF "\$aggressive_decoding = $aggressive_decoding;\n";
+ # boolean
+ print CF "\$lossy_encoding = $lossy_encoding;\n";
+ print CF "\n";
+
+ # string
+ print CF "\$domain = '$domain';\n";
+ # string
+ print CF "\$imapServerAddress = '$imapServerAddress';\n";
+ # integer
+ print CF "\$imapPort = $imapPort;\n";
+ # boolean
+ print CF "\$useSendmail = $useSendmail;\n";
+ # string
+ print CF "\$smtpServerAddress = '$smtpServerAddress';\n";
+ # integer
+ print CF "\$smtpPort = $smtpPort;\n";
+ # string
+ print CF "\$sendmail_path = '$sendmail_path';\n";
+ # string
+ print CF "\$sendmail_args = '$sendmail_args';\n";
+ # boolean
+# print CF "\$use_authenticated_smtp = $use_authenticated_smtp;\n";
+ # boolean
+ print CF "\$pop_before_smtp = $pop_before_smtp;\n";
+ # string
+ print CF "\$imap_server_type = '$imap_server_type';\n";
+ # boolean
+ print CF "\$invert_time = $invert_time;\n";
+ # string
+ print CF "\$optional_delimiter = '$optional_delimiter';\n";
+ # string
+ print CF "\$encode_header_key = '$encode_header_key';\n";
+ print CF "\n";
+
+ # string
+ print CF "\$default_folder_prefix = '$default_folder_prefix';\n";
+ # string
+ print CF "\$trash_folder = '$trash_folder';\n";
+ # string
+ print CF "\$sent_folder = '$sent_folder';\n";
+ # string
+ print CF "\$draft_folder = '$draft_folder';\n";
+ # boolean
+ print CF "\$default_move_to_trash = $default_move_to_trash;\n";
+ # boolean
+ print CF "\$default_move_to_sent = $default_move_to_sent;\n";
+ # boolean
+ print CF "\$default_save_as_draft = $default_save_as_draft;\n";
+ # boolean
+ print CF "\$show_prefix_option = $show_prefix_option;\n";
+ # boolean
+ print CF "\$list_special_folders_first = $list_special_folders_first;\n";
+ # boolean
+ print CF "\$use_special_folder_color = $use_special_folder_color;\n";
+ # boolean
+ print CF "\$auto_expunge = $auto_expunge;\n";
+ # boolean
+ print CF "\$default_sub_of_inbox = $default_sub_of_inbox;\n";
+ # boolean
+ print CF "\$show_contain_subfolders_option = $show_contain_subfolders_option;\n";
+ # integer
+ print CF "\$default_unseen_notify = $default_unseen_notify;\n";
+ # integer
+ print CF "\$default_unseen_type = $default_unseen_type;\n";
+ # boolean
+ print CF "\$auto_create_special = $auto_create_special;\n";
+ # boolean
+ print CF "\$delete_folder = $delete_folder;\n";
+ # boolean
+ print CF "\$noselect_fix_enable = $noselect_fix_enable;\n";
+
+ print CF "\n";
+
+ # string
+ print CF "\$data_dir = " . &change_to_SM_path($data_dir) . ";\n";
+ # string that can contain a variable
+ print CF "\$attachment_dir = " . &change_to_SM_path($attachment_dir) . ";\n";
+ # integer
+ print CF "\$dir_hash_level = $dir_hash_level;\n";
+ # string
+ print CF "\$default_left_size = '$default_left_size';\n";
+ # boolean
+ print CF "\$force_username_lowercase = $force_username_lowercase;\n";
+ # boolean
+ print CF "\$default_use_priority = $default_use_priority;\n";
+ # boolean
+ print CF "\$hide_sm_attributions = $hide_sm_attributions;\n";
+ # boolean
+ print CF "\$default_use_mdn = $default_use_mdn;\n";
+ # boolean
+ print CF "\$edit_identity = $edit_identity;\n";
+ # boolean
+ print CF "\$edit_name = $edit_name;\n";
+ # boolean
+ print CF "\$hide_auth_header = $hide_auth_header;\n";
+ # boolean
+ print CF "\$disable_thread_sort = $disable_thread_sort;\n";
+ # boolean
+ print CF "\$disable_server_sort = $disable_server_sort;\n";
+ # boolean
+ print CF "\$allow_charset_search = $allow_charset_search;\n";
+ # integer
+ print CF "\$allow_advanced_search = $allow_advanced_search;\n";
+ print CF "\n";
+ # integer
+ print CF "\$time_zone_type = $time_zone_type;\n";
+ print CF "\n";
+
+ # all plugins are strings
+ for ( $ct = 0 ; $ct <= $#plugins ; $ct++ ) {
+ print CF "\$plugins[] = '$plugins[$ct]';\n";
+ }
+ print CF "\n";
+
+ # strings
+ print CF "\$theme_css = " . &change_to_SM_path($theme_css) . ";\n";
+ if ( $theme_default eq '' ) { $theme_default = '0'; }
+ print CF "\$theme_default = $theme_default;\n";
+
+ for ( $count = 0 ; $count <= $#theme_name ; $count++ ) {
+ print CF "\$theme[$count]['PATH'] = " . &change_to_SM_path($theme_path[$count]) . ";\n";
+ # escape theme name so it can contain single quotes.
+ $esc_name = $theme_name[$count];
+ $esc_name =~ s/\\/\\\\/g;
+ $esc_name =~ s/'/\\'/g;
+ print CF "\$theme[$count]['NAME'] = '$esc_name';\n";
+ }
+ print CF "\n";
+
+ if ( $templateset_default eq '' ) { $templateset_default = '0'; }
+ print CF "\$templateset_default = $templateset_default;\n";
+
+ for ( $count = 0 ; $count <= $#templateset_name ; $count++ ) {
+ print CF "\$aTemplateSet[$count]['PATH'] = " . &change_to_SM_path($templateset_path[$count]) . ";\n";
+ # escape theme name so it can contain single quotes.
+ $esc_name = $templateset_name[$count];
+ $esc_name =~ s/\\/\\\\/g;
+ $esc_name =~ s/'/\\'/g;
+ print CF "\$aTemplateSet[$count]['NAME'] = '$esc_name';\n";
+ }
+ print CF "\n";
+
+
+ # integer
+ print CF "\$default_fontsize = '$default_fontsize';\n";
+ # string
+ print CF "\$default_fontset = '$default_fontset';\n";
+ print CF "\n";
+ # assoc. array (maybe initial value should be set somewhere else)
+ print CF '$fontsets = array();'."\n";
+ while (($fontset_name, $fontset_value) = each(%fontsets)) {
+ print CF "\$fontsets\['$fontset_name'\] = '$fontset_value';\n";
+ }
+ print CF "\n";
+
+ ## Address books
+ # boolean
+ print CF "\$default_use_javascript_addr_book = $default_use_javascript_addr_book;\n";
+ for ( $count = 0 ; $count <= $#ldap_host ; $count++ ) {
+ print CF "\$ldap_server[$count] = array(\n";
+ # string
+ print CF " 'host' => '$ldap_host[$count]',\n";
+ # string
+ print CF " 'base' => '$ldap_base[$count]'";
+ if ( $ldap_name[$count] ) {
+ print CF ",\n";
+ # string
+ print CF " 'name' => '$ldap_name[$count]'";
+ }
+ if ( $ldap_port[$count] ) {
+ print CF ",\n";
+ # integer
+ print CF " 'port' => $ldap_port[$count]";
+ }
+ if ( $ldap_charset[$count] ) {
+ print CF ",\n";
+ # string
+ print CF " 'charset' => '$ldap_charset[$count]'";
+ }
+ if ( $ldap_maxrows[$count] ) {
+ print CF ",\n";
+ # integer
+ print CF " 'maxrows' => $ldap_maxrows[$count]";
+ }
+ # string
+ if ( $ldap_filter[$count] ) {
+ print CF ",\n";
+ print CF " 'filter' => '$ldap_filter[$count]'";
+ }
+ if ( $ldap_binddn[$count] ) {
+ print CF ",\n";
+ # string
+ print CF " 'binddn' => '$ldap_binddn[$count]'";
+ if ( $ldap_bindpw[$count] ) {
+ print CF ",\n";
+ # string
+ print CF " 'bindpw' => '$ldap_bindpw[$count]'";
+ }
+ }
+ if ( $ldap_protocol[$count] ) {
+ print CF ",\n";
+ # integer
+ print CF " 'protocol' => $ldap_protocol[$count]";
+ }
+ if ( $ldap_limit_scope[$count] ) {
+ print CF ",\n";
+ # boolean
+ print CF " 'limit_scope' => $ldap_limit_scope[$count]";
+ }
+ if ( $ldap_listing[$count] ) {
+ print CF ",\n";
+ # boolean
+ print CF " 'listing' => $ldap_listing[$count]";
+ }
+ if ( $ldap_writeable[$count] ) {
+ print CF ",\n";
+ # boolean
+ print CF " 'writeable' => $ldap_writeable[$count]";
+ }
+ if ( $ldap_search_tree[$count] ) {
+ print CF ",\n";
+ # integer
+ print CF " 'search_tree' => $ldap_search_tree[$count]";
+ }
+ if ( $ldap_listing[$count] ) {
+ print CF ",\n";
+ # boolean
+ print CF " 'starttls' => $ldap_starttls[$count]";
+ }
+ print CF "\n";
+ print CF ");\n";
+ print CF "\n";
+ }
+
+ # string
+ print CF "\$addrbook_dsn = '$addrbook_dsn';\n";
+ # string
+ print CF "\$addrbook_table = '$addrbook_table';\n\n";
+ # string
+ print CF "\$prefs_dsn = '$prefs_dsn';\n";
+ # string
+ 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";
+ # integer
+ print CF "\$prefs_val_size = $prefs_val_size;\n\n";
+ # string
+ print CF "\$addrbook_global_dsn = '$addrbook_global_dsn';\n";
+ # string
+ print CF "\$addrbook_global_table = '$addrbook_global_table';\n";
+ # boolean
+ print CF "\$addrbook_global_writeable = $addrbook_global_writeable;\n";
+ # boolean
+ print CF "\$addrbook_global_listing = $addrbook_global_listing;\n\n";
+ # string
+ print CF "\$abook_global_file = '$abook_global_file';\n";
+ # boolean
+ print CF "\$abook_global_file_writeable = $abook_global_file_writeable;\n\n";
+ # boolean
+ print CF "\$abook_global_file_listing = $abook_global_file_listing;\n\n";
+ # boolean
+ print CF "\$no_list_for_subscribe = $no_list_for_subscribe;\n";
+
+ # string
+ print CF "\$smtp_auth_mech = '$smtp_auth_mech';\n";
+ # string
+ print CF "\$imap_auth_mech = '$imap_auth_mech';\n";
+ # boolean
+ print CF "\$use_imap_tls = $use_imap_tls;\n";
+ # boolean
+ print CF "\$use_smtp_tls = $use_smtp_tls;\n";
+ # string
+ print CF "\$session_name = '$session_name';\n";
+
+ print CF "\n";
+
+ # boolean
+ print CF "\$use_iframe = $use_iframe;\n";
+ print CF "\n";
+ # boolean
+ print CF "\$use_icons = $use_icons;\n";
+ print CF "\n";
+ # boolean
+ print CF "\$use_php_recode = $use_php_recode;\n";
+ print CF "\n";
+ # boolean
+ print CF "\$use_php_iconv = $use_php_iconv;\n";
+ print CF "\n";
+ # boolean
+ print CF "\$allow_remote_configtest = $allow_remote_configtest;\n";
+ print CF "\n";
+
+ print CF "\@include SM_PATH . 'config/config_local.php';\n";
+
+ print CF "\n/**\n";
+ print CF " * Make sure there are no characters after the PHP closing\n";
+ print CF " * tag below (including newline characters and whitespace).\n";
+ print CF " * Otherwise, that character will cause the headers to be\n";
+ print CF " * sent and regular output to begin, which will majorly screw\n";
+ print CF " * things up when we try to send more headers later.\n";
+ print CF " */\n";
+ print CF "?>";
+
+ close CF;
+
+ print "Data saved in config.php\n";
+ } else {
+ print "Error saving config.php: $!\n";
+ }