Allow admin to choose whether to enable the changing of full name and email address
authorsimond <simond@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 13 Feb 2002 14:15:16 +0000 (14:15 +0000)
committersimond <simond@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 13 Feb 2002 14:15:16 +0000 (14:15 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2430 7612ce4b-ef26-0410-bec9-ea0150e637f0

ChangeLog
config/conf.pl
config/config_default.php
plugins/administrator/defines.php
src/options_personal.php

index ae40d7d634b5338754d2aedcb3add23ddb0586d1..ad4f958ef9a9c4eb4199a5beec2bb4be298e2759 100644 (file)
--- 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
 --------------------------------
index 8bcc7acc28828854ef247b096d6011ceff319d09..c8b0ed41fda0a8254333aaafbc53c0fc3f415cfe 100755 (executable)
@@ -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 = <STDIN>;
+    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 = <STDIN>;
+    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++) {
index c965d4c0cd88fa3549436ef3e0b3f03cec4a4a2c..1d341d2e4d0eb87ffc37b3abe1419cbecc77d7c9 100644 (file)
@@ -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).
index e25a0f17c4225e89f67d662ad4107d92388853b5..a91cf0c28f6166a7da751c41c89d0c4aeed333a7 100644 (file)
@@ -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 ),
index c2a680bf2afb948c1af2a6a4d228ac1b7fbc0a50..8258c161c6c4ea1def1a465f3e2509f8d840bf29 100644 (file)
@@ -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 = '<A HREF="options_identities.php">'
-                           . _("Edit Advanced Identities")
-                           . '</A> '
-                           . _("(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 = '<A HREF="options_identities.php">'
+                               . _("Edit Advanced Identities")
+                               . '</A> '
+                               . _("(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");