security update core+modules
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user