+# 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 functions/i18n.php.\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;
+}
+
+
+# Advanced tree
+sub commandB1 {
+ print "Enable this option if you want to use DHTML based folder listing.\n";
+ print "Code is experimental, works only with some browsers and there might\n";
+ print "be some glitches.\n";
+ print "\n";
+
+ if ( lc($advanced_tree) eq 'true' ) {
+ $default_value = "y";
+ } else {
+ $default_value = "n";
+ }
+ print "Use advanced tree in folder listing? (y/n) [$WHT$default_value$NRM]: $WHT";
+ $advanced_tree = <STDIN>;
+ if ( ( $advanced_tree =~ /^y\n/i ) || ( ( $advanced_tree =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
+ $advanced_tree = 'true';
+ } else {
+ $advanced_tree = 'false';
+ }
+ return $advanced_tree;
+}
+# 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";