if ( !$edit_name ) {
$edit_name = "true";
}
+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 $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(); }
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;
+ }
+ print "Height: [$WHT$org_logo_height$NRM]: $WHT";
+ $new_org_logo_height = <STDIN>;
+ $new_org_logo_height =~ tr/0-9//cd; # only want digits!
+ unless ( $new_org_logo_height > 0 ) {
+ $new_org_logo_height = $org_logo_height;
+ }
+ 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";
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" ) ) {
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_logo = '$org_logo';\n";
print CF "\$org_title = \"$org_title\";\n";
print CF "\$signout_page = '$signout_page';\n";
print CF "\$frame_top = '$frame_top';\n";
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";