[prev in list] [next in list] [prev in thread] [next in thread]
List: squirrelmail-cvs
Subject: [SM-CVS] SF.net SVN: squirrelmail: [12274] trunk/squirrelmail
From: kink () users ! sourceforge ! net
Date: 2007-02-18 18:47:49
Message-ID: E1HIr4f-00013D-4F () sc8-pr-svn2 ! sourceforge ! net
[Download RAW message or body]
Revision: 12274
http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=12274&view=rev
Author: kink
Date: 2007-02-18 10:47:48 -0800 (Sun, 18 Feb 2007)
Log Message:
-----------
Add option to ask users for personal information on first login.
Many users start sending out mail without a decent or even correct
"From" header. Defaults to on. Admin can disable if he has a
retrieve_user_info plugin or the guessed defaults are ok.
Modified Paths:
--------------
trunk/squirrelmail/ChangeLog
trunk/squirrelmail/config/conf.pl
trunk/squirrelmail/config/config_default.php
trunk/squirrelmail/include/options/personal.php
trunk/squirrelmail/src/options.php
trunk/squirrelmail/src/right_main.php
trunk/squirrelmail/templates/default/css/options.css
trunk/squirrelmail/templates/default/options.tpl
Modified: trunk/squirrelmail/ChangeLog
===================================================================
--- trunk/squirrelmail/ChangeLog 2007-02-18 18:11:34 UTC (rev 12273)
+++ trunk/squirrelmail/ChangeLog 2007-02-18 18:47:48 UTC (rev 12274)
@@ -179,6 +179,7 @@
- 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)
--------------------------------------
Modified: trunk/squirrelmail/config/conf.pl
===================================================================
--- trunk/squirrelmail/config/conf.pl 2007-02-18 18:11:34 UTC (rev 12273)
+++ trunk/squirrelmail/config/conf.pl 2007-02-18 18:47:48 UTC (rev 12274)
@@ -472,6 +472,7 @@
$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";
@@ -790,6 +791,7 @@
} 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";
@@ -965,6 +967,7 @@
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(); }
@@ -4156,6 +4159,30 @@
}
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";
@@ -4661,13 +4688,13 @@
# 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";
Modified: trunk/squirrelmail/config/config_default.php
===================================================================
--- trunk/squirrelmail/config/config_default.php 2007-02-18 18:11:34 UTC (rev 12273)
+++ trunk/squirrelmail/config/config_default.php 2007-02-18 18:47:48 UTC (rev 12274)
@@ -1151,3 +1151,15 @@
* @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;
+
Modified: trunk/squirrelmail/include/options/personal.php
===================================================================
--- trunk/squirrelmail/include/options/personal.php 2007-02-18 18:11:34 UTC (rev \
12273)
+++ trunk/squirrelmail/include/options/personal.php 2007-02-18 18:47:48 UTC (rev \
12274) @@ -264,3 +264,4 @@
global $data_dir, $username;
setSig($data_dir, $username, 'g', $option->new_value);
}
+
Modified: trunk/squirrelmail/src/options.php
===================================================================
--- trunk/squirrelmail/src/options.php 2007-02-18 18:11:34 UTC (rev 12273)
+++ trunk/squirrelmail/src/options.php 2007-02-18 18:47:48 UTC (rev 12274)
@@ -44,9 +44,20 @@
/* 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', "
@@ -415,6 +426,13 @@
// 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
@@ -456,4 +474,3 @@
}
$oTemplate->display('footer.tpl');
-?>
Modified: trunk/squirrelmail/src/right_main.php
===================================================================
--- trunk/squirrelmail/src/right_main.php 2007-02-18 18:11:34 UTC (rev 12273)
+++ trunk/squirrelmail/src/right_main.php 2007-02-18 18:47:48 UTC (rev 12274)
@@ -20,6 +20,13 @@
*/
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');
@@ -29,7 +36,6 @@
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);
Modified: trunk/squirrelmail/templates/default/css/options.css
===================================================================
--- trunk/squirrelmail/templates/default/css/options.css 2007-02-18 18:11:34 UTC (rev \
12273)
+++ trunk/squirrelmail/templates/default/css/options.css 2007-02-18 18:47:48 UTC (rev \
12274) @@ -154,4 +154,10 @@
margin-left: auto;
margin-right: auto;
}
-
+#optionMessage {
+ text-align: center;
+ width: 100%;
+ font-size: larger;
+ color: red;
+ font-weight: bold;
+}
Modified: trunk/squirrelmail/templates/default/options.tpl
===================================================================
--- trunk/squirrelmail/templates/default/options.tpl 2007-02-18 18:11:34 UTC (rev \
12273)
+++ trunk/squirrelmail/templates/default/options.tpl 2007-02-18 18:47:48 UTC (rev \
12274) @@ -21,7 +21,13 @@
/** 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) {
This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
--
squirrelmail-cvs mailing list
List Address: squirrelmail-cvs@lists.sourceforge.net
List Info: https://lists.sourceforge.net/lists/listinfo/squirrelmail-cvs
http://squirrelmail.org/cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic