-while (($command ne "q") && ($command ne "Q")) {
- system "clear";
- print $WHT."SquirrelMail Configuration : ".$NRM;
- if ($config == 1) { print "Read: config.php"; }
- elsif ($config == 2) { print "Read: config_default.php"; }
- print "\n";
- print "---------------------------------------------------------\n";
-
- if ($menu == 0) {
- print $WHT."Main Menu --\n".$NRM;
- print "1. Organization Preferences\n";
- print "2. Server Settings\n";
- print "3. Folder Defaults\n";
- print "4. General Options\n";
- print "5. Themes\n";
- print "6. Address Books (LDAP)\n";
- print "7. Message of the Day (MOTD)\n";
- print "8. Plugins\n";
- print "\n";
- print "D. Set pre-defined settings for specific IMAP servers\n";
- print "\n";
- } elsif ($menu == 1) {
- print $WHT."Organization Preferences\n".$NRM;
- print "1. Organization Name : $WHT$org_name$NRM\n";
- print "2. Organization Logo : $WHT$org_logo$NRM\n";
- print "3. Organization Title : $WHT$org_title$NRM\n";
- print "\n";
- print "R Return to Main Menu\n";
- } elsif ($menu == 2) {
- print $WHT."Server Settings\n".$NRM;
- print "1. Domain : $WHT$domain$NRM\n";
- print "2. IMAP Server : $WHT$imapServerAddress$NRM\n";
- print "3. IMAP Port : $WHT$imapPort$NRM\n";
- print "4. Use Sendmail/SMTP : $WHT";
- if ($useSendmail eq "true") {
- print "Sendmail";
- } else {
- print "SMTP";
- }
- print "$NRM\n";
- if ($useSendmail eq "true") {
- print "5. Sendmail Path : $WHT$sendmail_path$NRM\n";
- } else {
- print "6. SMTP Server : $WHT$smtpServerAddress$NRM\n";
- print "7. SMTP Port : $WHT$smtpPort$NRM\n";
- }
- print "8. Server : $WHT$imap_server_type$NRM\n";
- print "\n";
- print "R Return to Main Menu\n";
- } elsif ($menu == 3) {
- print $WHT."Folder Defaults\n".$NRM;
- print "1. Default Folder Prefix : $WHT$default_folder_prefix$NRM\n";
- print "2. Show Folder Prefix Option : $WHT$show_prefix_option$NRM\n";
- print "3. Trash Folder : $WHT$trash_folder$NRM\n";
- print "4. Sent Folder : $WHT$sent_folder$NRM\n";
- print "5. By default, move to trash : $WHT$default_move_to_trash$NRM\n";
- print "6. By default, move to sent : $WHT$default_move_to_sent$NRM\n";
- print "7. List Special Folders First : $WHT$list_special_folders_first$NRM\n";
- print "8. Show Special Folders Color : $WHT$use_special_folder_color$NRM\n";
- print "9. Auto Expunge : $WHT$auto_expunge$NRM\n";
- print "10. Default Sub. of INBOX : $WHT$default_sub_of_inbox$NRM\n";
- print "11. Show 'Contain Sub.' Option : $WHT$show_contain_subfolders_option$NRM\n";
- print "12. Default Unseen Notify : $WHT$default_unseen_notify$NRM\n";
- print "13. Default Unseen Type : $WHT$default_unseen_type$NRM\n";
- print "\n";
- print "R Return to Main Menu\n";
- } elsif ($menu == 4) {
- print $WHT."General Options\n".$NRM;
- print "1. Default Charset : $WHT$default_charset$NRM\n";
- print "2. Data Directory : $WHT$data_dir$NRM\n";
- print "3. Attachment Directory : $WHT$attachment_dir$NRM\n";
- print "4. Default Left Size : $WHT$default_left_size$NRM\n";
- print "\n";
- print "R Return to Main Menu\n";
- } elsif ($menu == 5) {
- print $WHT."Themes\n".$NRM;
- print "1. Change Themes\n";
- for ($count = 0; $count <= $#theme_name; $count++) {
- print " > $theme_name[$count]\n";
- }
- print "\n";
- print "R Return to Main Menu\n";
- } elsif ($menu == 6) {
- print $WHT."Address Books (LDAP)\n".$NRM;
- print "1. Change Servers\n";
- for ($count = 0; $count <= $#ldap_host; $count++) {
- print " > $ldap_host[$count]\n";
- }
- print "2. Use Javascript Address Book Search : $WHT$default_use_javascript_addr_book$NRM\n";
- print "\n";
- print "R Return to Main Menu\n";
- } elsif ($menu == 7) {
- print $WHT."Message of the Day (MOTD)\n".$NRM;
- print "\n$motd\n";
- print "\n";
- print "1 Edit the MOTD\n";
- print "\n";
- print "R Return to Main Menu\n";
- } elsif ($menu == 8) {
- print $WHT."Plugins\n".$NRM;
- print "1 Change Plugins\n";
- for ($count = 0; $count <= $#plugins; $count++) {
- print " > $plugins[$count]\n";
- }
- print "\n";
- print "R Return to Main Menu\n";
- }
- print "S Save data\n";
- print "Q Quit\n";
-
- print "\n";
- print "Command >> ".$WHT;
- $command = <STDIN>;
- $command =~ s/[\n|\r]//g;
- print "$NRM\n";
-
- # Read the commands they entered.
- if (($command eq "R") || ($command eq "r")) {
- $menu = 0;
- } elsif (($command eq "s") || ($command eq "S")) {
- save_data ();
- print "Data saved in config.php\n";
- print "Press any key to continue...";
- $tmp = <STDIN>;
- $saved = 1;
- } elsif ((($command eq "q") || ($command eq "Q")) && ($saved == 0)) {
- print "You have not saved your data.\n";
- print "Save? (y/n) [".$WHT."y".$NRM."]: ";
- $save = <STDIN>;
- if (($save =~ /^y/i) || ($save =~ /^\s*$/)) {
- save_data ();
- }
- } elsif (($command eq "d") || ($command eq "D")) {
- set_defaults ();
- } else {
- $saved = 0;
- if ($menu == 0) {
- if (($command > 0) && ($command < 9)) {
- $menu = $command;
- }
- } elsif ($menu == 1) {
- if ($command == 1) { $org_name = command1 (); }
- elsif ($command == 2) { $org_logo = command2 (); }
- elsif ($command == 3) { $org_title = command3 (); }
- } elsif ($menu == 2) {
- if ($command == 1) { $domain = command11 (); }
- elsif ($command == 2) { $imapServerAddress = command12 (); }
- elsif ($command == 3) { $imapPort = command13 (); }
- elsif ($command == 4) { $useSendmail = command14 (); }
- elsif ($command == 5) { $sendmail_path = command15 (); }
- elsif ($command == 6) { $smtpServerAddress = command16 (); }
- elsif ($command == 7) { $smtpPort = command17 (); }
- elsif ($command == 8) { $imap_server_type = command18 (); }
- } elsif ($menu == 3) {
- if ($command == 1) { $default_folder_prefix = command21 (); }
- elsif ($command == 2) { $show_prefix_option = command22 (); }
- elsif ($command == 3) { $trash_folder = command23 (); }
- elsif ($command == 4) { $sent_folder = command24 (); }
- elsif ($command == 5) { $default_move_to_trash = command25 (); }
- elsif ($command == 6) { $default_move_to_sent = command26 (); }
- elsif ($command == 7) { $list_special_folders_first = command27 (); }
- elsif ($command == 8) { $use_special_folder_color = command28 (); }
- elsif ($command == 9) { $auto_expunge = command29 (); }
- elsif ($command == 10){ $default_sub_of_inbox = command210(); }
- elsif ($command == 11){ $show_contain_subfolders_option = command211(); }
- elsif ($command == 12){ $default_unseen_notify = command212(); }
- elsif ($command == 13){ $default_unseen_type = command213(); }
- } elsif ($menu == 4) {
- if ($command == 1) { $default_charset = command31 (); }
- elsif ($command == 2) { $data_dir = command33 (); }
- elsif ($command == 3) { $attachment_dir = command34 (); }
- elsif ($command == 4) { $default_left_size = command35 (); }
- } elsif ($menu == 5) {
- if ($command == 1) {
- command41 ();
- }
- } elsif ($menu == 6) {
- if ($command == 1) { command61(); }
- elsif ($command == 2) { command62(); }
- } elsif ($menu == 7) {
- if ($command == 1) { $motd = command71(); }
- } elsif ($menu == 8) {
- if ($command == 1) { $plugins = command81(); }
- }
- }
+while ( ( $command ne "q" ) && ( $command ne "Q" ) ) {
+ system "clear";
+ print $WHT. "SquirrelMail Configuration : " . $NRM;
+ if ( $config == 1 ) { print "Read: config.php"; }
+ elsif ( $config == 2 ) { print "Read: config_default.php"; }
+ print " ($print_config_version)\n";
+ print "---------------------------------------------------------\n";
+
+ if ( $menu == 0 ) {
+ print $WHT. "Main Menu --\n" . $NRM;
+ print "1. Organization Preferences\n";
+ print "2. Server Settings\n";
+ print "3. Folder Defaults\n";
+ print "4. General Options\n";
+ print "5. Themes\n";
+ print "6. Address Books (LDAP)\n";
+ print "7. Message of the Day (MOTD)\n";
+ print "8. Plugins\n";
+ print "9. Database\n";
+ print "\n";
+ print "D. Set pre-defined settings for specific IMAP servers\n";
+ print "\n";
+ } elsif ( $menu == 1 ) {
+ print $WHT. "Organization Preferences\n" . $NRM;
+ print "1. Organization Name : $WHT$org_name$NRM\n";
+ print "2. Organization Logo : $WHT$org_logo$NRM\n";
+ print "3. Org. Logo Width/Height : $WHT($org_logo_width/$org_logo_height)$NRM\n";
+ print "4. Organization Title : $WHT$org_title$NRM\n";
+ print "5. Signout Page : $WHT$signout_page$NRM\n";
+ print "6. Default Language : $WHT$squirrelmail_default_language$NRM\n";
+ print "7. Top Frame : $WHT$frame_top$NRM\n";
+ print "\n";
+ print "R Return to Main Menu\n";
+ } elsif ( $menu == 2 ) {
+ print $WHT. "Server Settings\n" . $NRM;
+ print "1. Domain : $WHT$domain$NRM\n";
+ print "2. IMAP Server : $WHT$imapServerAddress$NRM\n";
+ print "3. IMAP Port : $WHT$imapPort$NRM\n";
+ print "4. Use Sendmail/SMTP : $WHT";
+ if ( lc($useSendmail) eq "true" ) {
+ print "Sendmail";
+ } else {
+ print "SMTP";
+ }
+ print "$NRM\n";
+ if ( lc($useSendmail) eq "true" ) {
+ print "5. Sendmail Path : $WHT$sendmail_path$NRM\n";
+ } else {
+ print "6. SMTP Server : $WHT$smtpServerAddress$NRM\n";
+ print "7. SMTP Port : $WHT$smtpPort$NRM\n";
+ print "8. Authenticated SMTP : $WHT$use_authenticated_smtp$NRM\n";
+ print "9. POP Before SMTP : $WHT$pop_before_smtp$NRM\n";
+ }
+ print "10. Server : $WHT$imap_server_type$NRM\n";
+ print "11. Invert Time : $WHT$invert_time$NRM\n";
+ print "12. Delimiter : $WHT$optional_delimiter$NRM\n";
+ print "\n";
+ print "R Return to Main Menu\n";
+ } elsif ( $menu == 3 ) {
+ print $WHT. "Folder Defaults\n" . $NRM;
+ print "1. Default Folder Prefix : $WHT$default_folder_prefix$NRM\n";
+ print "2. Show Folder Prefix Option : $WHT$show_prefix_option$NRM\n";
+ print "3. Trash Folder : $WHT$trash_folder$NRM\n";
+ print "4. Sent Folder : $WHT$sent_folder$NRM\n";
+ print "5. Drafts Folder : $WHT$draft_folder$NRM\n";
+ print "6. By default, move to trash : $WHT$default_move_to_trash$NRM\n";
+ print "7. By default, move to sent : $WHT$default_move_to_sent$NRM\n";
+ print "8. By default, save as draft : $WHT$default_save_as_draft$NRM\n";
+ print "9. List Special Folders First : $WHT$list_special_folders_first$NRM\n";
+ print "10. Show Special Folders Color : $WHT$use_special_folder_color$NRM\n";
+ print "11. Auto Expunge : $WHT$auto_expunge$NRM\n";
+ print "12. Default Sub. of INBOX : $WHT$default_sub_of_inbox$NRM\n";
+ print "13. Show 'Contain Sub.' Option : $WHT$show_contain_subfolders_option$NRM\n";
+ print "14. Default Unseen Notify : $WHT$default_unseen_notify$NRM\n";
+ print "15. Default Unseen Type : $WHT$default_unseen_type$NRM\n";
+ print "16. Auto Create Special Folders : $WHT$auto_create_special$NRM\n";
+ print "17. Don't move folders into Trash : $WHT$delete_folder$NRM\n";
+ print "18. Enable /NoSelect folder fix : $WHT$noselect_fix_enable$NRM\n";
+ print "\n";
+ print "R Return to Main Menu\n";
+ } elsif ( $menu == 4 ) {
+ print $WHT. "General Options\n" . $NRM;
+ print "1. Default Charset : $WHT$default_charset$NRM\n";
+ print "2. Data Directory : $WHT$data_dir$NRM\n";
+ print "3. Attachment Directory : $WHT$attachment_dir$NRM\n";
+ print "4. Directory Hash Level : $WHT$dir_hash_level$NRM\n";
+ print "5. Default Left Size : $WHT$default_left_size$NRM\n";
+ print "6. Usernames in Lowercase : $WHT$force_username_lowercase$NRM\n";
+ print "7. Allow use of priority : $WHT$default_use_priority$NRM\n";
+ print "8. Hide SM attributions : $WHT$hide_sm_attributions$NRM\n";
+ print "9. Allow use of receipts : $WHT$default_use_mdn$NRM\n";
+ print "10. Allow editing of identity : $WHT$edit_identity$NRM\n";
+ print "11. Allow server thread sort : $WHT$allow_thread_sort$NRM\n";
+ print "12. Allow server-side sorting : $WHT$allow_server_sort$NRM\n";
+ if ( lc($edit_identity) eq "false" ) {
+ print "13. Allow editing of name : $WHT$edit_name$NRM\n";
+ }
+ print "14. Allow server charset search : $WHT$allow_charset_search$NRM\n";
+ print "15. Enable UID support : $WHT$uid_support$NRM\n";
+ print "\n";
+ print "R Return to Main Menu\n";
+ } elsif ( $menu == 5 ) {
+ print $WHT. "Themes\n" . $NRM;
+ print "1. Change Themes\n";
+ for ( $count = 0 ; $count <= $#theme_name ; $count++ ) {
+ print " > $theme_name[$count]\n";
+ }
+ print "2. CSS File : $WHT$theme_css$NRM\n";
+ print "\n";
+ print "R Return to Main Menu\n";
+ } elsif ( $menu == 6 ) {
+ print $WHT. "Address Books (LDAP)\n" . $NRM;
+ print "1. Change Servers\n";
+ for ( $count = 0 ; $count <= $#ldap_host ; $count++ ) {
+ print " > $ldap_host[$count]\n";
+ }
+ print
+ "2. Use Javascript Address Book Search : $WHT$default_use_javascript_addr_book$NRM\n";
+ print "\n";
+ print "R Return to Main Menu\n";
+ } elsif ( $menu == 7 ) {
+ print $WHT. "Message of the Day (MOTD)\n" . $NRM;
+ print "\n$motd\n";
+ print "\n";
+ print "1 Edit the MOTD\n";
+ print "\n";
+ print "R Return to Main Menu\n";
+ } elsif ( $menu == 8 ) {
+ print $WHT. "Plugins\n" . $NRM;
+ print " Installed Plugins\n";
+ $num = 0;
+ for ( $count = 0 ; $count <= $#plugins ; $count++ ) {
+ $num = $count + 1;
+ print " $num. $plugins[$count]\n";
+ }
+ print "\n Available Plugins:\n";
+ opendir( DIR, "../plugins" );
+ @files = readdir(DIR);
+ $pos = 0;
+ @unused_plugins = ();
+ for ( $i = 0 ; $i <= $#files ; $i++ ) {
+ if ( -d "../plugins/" . $files[$i] && $files[$i] !~ /^\./ && $files[$i] ne "CVS" ) {
+ $match = 0;
+ for ( $k = 0 ; $k <= $#plugins ; $k++ ) {
+ if ( $plugins[$k] eq $files[$i] ) {
+ $match = 1;
+ }
+ }
+ if ( $match == 0 ) {
+ $unused_plugins[$pos] = $files[$i];
+ $pos++;
+ }
+ }
+ }
+
+ for ( $i = 0 ; $i <= $#unused_plugins ; $i++ ) {
+ $num = $num + 1;
+ print " $num. $unused_plugins[$i]\n";
+ }
+ closedir DIR;
+
+ print "\n";
+ print "A Sanitize all plugins for use with Squirrelmail 1.2\n";
+ print "\n";
+ print "R Return to Main Menu\n";
+ } elsif ( $menu == 9 ) {
+ print $WHT. "Database\n" . $NRM;
+ print "1. DSN for Address Book : $WHT$addrbook_dsn$NRM\n";
+ print "2. Table for Address Book : $WHT$addrbook_table$NRM\n";
+ 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 "\n";
+ print "R Return to Main Menu\n";
+ }
+ if ( $config_use_color == 1 ) {
+ print "C. Turn color off\n";
+ } else {
+ print "C. Turn color on\n";
+ }
+ print "S Save data\n";
+ print "Q Quit\n";
+
+ print "\n";
+ print "Command >> " . $WHT;
+ $command = <STDIN>;
+ $command =~ s/[\n|\r]//g;
+ $command =~ tr/A-Z/a-z/;
+ print "$NRM\n";
+
+ # Read the commands they entered.
+ if ( $command eq "r" ) {
+ $menu = 0;
+ } elsif ( $command eq "s" ) {
+ save_data();
+ print "Press enter to continue...";
+ $tmp = <STDIN>;
+ $saved = 1;
+ } elsif ( ( $command eq "q" ) && ( $saved == 0 ) ) {
+ print "You have not saved your data.\n";
+ print "Save? [" . $WHT . "Y" . $NRM . "/n]: ";
+ $save = <STDIN>;
+ if ( ( $save =~ /^y/i ) || ( $save =~ /^\s*$/ ) ) {
+ save_data();
+ }
+ } elsif ( $command eq "c" ) {
+ if ( $config_use_color == 1 ) {
+ $config_use_color = 2;
+ $WHT = "";
+ $NRM = "";
+ } else {
+ $config_use_color = 1;
+ $WHT = "\x1B[37;1m";
+ $NRM = "\x1B[0m";
+ }
+ } elsif ( $command eq "d" && $menu == 0 ) {
+ set_defaults();
+ } else {
+ $saved = 0;
+ if ( $menu == 0 ) {
+ if ( ( $command > 0 ) && ( $command < 10 ) ) {
+ $menu = $command;
+ }
+ } elsif ( $menu == 1 ) {
+ if ( $command == 1 ) { $org_name = command1(); }
+ elsif ( $command == 2 ) { $org_logo = command2(); }
+ elsif ( $command == 3 ) { ($org_logo_width,$org_logo_height) = command2a(); }
+ elsif ( $command == 4 ) { $org_title = command3(); }
+ elsif ( $command == 5 ) { $signout_page = command4(); }
+ elsif ( $command == 6 ) { $squirrelmail_default_language = command5(); }
+ elsif ( $command == 7 ) { $frame_top = command6(); }
+ } elsif ( $menu == 2 ) {
+ if ( $command == 1 ) { $domain = command11(); }
+ elsif ( $command == 2 ) { $imapServerAddress = command12(); }
+ elsif ( $command == 3 ) { $imapPort = command13(); }
+ elsif ( $command == 4 ) { $useSendmail = command14(); }
+ elsif ( $command == 5 ) { $sendmail_path = command15(); }
+ elsif ( $command == 6 ) { $smtpServerAddress = command16(); }
+ elsif ( $command == 7 ) { $smtpPort = command17(); }
+ elsif ( $command == 8 ) { $use_authenticated_smtp = command18(); }
+ elsif ( $command == 9 ) { $pop_before_smtp = command18a(); }
+ elsif ( $command == 10 ) { $imap_server_type = command19(); }
+ elsif ( $command == 11 ) { $invert_time = command110(); }
+ elsif ( $command == 12 ) { $optional_delimiter = command111(); }
+ } elsif ( $menu == 3 ) {
+ if ( $command == 1 ) { $default_folder_prefix = command21(); }
+ elsif ( $command == 2 ) { $show_prefix_option = command22(); }
+ elsif ( $command == 3 ) { $trash_folder = command23a(); }
+ elsif ( $command == 4 ) { $sent_folder = command23b(); }
+ elsif ( $command == 5 ) { $draft_folder = command23c(); }
+ elsif ( $command == 6 ) { $default_move_to_trash = command24a(); }
+ elsif ( $command == 7 ) { $default_move_to_sent = command24b(); }
+ elsif ( $command == 8 ) { $default_save_as_draft = command24c(); }
+ elsif ( $command == 9 ) { $list_special_folders_first = command27(); }
+ elsif ( $command == 10 ) { $use_special_folder_color = command28(); }
+ elsif ( $command == 11 ) { $auto_expunge = command29(); }
+ elsif ( $command == 12 ) { $default_sub_of_inbox = command210(); }
+ elsif ( $command == 13 ) { $show_contain_subfolders_option = command211(); }
+ elsif ( $command == 14 ) { $default_unseen_notify = command212(); }
+ elsif ( $command == 15 ) { $default_unseen_type = command213(); }
+ elsif ( $command == 16 ) { $auto_create_special = command214(); }
+ elsif ( $command == 17 ) { $delete_folder = command215(); }
+ elsif ( $command == 18 ) { $noselect_fix_enable = command216(); }
+ } elsif ( $menu == 4 ) {
+ if ( $command == 1 ) { $default_charset = command31(); }
+ elsif ( $command == 2 ) { $data_dir = command33a(); }
+ elsif ( $command == 3 ) { $attachment_dir = command33b(); }
+ elsif ( $command == 4 ) { $dir_hash_level = command33c(); }
+ elsif ( $command == 5 ) { $default_left_size = command35(); }
+ elsif ( $command == 6 ) { $force_username_lowercase = command36(); }
+ elsif ( $command == 7 ) { $default_use_priority = command37(); }
+ elsif ( $command == 8 ) { $hide_sm_attributions = command38(); }
+ elsif ( $command == 9 ) { $default_use_mdn = command39(); }
+ elsif ( $command == 10 ) { $edit_identity = command310(); }
+ elsif ( $command == 11 ) { $allow_thread_sort = command312(); }
+ elsif ( $command == 12 ) { $allow_server_sort = command313(); }
+ elsif ( $command == 13 ) { $edit_name = command311(); }
+ elsif ( $command == 14 ) { $allow_charset_search = command314(); }
+ elsif ( $command == 15 ) { $uid_support = command315(); }
+ } elsif ( $menu == 5 ) {
+ if ( $command == 1 ) { command41(); }
+ elsif ( $command == 2 ) { $theme_css = command42(); }
+ } elsif ( $menu == 6 ) {
+ if ( $command == 1 ) { command61(); }
+ elsif ( $command == 2 ) { command62(); }
+ } elsif ( $menu == 7 ) {
+ if ( $command == 1 ) { $motd = command71(); }
+ } elsif ( $menu == 8 ) {
+ if ( $command =~ /^[0-9]+/ ) { @plugins = command81(); }
+ elsif ( $command eq "a" ) { command8s(); }
+ } elsif ( $menu == 9 ) {
+ if ( $command == 1 ) { $addrbook_dsn = command91(); }
+ elsif ( $command == 2 ) { $addrbook_table = command92(); }
+ elsif ( $command == 3 ) { $prefs_dsn = command93(); }
+ elsif ( $command == 4 ) { $prefs_table = command94(); }
+ elsif ( $command == 5 ) { $prefs_user_field = command95(); }
+ elsif ( $command == 6 ) { $prefs_key_field = command96(); }
+ elsif ( $command == 7 ) { $prefs_val_field = command97(); }
+ }
+ }