From 8a7d066909d44a9d25b2a1c5eba9b1c37a0317fa Mon Sep 17 00:00:00 2001 From: simond Date: Wed, 13 Feb 2002 14:15:16 +0000 Subject: [PATCH] Allow admin to choose whether to enable the changing of full name and email address git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2430 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- ChangeLog | 1 + config/conf.pl | 72 +++++++++++++++++++++++++---- config/config_default.php | 12 +++++ plugins/administrator/defines.php | 4 ++ src/options_personal.php | 76 ++++++++++++++++++++----------- 5 files changed, 129 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index ae40d7d6..ad4f958e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -25,6 +25,7 @@ Version 1.2.5 -- CVS - Removed GLOBALS from conf.pl - HTML messages optimization. - Added support for requesting read receipts (MDN) and delivery receipts. + - Added the ability to stop users changing their names and email addresses. Version 1.2.4 -- 25 January 2002 -------------------------------- diff --git a/config/conf.pl b/config/conf.pl index 8bcc7acc..c8b0ed41 100755 --- a/config/conf.pl +++ b/config/conf.pl @@ -273,6 +273,12 @@ if(!$default_use_mdn) { if(!$frame_top) { $frame_top = "_top"; } +if(!$edit_identity) { + $edit_identity = "true"; +} +if(!$edit_name) { + $edit_name = "true"; +} if ($ARGV[0] eq '--install-plugin') { print "Activating plugin " . $ARGV[1] @@ -384,15 +390,19 @@ while (($command ne "q") && ($command ne "Q")) { print "R Return to Main Menu\n"; } elsif ($menu == 4) { print $WHT."General Options\n".$NRM; - print "1. Default Charset : $WHT$default_charset$NRM\n"; - print "2. Data Directory : $WHT$data_dir$NRM\n"; - print "3. Attachment Directory : $WHT$attachment_dir$NRM\n"; - print "4. Directory Hash Level : $WHT$dir_hash_level$NRM\n"; - print "5. Default Left Size : $WHT$default_left_size$NRM\n"; - print "6. Usernames in Lowercase : $WHT$force_username_lowercase$NRM\n"; - print "7. Allow use of priority : $WHT$default_use_priority$NRM\n"; - print "8. Hide SM attributions : $WHT$hide_sm_attributions$NRM\n"; - print "9. Allow use of receipts : $WHT$default_use_mdn$NRM\n"; + print "1. Default Charset : $WHT$default_charset$NRM\n"; + print "2. Data Directory : $WHT$data_dir$NRM\n"; + print "3. Attachment Directory : $WHT$attachment_dir$NRM\n"; + print "4. Directory Hash Level : $WHT$dir_hash_level$NRM\n"; + print "5. Default Left Size : $WHT$default_left_size$NRM\n"; + print "6. Usernames in Lowercase : $WHT$force_username_lowercase$NRM\n"; + print "7. Allow use of priority : $WHT$default_use_priority$NRM\n"; + 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"; + if (lc($edit_identity) eq "false") { + print "11. Allow editing of name : $WHT$edit_name$NRM\n"; + } print "\n"; print "R Return to Main Menu\n"; } elsif ($menu == 5) { @@ -564,6 +574,8 @@ while (($command ne "q") && ($command ne "Q")) { elsif ($command == 7) { $default_use_priority = command37 (); } 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 ($menu == 5) { if ($command == 1) { command41 (); } elsif ($command == 2) { $theme_css = command42 (); } @@ -1558,6 +1570,46 @@ sub command39 { return "false"; } +sub command310 { + print "This allows you to prevent the editing of the users name and"; + print "email address. This is mainly useful when used with the"; + print "retrieveuserdata plugin\n"; + print "\n"; + + if (lc($edit_identity) eq "true") { + $default_value = "y"; + } else { + $default_value = "n"; + } + print "Allow editing? (y/n) [$WHT$default_value$NRM]: $WHT"; + $new_edit = ; + if (($new_edit =~ /^y\n/i) || (($new_edit =~ /^\n/) && ($default_value eq "y"))) { + $edit_identity = "true"; + } else { + $edit_identity = "false"; + } + return $edit_identity; +} + +sub command311 { + print "This option allows you to choose if the user can edit their full name"; + print "even when you don't want them to change their username\n"; + print "\n"; + + if (lc($edit_name) eq "true") { + $default_value = "y"; + } else { + $default_value = "n"; + } + print "Allow editing of the users full name? (y/n) [$WHT$default_value$NRM]: $WHT"; + $new_edit = ; + if (($new_edit =~ /^y\n/i) || (($new_edit =~ /^\n/) && ($default_value eq "y"))) { + $edit_name = "true"; + } else { + $edit_name = "false"; + } + return $edit_name; +} sub command41 { print "\nNow we will define the themes that you wish to use. If you have added\n"; @@ -2032,6 +2084,8 @@ sub save_data { 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 "\n"; for ($ct=0; $ct <= $#plugins; $ct++) { diff --git a/config/config_default.php b/config/config_default.php index c965d4c0..1d341d2e 100644 --- a/config/config_default.php +++ b/config/config_default.php @@ -448,6 +448,18 @@ global $plugins; * $plugins[1] = 'attachment_common'; */ +/** + * If you don't want to allow users to change their email address + * then you can set $edit_identity to false, if you want them to + * not be able to change their full name too then set $edit_name + * to false as well. $edit_name has no effect unless $edit_identity + * is false; + */ + +global $edit_identity, $edit_name; +$edit_identity = true; +$edit_name = true; + /** * Make sure there are no characters after the PHP closing * tag below (including newline characters and whitespace). diff --git a/plugins/administrator/defines.php b/plugins/administrator/defines.php index e25a0f17..a91cf0c2 100644 --- a/plugins/administrator/defines.php +++ b/plugins/administrator/defines.php @@ -198,6 +198,10 @@ $defcfg = array( '$config_version' => array( 'name' => _("Config File Version"), 'type' => SMOPT_TYPE_BOOLEAN ), '$hide_sm_attributions' => array( 'name' => _("Hide SM attributions"), 'type' => SMOPT_TYPE_BOOLEAN ), + '$edit_identity' => array( 'name' => _("Allow editing of identities"), + 'type' => SMOPT_TYPE_BOOLEAN ), + '$edit_name' => array( 'name' => _("Allow editing of full name"), + 'type' => SMOPT_TYPE_BOOLEAN ), /* --------------------------------------------------------*/ 'Group5' => array( 'name' => _("Message of the Day"), 'type' => SMOPT_TYPE_TITLE ), diff --git a/src/options_personal.php b/src/options_personal.php index c2a680bf..8258c161 100644 --- a/src/options_personal.php +++ b/src/options_personal.php @@ -21,7 +21,7 @@ define('SMOPT_GRP_SIG', 2); /* Define the optpage load function for the personal options page. */ function load_optpage_data_personal() { - global $data_dir, $username; + global $data_dir, $username, $edit_identity, $edit_name; global $full_name, $reply_to, $email_address; /* Set the values of some global variables. */ @@ -44,21 +44,41 @@ function load_optpage_data_personal() { /* Build a simple array into which we will build options. */ $optvals = array(); - $optvals[SMOPT_GRP_CONTACT][] = array( - 'name' => 'full_name', - 'caption' => _("Full Name"), - 'type' => SMOPT_TYPE_STRING, - 'refresh' => SMOPT_REFRESH_NONE, - 'size' => SMOPT_SIZE_HUGE - ); - - $optvals[SMOPT_GRP_CONTACT][] = array( - 'name' => 'email_address', - 'caption' => _("Email Address"), - 'type' => SMOPT_TYPE_STRING, - 'refresh' => SMOPT_REFRESH_NONE, - 'size' => SMOPT_SIZE_HUGE - ); + if ($edit_identity || $edit_name) { + $optvals[SMOPT_GRP_CONTACT][] = array( + 'name' => 'full_name', + 'caption' => _("Full Name"), + 'type' => SMOPT_TYPE_STRING, + 'refresh' => SMOPT_REFRESH_NONE, + 'size' => SMOPT_SIZE_HUGE + ); + } else { + $optvals[SMOPT_GRP_CONTACT][] = array( + 'name' => 'full_name', + 'caption' => _("Full Name"), + 'type' => SMOPT_TYPE_COMMENT, + 'refresh' => SMOPT_REFRESH_NONE, + 'comment' => $full_name + ); + } + + if ($edit_identity) { + $optvals[SMOPT_GRP_CONTACT][] = array( + 'name' => 'email_address', + 'caption' => _("Email Address"), + 'type' => SMOPT_TYPE_STRING, + 'refresh' => SMOPT_REFRESH_NONE, + 'size' => SMOPT_SIZE_HUGE + ); + } else { + $optvals[SMOPT_GRP_CONTACT][] = array( + 'name' => 'email_address', + 'caption' => _("Email Address"), + 'type' => SMOPT_TYPE_COMMENT, + 'refresh' => SMOPT_REFRESH_NONE, + 'comment' => $email_address + ); + } $optvals[SMOPT_GRP_CONTACT][] = array( 'name' => 'reply_to', @@ -68,17 +88,19 @@ function load_optpage_data_personal() { 'size' => SMOPT_SIZE_HUGE ); - $identities_link_value = '' - . _("Edit Advanced Identities") - . ' ' - . _("(discards changes made on this form so far)"); - $optvals[SMOPT_GRP_CONTACT][] = array( - 'name' => 'identities_link', - 'caption' => _("Multiple Identities"), - 'type' => SMOPT_TYPE_COMMENT, - 'refresh' => SMOPT_REFRESH_NONE, - 'comment' => $identities_link_value - ); + if ($edit_identity) { + $identities_link_value = '' + . _("Edit Advanced Identities") + . ' ' + . _("(discards changes made on this form so far)"); + $optvals[SMOPT_GRP_CONTACT][] = array( + 'name' => 'identities_link', + 'caption' => _("Multiple Identities"), + 'type' => SMOPT_TYPE_COMMENT, + 'refresh' => SMOPT_REFRESH_NONE, + 'comment' => $identities_link_value + ); + } /*** Load the Reply Citation Options into the array ***/ $optgrps[SMOPT_GRP_REPLY] = _("Reply Citation Options"); -- 2.25.1