@@ -1517,15 +1517,33 @@ function theme_user_list($variables) {
|
||||
return theme('item_list', array('items' => $items, 'title' => $title));
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the current user is anonymous.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if the user is anonymous, FALSE if the user is authenticated.
|
||||
*/
|
||||
function user_is_anonymous() {
|
||||
// Menu administrators can see items for anonymous when administering.
|
||||
return !$GLOBALS['user']->uid || !empty($GLOBALS['menu_admin']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the current user is logged in.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if the user is logged in, FALSE if the user is anonymous.
|
||||
*/
|
||||
function user_is_logged_in() {
|
||||
return (bool) $GLOBALS['user']->uid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the current user has access to the user registration page.
|
||||
*
|
||||
* @return bool
|
||||
* TRUE if the user is not already logged in and can register for an account.
|
||||
*/
|
||||
function user_register_access() {
|
||||
return user_is_anonymous() && variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL);
|
||||
}
|
||||
@@ -2289,26 +2307,14 @@ function user_external_login_register($name, $module) {
|
||||
*
|
||||
* @param object $account
|
||||
* An object containing the user account.
|
||||
* @param array $options
|
||||
* (optional) A keyed array of settings. Supported options are:
|
||||
* - langcode: A language code to be used when generating locale-sensitive
|
||||
* urls. If langcode is NULL the users preferred language is used.
|
||||
*
|
||||
* @return
|
||||
* A unique URL that provides a one-time log in for the user, from which
|
||||
* they can change their password.
|
||||
*/
|
||||
function user_pass_reset_url($account, $options = array()) {
|
||||
function user_pass_reset_url($account) {
|
||||
$timestamp = REQUEST_TIME;
|
||||
$url_options = array('absolute' => TRUE);
|
||||
if (isset($options['langcode'])) {
|
||||
$languages = language_list();
|
||||
$url_options['language'] = $languages[$options['langcode']];
|
||||
}
|
||||
else {
|
||||
$url_options['language'] = user_preferred_language($account);
|
||||
}
|
||||
return url("user/reset/$account->uid/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), $url_options);
|
||||
return url("user/reset/$account->uid/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), array('absolute' => TRUE));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2320,10 +2326,6 @@ function user_pass_reset_url($account, $options = array()) {
|
||||
* - uid: The user uid number.
|
||||
* - pass: The hashed user password string.
|
||||
* - login: The user login name.
|
||||
* @param array $options
|
||||
* (optional) A keyed array of settings. Supported options are:
|
||||
* - langcode: A language code to be used when generating locale-sensitive
|
||||
* urls. If langcode is NULL the users preferred language is used.
|
||||
*
|
||||
* @return
|
||||
* A unique URL that may be used to confirm the cancellation of the user
|
||||
@@ -2332,17 +2334,9 @@ function user_pass_reset_url($account, $options = array()) {
|
||||
* @see user_mail_tokens()
|
||||
* @see user_cancel_confirm()
|
||||
*/
|
||||
function user_cancel_url($account, $options = array()) {
|
||||
function user_cancel_url($account) {
|
||||
$timestamp = REQUEST_TIME;
|
||||
$url_options = array('absolute' => TRUE);
|
||||
if (isset($options['langcode'])) {
|
||||
$languages = language_list();
|
||||
$url_options['language'] = $languages[$options['langcode']];
|
||||
}
|
||||
else {
|
||||
$url_options['language'] = user_preferred_language($account);
|
||||
}
|
||||
return url("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), $url_options);
|
||||
return url("user/$account->uid/cancel/confirm/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), array('absolute' => TRUE));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2791,7 +2785,7 @@ Your account on [site:name] has been canceled.
|
||||
if ($replace) {
|
||||
// We do not sanitize the token replacement, since the output of this
|
||||
// replacement is intended for an e-mail message, not a web browser.
|
||||
return token_replace($text, $variables, array('langcode' => $langcode, 'callback' => 'user_mail_tokens', 'sanitize' => FALSE, 'clear' => TRUE));
|
||||
return token_replace($text, $variables, array('language' => $language, 'callback' => 'user_mail_tokens', 'sanitize' => FALSE, 'clear' => TRUE));
|
||||
}
|
||||
|
||||
return $text;
|
||||
@@ -2818,8 +2812,8 @@ Your account on [site:name] has been canceled.
|
||||
*/
|
||||
function user_mail_tokens(&$replacements, $data, $options) {
|
||||
if (isset($data['user'])) {
|
||||
$replacements['[user:one-time-login-url]'] = user_pass_reset_url($data['user'], $options);
|
||||
$replacements['[user:cancel-url]'] = user_cancel_url($data['user'], $options);
|
||||
$replacements['[user:one-time-login-url]'] = user_pass_reset_url($data['user']);
|
||||
$replacements['[user:cancel-url]'] = user_cancel_url($data['user']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3377,7 +3371,7 @@ function user_filters() {
|
||||
$options = array();
|
||||
foreach (module_implements('permission') as $module) {
|
||||
$function = $module . '_permission';
|
||||
if ($permissions = $function('permission')) {
|
||||
if ($permissions = $function()) {
|
||||
asort($permissions);
|
||||
foreach ($permissions as $permission => $description) {
|
||||
$options[t('@module module', array('@module' => $module))][$permission] = t($permission);
|
||||
|
||||
Reference in New Issue
Block a user