$noselect_fix_enable = 'false' if ( !$noselect_fix_enable );
$frame_top = "_top" if ( !$frame_top );
$provider_uri = '' if ( !$provider_uri );
-$provider_name = '' if ( !$provider_name );
+$provider_name = '' if ( !$provider_name || $provider_name eq 'SquirrelMail');
$no_list_for_subscribe = 'false' if ( !$no_list_for_subscribe );
$allow_charset_search = 'true' if ( !$allow_charset_search );
$allow_advanced_search = 0 if ( !$allow_advanced_search) ;
$disable_plugins = 'false' if ( !$disable_plugins );
$disable_plugins_user = '' if ( !$disable_plugins_user );
$only_secure_cookies = 'true' if ( !$only_secure_cookies );
+$ask_user_info = 'true' if ( !$ask_user_info );
if ( $ARGV[0] eq '--install-plugin' ) {
print "Activating plugin " . $ARGV[1] . "\n";
print "5. Signout Page : $WHT$signout_page$NRM\n";
print "6. Top Frame : $WHT$frame_top$NRM\n";
print "7. Provider link : $WHT$provider_uri$NRM\n";
- print "8. Provider name : $WHT$provider_name$NRM\n";
+ print "8. Provider link text : $WHT$provider_name$NRM\n";
print "\n";
print "R Return to Main Menu\n";
$num = 0;
for ( $count = 0 ; $count <= $#plugins ; $count++ ) {
$num = $count + 1;
- print " $num. $plugins[$count]\n";
+ print " $num. $plugins[$count]" . get_plugin_version($plugins[$count]) . "\n";
}
print "\n Available Plugins:\n";
opendir( DIR, "../plugins" );
for ( $i = 0 ; $i <= $#unused_plugins ; $i++ ) {
$num = $num + 1;
- print " $num. $unused_plugins[$i]\n";
+ print " $num. $unused_plugins[$i]" . get_plugin_version($unused_plugins[$i]) . "\n";
}
closedir DIR;
} elsif ( $menu == 11 ) {
print $WHT. "Interface tweaks\n" . $NRM;
print "1. Display html mails in iframe : $WHT$use_iframe$NRM\n";
+ print "2. Ask user info on first login : $WHT$ask_user_info$NRM\n";
print "\n";
print $WHT. "PHP tweaks\n" . $NRM;
print "4. Use php recode functions : $WHT$use_php_recode$NRM\n";
elsif ( $command == 5 ) { $lossy_encoding = commandA5(); }
} elsif ( $menu == 11 ) {
if ( $command == 1 ) { $use_iframe = commandB2(); }
+ elsif ( $command == 2 ) { $ask_user_info = command_ask_user_info(); }
elsif ( $command == 4 ) { $use_php_recode = commandB4(); }
elsif ( $command == 5 ) { $use_php_iconv = commandB5(); }
elsif ( $command == 6 ) { $allow_remote_configtest = commandB6(); }
# Default link to provider
sub command7 {
- print "Here you can set the link on the right of the page.\n";
- print "If empty, it will link to the SquirrelMail About page.\n";
+ print "Here you can set the link on the top-right of the message list.\n";
+ print "If empty, it will not be displayed.\n";
print "\n";
print "[$WHT$provider_uri$NRM]: $WHT";
$new_provider_uri = <STDIN>;
}
sub command8 {
- print "Here you can set the name of the link on the right of the page.\n";
- print "The default is 'SquirrelMail'\n";
+ print "Here you can set the name of the link on the top-right of the message list.\n";
+ print "The default is empty (do not display anything).'\n";
print "\n";
print "[$WHT$provider_name$NRM]: $WHT";
$new_provider_name = <STDIN>;
if ( $new_provider_name eq "\n" ) {
- $new_provider_name = 'SquirrelMail';
+ $new_provider_name = '';
} else {
$new_provider_name =~ s/[\r\n]//g;
$new_provider_name =~ s/^\s+$//g;
print "";
print "\n";
- if ( lc($default_hide_attribution) eq 'true' ) {
+ if ( lc($hide_sm_attributions) eq 'true' ) {
$default_value = "y";
} else {
$default_value = "n";
}
return $use_iframe;
}
+
+# display html emails in iframe
+sub command_ask_user_info {
+ print "New users need to supply their real name and email address to\n";
+ print "send out proper mails. When this option is enabled, a user that\n";
+ print "logs in for the first time will be redirected to the Personal\n";
+ print "Options screen and asked to supply their personal data.\n";
+ print "\n";
+
+ if ( lc($ask_user_info) eq 'true' ) {
+ $default_value = "y";
+ } else {
+ $default_value = "n";
+ }
+ print "Ask user info? (y/n) [$WHT$default_value$NRM]: $WHT";
+ $ask_user_info = <STDIN>;
+ if ( ( $ask_user_info =~ /^y\n/i ) || ( ( $ask_user_info =~ /^\n/ ) && ( $default_value eq "y" ) ) ) {
+ $ask_user_info = 'true';
+ } else {
+ $ask_user_info = 'false';
+ }
+ return $ask_user_info;
+}
+
# use icons
sub commandB3 {
print "Enabling this option will cause icons to be used instead of text\n";
# boolean
print CF "\$use_iframe = $use_iframe;\n";
- print CF "\n";
+ # boolean
+ print CF "\$ask_user_info = $ask_user_info;\n";
# boolean
print CF "\$use_icons = $use_icons;\n";
print CF "\n";
# boolean
print CF "\$use_php_recode = $use_php_recode;\n";
- print CF "\n";
# boolean
print CF "\$use_php_iconv = $use_php_iconv;\n";
print CF "\n";
return $string;
}
+# determine a plugin's version number
+#
+# parses the setup.php file, looking for the
+# version string in the <plugin>_info() or the
+# <plugin>_version functions.
+#
+sub get_plugin_version() {
+
+ my $plugin_name = shift(@_);
+
+ $setup_file = '../plugins/' . $plugin_name . '/setup.php';
+ if ( -e "$setup_file" ) {
+ # Make sure that file is readable
+ if (! -r "$setup_file") {
+ print "\n";
+ print "WARNING:\n";
+ print "The file \"$setup_file\" was found, but you don't\n";
+ print "have rights to read it. The plugin \"";
+ print $plugin_name . "\" may not work correctly until you fix this.\n";
+ print "\nPress enter to continue";
+ $ctu = <STDIN>;
+ print "\n";
+ next;
+ }
+
+ $version = ' ';
+# FIXME: grep the file instead of reading it into memory?
+ $whole_file = '';
+ open( FILE, "$setup_file" );
+ while ( $line = <FILE> ) {
+ $whole_file .= $line;
+ }
+ close(FILE);
+
+ # ideally, there is a version in the <plugin>_info function...
+ #
+ if ($whole_file =~ /('version'\s*=>\s*['"](.*?)['"])/) {
+ $version .= $2;
+
+ # this assumes there is only one function that returns
+ # a static string in the setup file
+ #
+ } elsif ($whole_file =~ /(return\s*['"](.*?)['"])/) {
+ $version .= $2;
+ }
+
+ return $version;
+
+ } else {
+ print "\n";
+ print "WARNING:\n";
+ print "The file \"$setup_file\" was not found.\n";
+ print "The plugin \"" . $plugin_name;
+ print "\" may not work correctly until you fix this.\n";
+ print "\nPress enter to continue";
+ $ctu = <STDIN>;
+ print "\n";
+ next;
+ }
+
+}
+
# parses the setup.php files for all activated plugins and
# builds static plugin hooks array so we don't have to load
# ALL plugins are runtime and build the hook array on every