diff options
Diffstat (limited to 'modules/user')
-rw-r--r-- | modules/user/user.admin.inc | 4 | ||||
-rw-r--r-- | modules/user/user.module | 18 | ||||
-rw-r--r-- | modules/user/user.pages.inc | 2 | ||||
-rw-r--r-- | modules/user/user.test | 2 |
4 files changed, 13 insertions, 13 deletions
diff --git a/modules/user/user.admin.inc b/modules/user/user.admin.inc index 1760c6e6a..fa188324d 100644 --- a/modules/user/user.admin.inc +++ b/modules/user/user.admin.inc @@ -180,8 +180,8 @@ function user_admin_account() { } asort($users_roles); $form['roles'][$account->uid][0] = array('#markup' => theme('item_list', $users_roles)); - $form['member_for'][$account->uid] = array('#markup' => format_interval(time() - $account->created)); - $form['last_access'][$account->uid] = array('#markup' => $account->access ? t('@time ago', array('@time' => format_interval(time() - $account->access))) : t('never')); + $form['member_for'][$account->uid] = array('#markup' => format_interval($_SERVER['REQUEST_TIME'] - $account->created)); + $form['last_access'][$account->uid] = array('#markup' => $account->access ? t('@time ago', array('@time' => format_interval($_SERVER['REQUEST_TIME'] - $account->access))) : t('never')); $form['operations'][$account->uid] = array('#markup' => l(t('edit'), "user/$account->uid/edit", array('query' => $destination))); } $form['accounts'] = array( diff --git a/modules/user/user.module b/modules/user/user.module index 5f8b629bd..5d920b8e3 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -240,7 +240,7 @@ function user_save($account, $edit = array(), $category = 'account') { // Consider users edited by an administrator as logged in, if they haven't // already, so anonymous users can view the profile (if allowed). if (empty($edit['access']) && empty($account->access) && user_access('administer users')) { - $edit['access'] = time(); + $edit['access'] = $_SERVER['REQUEST_TIME']; } foreach ($edit as $key => $value) { // Fields that don't pertain to the users or user_roles @@ -302,12 +302,12 @@ function user_save($account, $edit = array(), $category = 'account') { else { // Allow 'created' to be set by the caller. if (!isset($edit['created'])) { - $edit['created'] = time(); + $edit['created'] = $_SERVER['REQUEST_TIME']; } // Consider users created by an administrator as already logged in, so // anonymous users can view the profile (if allowed). if (empty($edit['access']) && user_access('administer users')) { - $edit['access'] = time(); + $edit['access'] = $_SERVER['REQUEST_TIME']; } $success = drupal_write_record('users', $edit); @@ -653,7 +653,7 @@ function user_user($type, &$edit, &$account, $category = NULL) { $account->content['summary']['member_for'] = array( '#type' => 'user_profile_item', '#title' => t('Member for'), - '#markup' => format_interval(time() - $account->created), + '#markup' => format_interval($_SERVER['REQUEST_TIME'] - $account->created), ); } if ($type == 'form' && $category == 'account') { @@ -788,7 +788,7 @@ function user_block($op = 'list', $delta = '', $edit = array()) { case 'online': if (user_access('access content')) { // Count users active within the defined period. - $interval = time() - variable_get('user_block_seconds_online', 900); + $interval = $_SERVER['REQUEST_TIME'] - variable_get('user_block_seconds_online', 900); // Perform database queries to gather online user lists. We use s.timestamp // rather than u.access because it is much faster. @@ -1341,7 +1341,7 @@ function user_authenticate_finalize(&$edit) { watchdog('user', 'Session opened for %name.', array('%name' => $user->name)); // Update the user table timestamp noting user has logged in. // This is also used to invalidate one-time login links. - $user->login = time(); + $user->login = $_SERVER['REQUEST_TIME']; db_query("UPDATE {users} SET login = %d WHERE uid = %d", $user->login, $user->uid); user_module_invoke('login', $edit, $user); sess_regenerate(); @@ -1380,7 +1380,7 @@ function user_external_login_register($name, $module) { 'pass' => user_password(), 'init' => $name, 'status' => 1, - 'access' => time() + 'access' => $_SERVER['REQUEST_TIME'] ); $account = user_save('', $userinfo); // Terminate if an error occured during user_save(). @@ -1395,7 +1395,7 @@ function user_external_login_register($name, $module) { } function user_pass_reset_url($account) { - $timestamp = time(); + $timestamp = $_SERVER['REQUEST_TIME']; return url("user/reset/$account->uid/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), array('absolute' => TRUE)); } @@ -2040,7 +2040,7 @@ function user_mail_tokens($account, $language) { '!uri' => $base_url, '!uri_brief' => preg_replace('!^https?://!', '', $base_url), '!mailto' => $account->mail, - '!date' => format_date(time(), 'medium', '', NULL, $language->language), + '!date' => format_date($_SERVER['REQUEST_TIME'], 'medium', '', NULL, $language->language), '!login_uri' => url('user', array('absolute' => TRUE, 'language' => $language)), '!edit_uri' => url('user/' . $account->uid . '/edit', array('absolute' => TRUE, 'language' => $language)), ); diff --git a/modules/user/user.pages.inc b/modules/user/user.pages.inc index df0c37fcc..be757643b 100644 --- a/modules/user/user.pages.inc +++ b/modules/user/user.pages.inc @@ -84,7 +84,7 @@ function user_pass_reset(&$form_state, $uid, $timestamp, $hashed_pass, $action = else { // Time out, in seconds, until login URL expires. 24 hours = 86400 seconds. $timeout = 86400; - $current = time(); + $current = $_SERVER['REQUEST_TIME']; // Some redundant checks for extra security ? if ($timestamp < $current && $account = user_load(array('uid' => $uid, 'status' => 1)) ) { // No time out for first time login. diff --git a/modules/user/user.test b/modules/user/user.test index 17a187a99..57a6a570b 100644 --- a/modules/user/user.test +++ b/modules/user/user.test @@ -43,7 +43,7 @@ class UserRegistrationTestCase extends DrupalWebTestCase { $this->assertEqual($user->mail, $mail, t('E-mail address matches.')); $this->assertEqual($user->theme, '', t('Correct theme field.')); $this->assertEqual($user->signature, '', t('Correct signature field.')); - $this->assertTrue(($user->created > time() - 20 ), t('Correct creation time.')); + $this->assertTrue(($user->created > $_SERVER['REQUEST_TIME'] - 20 ), t('Correct creation time.')); $this->assertEqual($user->status, variable_get('user_register', 1) == 1 ? 1 : 0, t('Correct status field.')); $this->assertEqual($user->timezone, variable_get('date_default_timezone', NULL), t('Correct timezone field.')); $this->assertEqual($user->language, '', t('Correct language field.')); |