summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2008-09-06 08:36:22 +0000
committerDries Buytaert <dries@buytaert.net>2008-09-06 08:36:22 +0000
commite5b0e5f76c0695a01d13c55147a8287df8750594 (patch)
treed4acfc3f1d038bccaea83e168fdd380d0dfa0708 /modules/system
parentcbb639a16ffec82f498ae689818b010e040bf5b4 (diff)
downloadbrdo-e5b0e5f76c0695a01d13c55147a8287df8750594.tar.gz
brdo-e5b0e5f76c0695a01d13c55147a8287df8750594.tar.bz2
- Patch #302763 by Dave Reid, Rob Loach: replace time() by ['REQUEST_TIME'] as per Rasmus' suggestion. Removed drupal_referrer() for consistency.
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/system.admin.inc14
-rw-r--r--modules/system/system.install8
-rw-r--r--modules/system/system.module8
3 files changed, 15 insertions, 15 deletions
diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc
index fb58f660e..c3f7e05b2 100644
--- a/modules/system/system.admin.inc
+++ b/modules/system/system.admin.inc
@@ -1557,13 +1557,13 @@ function system_date_time_settings() {
// Date settings: construct choices for user
foreach ($date_short as $f) {
- $date_short_choices[$f] = format_date(time(), 'custom', $f);
+ $date_short_choices[$f] = format_date($_SERVER['REQUEST_TIME'], 'custom', $f);
}
foreach ($date_medium as $f) {
- $date_medium_choices[$f] = format_date(time(), 'custom', $f);
+ $date_medium_choices[$f] = format_date($_SERVER['REQUEST_TIME'], 'custom', $f);
}
foreach ($date_long as $f) {
- $date_long_choices[$f] = format_date(time(), 'custom', $f);
+ $date_long_choices[$f] = format_date($_SERVER['REQUEST_TIME'], 'custom', $f);
}
$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'),
'#attributes' => array('class' => 'custom-format'),
'#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(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($_SERVER['REQUEST_TIME'], 'custom', $default_short_custom))),
);
$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'),
'#attributes' => array('class' => 'custom-format'),
'#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(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($_SERVER['REQUEST_TIME'], 'custom', $default_medium_custom))),
);
$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'),
'#attributes' => array('class' => 'custom-format'),
'#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(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($_SERVER['REQUEST_TIME'], 'custom', $default_long_custom))),
);
$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.
*/
function system_date_time_lookup() {
- $result = format_date(time(), 'custom', $_GET['format']);
+ $result = format_date($_SERVER['REQUEST_TIME'], 'custom', $_GET['format']);
echo drupal_to_js($result);
exit;
}
diff --git a/modules/system/system.install b/modules/system/system.install
index e4d7d8756..e133d55ec 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -143,10 +143,10 @@ function system_requirements($phase) {
// Determine severity based on time since cron last ran.
$severity = REQUIREMENT_OK;
- if (time() - $cron_last > $threshold_error) {
+ if ($_SERVER['REQUEST_TIME'] - $cron_last > $threshold_error) {
$severity = REQUIREMENT_ERROR;
}
- else if ($never_run || (time() - $cron_last > $threshold_warning)) {
+ else if ($never_run || ($_SERVER['REQUEST_TIME'] - $cron_last > $threshold_warning)) {
$severity = REQUIREMENT_WARNING;
}
@@ -163,7 +163,7 @@ function system_requirements($phase) {
$description = $t('Cron has not run.') . ' ' . $help;
}
else {
- $summary = $t('Last run !time ago', array('!time' => format_interval(time() - $cron_last)));
+ $summary = $t('Last run !time ago', array('!time' => format_interval($_SERVER['REQUEST_TIME'] - $cron_last)));
$description = '';
if ($severity != REQUIREMENT_OK) {
$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
// anyways. So we insert the superuser here, the uid is 2 here for now, but
// 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', 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', $_SERVER['REQUEST_TIME'], serialize(array()));
// This sets the above two users uid 0 (anonymous). We avoid an explicit 0
// otherwise MySQL might insert the next auto_increment value.
db_query("UPDATE {users} SET uid = uid - uid WHERE name = '%s'", '');
diff --git a/modules/system/system.module b/modules/system/system.module
index 005d21a89..9b9791f0f 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -1391,12 +1391,12 @@ function system_get_module_admin_tasks($module) {
*/
function system_cron() {
// Cleanup the flood.
- db_query('DELETE FROM {flood} WHERE timestamp < %d', time() - 3600);
+ db_query('DELETE FROM {flood} WHERE timestamp < %d', $_SERVER['REQUEST_TIME'] - 3600);
// Cleanup the batch table.
- db_query('DELETE FROM {batch} WHERE timestamp < %d', time() - 864000);
+ db_query('DELETE FROM {batch} WHERE timestamp < %d', $_SERVER['REQUEST_TIME'] - 864000);
// 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, time() - 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);
while ($file = db_fetch_object($result)) {
if (file_exists($file->filepath)) {
// If files that exist cannot be deleted, continue so the database remains
@@ -2027,7 +2027,7 @@ function system_block_ip_action() {
* Generate an array of time zones and their local time&date.
*/
function _system_zonelist() {
- $timestamp = time();
+ $timestamp = $_SERVER['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);
$zones = array();
foreach ($zonelist as $offset) {