- Update for switch from CVS to Subversion.
- Default provider URI link fixed (was broken when on plugin options pages, etc)
- Fix URL to send read receipts from read_body (#1637572).
+ - Add option to ask users for personal information on first login.
Version 1.5.1 (branched on 2006-02-12)
--------------------------------------
$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";
} 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(); }
}
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";
* @global integer $config_use_color
*/
$config_use_color = 2;
+
+/**
+ * Ask User for Personal Information on login
+ *
+ * When a user logs in that doesn't have an email address configured,
+ * redirect him/her to the options page with a request to fill in their
+ * personal information.
+ *
+ * @global bool $ask_user_info
+ */
+$ask_user_info = true;
+
global $data_dir, $username;
setSig($data_dir, $username, 'g', $option->new_value);
}
+
/* Initialize the maximum option refresh level. */
$max_refresh = SMOPT_REFRESH_NONE;
+
+
/* Save each option in each option group. */
foreach ($optpage_data['options'] as $option_grp) {
foreach ($option_grp['options'] as $option) {
+
+ /* Special case: need to make sure emailaddress
+ * is saved if we use it as a test for ask_user_info */
+ global $ask_user_info;
+ if ( $optpage = SMOPT_PAGE_PERSONAL && $ask_user_info &&
+ $option->name == 'email_address' ) {
+ $option->setValue('');
+ }
+
/* Remove Debug Mode Until Needed
echo "name = '$option->name', "
. "value = '$option->value', "
// This is the only variable that is needed by *just* the template.
$oTemplate->assign('options', $optpage_data['options']);
+ global $ask_user_info;
+ if ( $optpage = SMOPT_PAGE_PERSONAL && $ask_user_info
+ && getPref($data_dir, $username,'email_address') == "" ) {
+ $oTemplate->assign('topmessage',
+ _("Welcome to SquirrelMail. Please supply your full name and email address.") );
+ }
+
/**
* The variables below should not be needed by the template since all plugin
* hooks are called here, not in the template. If we find otherwise, these
}
$oTemplate->display('footer.tpl');
-?>
*/
include('../include/init.php');
+/* If email_address not set and admin wants us to ask user for it,
+ * redirect to options page. */
+if ( $ask_user_info && getPref($data_dir, $username,'email_address') == "" ) {
+ header("Location: " . get_location() . "/options.php?optpage=personal");
+ exit;
+}
+
/* SquirrelMail required files. */
require_once(SM_PATH . 'functions/imap_asearch.php');
require_once(SM_PATH . 'functions/imap_general.php');
require_once(SM_PATH . 'functions/mailbox_display.php');
require_once(SM_PATH . 'functions/compose.php');
-
/* lets get the global vars we may need */
sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
sqgetGlobalVar('delayed_errors', $delayed_errors, SQ_SESSION);
margin-left: auto;
margin-right: auto;
}
-
+#optionMessage {
+ text-align: center;
+ width: 100%;
+ font-size: larger;
+ color: red;
+ font-weight: bold;
+}
/** extract variables */
extract($t);
+
+
+if ( !empty($topmessage) ) {
+ echo "<div id=\"optionMessage\">\n$topmessage\n</div>\n\n";
+}
?>
+
<div id="optionDisplay">
<?php
foreach ($options as $option) {