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

@@ -105,8 +105,9 @@ $plugin = array(
*/
function page_manager_http_response_codes() {
return array(
404 => t('404 Page not found'),
403 => t('403 Access denied'),
404 => t('404 Page not found'),
410 => t('410 Gone'),
301 => t('301 Redirect'),
);
}
@@ -215,6 +216,9 @@ function page_manager_http_response_title($handler, $task, $subtask) {
* General settings for the panel
*/
function page_manager_http_response_edit_settings($form, &$form_state) {
ctools_include('page_manager.admin', 'page_manager', '');
ctools_include('export', 'ctools');
$conf = $form_state['handler']->conf;
$form['title'] = array(
'#type' => 'textfield',
@@ -223,6 +227,23 @@ function page_manager_http_response_edit_settings($form, &$form_state) {
'#description' => t('Administrative title of this variant.'),
);
$name = isset($conf['name']) ? $conf['name'] : FALSE;
$form['name'] = array(
'#type' => 'machine_name',
'#title' => t('Machine name'),
'#required' => FALSE,
'#default_value' => $name,
'#description' => t("A unique machine-readable name for this variant. It must only contain lowercase letters, numbers, and underscores. This name will be used when exporting the variant. If left empty the variant's name will be used instead."),
'#size' => 32,
'#maxlength' => 32,
'#machine_name' => array(
'exists' => 'page_manager_handler_check_machine_name',
'source' => array('title'),
),
'#field_prefix' => '<span dir="ltr">' . $form_state['task_name'] . '__',
'#field_suffix' => '</span>&lrm;',
);
$form['code'] = array(
'#title' => t('Response code'),
'#type' => 'select',
@@ -243,7 +264,33 @@ function page_manager_http_response_edit_settings($form, &$form_state) {
}
function page_manager_http_response_edit_settings_submit($form, &$form_state) {
$machine_name = $form_state['handler']->name;
$name = $form_state['task_name'] . '__' . $form_state['values']['name'];
// If new name doesn't equal machine name, we need to update and redirect.
if ($machine_name !== $name) {
$form_state['handler']->name = $name;
// If there's a trail, we need to replace it for redirection.
if (isset($form_state['trail'])) {
$form_state['new trail'] = $form_state['trail'];
$delta = array_search($machine_name, $form_state['new trail']);
$form_state['new trail'][$delta] = $name;
}
// If handler id is set, replace it.
if ($form_state['handler_id']) {
$form_state['handler_id'] = $name;
}
// If we're defining a new custom handler, move page handler to new name.
if (isset($form_state['page']->handlers[$machine_name]) && isset($form_state['page']->handler_info[$machine_name])) {
$form_state['page']->handlers[$name] = $form_state['page']->handlers[$machine_name];
unset($form_state['page']->handlers[$machine_name]);
$form_state['page']->handler_info[$name] = $form_state['page']->handler_info[$machine_name];
unset($form_state['page']->handler_info[$machine_name]);
}
}
$form_state['handler']->conf['title'] = $form_state['values']['title'];
$form_state['handler']->conf['name'] = $form_state['values']['name'];
$form_state['handler']->conf['code'] = $form_state['values']['code'];
$form_state['handler']->conf['destination'] = $form_state['values']['destination'];
}
@@ -282,4 +329,4 @@ function page_manager_http_response_render($handler, $base_contexts, $args, $tes
}
return $info;
}
}

View File

@@ -67,7 +67,7 @@ function page_manager_comment_reply_page($node, $pid = NULL){
}
$output = ctools_context_handler_render($task, '', $contexts, array($node, $pid));
if ($output != FALSE) {
if ($output !== FALSE) {
return $output;
}

View File

@@ -126,7 +126,7 @@ function page_manager_node_add($type) {
'language' => LANGUAGE_NONE,
);
drupal_set_title(t('Create @name', array('@name' => $types[$type]->name)));
drupal_set_title(t('Create @name', array('@name' => $types[$type]->name)), PASS_THROUGH);
return page_manager_node_edit($node);
}

View File

@@ -78,6 +78,10 @@ function page_manager_node_view_menu_alter(&$items, $task) {
* node view, which is node_page_view().
*/
function page_manager_node_view_page($node) {
// Prep the node to be displayed so all of the regular hooks are triggered.
// Also save the output for later, in case it is needed.
$default_output = node_page_view($node);
// Load my task plugin
$task = page_manager_get_task('node_view');
@@ -85,32 +89,26 @@ function page_manager_node_view_page($node) {
ctools_include('context');
ctools_include('context-task-handler');
// We need to mimic Drupal's behavior of setting the node title here.
drupal_set_title($node->title);
$uri = entity_uri('node', $node);
// Set the node path as the canonical URL to prevent duplicate content.
drupal_add_html_head_link(array('rel' => 'canonical', 'href' => url($uri['path'], $uri['options'])), TRUE);
// Set the non-aliased path as a default shortlink.
drupal_add_html_head_link(array('rel' => 'shortlink', 'href' => url($uri['path'], array_merge($uri['options'], array('alias' => TRUE)))), TRUE);
// Load all contexts.
$contexts = ctools_context_handler_get_task_contexts($task, '', array($node));
// Build the full output using the configured CTools plugin.
$output = ctools_context_handler_render($task, '', $contexts, array($node->nid));
if ($output != FALSE) {
if ($output !== FALSE) {
node_tag_new($node);
return $output;
}
$function = 'node_page_view';
// Try loading an override plugin.
foreach (module_implements('page_manager_override') as $module) {
$call = $module . '_page_manager_override';
if (($rc = $call('node_view')) && function_exists($rc)) {
$function = $rc;
break;
return $rc($node);
}
}
// Otherwise, fall back.
return $function($node);
// Otherwise, fall back to the default output generated by node_page_view().
return $default_output;
}
/**

View File

@@ -38,7 +38,7 @@ function page_manager_page_menu(&$items, $task) {
) + $base;
if ($access_callback == 'user_access') {
$items['admin/structure/pages/import']['access callback'] = 'ctools_access_multiperm';
$items['admin/structure/pages/import']['access arguments'][] = 'use PHP for settings';
$items['admin/structure/pages/import']['access arguments'][] = 'use ctools import';
}
// AJAX callbacks for argument modal.
@@ -237,7 +237,7 @@ function page_manager_page_add_subtask($task_name = NULL, $step = NULL) {
if ($task_name) {
$page = page_manager_get_page_cache($task_name);
if (empty($page)) {
return drupal_not_found();
return MENU_NOT_FOUND;
}
$form_info['path'] = "admin/structure/pages/add/$task_name/%step";
@@ -443,7 +443,7 @@ function page_manager_page_form_basic($form, &$form_state) {
'#type' => 'checkbox',
'#default_value' => !empty($page->make_frontpage),
'#title' => t('Make this your site home page.'),
'#description' => t('To set this panel as your home page you must create a unique path name with no % placeholders in the path. The site home page is currently set to %homepage on the !siteinfo configuration form.', array('!siteinfo' => l(t('Site Information'), 'admin/settings/site-information'), '%homepage' => '/' . $frontpage)),
'#description' => t('To set this panel as your home page you must create a unique path name with no % placeholders in the path. The site home page is currently set to %homepage on the !siteinfo configuration form.', array('!siteinfo' => l(t('Site Information'), 'admin/config/system/site-information'), '%homepage' => '/' . $frontpage)),
);
$form['admin_paths'] = array(
'#type' => 'checkbox',
@@ -769,12 +769,12 @@ function page_manager_page_form_menu($form, &$form_state) {
);
}
$form['menu']['parent']['weight'] = array(
'#title' => t('Tab weight'),
'#title' => t('Parent weight'),
'#type' => 'textfield',
'#default_value' => $menu['parent']['weight'],
'#size' => 5,
'#description' => t('If the parent menu item is a tab, enter the weight of the tab. The lower the number, the more to the left it will be.'),
'#dependency' => array('radio:menu[type]' => array('default tab'), 'radio:menu[parent][type]' => array('tab')),
'#description' => t('Enter the weight of the parent item. The lower the number, the more to the left it will be.'),
'#dependency' => array('radio:menu[type]' => array('default tab'), 'radio:menu[parent][type]' => array('tab', 'normal')),
'#dependency_count' => 2,
);

View File

@@ -321,7 +321,7 @@ function page_manager_page_execute($subtask_id) {
ctools_include('context-task-handler');
$output = ctools_context_handler_render($task, $subtask, $contexts, $args);
if ($output === FALSE) {
return drupal_not_found();
return MENU_NOT_FOUND;
}
return $output;

View File

@@ -138,7 +138,7 @@ function page_manager_term_view_page($term, $depth = NULL) {
$contexts = ctools_context_handler_get_task_contexts($task, '', array($term, $depth));
if (empty($contexts)) {
return drupal_not_found();
return MENU_NOT_FOUND;
}
// Build the full output using the configured CTools plugin.
@@ -151,7 +151,7 @@ function page_manager_term_view_page($term, $depth = NULL) {
foreach (module_implements('page_manager_override') as $module) {
$call = $module . '_page_manager_override';
if (($rc = $call('term_view')) && function_exists($rc)) {
return $rc($node);
return $rc($term, $depth);
}
}

View File

@@ -97,8 +97,8 @@ function page_manager_user_edit_page($account, $category = 'account') {
$output = ctools_context_handler_render($task, '', $contexts, array($account->uid));
if (is_array($output)) {
$output = drupal_render($output);
}
if ($output != FALSE) {
}
if ($output !== FALSE) {
return $output;
}
@@ -119,7 +119,7 @@ function page_manager_user_edit_page($account, $category = 'account') {
//call drupal_build_form.
$form_state = array();
$form_id = 'user_profile_form';
$args = array($account);
$args = array($account, $category);
$form_state['build_info']['args'] = $args;
form_load_include($form_state, 'inc', 'user', 'user.pages');
$output = drupal_build_form($form_id, $form_state);

View File

@@ -81,7 +81,7 @@ function page_manager_user_view_page($account) {
user_build_content($account);
$output = ctools_context_handler_render($task, '', $contexts, array($account->uid));
if ($output != FALSE) {
if ($output !== FALSE) {
return $output;
}