Commit 05219169 authored by Dries's avatar Dries

- Patch #988878 by Shyamala, Dave Reid: system_tokens() references a not initialized variable.

parent a61ac857
......@@ -130,10 +130,13 @@ function system_token_info() {
*/
function system_tokens($type, $tokens, array $data = array(), array $options = array()) {
$url_options = array('absolute' => TRUE);
if (isset($language)) {
$url_options['language'] = $language;
if (isset($options['language'])) {
$url_options['language'] = $options['language'];
$language_code = $options['language']->language;
}
else {
$language_code = NULL;
}
$langcode = (isset($language) ? $language->language : NULL);
$sanitize = !empty($options['sanitize']);
$replacements = array();
......@@ -181,19 +184,19 @@ function system_tokens($type, $tokens, array $data = array(), array $options = a
foreach ($tokens as $name => $original) {
switch ($name) {
case 'short':
$replacements[$original] = format_date($date, 'short', '', NULL, $langcode);
$replacements[$original] = format_date($date, 'short', '', NULL, $language_code);
break;
case 'medium':
$replacements[$original] = format_date($date, 'medium', '', NULL, $langcode);
$replacements[$original] = format_date($date, 'medium', '', NULL, $language_code);
break;
case 'long':
$replacements[$original] = format_date($date, 'long', '', NULL, $langcode);
$replacements[$original] = format_date($date, 'long', '', NULL, $language_code);
break;
case 'since':
$replacements[$original] = format_interval((REQUEST_TIME - $date), 2, $langcode);
$replacements[$original] = format_interval((REQUEST_TIME - $date), 2, $language_code);
break;
case 'raw':
......@@ -204,7 +207,7 @@ function system_tokens($type, $tokens, array $data = array(), array $options = a
if ($created_tokens = token_find_with_prefix($tokens, 'custom')) {
foreach ($created_tokens as $name => $original) {
$replacements[$original] = format_date($date, 'custom', $name, NULL, $langcode);
$replacements[$original] = format_date($date, 'custom', $name, NULL, $language_code);
}
}
}
......@@ -242,7 +245,7 @@ function system_tokens($type, $tokens, array $data = array(), array $options = a
// These tokens are default variations on the chained tokens handled below.
case 'timestamp':
$replacements[$original] = format_date($file->timestamp, 'medium', '', NULL, $langcode);
$replacements[$original] = format_date($file->timestamp, 'medium', '', NULL, $language_code);
break;
case 'owner':
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment