if ( !$edit_name ) {
$edit_name = "true";
}
+if ( !$allow_thread_sort ) {
+ $allow_thread_sort = 'false';
+}
+if ( !$allow_server_sort ) {
+ $allow_server_sort = 'false';
+}
+if ( !$prefs_user_field ) {
+ $prefs_user_field = 'user';
+}
+if ( !$prefs_key_field ) {
+ $prefs_key_field = 'prefkey';
+}
+if ( !$prefs_val_field ) {
+ $prefs_val_field = 'prefval';
+}
if ( $ARGV[0] eq '--install-plugin' ) {
print "Activating plugin " . $ARGV[1] . "\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 "4. Signout Page : $WHT$signout_page$NRM\n";
- print "5. Default Language : $WHT$squirrelmail_default_language$NRM\n";
- print "6. Top Frame : $WHT$frame_top$NRM\n";
+ 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 "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 "9. Server : $WHT$imap_server_type$NRM\n";
- print "10. Invert Time : $WHT$invert_time$NRM\n";
- print "11. Delimiter : $WHT$optional_delimiter$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 "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 "11. Allow editing of name : $WHT$edit_name$NRM\n";
+ print "13. Allow editing of name : $WHT$edit_name$NRM\n";
}
print "\n";
print "R Return to Main Menu\n";
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 "S Save data\n";
print "R Return to Main Menu\n";
} elsif ( $menu == 1 ) {
if ( $command == 1 ) { $org_name = command1(); }
elsif ( $command == 2 ) { $org_logo = command2(); }
- elsif ( $command == 3 ) { $org_title = command3(); }
- elsif ( $command == 4 ) { $signout_page = command4(); }
- elsif ( $command == 5 ) { $squirrelmail_default_language = command5(); }
- elsif ( $command == 6 ) { $frame_top = command6(); }
+ 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 == 6 ) { $smtpServerAddress = command16(); }
elsif ( $command == 7 ) { $smtpPort = command17(); }
elsif ( $command == 8 ) { $use_authenticated_smtp = command18(); }
- elsif ( $command == 9 ) { $imap_server_type = command19(); }
- elsif ( $command == 10 ) { $invert_time = command110(); }
- elsif ( $command == 11 ) { $optional_delimiter = command111(); }
+ 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 == 8 ) { $hide_sm_attributions = command38(); }
elsif ( $command == 9 ) { $default_use_mdn = command39(); }
elsif ( $command == 10 ) { $edit_identity = command310(); }
- elsif ( $command == 11 ) { $edit_name = command311(); }
+ elsif ( $command == 11 ) { $allow_thread_sort = command312(); }
+ elsif ( $command == 12 ) { $allow_server_sort = command313(); }
+ elsif ( $command == 13 ) { $edit_name = command311(); }
} elsif ( $menu == 5 ) {
if ( $command == 1 ) { command41(); }
elsif ( $command == 2 ) { $theme_css = command42(); }
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(); }
+ 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(); }
}
}
}
return $new_org_logo;
}
+# org_logo_width
+sub command2a {
+ print "Your organization's logo is an image that will be displayed at\n";
+ print "different times throughout SquirrelMail. Width\n";
+ print "and Height of your logo image. Use '0' to disable.\n";
+ print "\n";
+ print "Width: [$WHT$org_logo_width$NRM]: $WHT";
+ $new_org_logo_width = <STDIN>;
+ $new_org_logo_width =~ tr/0-9//cd; # only want digits!
+ if ( $new_org_logo_width eq '' ) {
+ $new_org_logo_width = $org_logo_width;
+ }
+ if ( $new_org_logo_width > 0 ) {
+ print "Height: [$WHT$org_logo_height$NRM]: $WHT";
+ $new_org_logo_height = <STDIN>;
+ $new_org_logo_height =~ tr/0-9//cd; # only want digits!
+ if( $new_org_logo_height eq '' ) {
+ $new_org_logo_height = $org_logo_height;
+ }
+ } else {
+ $new_org_logo_height = 0;
+ }
+ return ($new_org_logo_width, $new_org_logo_height);
+}
+
# org_title
sub command3 {
print "A title is what is displayed at the top of the browser window in\n";
return $use_authenticated_smtp;
}
+# pop before SMTP
+sub command18a {
+ print "Do you wish to use POP3 before SMTP? Your server must\n";
+ print "support this in order for SquirrelMail to work with it.\n";
+
+ $YesNo = 'n';
+ $YesNo = 'y' if ( lc($pop_before_smtp) eq "true" );
+
+ print "Use pop before SMTP (y/n) [$WHT$YesNo$NRM]: $WHT";
+
+ $new_pop_before_smtp = <STDIN>;
+ $new_pop_before_smtp =~ tr/yn//cd;
+ return "true" if ( $new_pop_before_smtp eq "y" );
+ return "false" if ( $new_pop_before_smtp eq "n" );
+ return $pop_before_smtp;
+}
+
# imap_server_type
sub command19 {
print "Each IMAP server has its own quirks. As much as we tried to stick\n";
# sanitize the plugin
$dir = $unused_plugins[$ct];
- `./ri_once.pl ../plugins/$dir`;
+ if (-d "../plugins/$dir") {
+ `./ri_once.pl ../plugins/$dir`;
+ } else {
+ print "Could not locate ../plugins/$dir\n" ;
+ print "The plugin $dir could *not* be sanitized!\n" ;
+ print "If you want to try to do this manually, please run\n" ;
+ print "config/ri_once.pl with the full path to the $dir plugin.\n" ;
+ }
}
$ct++;
}
if ( $new_default_folder_prefix eq "\n" ) {
$new_default_folder_prefix = $default_folder_prefix;
} else {
- $new_default_folder_prefix =~ s/[\r|\n]//g;
+ $new_default_folder_prefix =~ s/[\r\n]//g;
}
- if ( ( $new_default_folder_prefix =~ /^\s*$/ ) || ( $new_default_folder_prefix =~ /none/i ) ) {
+ if ( ( $new_default_folder_prefix =~ /^\s*$/ ) || ( $new_default_folder_prefix =~ m/^none$/i ) ) {
$new_default_folder_prefix = "";
} else {
- $new_default_folder_prefix =~ s/\/*$//g;
- $new_default_folder_prefix =~ s/$/\//g;
+ # add the trailing delimiter only if we know what the server is.
+ if ($optional_delimiter and $optional_delimiter ne 'detect') {
+ $new_default_folder_prefix =~ s/${optional_delimiter}*$/$optional_delimiter/;
+ } elsif ($imap_server_type eq 'cyrus' or
+ $imap_server_type eq 'courier') {
+ $new_default_folder_prefix =~ s/\.*$/\./;
+ } elsif ($imap_server_type eq 'uw') {
+ $new_default_folder_prefix =~ s/\/*$/\//;
+ }
}
return $new_default_folder_prefix;
}
return $edit_name;
}
+sub command312 {
+ print "This option allows you to choose if users can use thread sorting\n";
+ print "Your IMAP server must support the THREAD command for this to work\n";
+ print "PHP versions later than 4.0.3 recommended\n";
+ print "\n";
+
+ if ( lc($allow_thread_sort) eq "true" ) {
+ $default_value = "y";
+ } else {
+ $default_value = "n";
+ }
+ print "Allow server side thread sorting? (y/n) [$WHT$default_value$NRM]: $WHT";
+ $allow_thread_sort = <STDIN>;
+ if ( ( $allow_thread_sort =~ /^y\n/i ) || ( ( $allow_thread_sort =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
+ $allow_thread_sort = "true";
+ } else {
+ $allow_thread_sort = "false";
+ }
+ return $allow_thread_sort;
+}
+
+sub command313 {
+ print "This option allows you to choose if SM uses server-side sorting\n";
+ print "Your IMAP server must support the SORT command for this to work\n";
+ print "\n";
+
+ if ( lc($allow_server_sort) eq "true" ) {
+ $default_value = "y";
+ } else {
+ $default_value = "n";
+ }
+ print "Allow server-side sorting? (y/n) [$WHT$default_value$NRM]: $WHT";
+ $allow_server_sort = <STDIN>;
+ if ( ( $allow_server_sort =~ /^y\n/i ) || ( ( $allow_server_sort =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
+ $allow_server_sort = "true";
+ } else {
+ $allow_server_sort = "false";
+ }
+ return $allow_server_sort;
+}
+
sub command41 {
print "\nNow we will define the themes that you wish to use. If you have added\n";
print "a theme of your own, just follow the instructions (?) about how to add\n";
sub command94 {
print "This is the name of the table you want to store the preferences\n";
- print "data in, it defaults to 'address'\n";
+ print "data in, it defaults to 'userprefs'\n";
print "\n";
print "[$WHT$prefs_table$NRM]: $WHT";
$new_table = <STDIN>;
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;
+ }
+ 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;
+ }
+ 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;
+ }
+ return $new_field;
+}
+
sub save_data {
$tab = " ";
if ( open( CF, ">config.php" ) ) {
if ($print_config_version) {
print CF "\$config_version = '$print_config_version';\n";
}
- print CF "\$config_use_color = $config_use_color;\n";
+ print CF "\$config_use_color = '$config_use_color';\n";
print CF "\n";
- print CF "\$org_name = \"$org_name\";\n";
+ print CF "\$org_name = '$org_name';\n";
print CF "\$org_logo = '$org_logo';\n";
+ $org_logo_width |= 0;
+ $org_logo_height |= 0;
+ print CF "\$org_logo_width = '$org_logo_width';\n";
+ print CF "\$org_logo_height = '$org_logo_height';\n";
print CF "\$org_title = \"$org_title\";\n";
print CF "\$signout_page = '$signout_page';\n";
print CF "\$frame_top = '$frame_top';\n";
print CF "\$domain = '$domain';\n";
print CF "\$imapServerAddress = '$imapServerAddress';\n";
- print CF "\$imapPort = $imapPort;\n";
- print CF "\$useSendmail = $useSendmail;\n";
+ print CF "\$imapPort = '$imapPort';\n";
+ print CF "\$useSendmail = '$useSendmail';\n";
print CF "\$smtpServerAddress = '$smtpServerAddress';\n";
- print CF "\$smtpPort = $smtpPort;\n";
+ print CF "\$smtpPort = '$smtpPort';\n";
print CF "\$sendmail_path = '$sendmail_path';\n";
- print CF "\$use_authenticated_smtp = $use_authenticated_smtp;\n";
+ print CF "\$use_authenticated_smtp = '$use_authenticated_smtp';\n";
+ print CF "\$pop_before_smtp = '$pop_before_smtp';\n";
print CF "\$imap_server_type = '$imap_server_type';\n";
print CF "\$invert_time = $invert_time;\n";
print CF "\$optional_delimiter = '$optional_delimiter';\n";
print CF "\$trash_folder = '$trash_folder';\n";
print CF "\$sent_folder = '$sent_folder';\n";
print CF "\$draft_folder = '$draft_folder';\n";
- print CF "\$default_move_to_trash = $default_move_to_trash;\n";
- print CF "\$default_move_to_sent = $default_move_to_sent;\n";
- print CF "\$default_save_as_draft = $default_save_as_draft;\n";
- print CF "\$show_prefix_option = $show_prefix_option;\n";
- print CF "\$list_special_folders_first = $list_special_folders_first;\n";
- print CF "\$use_special_folder_color = $use_special_folder_color;\n";
- print CF "\$auto_expunge = $auto_expunge;\n";
- print CF "\$default_sub_of_inbox = $default_sub_of_inbox;\n";
- print CF "\$show_contain_subfolders_option = $show_contain_subfolders_option;\n";
- print CF "\$default_unseen_notify = $default_unseen_notify;\n";
- print CF "\$default_unseen_type = $default_unseen_type;\n";
- print CF "\$auto_create_special = $auto_create_special;\n";
- print CF "\$delete_folder = $delete_folder;\n";
+ print CF "\$default_move_to_trash = '$default_move_to_trash';\n";
+ print CF "\$default_move_to_sent = '$default_move_to_sent';\n";
+ print CF "\$default_save_as_draft = '$default_save_as_draft';\n";
+ print CF "\$show_prefix_option = '$show_prefix_option';\n";
+ print CF "\$list_special_folders_first = '$list_special_folders_first';\n";
+ print CF "\$use_special_folder_color = '$use_special_folder_color';\n";
+ print CF "\$auto_expunge = '$auto_expunge';\n";
+ print CF "\$default_sub_of_inbox = '$default_sub_of_inbox';\n";
+ print CF "\$show_contain_subfolders_option = '$show_contain_subfolders_option';\n";
+ print CF "\$default_unseen_notify = '$default_unseen_notify';\n";
+ print CF "\$default_unseen_type = '$default_unseen_type';\n";
+ print CF "\$auto_create_special = '$auto_create_special';\n";
+ print CF "\$delete_folder = '$delete_folder';\n";
print CF "\n";
print CF "\$default_charset = '$default_charset';\n";
print CF "\$data_dir = '$data_dir';\n";
print CF "\$attachment_dir = \"$attachment_dir\";\n";
- print CF "\$dir_hash_level = $dir_hash_level;\n";
- print CF "\$default_left_size = $default_left_size;\n";
- print CF "\$force_username_lowercase = $force_username_lowercase;\n";
- print CF "\$default_use_priority = $default_use_priority;\n";
- print CF "\$hide_sm_attributions = $hide_sm_attributions;\n";
- print CF "\$default_use_mdn = $default_use_mdn;\n";
- print CF "\$edit_identity = $edit_identity;\n";
- print CF "\$edit_name = $edit_name;\n";
+ print CF "\$dir_hash_level = '$dir_hash_level';\n";
+ print CF "\$default_left_size = '$default_left_size';\n";
+ print CF "\$force_username_lowercase = '$force_username_lowercase';\n";
+ print CF "\$default_use_priority = '$default_use_priority';\n";
+ print CF "\$hide_sm_attributions = '$hide_sm_attributions';\n";
+ print CF "\$default_use_mdn = '$default_use_mdn';\n";
+ print CF "\$edit_identity = '$edit_identity';\n";
+ print CF "\$edit_name = '$edit_name';\n";
+ print CF "\$allow_thread_sort = '$allow_thread_sort';\n";
+ print CF "\$allow_server_sort = '$allow_server_sort';\n";
print CF "\n";
for ( $ct = 0 ; $ct <= $#plugins ; $ct++ ) {
print CF "\$addrbook_dsn = '$addrbook_dsn';\n";
print CF "\$addrbook_table = '$addrbook_table';\n\n";
print CF "\$prefs_dsn = '$prefs_dsn';\n";
- print CF "\$prefs_table = '$prefs_table';\n\n";
+ print CF "\$prefs_table = '$prefs_table';\n";
+ print CF "\$prefs_user_field = '$prefs_user_field';\n";
+ print CF "\$prefs_key_field = '$prefs_key_field';\n";
+ print CF "\$prefs_val_field = '$prefs_val_field';\n";
+ print CF "\n";
print CF "/**\n";
print CF " * Make sure there are no characters after the PHP closing\n";