Index: trunk/profile.php
===================================================================
--- trunk/profile.php	(revision 5206)
+++ trunk/profile.php	(revision 5328)
@@ -105,34 +105,37 @@
   }
 
-  $int_pattern = '/^\d+$/';
-  if (empty($_POST['nb_image_line'])
-      or (!preg_match($int_pattern, $_POST['nb_image_line'])))
-  {
-    $errors[] = l10n('The number of images per row must be a not null scalar');
-  }
-
-  if (empty($_POST['nb_line_page'])
-      or (!preg_match($int_pattern, $_POST['nb_line_page'])))
-  {
-    $errors[] = l10n('The number of rows per page must be a not null scalar');
-  }
-
-  if ($_POST['maxwidth'] != ''
-      and (!preg_match($int_pattern, $_POST['maxwidth'])
-           or $_POST['maxwidth'] < 50))
-  {
-    $errors[] = l10n('Maximum width must be a number superior to 50');
-  }
-  if ($_POST['maxheight']
-       and (!preg_match($int_pattern, $_POST['maxheight'])
-             or $_POST['maxheight'] < 50))
-  {
-    $errors[] = l10n('Maximum height must be a number superior to 50');
-  }
-  // periods must be integer values, they represents number of days
-  if (!preg_match($int_pattern, $_POST['recent_period'])
-      or $_POST['recent_period'] <= 0)
-  {
-    $errors[] = l10n('Recent period must be a positive integer value') ;
+  if ($conf['allow_user_customization'] or defined('IN_ADMIN'))
+  {
+    $int_pattern = '/^\d+$/';
+    if (empty($_POST['nb_image_line'])
+        or (!preg_match($int_pattern, $_POST['nb_image_line'])))
+    {
+      $errors[] = l10n('The number of images per row must be a not null scalar');
+    }
+
+    if (empty($_POST['nb_line_page'])
+        or (!preg_match($int_pattern, $_POST['nb_line_page'])))
+    {
+      $errors[] = l10n('The number of rows per page must be a not null scalar');
+    }
+
+    if ($_POST['maxwidth'] != ''
+        and (!preg_match($int_pattern, $_POST['maxwidth'])
+             or $_POST['maxwidth'] < 50))
+    {
+      $errors[] = l10n('Maximum width must be a number superior to 50');
+    }
+    if ($_POST['maxheight']
+         and (!preg_match($int_pattern, $_POST['maxheight'])
+               or $_POST['maxheight'] < 50))
+    {
+      $errors[] = l10n('Maximum height must be a number superior to 50');
+    }
+    // periods must be integer values, they represents number of days
+    if (!preg_match($int_pattern, $_POST['recent_period'])
+        or $_POST['recent_period'] <= 0)
+    {
+      $errors[] = l10n('Recent period must be a positive integer value') ;
+    }
   }
 
@@ -200,24 +203,26 @@
     }
 
-    // update user "additional" informations (specific to Piwigo)
-    $fields = array(
-      'nb_image_line', 'nb_line_page', 'language', 'maxwidth', 'maxheight',
-      'expand', 'show_nb_comments', 'show_nb_hits', 'recent_period', 'theme'
-      );
-
-    $data = array();
-    $data['user_id'] = $userdata['id'];
-
-    foreach ($fields as $field)
-    {
-      if (isset($_POST[$field]))
+    if ($conf['allow_user_customization'] or defined('IN_ADMIN'))
+    {
+      // update user "additional" informations (specific to Piwigo)
+      $fields = array(
+        'nb_image_line', 'nb_line_page', 'language', 'maxwidth', 'maxheight',
+        'expand', 'show_nb_comments', 'show_nb_hits', 'recent_period', 'theme'
+        );
+
+      $data = array();
+      $data['user_id'] = $userdata['id'];
+
+      foreach ($fields as $field)
       {
-        $data[$field] = $_POST[$field];
+        if (isset($_POST[$field]))
+        {
+          $data[$field] = $_POST[$field];
+        }
       }
-    }
-    mass_updates(USER_INFOS_TABLE,
-                 array('primary' => array('user_id'), 'update' => $fields),
-                 array($data));
-
+      mass_updates(USER_INFOS_TABLE,
+                   array('primary' => array('user_id'), 'update' => $fields),
+                   array($data));
+    }
     trigger_action( 'save_profile_from_post', $userdata['id'] );
 
@@ -246,4 +251,5 @@
       'USERNAME'=>stripslashes($userdata['username']),
       'EMAIL'=>get_email_address_as_display_text(@$userdata['email']),
+      'ALLOW_USER_CUSTOMIZATION'=>$conf['allow_user_customization'],
       'NB_IMAGE_LINE'=>$userdata['nb_image_line'],
       'NB_ROW_PAGE'=>$userdata['nb_line_page'],
