diff modules/user/user.module @ 5:2427550111ae 6.2

Drupal 6.2
author Franck Deroche <webmaster@defr.org>
date Tue, 23 Dec 2008 14:30:08 +0100
parents c1f4ac30525a
children fff6d4c8c043
line wrap: on
line diff
--- a/modules/user/user.module	Tue Dec 23 14:29:21 2008 +0100
+++ b/modules/user/user.module	Tue Dec 23 14:30:08 2008 +0100
@@ -1,5 +1,5 @@
 <?php
-// $Id: user.module,v 1.892 2008/02/03 19:23:01 goba Exp $
+// $Id: user.module,v 1.892.2.2 2008/04/09 21:11:51 goba Exp $
 
 /**
  * @file
@@ -867,6 +867,9 @@
     );
 }
 
+/**
+ * Access callback for user account editing.
+ */
 function user_edit_access($account) {
   return (($GLOBALS['user']->uid == $account->uid) || user_access('administer users')) && $account->uid > 0;
 }
@@ -956,6 +959,7 @@
   $items['admin/user/user/create'] = array(
     'title' => 'Add user',
     'page arguments' => array('create'),
+    'access arguments' => array('administer users'),
     'type' => MENU_LOCAL_TASK,
     'file' => 'user.admin.inc',
   );
@@ -988,6 +992,7 @@
   $items['admin/user/roles/edit'] = array(
     'title' => 'Edit role',
     'page arguments' => array('user_admin_role'),
+    'access arguments' => array('administer permissions'),
     'type' => MENU_CALLBACK,
     'file' => 'user.admin.inc',
   );
@@ -1006,18 +1011,21 @@
   $items['admin/user/rules/add'] = array(
     'title' => 'Add rule',
     'page callback' => 'user_admin_access_add',
+    'access arguments' => array('administer permissions'),
     'type' => MENU_LOCAL_TASK,
     'file' => 'user.admin.inc',
   );
   $items['admin/user/rules/check'] = array(
     'title' => 'Check rules',
     'page callback' => 'user_admin_access_check',
+    'access arguments' => array('administer permissions'),
     'type' => MENU_LOCAL_TASK,
     'file' => 'user.admin.inc',
   );
   $items['admin/user/rules/edit'] = array(
     'title' => 'Edit rule',
     'page callback' => 'user_admin_access_edit',
+    'access arguments' => array('administer permissions'),
     'type' => MENU_CALLBACK,
     'file' => 'user.admin.inc',
   );
@@ -1025,6 +1033,7 @@
     'title' => 'Delete rule',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('user_admin_access_delete_confirm'),
+    'access arguments' => array('administer permissions'),
     'type' => MENU_CALLBACK,
     'file' => 'user.admin.inc',
   );
@@ -1037,7 +1046,7 @@
     'file' => 'user.pages.inc',
   );
 
-  $items['user/%user_current'] = array(
+  $items['user/%user_uid_optional'] = array(
     'title' => 'My account',
     'title callback' => 'user_page_title',
     'title arguments' => array(1),
@@ -1092,8 +1101,8 @@
           'title arguments' => array($category['title']),
           'page callback' => 'user_edit',
           'page arguments' => array(1, 3),
-          'access callback' => isset($category['access callback']) ? $category['access callback'] : TRUE,
-          'access arguments' => isset($category['access arguments']) ? $category['access arguments'] : array(),
+          'access callback' => isset($category['access callback']) ? $category['access callback'] : 'user_edit_access',
+          'access arguments' => isset($category['access arguments']) ? $category['access arguments'] : array(1),
           'type' => MENU_LOCAL_TASK,
           'weight' => $category['weight'],
           'load arguments' => array('%map', '%index'),
@@ -1110,8 +1119,8 @@
   drupal_add_css(drupal_get_path('module', 'user') .'/user.css', 'module');
 }
 
-function user_current_load($arg) {
-  return user_load($arg ? $arg : $GLOBALS['user']->uid);
+function user_uid_optional_load($arg) {
+  return user_load(isset($arg) ? $arg : $GLOBALS['user']->uid);
 }
 
 /**
@@ -1156,7 +1165,7 @@
 /**
  * Returns the user id of the currently logged in user.
  */
-function user_current_to_arg($arg) {
+function user_uid_optional_to_arg($arg) {
   // Give back the current user uid when called from eg. tracker, aka.
   // with an empty arg. Also use the current user uid when called from
   // the menu with a % for the current account link.
@@ -1224,7 +1233,7 @@
  *
  * @ingroup forms
  */
-function user_login(&$form_state, $msg = '') {
+function user_login(&$form_state) {
   global $user;
 
   // If we are already logged on, go to the user page instead.
@@ -1233,9 +1242,6 @@
   }
 
   // Display login form:
-  if ($msg) {
-    $form['message'] = array('#value' => '<p>'. check_plain($msg) .'</p>');
-  }
   $form['name'] = array('#type' => 'textfield',
     '#title' => t('Username'),
     '#size' => 60,