security update core+modules

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-26 18:38:56 +02:00
parent 2f45ea820a
commit 7c96373038
1022 changed files with 30319 additions and 11259 deletions

View File

@@ -9,9 +9,9 @@ configure = admin/config/regional/i18n/node
files[]=i18n_node.test
files[]=i18n_node.variable.inc
; Information added by drupal.org packaging script on 2013-01-13
version = "7.x-1.8"
; Information added by Drupal.org packaging script on 2015-01-26
version = "7.x-1.12"
core = "7.x"
project = "i18n"
datestamp = "1358075001"
datestamp = "1422286982"

View File

@@ -54,7 +54,7 @@ function i18n_node_block_view_system_help_alter(&$block) {
$arg = drupal_help_arg(arg(NULL));
if ($arg[0] == 'node' && $arg[1] == 'add' && $arg[2]) {
if (($type = node_type_get_type(str_replace('-', '_', $arg[2]))) && !empty($type->help)) {
$help = i18n_node_translate_type($type, 'help');
$help = i18n_node_translate_type($type, 'help', NULL, array('sanitize' => FALSE));
if ($help !== $type->help) {
$block['content'] = str_replace(filter_xss_admin($type->help), filter_xss_admin($help), $block['content']);
}
@@ -64,7 +64,7 @@ function i18n_node_block_view_system_help_alter(&$block) {
$node = menu_get_object();
if ($node && isset($node->type)) {
$type = node_type_get_type($node->type);
$help = i18n_node_translate_type($type, 'help');
$help = i18n_node_translate_type($type, 'help', NULL, array('sanitize' => FALSE));
if ($help !== $type->help) {
$block['content'] = str_replace(filter_xss_admin($type->help), filter_xss_admin($help), $block['content']);
}
@@ -121,6 +121,8 @@ function i18n_node_i18n_translate_path($path) {
'href' => 'node/' . $node_translation->nid . $matches[2],
'title' => $node_translation->title,
'object' => $node_translation,
// Performance: for node view add access information right away.
'access' => !$matches[2] ? $node_translation->status : NULL,
);
}
return $result;
@@ -347,7 +349,7 @@ function i18n_node_textfield_process($element) {
static $sent = FALSE;
// Ensure we send the Javascript only once.
if (!$sent && isset($element['#autocomplete_path']) && !empty($element['#autocomplete_path']) && variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE) != LANGUAGE_NEGOTIATION_NONE) {
if (!$sent && isset($element['#autocomplete_path']) && !empty($element['#autocomplete_path']) && variable_get('language_negotiation', LANGUAGE_NEGOTIATION_DEFAULT) != LANGUAGE_NEGOTIATION_DEFAULT) {
// Add a JS file for node forms.
// Determine if we are either editing or translating an existing node.
// We can't act on regular node creation because we don't have a specified
@@ -442,7 +444,7 @@ function i18n_node_form_node_form_alter(&$form, $form_state) {
*
* @see http://drupal.org/node/765860
*/
// Replace core's node submit callback with our own,
// in order to translate the node type name.
$key = array_search('node_form_submit', $form['actions']['submit']['#submit']);
@@ -464,8 +466,7 @@ function i18n_node_form_submit($form, &$form_state) {
$insert = empty($node->nid);
node_save($node);
$node_link = l(t('view'), 'node/' . $node->nid);
$type = node_type_get_type($node->type);
$type_name = i18n_node_translate_type($type);
$type_name = i18n_node_type_name($node->type);
$watchdog_args = array('@type' => $node->type, '%title' => $node->title);
$t_args = array('@type' => $type_name, '%title' => $node->title);
@@ -481,7 +482,7 @@ function i18n_node_form_submit($form, &$form_state) {
if ($node->nid) {
$form_state['values']['nid'] = $node->nid;
$form_state['nid'] = $node->nid;
$form_state['redirect'] = 'node/' . $node->nid;
$form_state['redirect'] = node_access('view', $node) ? 'node/' . $node->nid : '<front>';
}
else {
// In the unlikely case something went wrong on save, the node will be
@@ -516,12 +517,11 @@ function _i18n_node_form_node_form_alter($form, &$form_state) {
$form['body_field']['body']['#title'] = i18n_node_translate_type($node->type, 'body', $form['body_field']['body']['#title']);
}
// Translate page title for node/add/% and node/%/edit pages.
$types = node_type_get_types();
if (empty($node->nid) && strpos($_GET['q'], 'node/add/' . str_replace('_', '-', $node->type)) === 0) {
drupal_set_title(t('Create @name', array('@name' => i18n_node_translate_type($types[$node->type], 'name'))), PASS_THROUGH);
drupal_set_title(t('Create @name', array('@name' => i18n_node_type_name($node->type))), PASS_THROUGH);
}
elseif (!empty($node->nid) && $_GET['q'] == 'node/' . $node->nid . '/edit') {
drupal_set_title(t('<em>Edit @type</em> @title', array('@type' => i18n_node_translate_type($types[$node->type], 'name'), '@title' => $node->title)), PASS_THROUGH);
drupal_set_title(t('<em>Edit @type</em> @title', array('@type' => i18n_node_type_name($node->type), '@title' => $node->title)), PASS_THROUGH);
}
return $form;
}
@@ -553,10 +553,16 @@ function i18n_node_translate_type($type, $property = 'name', $source = NULL, $op
}
/**
* Translate node type name (unfiltered)
* Get translated node type name (unfiltered)
*
* @param string $type
* Node type.
* @param string $name
* Optional node type name.
*/
function i18n_node_type_name($type, $name) {
return i18n_string_translate(array('node', 'type', $type, 'name'), $name);
function i18n_node_type_name($type, $name = NULL) {
$name = isset($name) ? $name : node_type_get_name($type);
return i18n_string_translate(array('node', 'type', $type, 'name'), $name, array('sanitize' => FALSE));
}
/**

View File

@@ -25,7 +25,7 @@ function i18n_node_add_page() {
if ($type) {
// We just need to translate the description, the title is translated by the menu system
// The string will be filtered (xss_admin) on the theme layer
$item['description'] = i18n_node_translate_type($type, 'description', $item['description']);
$item['description'] = i18n_node_translate_type($type, 'description', $item['description'], array('sanitize' => FALSE));
}
}
return theme('node_add_list', array('content' => $content));
@@ -213,6 +213,7 @@ function i18n_node_select_translation_submit($form, &$form_state) {
))
->condition('nid', $add)
->execute();
entity_get_controller('node')->resetCache($add);
if (count($new)) {
drupal_set_message(format_plural(count($new), 'Added a node to the translation set.', 'Added @count nodes to the translation set.'));
}
@@ -224,6 +225,7 @@ function i18n_node_select_translation_submit($form, &$form_state) {
))
->condition('nid', $remove)
->execute();
entity_get_controller('node')->resetCache($remove);
drupal_set_message(format_plural(count($remove), 'Removed a node from the translation set.', 'Removed @count nodes from the translation set.'));
}
}
@@ -246,7 +248,7 @@ function i18n_node_autocomplete($type, $language, $string = '') {
*/
function i18n_node_nid2autocomplete($nid) {
if ($node = node_load($nid)) {
return check_plain($node->title) . ' [nid:' . $nid . ']';
return $node->title . ' [nid:' . $nid . ']';
}
else {
return t('Not found');

View File

@@ -0,0 +1,61 @@
<?php
/**
* @file
* Builds placeholder replacement tokens for content types.
*/
/**
* Implements hook_token_info().
*/
function i18n_node_token_info() {
$content_type['i18n-name'] = array(
'name' => t("Name (localized)"),
'description' => t("The name of the content type."),
);
$content_type['i18n-description'] = array(
'name' => t("Description (localized)"),
'description' => t("The optional description of the content type."),
);
return array(
'tokens' => array(
'content-type' => $content_type,
),
);
}
/**
* Implements hook_tokens().
*/
function i18n_node_tokens($type, $tokens, array $data = array(), array $options = array()) {
$replacements = array();
$sanitize = !empty($options['sanitize']) ? TRUE : FALSE;
$langcode = isset($options['language']) ? $options['language']->language : i18n_langcode();
if ($type == 'content-type' && !empty($data['node_type'])) {
$node_type = $data['node_type'];
foreach ($tokens as $name => $original) {
switch ($name) {
case 'i18n-name':
$name = array('node', 'type', $node_type->type, 'name');
$options = array('sanitize' => $sanitize, 'langcode' => $langcode);
$name = i18n_string_translate($name, $node_type->name, $options);
$replacements[$original] = $name;
break;
case 'i18n-description':
$description = array('node', 'type', $node_type->type, 'description');
$options = array('sanitize' => $sanitize, 'langcode' => $langcode);
$description = i18n_string_translate($description, $node_type->description, $options);
$replacements[$original] = $description;
break;
}
}
}
return $replacements;
}