- Patch #305645 by pwolanin: ['REQUEST_TIME'] -> REQUEST_TIME. Improved developer experience.
parent
6f8b5f9a5b
commit
7f29b14277
|
@ -180,6 +180,11 @@ define('LANGUAGE_NEGOTIATION_PATH', 2);
|
||||||
*/
|
*/
|
||||||
define('LANGUAGE_NEGOTIATION_DOMAIN', 3);
|
define('LANGUAGE_NEGOTIATION_DOMAIN', 3);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For convenience, define a short form of the request time global.
|
||||||
|
*/
|
||||||
|
define ('REQUEST_TIME', $_SERVER['REQUEST_TIME']);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start the timer with the specified name. If you start and stop
|
* Start the timer with the specified name. If you start and stop
|
||||||
* the same timer multiple times, the measured intervals will be
|
* the same timer multiple times, the measured intervals will be
|
||||||
|
@ -816,7 +821,7 @@ function watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NO
|
||||||
'request_uri' => $base_root . request_uri(),
|
'request_uri' => $base_root . request_uri(),
|
||||||
'referer' => $_SERVER['HTTP_REFERER'],
|
'referer' => $_SERVER['HTTP_REFERER'],
|
||||||
'ip' => ip_address(),
|
'ip' => ip_address(),
|
||||||
'timestamp' => $_SERVER['REQUEST_TIME'],
|
'timestamp' => REQUEST_TIME,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Call the logging hooks to log/process the message
|
// Call the logging hooks to log/process the message
|
||||||
|
|
|
@ -19,7 +19,7 @@ function cache_get($cid, $table = 'cache') {
|
||||||
|
|
||||||
// Garbage collection necessary when enforcing a minimum cache lifetime
|
// Garbage collection necessary when enforcing a minimum cache lifetime
|
||||||
$cache_flush = variable_get('cache_flush', 0);
|
$cache_flush = variable_get('cache_flush', 0);
|
||||||
if ($cache_flush && ($cache_flush + variable_get('cache_lifetime', 0) <= $_SERVER['REQUEST_TIME'])) {
|
if ($cache_flush && ($cache_flush + variable_get('cache_lifetime', 0) <= REQUEST_TIME)) {
|
||||||
// Reset the variable immediately to prevent a meltdown in heavy load situations.
|
// Reset the variable immediately to prevent a meltdown in heavy load situations.
|
||||||
variable_set('cache_flush', 0);
|
variable_set('cache_flush', 0);
|
||||||
// Time to flush old cache data
|
// Time to flush old cache data
|
||||||
|
@ -104,7 +104,7 @@ function cache_get($cid, $table = 'cache') {
|
||||||
function cache_set($cid, $data, $table = 'cache', $expire = CACHE_PERMANENT, $headers = NULL) {
|
function cache_set($cid, $data, $table = 'cache', $expire = CACHE_PERMANENT, $headers = NULL) {
|
||||||
$fields = array(
|
$fields = array(
|
||||||
'serialized' => 0,
|
'serialized' => 0,
|
||||||
'created' => $_SERVER['REQUEST_TIME'],
|
'created' => REQUEST_TIME,
|
||||||
'expire' => $expire,
|
'expire' => $expire,
|
||||||
'headers' => $headers,
|
'headers' => $headers,
|
||||||
);
|
);
|
||||||
|
@ -155,23 +155,23 @@ function cache_clear_all($cid = NULL, $table = NULL, $wildcard = FALSE) {
|
||||||
// will be saved into the sessions table by _sess_write(). We then
|
// will be saved into the sessions table by _sess_write(). We then
|
||||||
// simulate that the cache was flushed for this user by not returning
|
// simulate that the cache was flushed for this user by not returning
|
||||||
// cached data that was cached before the timestamp.
|
// cached data that was cached before the timestamp.
|
||||||
$user->cache = $_SERVER['REQUEST_TIME'];
|
$user->cache = REQUEST_TIME;
|
||||||
|
|
||||||
$cache_flush = variable_get('cache_flush', 0);
|
$cache_flush = variable_get('cache_flush', 0);
|
||||||
if ($cache_flush == 0) {
|
if ($cache_flush == 0) {
|
||||||
// This is the first request to clear the cache, start a timer.
|
// This is the first request to clear the cache, start a timer.
|
||||||
variable_set('cache_flush', $_SERVER['REQUEST_TIME']);
|
variable_set('cache_flush', REQUEST_TIME);
|
||||||
}
|
}
|
||||||
else if ($_SERVER['REQUEST_TIME'] > ($cache_flush + variable_get('cache_lifetime', 0))) {
|
else if (REQUEST_TIME > ($cache_flush + variable_get('cache_lifetime', 0))) {
|
||||||
// Clear the cache for everyone, cache_flush_delay seconds have
|
// Clear the cache for everyone, cache_flush_delay seconds have
|
||||||
// passed since the first request to clear the cache.
|
// passed since the first request to clear the cache.
|
||||||
db_query("DELETE FROM {" . $table . "} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, $_SERVER['REQUEST_TIME']);
|
db_query("DELETE FROM {" . $table . "} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, REQUEST_TIME);
|
||||||
variable_set('cache_flush', 0);
|
variable_set('cache_flush', 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// No minimum cache lifetime, flush all temporary cache entries now.
|
// No minimum cache lifetime, flush all temporary cache entries now.
|
||||||
db_query("DELETE FROM {" . $table . "} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, $_SERVER['REQUEST_TIME']);
|
db_query("DELETE FROM {" . $table . "} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, REQUEST_TIME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -903,7 +903,7 @@ function valid_url($url, $absolute = FALSE) {
|
||||||
* The name of an event.
|
* The name of an event.
|
||||||
*/
|
*/
|
||||||
function flood_register_event($name) {
|
function flood_register_event($name) {
|
||||||
db_query("INSERT INTO {flood} (event, hostname, timestamp) VALUES ('%s', '%s', %d)", $name, ip_address(), $_SERVER['REQUEST_TIME']);
|
db_query("INSERT INTO {flood} (event, hostname, timestamp) VALUES ('%s', '%s', %d)", $name, ip_address(), REQUEST_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -920,7 +920,7 @@ function flood_register_event($name) {
|
||||||
* True if the user did not exceed the hourly threshold. False otherwise.
|
* True if the user did not exceed the hourly threshold. False otherwise.
|
||||||
*/
|
*/
|
||||||
function flood_is_allowed($name, $threshold) {
|
function flood_is_allowed($name, $threshold) {
|
||||||
$number = db_result(db_query("SELECT COUNT(*) FROM {flood} WHERE event = '%s' AND hostname = '%s' AND timestamp > %d", $name, ip_address(), $_SERVER['REQUEST_TIME'] - 3600));
|
$number = db_result(db_query("SELECT COUNT(*) FROM {flood} WHERE event = '%s' AND hostname = '%s' AND timestamp > %d", $name, ip_address(), REQUEST_TIME - 3600));
|
||||||
return ($number < $threshold ? TRUE : FALSE);
|
return ($number < $threshold ? TRUE : FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2104,7 +2104,7 @@ function drupal_get_js($scope = 'header', $javascript = NULL) {
|
||||||
// browser-caching. The string changes on every update or full cache
|
// browser-caching. The string changes on every update or full cache
|
||||||
// flush, forcing browsers to load a new copy of the files, as the
|
// flush, forcing browsers to load a new copy of the files, as the
|
||||||
// URL changed. Files that should not be cached (see drupal_add_js())
|
// URL changed. Files that should not be cached (see drupal_add_js())
|
||||||
// get $_SERVER['REQUEST_TIME'] as query-string instead, to enforce reload on every
|
// get REQUEST_TIME as query-string instead, to enforce reload on every
|
||||||
// page request.
|
// page request.
|
||||||
$query_string = '?' . substr(variable_get('css_js_query_string', '0'), 0, 1);
|
$query_string = '?' . substr(variable_get('css_js_query_string', '0'), 0, 1);
|
||||||
|
|
||||||
|
@ -2131,7 +2131,7 @@ function drupal_get_js($scope = 'header', $javascript = NULL) {
|
||||||
// Additionally, go through any remaining scripts if JS preprocessing is on and output the non-cached ones.
|
// Additionally, go through any remaining scripts if JS preprocessing is on and output the non-cached ones.
|
||||||
foreach ($data as $path => $info) {
|
foreach ($data as $path => $info) {
|
||||||
if (!$info['preprocess'] || !$is_writable || !$preprocess_js) {
|
if (!$info['preprocess'] || !$is_writable || !$preprocess_js) {
|
||||||
$no_preprocess[$type] .= '<script type="text/javascript"' . ($info['defer'] ? ' defer="defer"' : '') . ' src="' . base_path() . $path . ($info['cache'] ? $query_string : '?' . $_SERVER['REQUEST_TIME']) . "\"></script>\n";
|
$no_preprocess[$type] .= '<script type="text/javascript"' . ($info['defer'] ? ' defer="defer"' : '') . ' src="' . base_path() . $path . ($info['cache'] ? $query_string : '?' . REQUEST_TIME) . "\"></script>\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$files[$path] = $info;
|
$files[$path] = $info;
|
||||||
|
@ -2583,7 +2583,7 @@ function drupal_cron_run() {
|
||||||
$semaphore = variable_get('cron_semaphore', FALSE);
|
$semaphore = variable_get('cron_semaphore', FALSE);
|
||||||
|
|
||||||
if ($semaphore) {
|
if ($semaphore) {
|
||||||
if ($_SERVER['REQUEST_TIME'] - $semaphore > 3600) {
|
if (REQUEST_TIME - $semaphore > 3600) {
|
||||||
// Either cron has been running for more than an hour or the semaphore
|
// Either cron has been running for more than an hour or the semaphore
|
||||||
// was not reset due to a database error.
|
// was not reset due to a database error.
|
||||||
watchdog('cron', 'Cron has been running for more than an hour and is most likely stuck.', array(), WATCHDOG_ERROR);
|
watchdog('cron', 'Cron has been running for more than an hour and is most likely stuck.', array(), WATCHDOG_ERROR);
|
||||||
|
@ -2601,13 +2601,13 @@ function drupal_cron_run() {
|
||||||
register_shutdown_function('drupal_cron_cleanup');
|
register_shutdown_function('drupal_cron_cleanup');
|
||||||
|
|
||||||
// Lock cron semaphore
|
// Lock cron semaphore
|
||||||
variable_set('cron_semaphore', $_SERVER['REQUEST_TIME']);
|
variable_set('cron_semaphore', REQUEST_TIME);
|
||||||
|
|
||||||
// Iterate through the modules calling their cron handlers (if any):
|
// Iterate through the modules calling their cron handlers (if any):
|
||||||
module_invoke_all('cron');
|
module_invoke_all('cron');
|
||||||
|
|
||||||
// Record cron time
|
// Record cron time
|
||||||
variable_set('cron_last', $_SERVER['REQUEST_TIME']);
|
variable_set('cron_last', REQUEST_TIME);
|
||||||
watchdog('cron', 'Cron run completed.', array(), WATCHDOG_NOTICE);
|
watchdog('cron', 'Cron run completed.', array(), WATCHDOG_NOTICE);
|
||||||
|
|
||||||
// Release cron semaphore
|
// Release cron semaphore
|
||||||
|
|
|
@ -643,7 +643,7 @@ function file_save_upload($source, $validators = array(), $destination = FALSE,
|
||||||
|
|
||||||
// If we made it this far it's safe to record this file in the database.
|
// If we made it this far it's safe to record this file in the database.
|
||||||
$file->status = FILE_STATUS_TEMPORARY;
|
$file->status = FILE_STATUS_TEMPORARY;
|
||||||
$file->timestamp = $_SERVER['REQUEST_TIME'];
|
$file->timestamp = REQUEST_TIME;
|
||||||
drupal_write_record('files', $file);
|
drupal_write_record('files', $file);
|
||||||
|
|
||||||
// Add file to the cache.
|
// Add file to the cache.
|
||||||
|
|
|
@ -235,9 +235,9 @@ function form_set_cache($form_build_id, $form, $form_state) {
|
||||||
// 6 hours cache life time for forms should be plenty.
|
// 6 hours cache life time for forms should be plenty.
|
||||||
$expire = 21600;
|
$expire = 21600;
|
||||||
|
|
||||||
cache_set('form_' . $form_build_id, $form, 'cache_form', $_SERVER['REQUEST_TIME'] + $expire);
|
cache_set('form_' . $form_build_id, $form, 'cache_form', REQUEST_TIME + $expire);
|
||||||
if (!empty($form_state['storage'])) {
|
if (!empty($form_state['storage'])) {
|
||||||
cache_set('storage_' . $form_build_id, $form_state['storage'], 'cache_form', $_SERVER['REQUEST_TIME'] + $expire);
|
cache_set('storage_' . $form_build_id, $form_state['storage'], 'cache_form', REQUEST_TIME + $expire);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1645,9 +1645,9 @@ function theme_date($element) {
|
||||||
function form_process_date($element) {
|
function form_process_date($element) {
|
||||||
// Default to current date
|
// Default to current date
|
||||||
if (empty($element['#value'])) {
|
if (empty($element['#value'])) {
|
||||||
$element['#value'] = array('day' => format_date($_SERVER['REQUEST_TIME'], 'custom', 'j'),
|
$element['#value'] = array('day' => format_date(REQUEST_TIME, 'custom', 'j'),
|
||||||
'month' => format_date($_SERVER['REQUEST_TIME'], 'custom', 'n'),
|
'month' => format_date(REQUEST_TIME, 'custom', 'n'),
|
||||||
'year' => format_date($_SERVER['REQUEST_TIME'], 'custom', 'Y'));
|
'year' => format_date(REQUEST_TIME, 'custom', 'Y'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$element['#tree'] = TRUE;
|
$element['#tree'] = TRUE;
|
||||||
|
@ -2483,7 +2483,7 @@ function batch_process($redirect = NULL, $url = NULL) {
|
||||||
|
|
||||||
// Initiate db storage in order to get a batch id. We have to provide
|
// Initiate db storage in order to get a batch id. We have to provide
|
||||||
// at least an empty string for the (not null) 'token' column.
|
// at least an empty string for the (not null) 'token' column.
|
||||||
db_query("INSERT INTO {batch} (token, timestamp) VALUES ('', %d)", $_SERVER['REQUEST_TIME']);
|
db_query("INSERT INTO {batch} (token, timestamp) VALUES ('', %d)", REQUEST_TIME);
|
||||||
$batch['id'] = db_last_insert_id('batch', 'bid');
|
$batch['id'] = db_last_insert_id('batch', 'bid');
|
||||||
|
|
||||||
// Now that we have a batch id, we can generate the redirection link in
|
// Now that we have a batch id, we can generate the redirection link in
|
||||||
|
|
|
@ -148,18 +148,18 @@ function _sess_write($key, $value) {
|
||||||
// and gives more useful statistics. We can't eliminate anonymous session
|
// and gives more useful statistics. We can't eliminate anonymous session
|
||||||
// table rows without breaking "Who's Online" block.
|
// table rows without breaking "Who's Online" block.
|
||||||
if ($user->uid || $value || count($_COOKIE)) {
|
if ($user->uid || $value || count($_COOKIE)) {
|
||||||
db_query("INSERT INTO {sessions} (sid, uid, cache, hostname, session, timestamp) VALUES ('%s', %d, %d, '%s', '%s', %d)", $key, $user->uid, isset($user->cache) ? $user->cache : 0, ip_address(), $value, $_SERVER['REQUEST_TIME']);
|
db_query("INSERT INTO {sessions} (sid, uid, cache, hostname, session, timestamp) VALUES ('%s', %d, %d, '%s', '%s', %d)", $key, $user->uid, isset($user->cache) ? $user->cache : 0, ip_address(), $value, REQUEST_TIME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
db_query("UPDATE {sessions} SET uid = %d, cache = %d, hostname = '%s', session = '%s', timestamp = %d WHERE sid = '%s'", $user->uid, isset($user->cache) ? $user->cache : 0, ip_address(), $value, $_SERVER['REQUEST_TIME'], $key);
|
db_query("UPDATE {sessions} SET uid = %d, cache = %d, hostname = '%s', session = '%s', timestamp = %d WHERE sid = '%s'", $user->uid, isset($user->cache) ? $user->cache : 0, ip_address(), $value, REQUEST_TIME, $key);
|
||||||
|
|
||||||
if (db_affected_rows()) {
|
if (db_affected_rows()) {
|
||||||
// Last access time is updated no more frequently
|
// Last access time is updated no more frequently
|
||||||
// than once every 180 seconds.
|
// than once every 180 seconds.
|
||||||
// This reduces contention in the users table.
|
// This reduces contention in the users table.
|
||||||
if ($user->uid && $_SERVER['REQUEST_TIME'] - $user->access > variable_get('session_write_interval', 180)) {
|
if ($user->uid && REQUEST_TIME - $user->access > variable_get('session_write_interval', 180)) {
|
||||||
db_query("UPDATE {users} SET access = %d WHERE uid = %d", $_SERVER['REQUEST_TIME'], $user->uid);
|
db_query("UPDATE {users} SET access = %d WHERE uid = %d", REQUEST_TIME, $user->uid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -227,7 +227,7 @@ function _sess_gc($lifetime) {
|
||||||
// for three weeks before deleting them, you need to set gc_maxlifetime
|
// for three weeks before deleting them, you need to set gc_maxlifetime
|
||||||
// to '1814400'. At that value, only after a user doesn't log in after
|
// to '1814400'. At that value, only after a user doesn't log in after
|
||||||
// three weeks (1814400 seconds) will his/her session be removed.
|
// three weeks (1814400 seconds) will his/her session be removed.
|
||||||
db_query("DELETE FROM {sessions} WHERE timestamp < %d", $_SERVER['REQUEST_TIME'] - $lifetime);
|
db_query("DELETE FROM {sessions} WHERE timestamp < %d", REQUEST_TIME - $lifetime);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ function aggregator_view() {
|
||||||
$header = array(t('Title'), t('Items'), t('Last update'), t('Next update'), array('data' => t('Operations'), 'colspan' => '3'));
|
$header = array(t('Title'), t('Items'), t('Last update'), t('Next update'), array('data' => t('Operations'), 'colspan' => '3'));
|
||||||
$rows = array();
|
$rows = array();
|
||||||
while ($feed = db_fetch_object($result)) {
|
while ($feed = db_fetch_object($result)) {
|
||||||
$rows[] = array(l($feed->title, "aggregator/sources/$feed->fid"), format_plural($feed->items, '1 item', '@count items'), ($feed->checked ? t('@time ago', array('@time' => format_interval($_SERVER['REQUEST_TIME'] - $feed->checked))) : t('never')), ($feed->checked ? t('%time left', array('%time' => format_interval($feed->checked + $feed->refresh - $_SERVER['REQUEST_TIME']))) : t('never')), l(t('edit'), "admin/content/aggregator/edit/feed/$feed->fid"), l(t('remove items'), "admin/content/aggregator/remove/$feed->fid"), l(t('update items'), "admin/content/aggregator/update/$feed->fid"));
|
$rows[] = array(l($feed->title, "aggregator/sources/$feed->fid"), format_plural($feed->items, '1 item', '@count items'), ($feed->checked ? t('@time ago', array('@time' => format_interval(REQUEST_TIME - $feed->checked))) : t('never')), ($feed->checked ? t('%time left', array('%time' => format_interval($feed->checked + $feed->refresh - REQUEST_TIME))) : t('never')), l(t('edit'), "admin/content/aggregator/edit/feed/$feed->fid"), l(t('remove items'), "admin/content/aggregator/remove/$feed->fid"), l(t('update items'), "admin/content/aggregator/update/$feed->fid"));
|
||||||
}
|
}
|
||||||
$output .= theme('table', $header, $rows);
|
$output .= theme('table', $header, $rows);
|
||||||
|
|
||||||
|
|
|
@ -281,7 +281,7 @@ function aggregator_perm() {
|
||||||
* Checks news feeds for updates once their refresh interval has elapsed.
|
* Checks news feeds for updates once their refresh interval has elapsed.
|
||||||
*/
|
*/
|
||||||
function aggregator_cron() {
|
function aggregator_cron() {
|
||||||
$result = db_query('SELECT * FROM {aggregator_feed} WHERE checked + refresh < %d', $_SERVER['REQUEST_TIME']);
|
$result = db_query('SELECT * FROM {aggregator_feed} WHERE checked + refresh < %d', REQUEST_TIME);
|
||||||
while ($feed = db_fetch_array($result)) {
|
while ($feed = db_fetch_array($result)) {
|
||||||
aggregator_refresh($feed);
|
aggregator_refresh($feed);
|
||||||
}
|
}
|
||||||
|
@ -592,7 +592,7 @@ function aggregator_refresh($feed) {
|
||||||
// Process HTTP response code.
|
// Process HTTP response code.
|
||||||
switch ($result->code) {
|
switch ($result->code) {
|
||||||
case 304:
|
case 304:
|
||||||
db_query('UPDATE {aggregator_feed} SET checked = %d WHERE fid = %d', $_SERVER['REQUEST_TIME'], $feed['fid']);
|
db_query('UPDATE {aggregator_feed} SET checked = %d WHERE fid = %d', REQUEST_TIME, $feed['fid']);
|
||||||
drupal_set_message(t('There is no new syndicated content from %site.', array('%site' => $feed['title'])));
|
drupal_set_message(t('There is no new syndicated content from %site.', array('%site' => $feed['title'])));
|
||||||
break;
|
break;
|
||||||
case 301:
|
case 301:
|
||||||
|
@ -606,7 +606,7 @@ function aggregator_refresh($feed) {
|
||||||
// data. If both are equal we say that feed is not updated.
|
// data. If both are equal we say that feed is not updated.
|
||||||
$md5 = md5($result->data);
|
$md5 = md5($result->data);
|
||||||
if ($feed['hash'] == $md5) {
|
if ($feed['hash'] == $md5) {
|
||||||
db_query('UPDATE {aggregator_feed} SET checked = %d WHERE fid = %d', $_SERVER['REQUEST_TIME'], $feed['fid']);
|
db_query('UPDATE {aggregator_feed} SET checked = %d WHERE fid = %d', REQUEST_TIME, $feed['fid']);
|
||||||
drupal_set_message(t('There is no new syndicated content from %site.', array('%site' => $feed['title'])));
|
drupal_set_message(t('There is no new syndicated content from %site.', array('%site' => $feed['title'])));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -636,7 +636,7 @@ function aggregator_refresh($feed) {
|
||||||
|
|
||||||
$etag = empty($result->headers['ETag']) ? '' : $result->headers['ETag'];
|
$etag = empty($result->headers['ETag']) ? '' : $result->headers['ETag'];
|
||||||
// Update the feed data.
|
// Update the feed data.
|
||||||
db_query("UPDATE {aggregator_feed} SET url = '%s', checked = %d, link = '%s', description = '%s', image = '%s', hash = '%s', etag = '%s', modified = %d WHERE fid = %d", $feed['url'], $_SERVER['REQUEST_TIME'], $channel['LINK'], $channel['DESCRIPTION'], $image, $md5, $etag, $modified, $feed['fid']);
|
db_query("UPDATE {aggregator_feed} SET url = '%s', checked = %d, link = '%s', description = '%s', image = '%s', hash = '%s', etag = '%s', modified = %d WHERE fid = %d", $feed['url'], REQUEST_TIME, $channel['LINK'], $channel['DESCRIPTION'], $image, $md5, $etag, $modified, $feed['fid']);
|
||||||
|
|
||||||
// Clear the cache.
|
// Clear the cache.
|
||||||
cache_clear_all();
|
cache_clear_all();
|
||||||
|
@ -803,14 +803,14 @@ function aggregator_parse_feed(&$data, $feed) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$timestamp) {
|
if (!$timestamp) {
|
||||||
$timestamp = isset($entry->timestamp) ? $entry->timestamp : $_SERVER['REQUEST_TIME'];
|
$timestamp = isset($entry->timestamp) ? $entry->timestamp : REQUEST_TIME;
|
||||||
}
|
}
|
||||||
$item += array('AUTHOR' => '', 'DESCRIPTION' => '');
|
$item += array('AUTHOR' => '', 'DESCRIPTION' => '');
|
||||||
aggregator_save_item(array('iid' => (isset($entry->iid) ? $entry->iid : ''), 'fid' => $feed['fid'], 'timestamp' => $timestamp, 'title' => $title, 'link' => $link, 'author' => $item['AUTHOR'], 'description' => $item['DESCRIPTION'], 'guid' => $guid));
|
aggregator_save_item(array('iid' => (isset($entry->iid) ? $entry->iid : ''), 'fid' => $feed['fid'], 'timestamp' => $timestamp, 'title' => $title, 'link' => $link, 'author' => $item['AUTHOR'], 'description' => $item['DESCRIPTION'], 'guid' => $guid));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove all items that are older than flush item timer.
|
// Remove all items that are older than flush item timer.
|
||||||
$age = $_SERVER['REQUEST_TIME'] - variable_get('aggregator_clear', 9676800);
|
$age = REQUEST_TIME - variable_get('aggregator_clear', 9676800);
|
||||||
$result = db_query('SELECT iid FROM {aggregator_item} WHERE fid = %d AND timestamp < %d', $feed['fid'], $age);
|
$result = db_query('SELECT iid FROM {aggregator_item} WHERE fid = %d AND timestamp < %d', $feed['fid'], $age);
|
||||||
|
|
||||||
$items = array();
|
$items = array();
|
||||||
|
|
|
@ -265,7 +265,7 @@ function template_preprocess_aggregator_item(&$variables) {
|
||||||
$variables['source_title'] = check_plain($item->ftitle);
|
$variables['source_title'] = check_plain($item->ftitle);
|
||||||
}
|
}
|
||||||
if (date('Ymd', $item->timestamp) == date('Ymd')) {
|
if (date('Ymd', $item->timestamp) == date('Ymd')) {
|
||||||
$variables['source_date'] = t('%ago ago', array('%ago' => format_interval($_SERVER['REQUEST_TIME'] - $item->timestamp)));
|
$variables['source_date'] = t('%ago ago', array('%ago' => format_interval(REQUEST_TIME - $item->timestamp)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$variables['source_date'] = format_date($item->timestamp, 'custom', variable_get('date_format_medium', 'D, m/d/Y - H:i'));
|
$variables['source_date'] = format_date($item->timestamp, 'custom', variable_get('date_format_medium', 'D, m/d/Y - H:i'));
|
||||||
|
@ -462,7 +462,7 @@ function template_preprocess_aggregator_summary_item(&$variables) {
|
||||||
|
|
||||||
$variables['feed_url'] = check_url($item->link);
|
$variables['feed_url'] = check_url($item->link);
|
||||||
$variables['feed_title'] = check_plain($item->title);
|
$variables['feed_title'] = check_plain($item->title);
|
||||||
$variables['feed_age'] = t('%age old', array('%age' => format_interval($_SERVER['REQUEST_TIME'] - $item->timestamp)));
|
$variables['feed_age'] = t('%age old', array('%age' => format_interval(REQUEST_TIME - $item->timestamp)));
|
||||||
|
|
||||||
$variables['source_url'] = '';
|
$variables['source_url'] = '';
|
||||||
$variables['source_title'] = '';
|
$variables['source_title'] = '';
|
||||||
|
@ -486,7 +486,7 @@ function template_preprocess_aggregator_feed_source(&$variables) {
|
||||||
$variables['source_url'] = check_url(url($feed->link, array('absolute' => TRUE)));
|
$variables['source_url'] = check_url(url($feed->link, array('absolute' => TRUE)));
|
||||||
|
|
||||||
if ($feed->checked) {
|
if ($feed->checked) {
|
||||||
$variables['last_checked'] = t('@time ago', array('@time' => format_interval($_SERVER['REQUEST_TIME'] - $feed->checked)));
|
$variables['last_checked'] = t('@time ago', array('@time' => format_interval(REQUEST_TIME - $feed->checked)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$variables['last_checked'] = t('never');
|
$variables['last_checked'] = t('never');
|
||||||
|
|
|
@ -218,7 +218,7 @@ function blogapi_blogger_new_post($appkey, $blogid, $username, $password, $conte
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user_access('administer nodes') && !isset($edit['date'])) {
|
if (user_access('administer nodes') && !isset($edit['date'])) {
|
||||||
$edit['date'] = format_date($_SERVER['REQUEST_TIME'], 'custom', 'Y-m-d H:i:s O');
|
$edit['date'] = format_date(REQUEST_TIME, 'custom', 'Y-m-d H:i:s O');
|
||||||
}
|
}
|
||||||
|
|
||||||
node_invoke_nodeapi($edit, 'blogapi new');
|
node_invoke_nodeapi($edit, 'blogapi new');
|
||||||
|
|
|
@ -14,11 +14,11 @@ function comment_enable() {
|
||||||
*/
|
*/
|
||||||
function comment_update_1() {
|
function comment_update_1() {
|
||||||
// Change any future last comment timestamps to current time.
|
// Change any future last comment timestamps to current time.
|
||||||
db_query('UPDATE {node_comment_statistics} SET last_comment_timestamp = %d WHERE last_comment_timestamp > %d', $_SERVER['REQUEST_TIME'], $_SERVER['REQUEST_TIME']);
|
db_query('UPDATE {node_comment_statistics} SET last_comment_timestamp = %d WHERE last_comment_timestamp > %d', REQUEST_TIME, REQUEST_TIME);
|
||||||
|
|
||||||
// Unstuck node indexing timestamp if needed.
|
// Unstuck node indexing timestamp if needed.
|
||||||
if (($last = variable_get('node_cron_last', FALSE)) !== FALSE) {
|
if (($last = variable_get('node_cron_last', FALSE)) !== FALSE) {
|
||||||
variable_set('node_cron_last', min($_SERVER['REQUEST_TIME'], $last));
|
variable_set('node_cron_last', min(REQUEST_TIME, $last));
|
||||||
}
|
}
|
||||||
|
|
||||||
return array();
|
return array();
|
||||||
|
|
|
@ -378,7 +378,7 @@ function theme_comment_block() {
|
||||||
$items = array();
|
$items = array();
|
||||||
$number = variable_get('comment_block_count', 10);
|
$number = variable_get('comment_block_count', 10);
|
||||||
foreach (comment_get_recent($number) as $comment) {
|
foreach (comment_get_recent($number) as $comment) {
|
||||||
$items[] = l($comment->subject, 'node/' . $comment->nid, array('fragment' => 'comment-' . $comment->cid)) . '<br />' . t('@time ago', array('@time' => format_interval($_SERVER['REQUEST_TIME'] - $comment->timestamp)));
|
$items[] = l($comment->subject, 'node/' . $comment->nid, array('fragment' => 'comment-' . $comment->cid)) . '<br />' . t('@time ago', array('@time' => format_interval(REQUEST_TIME - $comment->timestamp)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($items) {
|
if ($items) {
|
||||||
|
@ -712,7 +712,7 @@ function comment_save($edit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($edit['timestamp'])) {
|
if (empty($edit['timestamp'])) {
|
||||||
$edit['timestamp'] = $_SERVER['REQUEST_TIME'];
|
$edit['timestamp'] = REQUEST_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($edit['uid'] === $user->uid) { // '===' Need to modify anonymous users as well.
|
if ($edit['uid'] === $user->uid) { // '===' Need to modify anonymous users as well.
|
||||||
|
@ -1448,7 +1448,7 @@ function comment_form_add_preview($form, &$form_state) {
|
||||||
$comment->name = variable_get('anonymous', t('Anonymous'));
|
$comment->name = variable_get('anonymous', t('Anonymous'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$comment->timestamp = !empty($edit['timestamp']) ? $edit['timestamp'] : $_SERVER['REQUEST_TIME'];
|
$comment->timestamp = !empty($edit['timestamp']) ? $edit['timestamp'] : REQUEST_TIME;
|
||||||
$output .= theme('comment_view', $comment, $node);
|
$output .= theme('comment_view', $comment, $node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1490,7 +1490,7 @@ function comment_form_validate($form, &$form_state) {
|
||||||
foreach (array('name', 'homepage', 'mail') as $field) {
|
foreach (array('name', 'homepage', 'mail') as $field) {
|
||||||
// Set cookie for 365 days.
|
// Set cookie for 365 days.
|
||||||
if (isset($form_state['values'][$field])) {
|
if (isset($form_state['values'][$field])) {
|
||||||
setcookie('comment_info_' . $field, $form_state['values'][$field], $_SERVER['REQUEST_TIME'] + 31536000, '/');
|
setcookie('comment_info_' . $field, $form_state['values'][$field], REQUEST_TIME + 31536000, '/');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ class DBLogTestCase extends DrupalWebTestCase {
|
||||||
'request_uri' => $base_root . request_uri(),
|
'request_uri' => $base_root . request_uri(),
|
||||||
'referer' => $_SERVER['HTTP_REFERER'],
|
'referer' => $_SERVER['HTTP_REFERER'],
|
||||||
'ip' => ip_address(),
|
'ip' => ip_address(),
|
||||||
'timestamp' => $_SERVER['REQUEST_TIME'],
|
'timestamp' => REQUEST_TIME,
|
||||||
);
|
);
|
||||||
$message = 'Log entry added to test the dblog row limit.';
|
$message = 'Log entry added to test the dblog row limit.';
|
||||||
for ($i = 0; $i < $count; $i++) {
|
for ($i = 0; $i < $count; $i++) {
|
||||||
|
|
|
@ -446,7 +446,7 @@ function check_markup($text, $format = FILTER_FORMAT_DEFAULT, $check = TRUE) {
|
||||||
|
|
||||||
// Store in cache with a minimum expiration time of 1 day.
|
// Store in cache with a minimum expiration time of 1 day.
|
||||||
if ($cache) {
|
if ($cache) {
|
||||||
cache_set($cache_id, $text, 'cache_filter', $_SERVER['REQUEST_TIME'] + (60 * 60 * 24));
|
cache_set($cache_id, $text, 'cache_filter', REQUEST_TIME + (60 * 60 * 24));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -908,7 +908,7 @@ function template_preprocess_forum_topic_navigation(&$variables) {
|
||||||
*/
|
*/
|
||||||
function template_preprocess_forum_submitted(&$variables) {
|
function template_preprocess_forum_submitted(&$variables) {
|
||||||
$variables['author'] = isset($variables['topic']->uid) ? theme('username', $variables['topic']) : '';
|
$variables['author'] = isset($variables['topic']->uid) ? theme('username', $variables['topic']) : '';
|
||||||
$variables['time'] = isset($variables['topic']->timestamp) ? format_interval($_SERVER['REQUEST_TIME'] - $variables['topic']->timestamp) : '';
|
$variables['time'] = isset($variables['topic']->timestamp) ? format_interval(REQUEST_TIME - $variables['topic']->timestamp) : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function _forum_user_last_visit($nid) {
|
function _forum_user_last_visit($nid) {
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
* Nodes changed after this time may be marked new, updated, or read, depending
|
* Nodes changed after this time may be marked new, updated, or read, depending
|
||||||
* on their state for the current user. Defaults to 30 days ago.
|
* on their state for the current user. Defaults to 30 days ago.
|
||||||
*/
|
*/
|
||||||
define('NODE_NEW_LIMIT', $_SERVER['REQUEST_TIME'] - 30 * 24 * 60 * 60);
|
define('NODE_NEW_LIMIT', REQUEST_TIME - 30 * 24 * 60 * 60);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Node is being built before being viewed normally.
|
* Node is being built before being viewed normally.
|
||||||
|
@ -188,10 +188,10 @@ function node_tag_new($nid) {
|
||||||
|
|
||||||
if ($user->uid) {
|
if ($user->uid) {
|
||||||
if (node_last_viewed($nid)) {
|
if (node_last_viewed($nid)) {
|
||||||
db_query('UPDATE {history} SET timestamp = %d WHERE uid = %d AND nid = %d', $_SERVER['REQUEST_TIME'], $user->uid, $nid);
|
db_query('UPDATE {history} SET timestamp = %d WHERE uid = %d AND nid = %d', REQUEST_TIME, $user->uid, $nid);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@db_query('INSERT INTO {history} (uid, nid, timestamp) VALUES (%d, %d, %d)', $user->uid, $nid, $_SERVER['REQUEST_TIME']);
|
@db_query('INSERT INTO {history} (uid, nid, timestamp) VALUES (%d, %d, %d)', $user->uid, $nid, REQUEST_TIME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -880,7 +880,7 @@ function node_submit($node) {
|
||||||
$node->uid = 0;
|
$node->uid = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$node->created = !empty($node->date) ? strtotime($node->date) : $_SERVER['REQUEST_TIME'];
|
$node->created = !empty($node->date) ? strtotime($node->date) : REQUEST_TIME;
|
||||||
$node->validated = TRUE;
|
$node->validated = TRUE;
|
||||||
|
|
||||||
return $node;
|
return $node;
|
||||||
|
@ -932,12 +932,12 @@ function node_save(&$node) {
|
||||||
|
|
||||||
// Set some required fields:
|
// Set some required fields:
|
||||||
if (empty($node->created)) {
|
if (empty($node->created)) {
|
||||||
$node->created = $_SERVER['REQUEST_TIME'];
|
$node->created = REQUEST_TIME;
|
||||||
}
|
}
|
||||||
// The changed timestamp is always updated for bookkeeping purposes (revisions, searching, ...)
|
// The changed timestamp is always updated for bookkeeping purposes (revisions, searching, ...)
|
||||||
$node->changed = $_SERVER['REQUEST_TIME'];
|
$node->changed = REQUEST_TIME;
|
||||||
|
|
||||||
$node->timestamp = $_SERVER['REQUEST_TIME'];
|
$node->timestamp = REQUEST_TIME;
|
||||||
$node->format = isset($node->format) ? $node->format : FILTER_FORMAT_DEFAULT;
|
$node->format = isset($node->format) ? $node->format : FILTER_FORMAT_DEFAULT;
|
||||||
$update_node = TRUE;
|
$update_node = TRUE;
|
||||||
|
|
||||||
|
@ -1221,7 +1221,7 @@ function node_search($op = 'search', $keys = NULL) {
|
||||||
return t('Content');
|
return t('Content');
|
||||||
|
|
||||||
case 'reset':
|
case 'reset':
|
||||||
db_query("UPDATE {search_dataset} SET reindex = %d WHERE type = 'node'", $_SERVER['REQUEST_TIME']);
|
db_query("UPDATE {search_dataset} SET reindex = %d WHERE type = 'node'", REQUEST_TIME);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case 'status':
|
case 'status':
|
||||||
|
|
|
@ -80,7 +80,7 @@ function node_object_prepare(&$node) {
|
||||||
}
|
}
|
||||||
global $user;
|
global $user;
|
||||||
$node->uid = $user->uid;
|
$node->uid = $user->uid;
|
||||||
$node->created = $_SERVER['REQUEST_TIME'];
|
$node->created = REQUEST_TIME;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$node->date = format_date($node->created, 'custom', 'Y-m-d H:i:s O');
|
$node->date = format_date($node->created, 'custom', 'Y-m-d H:i:s O');
|
||||||
|
@ -361,7 +361,7 @@ function node_preview($node) {
|
||||||
$node->picture = $user->picture;
|
$node->picture = $user->picture;
|
||||||
}
|
}
|
||||||
|
|
||||||
$node->changed = $_SERVER['REQUEST_TIME'];
|
$node->changed = REQUEST_TIME;
|
||||||
|
|
||||||
// Extract a teaser, if it hasn't been set (e.g. by a module-provided
|
// Extract a teaser, if it hasn't been set (e.g. by a module-provided
|
||||||
// 'teaser' form item).
|
// 'teaser' form item).
|
||||||
|
|
|
@ -333,7 +333,7 @@ function openid_association($op_endpoint) {
|
||||||
module_load_include('inc', 'openid');
|
module_load_include('inc', 'openid');
|
||||||
|
|
||||||
// Remove Old Associations:
|
// Remove Old Associations:
|
||||||
db_query("DELETE FROM {openid_association} WHERE created + expires_in < %d", $_SERVER['REQUEST_TIME']);
|
db_query("DELETE FROM {openid_association} WHERE created + expires_in < %d", REQUEST_TIME);
|
||||||
|
|
||||||
// Check to see if we have an association for this IdP already
|
// Check to see if we have an association for this IdP already
|
||||||
$assoc_handle = db_result(db_query("SELECT assoc_handle FROM {openid_association} WHERE idp_endpoint_uri = '%s'", $op_endpoint));
|
$assoc_handle = db_result(db_query("SELECT assoc_handle FROM {openid_association} WHERE idp_endpoint_uri = '%s'", $op_endpoint));
|
||||||
|
@ -367,7 +367,7 @@ function openid_association($op_endpoint) {
|
||||||
$assoc_response['mac_key'] = base64_encode(_openid_dh_xorsecret($shared, $enc_mac_key));
|
$assoc_response['mac_key'] = base64_encode(_openid_dh_xorsecret($shared, $enc_mac_key));
|
||||||
}
|
}
|
||||||
db_query("INSERT INTO {openid_association} (idp_endpoint_uri, session_type, assoc_handle, assoc_type, expires_in, mac_key, created) VALUES('%s', '%s', '%s', '%s', %d, '%s', %d)",
|
db_query("INSERT INTO {openid_association} (idp_endpoint_uri, session_type, assoc_handle, assoc_type, expires_in, mac_key, created) VALUES('%s', '%s', '%s', '%s', %d, '%s', %d)",
|
||||||
$op_endpoint, $assoc_response['session_type'], $assoc_response['assoc_handle'], $assoc_response['assoc_type'], $assoc_response['expires_in'], $assoc_response['mac_key'], $_SERVER['REQUEST_TIME']);
|
$op_endpoint, $assoc_response['session_type'], $assoc_response['assoc_handle'], $assoc_response['assoc_type'], $assoc_response['expires_in'], $assoc_response['mac_key'], REQUEST_TIME);
|
||||||
|
|
||||||
$assoc_handle = $assoc_response['assoc_handle'];
|
$assoc_handle = $assoc_response['assoc_handle'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,7 +161,7 @@ function poll_block($op = 'list', $delta = '') {
|
||||||
* Closes polls that have exceeded their allowed runtime.
|
* Closes polls that have exceeded their allowed runtime.
|
||||||
*/
|
*/
|
||||||
function poll_cron() {
|
function poll_cron() {
|
||||||
$result = db_query('SELECT p.nid FROM {poll} p INNER JOIN {node} n ON p.nid = n.nid WHERE (n.created + p.runtime) < ' . $_SERVER['REQUEST_TIME'] . ' AND p.active = 1 AND p.runtime != 0');
|
$result = db_query('SELECT p.nid FROM {poll} p INNER JOIN {node} n ON p.nid = n.nid WHERE (n.created + p.runtime) < ' . REQUEST_TIME . ' AND p.active = 1 AND p.runtime != 0');
|
||||||
while ($poll = db_fetch_object($result)) {
|
while ($poll = db_fetch_object($result)) {
|
||||||
db_query("UPDATE {poll} SET active = 0 WHERE nid = %d", $poll->nid);
|
db_query("UPDATE {poll} SET active = 0 WHERE nid = %d", $poll->nid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -622,7 +622,7 @@ function search_index($sid, $type, $text) {
|
||||||
* The nid of the node that needs reindexing.
|
* The nid of the node that needs reindexing.
|
||||||
*/
|
*/
|
||||||
function search_touch_node($nid) {
|
function search_touch_node($nid) {
|
||||||
db_query("UPDATE {search_dataset} SET reindex = %d WHERE sid = %d AND type = 'node'", $_SERVER['REQUEST_TIME'], $nid);
|
db_query("UPDATE {search_dataset} SET reindex = %d WHERE sid = %d AND type = 'node'", REQUEST_TIME, $nid);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -305,7 +305,7 @@ class SearchRankingTestCase extends DrupalWebTestCase {
|
||||||
$settings['body'] .= " really rocks";
|
$settings['body'] .= " really rocks";
|
||||||
break;
|
break;
|
||||||
case 'recent':
|
case 'recent':
|
||||||
$settings['created'] = $_SERVER['REQUEST_TIME'] + 3600;
|
$settings['created'] = REQUEST_TIME + 3600;
|
||||||
break;
|
break;
|
||||||
case 'comments':
|
case 'comments':
|
||||||
$settings['comment'] = 2;
|
$settings['comment'] = 2;
|
||||||
|
|
|
@ -369,7 +369,7 @@ class DrupalWebTestCase {
|
||||||
'body' => $this->randomName(32),
|
'body' => $this->randomName(32),
|
||||||
'title' => $this->randomName(8),
|
'title' => $this->randomName(8),
|
||||||
'comment' => 2,
|
'comment' => 2,
|
||||||
'changed' => $_SERVER['REQUEST_TIME'],
|
'changed' => REQUEST_TIME,
|
||||||
'format' => FILTER_FORMAT_DEFAULT,
|
'format' => FILTER_FORMAT_DEFAULT,
|
||||||
'moderate' => 0,
|
'moderate' => 0,
|
||||||
'promote' => 0,
|
'promote' => 0,
|
||||||
|
|
|
@ -428,7 +428,7 @@ class FileCopyDeleteMoveTest extends DrupalWebTestCase {
|
||||||
touch($f->filepath);
|
touch($f->filepath);
|
||||||
$f->filemime = 'text/plain';
|
$f->filemime = 'text/plain';
|
||||||
$f->uid = 1;
|
$f->uid = 1;
|
||||||
$f->timestamp = $_SERVER['REQUEST_TIME'];
|
$f->timestamp = REQUEST_TIME;
|
||||||
$f->filesize = 0;
|
$f->filesize = 0;
|
||||||
drupal_write_record('files', $f);
|
drupal_write_record('files', $f);
|
||||||
$this->file = $f;
|
$this->file = $f;
|
||||||
|
|
|
@ -66,7 +66,7 @@ class XMLRPCValidator1IncTestCase extends DrupalWebTestCase {
|
||||||
$bool_5 = (($int_5 % 2) == 0);
|
$bool_5 = (($int_5 % 2) == 0);
|
||||||
$string_5 = $this->randomName();
|
$string_5 = $this->randomName();
|
||||||
$double_5 = (double)(mt_rand(-1000,1000) / 100);
|
$double_5 = (double)(mt_rand(-1000,1000) / 100);
|
||||||
$time_5 = $_SERVER['REQUEST_TIME'];
|
$time_5 = REQUEST_TIME;
|
||||||
$base64_5 = $this->randomName(100);
|
$base64_5 = $this->randomName(100);
|
||||||
$l_res_5 = xmlrpc_test_manyTypesTest($int_5, $bool_5, $string_5, $double_5, xmlrpc_date($time_5), $base64_5);
|
$l_res_5 = xmlrpc_test_manyTypesTest($int_5, $bool_5, $string_5, $double_5, xmlrpc_date($time_5), $base64_5);
|
||||||
$l_res_5[5] = $l_res_5[5]->data; /* override warpping */
|
$l_res_5[5] = $l_res_5[5]->data; /* override warpping */
|
||||||
|
|
|
@ -122,7 +122,7 @@ function statistics_top_referrers() {
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
while ($referrer = db_fetch_object($result)) {
|
while ($referrer = db_fetch_object($result)) {
|
||||||
$rows[] = array($referrer->hits, _statistics_link($referrer->url), t('@time ago', array('@time' => format_interval($_SERVER['REQUEST_TIME'] - $referrer->last))));
|
$rows[] = array($referrer->hits, _statistics_link($referrer->url), t('@time ago', array('@time' => format_interval(REQUEST_TIME - $referrer->last))));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($rows)) {
|
if (empty($rows)) {
|
||||||
|
|
|
@ -55,7 +55,7 @@ function statistics_exit() {
|
||||||
'daycount' => 1,
|
'daycount' => 1,
|
||||||
'totalcount' => 1,
|
'totalcount' => 1,
|
||||||
'nid' => arg(1),
|
'nid' => arg(1),
|
||||||
'timestamp' => $_SERVER['REQUEST_TIME'],
|
'timestamp' => REQUEST_TIME,
|
||||||
);
|
);
|
||||||
db_merge('node_counter')
|
db_merge('node_counter')
|
||||||
->fields($fields)
|
->fields($fields)
|
||||||
|
@ -74,7 +74,7 @@ function statistics_exit() {
|
||||||
'uid' => $user->uid,
|
'uid' => $user->uid,
|
||||||
'sid' => session_id(),
|
'sid' => session_id(),
|
||||||
'timer' => timer_read('page'),
|
'timer' => timer_read('page'),
|
||||||
'timestamp' => $_SERVER['REQUEST_TIME'],
|
'timestamp' => REQUEST_TIME,
|
||||||
))->execute();
|
))->execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -188,14 +188,14 @@ function statistics_user($op, &$edit, &$user) {
|
||||||
function statistics_cron() {
|
function statistics_cron() {
|
||||||
$statistics_timestamp = variable_get('statistics_day_timestamp', '');
|
$statistics_timestamp = variable_get('statistics_day_timestamp', '');
|
||||||
|
|
||||||
if (($_SERVER['REQUEST_TIME'] - $statistics_timestamp) >= 86400) {
|
if ((REQUEST_TIME - $statistics_timestamp) >= 86400) {
|
||||||
// Reset day counts.
|
// Reset day counts.
|
||||||
db_query('UPDATE {node_counter} SET daycount = 0');
|
db_query('UPDATE {node_counter} SET daycount = 0');
|
||||||
variable_set('statistics_day_timestamp', $_SERVER['REQUEST_TIME']);
|
variable_set('statistics_day_timestamp', REQUEST_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up expired access logs.
|
// Clean up expired access logs.
|
||||||
db_query('DELETE FROM {accesslog} WHERE timestamp < %d', $_SERVER['REQUEST_TIME'] - variable_get('statistics_flush_accesslog_timer', 259200));
|
db_query('DELETE FROM {accesslog} WHERE timestamp < %d', REQUEST_TIME - variable_get('statistics_flush_accesslog_timer', 259200));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,7 +23,7 @@ class StatisticsBlockVisitorsTestCase extends DrupalWebTestCase {
|
||||||
$this->blocking_user = $this->drupalCreateUser(array('block IP addresses', 'access statistics'));
|
$this->blocking_user = $this->drupalCreateUser(array('block IP addresses', 'access statistics'));
|
||||||
|
|
||||||
// Insert dummy access by anonymous user into access log.
|
// Insert dummy access by anonymous user into access log.
|
||||||
db_query("INSERT INTO {accesslog} (title, path, url, hostname, uid, sid, timer, timestamp) values('%s', '%s', '%s', '%s', %d, '%s', %d, %d)", 'test', 'node/1', 'http://example.com', '192.168.1.1', '0', '10', '10', $_SERVER['REQUEST_TIME']);
|
db_query("INSERT INTO {accesslog} (title, path, url, hostname, uid, sid, timer, timestamp) values('%s', '%s', '%s', '%s', %d, '%s', %d, %d)", 'test', 'node/1', 'http://example.com', '192.168.1.1', '0', '10', '10', REQUEST_TIME);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1557,13 +1557,13 @@ function system_date_time_settings() {
|
||||||
|
|
||||||
// Date settings: construct choices for user
|
// Date settings: construct choices for user
|
||||||
foreach ($date_short as $f) {
|
foreach ($date_short as $f) {
|
||||||
$date_short_choices[$f] = format_date($_SERVER['REQUEST_TIME'], 'custom', $f);
|
$date_short_choices[$f] = format_date(REQUEST_TIME, 'custom', $f);
|
||||||
}
|
}
|
||||||
foreach ($date_medium as $f) {
|
foreach ($date_medium as $f) {
|
||||||
$date_medium_choices[$f] = format_date($_SERVER['REQUEST_TIME'], 'custom', $f);
|
$date_medium_choices[$f] = format_date(REQUEST_TIME, 'custom', $f);
|
||||||
}
|
}
|
||||||
foreach ($date_long as $f) {
|
foreach ($date_long as $f) {
|
||||||
$date_long_choices[$f] = format_date($_SERVER['REQUEST_TIME'], 'custom', $f);
|
$date_long_choices[$f] = format_date(REQUEST_TIME, 'custom', $f);
|
||||||
}
|
}
|
||||||
|
|
||||||
$date_long_choices['custom'] = $date_medium_choices['custom'] = $date_short_choices['custom'] = t('Custom format');
|
$date_long_choices['custom'] = $date_medium_choices['custom'] = $date_short_choices['custom'] = t('Custom format');
|
||||||
|
@ -1622,7 +1622,7 @@ function system_date_time_settings() {
|
||||||
'#title' => t('Custom short date format'),
|
'#title' => t('Custom short date format'),
|
||||||
'#attributes' => array('class' => 'custom-format'),
|
'#attributes' => array('class' => 'custom-format'),
|
||||||
'#default_value' => $default_short_custom,
|
'#default_value' => $default_short_custom,
|
||||||
'#description' => t('A user-defined short date format. See the <a href="@url">PHP manual</a> for available options. This format is currently set to display as <span>%date</span>.', array('@url' => 'http://php.net/manual/function.date.php', '%date' => format_date($_SERVER['REQUEST_TIME'], 'custom', $default_short_custom))),
|
'#description' => t('A user-defined short date format. See the <a href="@url">PHP manual</a> for available options. This format is currently set to display as <span>%date</span>.', array('@url' => 'http://php.net/manual/function.date.php', '%date' => format_date(REQUEST_TIME, 'custom', $default_short_custom))),
|
||||||
);
|
);
|
||||||
|
|
||||||
$date_format_medium = variable_get('date_format_medium', $date_medium[1]);
|
$date_format_medium = variable_get('date_format_medium', $date_medium[1]);
|
||||||
|
@ -1645,7 +1645,7 @@ function system_date_time_settings() {
|
||||||
'#title' => t('Custom medium date format'),
|
'#title' => t('Custom medium date format'),
|
||||||
'#attributes' => array('class' => 'custom-format'),
|
'#attributes' => array('class' => 'custom-format'),
|
||||||
'#default_value' => $default_medium_custom,
|
'#default_value' => $default_medium_custom,
|
||||||
'#description' => t('A user-defined medium date format. See the <a href="@url">PHP manual</a> for available options. This format is currently set to display as <span>%date</span>.', array('@url' => 'http://php.net/manual/function.date.php', '%date' => format_date($_SERVER['REQUEST_TIME'], 'custom', $default_medium_custom))),
|
'#description' => t('A user-defined medium date format. See the <a href="@url">PHP manual</a> for available options. This format is currently set to display as <span>%date</span>.', array('@url' => 'http://php.net/manual/function.date.php', '%date' => format_date(REQUEST_TIME, 'custom', $default_medium_custom))),
|
||||||
);
|
);
|
||||||
|
|
||||||
$date_format_long = variable_get('date_format_long', $date_long[0]);
|
$date_format_long = variable_get('date_format_long', $date_long[0]);
|
||||||
|
@ -1668,7 +1668,7 @@ function system_date_time_settings() {
|
||||||
'#title' => t('Custom long date format'),
|
'#title' => t('Custom long date format'),
|
||||||
'#attributes' => array('class' => 'custom-format'),
|
'#attributes' => array('class' => 'custom-format'),
|
||||||
'#default_value' => $default_long_custom,
|
'#default_value' => $default_long_custom,
|
||||||
'#description' => t('A user-defined long date format. See the <a href="@url">PHP manual</a> for available options. This format is currently set to display as <span>%date</span>.', array('@url' => 'http://php.net/manual/function.date.php', '%date' => format_date($_SERVER['REQUEST_TIME'], 'custom', $default_long_custom))),
|
'#description' => t('A user-defined long date format. See the <a href="@url">PHP manual</a> for available options. This format is currently set to display as <span>%date</span>.', array('@url' => 'http://php.net/manual/function.date.php', '%date' => format_date(REQUEST_TIME, 'custom', $default_long_custom))),
|
||||||
);
|
);
|
||||||
|
|
||||||
$form = system_settings_form($form);
|
$form = system_settings_form($form);
|
||||||
|
@ -1697,7 +1697,7 @@ function system_date_time_settings_submit($form, &$form_state) {
|
||||||
* Return the date for a given format string via Ajax.
|
* Return the date for a given format string via Ajax.
|
||||||
*/
|
*/
|
||||||
function system_date_time_lookup() {
|
function system_date_time_lookup() {
|
||||||
$result = format_date($_SERVER['REQUEST_TIME'], 'custom', $_GET['format']);
|
$result = format_date(REQUEST_TIME, 'custom', $_GET['format']);
|
||||||
echo drupal_to_js($result);
|
echo drupal_to_js($result);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,10 +143,10 @@ function system_requirements($phase) {
|
||||||
|
|
||||||
// Determine severity based on time since cron last ran.
|
// Determine severity based on time since cron last ran.
|
||||||
$severity = REQUIREMENT_OK;
|
$severity = REQUIREMENT_OK;
|
||||||
if ($_SERVER['REQUEST_TIME'] - $cron_last > $threshold_error) {
|
if (REQUEST_TIME - $cron_last > $threshold_error) {
|
||||||
$severity = REQUIREMENT_ERROR;
|
$severity = REQUIREMENT_ERROR;
|
||||||
}
|
}
|
||||||
else if ($never_run || ($_SERVER['REQUEST_TIME'] - $cron_last > $threshold_warning)) {
|
else if ($never_run || (REQUEST_TIME - $cron_last > $threshold_warning)) {
|
||||||
$severity = REQUIREMENT_WARNING;
|
$severity = REQUIREMENT_WARNING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ function system_requirements($phase) {
|
||||||
$description = $t('Cron has not run.') . ' ' . $help;
|
$description = $t('Cron has not run.') . ' ' . $help;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$summary = $t('Last run !time ago', array('!time' => format_interval($_SERVER['REQUEST_TIME'] - $cron_last)));
|
$summary = $t('Last run !time ago', array('!time' => format_interval(REQUEST_TIME - $cron_last)));
|
||||||
$description = '';
|
$description = '';
|
||||||
if ($severity != REQUIREMENT_OK) {
|
if ($severity != REQUIREMENT_OK) {
|
||||||
$description = $t('Cron has not run recently.') . ' ' . $help;
|
$description = $t('Cron has not run recently.') . ' ' . $help;
|
||||||
|
@ -371,7 +371,7 @@ function system_install() {
|
||||||
// presumed to be a serialized array. Install will change uid 1 immediately
|
// presumed to be a serialized array. Install will change uid 1 immediately
|
||||||
// anyways. So we insert the superuser here, the uid is 2 here for now, but
|
// anyways. So we insert the superuser here, the uid is 2 here for now, but
|
||||||
// very soon it will be changed to 1.
|
// very soon it will be changed to 1.
|
||||||
db_query("INSERT INTO {users} (name, mail, created, data) VALUES('%s', '%s', %d, '%s')", 'placeholder-for-uid-1', 'placeholder-for-uid-1', $_SERVER['REQUEST_TIME'], serialize(array()));
|
db_query("INSERT INTO {users} (name, mail, created, data) VALUES('%s', '%s', %d, '%s')", 'placeholder-for-uid-1', 'placeholder-for-uid-1', REQUEST_TIME, serialize(array()));
|
||||||
// This sets the above two users uid 0 (anonymous). We avoid an explicit 0
|
// This sets the above two users uid 0 (anonymous). We avoid an explicit 0
|
||||||
// otherwise MySQL might insert the next auto_increment value.
|
// otherwise MySQL might insert the next auto_increment value.
|
||||||
db_query("UPDATE {users} SET uid = uid - uid WHERE name = '%s'", '');
|
db_query("UPDATE {users} SET uid = uid - uid WHERE name = '%s'", '');
|
||||||
|
|
|
@ -1397,12 +1397,12 @@ function system_get_module_admin_tasks($module) {
|
||||||
*/
|
*/
|
||||||
function system_cron() {
|
function system_cron() {
|
||||||
// Cleanup the flood.
|
// Cleanup the flood.
|
||||||
db_query('DELETE FROM {flood} WHERE timestamp < %d', $_SERVER['REQUEST_TIME'] - 3600);
|
db_query('DELETE FROM {flood} WHERE timestamp < %d', REQUEST_TIME - 3600);
|
||||||
// Cleanup the batch table.
|
// Cleanup the batch table.
|
||||||
db_query('DELETE FROM {batch} WHERE timestamp < %d', $_SERVER['REQUEST_TIME'] - 864000);
|
db_query('DELETE FROM {batch} WHERE timestamp < %d', REQUEST_TIME - 864000);
|
||||||
|
|
||||||
// Remove temporary files that are older than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
|
// Remove temporary files that are older than DRUPAL_MAXIMUM_TEMP_FILE_AGE.
|
||||||
$result = db_query('SELECT * FROM {files} WHERE status = %d and timestamp < %d', FILE_STATUS_TEMPORARY, $_SERVER['REQUEST_TIME'] - DRUPAL_MAXIMUM_TEMP_FILE_AGE);
|
$result = db_query('SELECT * FROM {files} WHERE status = %d and timestamp < %d', FILE_STATUS_TEMPORARY, REQUEST_TIME - DRUPAL_MAXIMUM_TEMP_FILE_AGE);
|
||||||
while ($file = db_fetch_object($result)) {
|
while ($file = db_fetch_object($result)) {
|
||||||
if (file_exists($file->filepath)) {
|
if (file_exists($file->filepath)) {
|
||||||
// If files that exist cannot be deleted, continue so the database remains
|
// If files that exist cannot be deleted, continue so the database remains
|
||||||
|
@ -2033,7 +2033,7 @@ function system_block_ip_action() {
|
||||||
* Generate an array of time zones and their local time&date.
|
* Generate an array of time zones and their local time&date.
|
||||||
*/
|
*/
|
||||||
function _system_zonelist() {
|
function _system_zonelist() {
|
||||||
$timestamp = $_SERVER['REQUEST_TIME'];
|
$timestamp = REQUEST_TIME;
|
||||||
$zonelist = array(-11, -10, -9.5, -9, -8, -7, -6, -5, -4, -3.5, -3, -2, -1, 0, 1, 2, 3, 3.5, 4, 5, 5.5, 5.75, 6, 6.5, 7, 8, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 14);
|
$zonelist = array(-11, -10, -9.5, -9, -8, -7, -6, -5, -4, -3.5, -3, -2, -1, 0, 1, 2, 3, 3.5, 4, 5, 5.5, 5.75, 6, 6.5, 7, 8, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 14);
|
||||||
$zones = array();
|
$zones = array();
|
||||||
foreach ($zonelist as $offset) {
|
foreach ($zonelist as $offset) {
|
||||||
|
|
|
@ -54,7 +54,7 @@ function tracker_page($account = NULL, $set_title = FALSE) {
|
||||||
l($node->title, "node/$node->nid") . ' ' . theme('mark', node_mark($node->nid, $node->changed)),
|
l($node->title, "node/$node->nid") . ' ' . theme('mark', node_mark($node->nid, $node->changed)),
|
||||||
theme('username', $node),
|
theme('username', $node),
|
||||||
array('class' => 'replies', 'data' => $comments),
|
array('class' => 'replies', 'data' => $comments),
|
||||||
t('!time ago', array('!time' => format_interval($_SERVER['REQUEST_TIME'] - $node->last_updated)))
|
t('!time ago', array('!time' => format_interval(REQUEST_TIME - $node->last_updated)))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ function update_get_projects() {
|
||||||
_update_process_info_list($projects, module_rebuild_cache(), 'module');
|
_update_process_info_list($projects, module_rebuild_cache(), 'module');
|
||||||
_update_process_info_list($projects, system_theme_data(), 'theme');
|
_update_process_info_list($projects, system_theme_data(), 'theme');
|
||||||
// Set the projects array into the cache table.
|
// Set the projects array into the cache table.
|
||||||
cache_set('update_project_projects', $projects, 'cache_update', $_SERVER['REQUEST_TIME'] + 3600);
|
cache_set('update_project_projects', $projects, 'cache_update', REQUEST_TIME + 3600);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $projects;
|
return $projects;
|
||||||
|
@ -551,7 +551,7 @@ function update_calculate_project_data($available) {
|
||||||
drupal_alter('update_status', $projects);
|
drupal_alter('update_status', $projects);
|
||||||
|
|
||||||
// Set the projects array into the cache table.
|
// Set the projects array into the cache table.
|
||||||
cache_set('update_project_data', $projects, 'cache_update', $_SERVER['REQUEST_TIME'] + 3600);
|
cache_set('update_project_data', $projects, 'cache_update', REQUEST_TIME + 3600);
|
||||||
return $projects;
|
return $projects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -588,7 +588,7 @@ function update_project_cache($cid) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$cache = cache_get($cid, 'cache_update');
|
$cache = cache_get($cid, 'cache_update');
|
||||||
if (!empty($cache->data) && $cache->expire > $_SERVER['REQUEST_TIME']) {
|
if (!empty($cache->data) && $cache->expire > REQUEST_TIME) {
|
||||||
$projects = $cache->data;
|
$projects = $cache->data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,8 +52,8 @@ function _update_refresh() {
|
||||||
}
|
}
|
||||||
if (!empty($available) && is_array($available)) {
|
if (!empty($available) && is_array($available)) {
|
||||||
$frequency = variable_get('update_check_frequency', 1);
|
$frequency = variable_get('update_check_frequency', 1);
|
||||||
cache_set('update_info', $available, 'cache_update', $_SERVER['REQUEST_TIME'] + (60 * 60 * 24 * $frequency));
|
cache_set('update_info', $available, 'cache_update', REQUEST_TIME + (60 * 60 * 24 * $frequency));
|
||||||
variable_set('update_last_check', $_SERVER['REQUEST_TIME']);
|
variable_set('update_last_check', REQUEST_TIME);
|
||||||
watchdog('update', 'Fetched information about all available new releases and updates.', array(), WATCHDOG_NOTICE, l(t('view'), 'admin/reports/updates'));
|
watchdog('update', 'Fetched information about all available new releases and updates.', array(), WATCHDOG_NOTICE, l(t('view'), 'admin/reports/updates'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -276,7 +276,7 @@ function _update_requirement_check($project, $type) {
|
||||||
function update_cron() {
|
function update_cron() {
|
||||||
$frequency = variable_get('update_check_frequency', 1);
|
$frequency = variable_get('update_check_frequency', 1);
|
||||||
$interval = 60 * 60 * 24 * $frequency;
|
$interval = 60 * 60 * 24 * $frequency;
|
||||||
if ($_SERVER['REQUEST_TIME'] - variable_get('update_last_check', 0) > $interval) {
|
if (REQUEST_TIME - variable_get('update_last_check', 0) > $interval) {
|
||||||
update_refresh();
|
update_refresh();
|
||||||
_update_cron_notify();
|
_update_cron_notify();
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,7 @@ function update_get_available($refresh = FALSE) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$needs_refresh && ($cache = cache_get('update_info', 'cache_update'))
|
if (!$needs_refresh && ($cache = cache_get('update_info', 'cache_update'))
|
||||||
&& $cache->expire > $_SERVER['REQUEST_TIME']) {
|
&& $cache->expire > REQUEST_TIME) {
|
||||||
$available = $cache->data;
|
$available = $cache->data;
|
||||||
}
|
}
|
||||||
elseif ($needs_refresh || $refresh) {
|
elseif ($needs_refresh || $refresh) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ function update_status() {
|
||||||
*/
|
*/
|
||||||
function theme_update_report($data) {
|
function theme_update_report($data) {
|
||||||
$last = variable_get('update_last_check', 0);
|
$last = variable_get('update_last_check', 0);
|
||||||
$output = '<div class="update checked">' . ($last ? t('Last checked: @time ago', array('@time' => format_interval($_SERVER['REQUEST_TIME'] - $last))) : t('Last checked: never'));
|
$output = '<div class="update checked">' . ($last ? t('Last checked: @time ago', array('@time' => format_interval(REQUEST_TIME - $last))) : t('Last checked: never'));
|
||||||
$output .= ' <span class="check-manually">(' . l(t('Check manually'), 'admin/reports/updates/check') . ')</span>';
|
$output .= ' <span class="check-manually">(' . l(t('Check manually'), 'admin/reports/updates/check') . ')</span>';
|
||||||
$output .= "</div>\n";
|
$output .= "</div>\n";
|
||||||
|
|
||||||
|
|
|
@ -180,8 +180,8 @@ function user_admin_account() {
|
||||||
}
|
}
|
||||||
asort($users_roles);
|
asort($users_roles);
|
||||||
$form['roles'][$account->uid][0] = array('#markup' => theme('item_list', $users_roles));
|
$form['roles'][$account->uid][0] = array('#markup' => theme('item_list', $users_roles));
|
||||||
$form['member_for'][$account->uid] = array('#markup' => format_interval($_SERVER['REQUEST_TIME'] - $account->created));
|
$form['member_for'][$account->uid] = array('#markup' => format_interval(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['last_access'][$account->uid] = array('#markup' => $account->access ? t('@time ago', array('@time' => format_interval(REQUEST_TIME - $account->access))) : t('never'));
|
||||||
$form['operations'][$account->uid] = array('#markup' => l(t('edit'), "user/$account->uid/edit", array('query' => $destination)));
|
$form['operations'][$account->uid] = array('#markup' => l(t('edit'), "user/$account->uid/edit", array('query' => $destination)));
|
||||||
}
|
}
|
||||||
$form['accounts'] = array(
|
$form['accounts'] = array(
|
||||||
|
|
|
@ -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
|
// Consider users edited by an administrator as logged in, if they haven't
|
||||||
// already, so anonymous users can view the profile (if allowed).
|
// already, so anonymous users can view the profile (if allowed).
|
||||||
if (empty($edit['access']) && empty($account->access) && user_access('administer users')) {
|
if (empty($edit['access']) && empty($account->access) && user_access('administer users')) {
|
||||||
$edit['access'] = $_SERVER['REQUEST_TIME'];
|
$edit['access'] = REQUEST_TIME;
|
||||||
}
|
}
|
||||||
foreach ($edit as $key => $value) {
|
foreach ($edit as $key => $value) {
|
||||||
// Fields that don't pertain to the users or user_roles
|
// Fields that don't pertain to the users or user_roles
|
||||||
|
@ -302,12 +302,12 @@ function user_save($account, $edit = array(), $category = 'account') {
|
||||||
else {
|
else {
|
||||||
// Allow 'created' to be set by the caller.
|
// Allow 'created' to be set by the caller.
|
||||||
if (!isset($edit['created'])) {
|
if (!isset($edit['created'])) {
|
||||||
$edit['created'] = $_SERVER['REQUEST_TIME'];
|
$edit['created'] = REQUEST_TIME;
|
||||||
}
|
}
|
||||||
// Consider users created by an administrator as already logged in, so
|
// Consider users created by an administrator as already logged in, so
|
||||||
// anonymous users can view the profile (if allowed).
|
// anonymous users can view the profile (if allowed).
|
||||||
if (empty($edit['access']) && user_access('administer users')) {
|
if (empty($edit['access']) && user_access('administer users')) {
|
||||||
$edit['access'] = $_SERVER['REQUEST_TIME'];
|
$edit['access'] = REQUEST_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
$success = drupal_write_record('users', $edit);
|
$success = drupal_write_record('users', $edit);
|
||||||
|
@ -653,7 +653,7 @@ function user_user($type, &$edit, &$account, $category = NULL) {
|
||||||
$account->content['summary']['member_for'] = array(
|
$account->content['summary']['member_for'] = array(
|
||||||
'#type' => 'user_profile_item',
|
'#type' => 'user_profile_item',
|
||||||
'#title' => t('Member for'),
|
'#title' => t('Member for'),
|
||||||
'#markup' => format_interval($_SERVER['REQUEST_TIME'] - $account->created),
|
'#markup' => format_interval(REQUEST_TIME - $account->created),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ($type == 'form' && $category == 'account') {
|
if ($type == 'form' && $category == 'account') {
|
||||||
|
@ -788,7 +788,7 @@ function user_block($op = 'list', $delta = '', $edit = array()) {
|
||||||
case 'online':
|
case 'online':
|
||||||
if (user_access('access content')) {
|
if (user_access('access content')) {
|
||||||
// Count users active within the defined period.
|
// Count users active within the defined period.
|
||||||
$interval = $_SERVER['REQUEST_TIME'] - variable_get('user_block_seconds_online', 900);
|
$interval = REQUEST_TIME - variable_get('user_block_seconds_online', 900);
|
||||||
|
|
||||||
// Perform database queries to gather online user lists. We use s.timestamp
|
// Perform database queries to gather online user lists. We use s.timestamp
|
||||||
// rather than u.access because it is much faster.
|
// 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));
|
watchdog('user', 'Session opened for %name.', array('%name' => $user->name));
|
||||||
// Update the user table timestamp noting user has logged in.
|
// Update the user table timestamp noting user has logged in.
|
||||||
// This is also used to invalidate one-time login links.
|
// This is also used to invalidate one-time login links.
|
||||||
$user->login = $_SERVER['REQUEST_TIME'];
|
$user->login = REQUEST_TIME;
|
||||||
db_query("UPDATE {users} SET login = %d WHERE uid = %d", $user->login, $user->uid);
|
db_query("UPDATE {users} SET login = %d WHERE uid = %d", $user->login, $user->uid);
|
||||||
user_module_invoke('login', $edit, $user);
|
user_module_invoke('login', $edit, $user);
|
||||||
drupal_session_regenerate();
|
drupal_session_regenerate();
|
||||||
|
@ -1380,7 +1380,7 @@ function user_external_login_register($name, $module) {
|
||||||
'pass' => user_password(),
|
'pass' => user_password(),
|
||||||
'init' => $name,
|
'init' => $name,
|
||||||
'status' => 1,
|
'status' => 1,
|
||||||
'access' => $_SERVER['REQUEST_TIME']
|
'access' => REQUEST_TIME
|
||||||
);
|
);
|
||||||
$account = user_save('', $userinfo);
|
$account = user_save('', $userinfo);
|
||||||
// Terminate if an error occured during user_save().
|
// 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) {
|
function user_pass_reset_url($account) {
|
||||||
$timestamp = $_SERVER['REQUEST_TIME'];
|
$timestamp = REQUEST_TIME;
|
||||||
return url("user/reset/$account->uid/$timestamp/" . user_pass_rehash($account->pass, $timestamp, $account->login), array('absolute' => TRUE));
|
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' => $base_url,
|
||||||
'!uri_brief' => preg_replace('!^https?://!', '', $base_url),
|
'!uri_brief' => preg_replace('!^https?://!', '', $base_url),
|
||||||
'!mailto' => $account->mail,
|
'!mailto' => $account->mail,
|
||||||
'!date' => format_date($_SERVER['REQUEST_TIME'], 'medium', '', NULL, $language->language),
|
'!date' => format_date(REQUEST_TIME, 'medium', '', NULL, $language->language),
|
||||||
'!login_uri' => url('user', array('absolute' => TRUE, 'language' => $language)),
|
'!login_uri' => url('user', array('absolute' => TRUE, 'language' => $language)),
|
||||||
'!edit_uri' => url('user/' . $account->uid . '/edit', array('absolute' => TRUE, 'language' => $language)),
|
'!edit_uri' => url('user/' . $account->uid . '/edit', array('absolute' => TRUE, 'language' => $language)),
|
||||||
);
|
);
|
||||||
|
|
|
@ -84,7 +84,7 @@ function user_pass_reset(&$form_state, $uid, $timestamp, $hashed_pass, $action =
|
||||||
else {
|
else {
|
||||||
// Time out, in seconds, until login URL expires. 24 hours = 86400 seconds.
|
// Time out, in seconds, until login URL expires. 24 hours = 86400 seconds.
|
||||||
$timeout = 86400;
|
$timeout = 86400;
|
||||||
$current = $_SERVER['REQUEST_TIME'];
|
$current = REQUEST_TIME;
|
||||||
// Some redundant checks for extra security ?
|
// Some redundant checks for extra security ?
|
||||||
if ($timestamp < $current && $account = user_load(array('uid' => $uid, 'status' => 1)) ) {
|
if ($timestamp < $current && $account = user_load(array('uid' => $uid, 'status' => 1)) ) {
|
||||||
// No time out for first time login.
|
// No time out for first time login.
|
||||||
|
|
|
@ -43,7 +43,7 @@ class UserRegistrationTestCase extends DrupalWebTestCase {
|
||||||
$this->assertEqual($user->mail, $mail, t('E-mail address matches.'));
|
$this->assertEqual($user->mail, $mail, t('E-mail address matches.'));
|
||||||
$this->assertEqual($user->theme, '', t('Correct theme field.'));
|
$this->assertEqual($user->theme, '', t('Correct theme field.'));
|
||||||
$this->assertEqual($user->signature, '', t('Correct signature field.'));
|
$this->assertEqual($user->signature, '', t('Correct signature field.'));
|
||||||
$this->assertTrue(($user->created > $_SERVER['REQUEST_TIME'] - 20 ), t('Correct creation time.'));
|
$this->assertTrue(($user->created > 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->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->timezone, variable_get('date_default_timezone', NULL), t('Correct timezone field.'));
|
||||||
$this->assertEqual($user->language, '', t('Correct language field.'));
|
$this->assertEqual($user->language, '', t('Correct language field.'));
|
||||||
|
|
Loading…
Reference in New Issue