+# SquirrelMail debug mode (since 1.5.2)
+sub commandB8 {
+ print "When debugging or developing SquirrelMail, you may want to increase\n";
+ print "the verbosity of certain kinds of errors, notices, and/or diagnostics.\n";
+ print "You may enable one or more of the debugging modes here. Please make\n";
+ print "sure that you have turned off debugging if you are using SquirrelMail\n";
+ print "in a production environment.\n\n";
+
+ $input = "";
+ while ( $input ne "d\n" ) {
+ $sm_debug_mode = convert_debug_constants_to_binary_integer($sm_debug_mode);
+
+ # per include/constants.php, here are the debug mode values:
+ #
+ # 0 SM_DEBUG_MODE_OFF
+ # 1 SM_DEBUG_MODE_SIMPLE
+ # 512 SM_DEBUG_MODE_MODERATE
+ # 524288 SM_DEBUG_MODE_ADVANCED
+ # 536870912 SM_DEBUG_MODE_STRICT
+ #
+ print "\n# Enabled? Description\n";
+ print "---------------------------------------------------------------------\n";
+ print "0 " . ($sm_debug_mode == 0 ? "y" : " ")
+ . " No debugging (recommended in production environments)\n";
+ print "1 " . ($sm_debug_mode & 1 ? "y" : " ")
+ . " Simple debugging (PHP E_ERROR)\n";
+ print "2 " . ($sm_debug_mode & 512 ? "y" : " ")
+ . " Moderate debugging (PHP E_ALL without E_STRICT)\n";
+ print "3 " . ($sm_debug_mode & 524288 ? "y" : " ")
+ . " Advanced debugging (PHP E_ALL (without E_STRICT) plus\n";
+ print " log errors intentionally suppressed)\n";
+ print "4 " . ($sm_debug_mode & 536870912 ? "y" : " ")
+ . " Strict debugging (PHP E_ALL and E_STRICT)\n";
+ print "\n";
+
+ print "SquirrelMail debug mode (0,1,2,3,4) or d when done? : $WHT";
+ $input = <STDIN>;
+ if ( $input eq "d\n" ) {
+ # nothing
+ } elsif ($input !~ /^[0-9]+\n$/) {
+ print "\nInvalid configuration value.\n";
+ print "\nPress enter to continue...";
+ $tmp = <STDIN>;
+ } elsif ( $input == "0\n" ) {
+ $sm_debug_mode = 0;
+ } elsif ( $input == "1\n" ) {
+ if ($sm_debug_mode & 1) {
+ $sm_debug_mode ^= 1;
+ } else {
+ $sm_debug_mode |= 1;
+ }
+ } elsif ( $input == "2\n" ) {
+ if ($sm_debug_mode & 512) {
+ $sm_debug_mode ^= 512;
+ } else {
+ $sm_debug_mode |= 512;
+ }
+ } elsif ( $input == "3\n" ) {
+ if ($sm_debug_mode & 524288) {
+ $sm_debug_mode ^= 524288;
+ } else {
+ $sm_debug_mode |= 524288;
+ }
+ } elsif ( $input == "4\n" ) {
+ if ($sm_debug_mode & 536870912) {
+ $sm_debug_mode ^= 536870912;
+ } else {
+ $sm_debug_mode |= 536870912;
+ }
+ } else {
+ print "\nInvalid configuration value.\n";
+ print "\nPress enter to continue...";
+ $tmp = <STDIN>;
+ }
+ print "\n";
+ }
+ $sm_debug_mode = convert_debug_binary_integer_to_constants($sm_debug_mode);
+ return $sm_debug_mode;
+}
+
+# Secured configuration mode (since 1.5.2)
+sub commandB9 {
+ print "This option allows you to enable \"Secured Configuration\" mode,\n";
+ print "which will guarantee that certain settings made herein will be\n";
+ print "made immutable and will not be subject to override by either friendly\n";
+ print "or unfriendly code/plugins. Only a small number of settings herein\n";
+ print "will be used in this manner - just those that are deemed to be a\n";
+ print "potential security threat when rouge plugin or other code may be\n";
+ print "executed inside SquirrelMail.\n";
+ print "\n";
+
+ if ( lc($secured_config) eq 'true' ) {
+ $default_value = "y";
+ } else {
+ $default_value = "n";
+ }
+ print "Enable secured configuration mode? (y/n) [$WHT$default_value$NRM]: $WHT";
+ $secured_config = <STDIN>;
+ if ( ( $secured_config =~ /^y\n/i ) || ( ( $secured_config =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
+ $secured_config = 'true';
+ } else {
+ $secured_config = 'false';
+ }
+ return $secured_config;
+}
+
+# Set a (non-standard) HTTPS port
+sub commandB10 {
+ print "If you run HTTPS (SSL-secured HTTP) on a non-standard port, you should\n";
+ print "indicate that port here. Even if you do not, SquirrelMail may still\n";
+ print "auto-detect secure connections, but it is safer and also very useful\n";
+ print "for third party plugins if you specify the port number here.\n";
+ print "\n";
+ print "Most SquirrelMail administrators will not need to use this setting\n";
+ print "because most all web servers use port 443 for HTTPS connections, and\n";
+ print "SquirrelMail assumes 443 unless something else is given here.\n";
+ print "\n";
+
+ print "Enter your HTTPS port [$sq_https_port]: ";
+ my $tmp = <STDIN>;
+ $tmp = trim($tmp);
+ # value is not modified, if user hits Enter or enters space
+ if ($tmp ne '') {
+ # make sure that input is numeric
+ if ($tmp =~ /^\d+$/) {
+ $sq_https_port = $tmp;
+ } else {
+ print "\n";
+ print "--- INPUT ERROR ---\n";
+ print "\n";
+ print "If you want to change this setting, you must enter a number.\n";
+ print "If you want to keep the original value, just press Enter.\n\n";
+ print "Press Enter to continue...";
+ $tmp = <STDIN>;
+ }
+ }
+ return $sq_https_port;
+}
+
+# Ignore HTTP_X_FORWARDED_* headers?
+sub commandB11 {
+
+ if ( lc($sq_ignore_http_x_forwarded_headers) eq 'true' ) {
+ $default_value = "y";
+ } else {
+ $default_value = "n";
+ }
+
+ print "Because HTTP_X_FORWARDED_* headers can be sent by the client and\n";
+ print "therefore possibly exploited by an outsider, SquirrelMail ignores\n";
+ print "them by default. If a proxy server or other machine sits between\n";
+ print "clients and your SquirrelMail server, you can turn this off to\n";
+ print "tell SquirrelMail to use such headers.\n";
+ print "\n";
+
+ print "Ignore HTTP_X_FORWARDED headers? (y/n) [$WHT$default_value$NRM]: $WHT";
+ $sq_ignore_http_x_forwarded_headers = <STDIN>;
+ if ( ( $sq_ignore_http_x_forwarded_headers =~ /^y\n/i ) || ( ( $sq_ignore_http_x_forwarded_headers =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
+ $sq_ignore_http_x_forwarded_headers = 'true';
+ } else {
+ $sq_ignore_http_x_forwarded_headers = 'false';
+ }
+ return $sq_ignore_http_x_forwarded_headers;
+}
+