+while (($command ne "q") && ($command ne "Q")) {
+ system "clear";
+ if ($menu == 0) {
+ print $WHT."SquirrelMail Configuration Utility\n".$NRM;
+ 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 "\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 : $WHT$useSendmail$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 "\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. List Special Folders First : $WHT$list_special_folders_first$NRM\n";
+ print "6. Show Special Folders Color : $WHT$use_special_folder_color$NRM\n";
+ print "7. By default, move to trash : $WHT$default_move_to_trash$NRM\n";
+ print "8. Auto Expunge : $WHT$auto_expunge$NRM\n";
+ print "9. Default Sub. of INBOX : $WHT$default_sub_of_inbox$NRM\n";
+ print "10. Show 'Contain Sub.' Option : $WHT$show_contain_subfolders_option$NRM\n";
+ print "11. Special Folders > $WHT$special_folders[0]$NRM\n";
+ for ($count = 1; $count <= $#special_folders; $count++) {
+ print " > $WHT$special_folders[$count]$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. Auto Forward : $WHT$auto_forward$NRM\n";
+ print "3. Data Directory : $WHT$data_dir$NRM\n";
+ print "4. Attachment Directory : $WHT$attachment_dir$NRM\n";
+ print "5. 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 "\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";
+ }
+ 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 ();
+ }
+ } else {
+ $saved = 0;
+ if ($menu == 0) {
+ if (($command > 0) && ($command < 8)) {
+ $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 ($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) { $list_special_folders_first = command25 (); }
+ elsif ($command == 6) { $use_special_folder_color = command26 (); }
+ elsif ($command == 7) { $default_move_to_trash = command27 (); }
+ elsif ($command == 8) { $auto_expunge = command28 (); }
+ elsif ($command == 9) { $default_sub_of_inbox = command29 (); }
+ elsif ($command == 10){ $show_contain_subfolders_option = command210(); }
+ elsif ($command == 11){ $special_folders = command211(); }
+ } elsif ($menu == 4) {
+ if ($command == 1) { $default_charset = command31 (); }
+ elsif ($command == 2) { $auto_forward = command32 (); }
+ elsif ($command == 3) { $data_dir = command33 (); }
+ elsif ($command == 4) { $attachment_dir = command34 (); }
+ elsif ($command == 5) { $default_left_size = command35 (); }
+ } elsif ($menu == 5) {
+ if ($command == 1) {
+ command41 ();
+ }
+ } elsif ($menu == 6) {
+ } elsif ($menu == 7) {
+ if ($command == 1) { $motd = command71 (); $motd =~ s/"/\\"/g;}
+ }
+ }