contrib modules security updates

This commit is contained in:
Bachir Soussi Chiadmi
2016-10-13 12:10:40 +02:00
parent ffd758abc9
commit 747127f643
732 changed files with 67976 additions and 23207 deletions

View File

@@ -49,8 +49,8 @@ div.panels-ipe-control .form-submit {
padding: 0 34px 2px 0.8em;
}
input#panels-ipe-save,
input#panels-ipe-cancel {
#panels-ipe-save,
#panels-ipe-cancel {
background-position: 86% 0;
}

View File

@@ -241,7 +241,9 @@ div.panels-ipe-handlebar-wrapper li.delete a span {
div.panels-ipe-handlebar-wrapper li a:hover,
div.panels-ipe-dragtitle span:hover,
div.panels-ipe-newblock a:hover,
span.panels-ipe-draghandle-icon:hover {
span.panels-ipe-draghandle-icon:hover,
div.panels-ipe-handlebar-wrapper li a:focus,
div.panels-ipe-newblock a:focus {
background: #E6E6E6;
background-image: linear-gradient(bottom, #C5C5C5 0%, #FAFAFA 100%);
background-image: -o-linear-gradient(bottom, #C5C5C5 0%, #FAFAFA 100%);
@@ -382,6 +384,7 @@ div.panels-ipe-control .form-submit {
div.panels-ipe-control input.panels-ipe-save, div.panels-ipe-control input.panels-ipe-cancel,
div.panels-ipe-control input.panels-ipe-save:hover, div.panels-ipe-control input.panels-ipe-cancel:hover,
div.panels-ipe-control input.panels-ipe-save:focus, div.panels-ipe-control input.panels-ipe-cancel:focus,
div.panels-ipe-control input.panels-ipe-save:active, div.panels-ipe-control input.panels-ipe-cancel:active {
background-repeat: no-repeat;
}
@@ -394,7 +397,7 @@ div.panels-ipe-pseudobutton-container a {
text-decoration: none;
}
div.panels-ipe-control input.panels-ipe-save {
div.panels-ipe-control .panels-ipe-save {
background-image: url(../images/icon-save.png);
background-image: url(../images/icon-save.png), linear-gradient(bottom, #383838 0%, #666666 100%);
background-image: url(../images/icon-save.png), -o-linear-gradient(bottom, #383838 0%, #666666 100%);
@@ -411,7 +414,7 @@ div.panels-ipe-control input.panels-ipe-save {
);
}
div.panels-ipe-control input.panels-ipe-cancel {
div.panels-ipe-control .panels-ipe-cancel {
background-image: url(../images/icon-close.png);
background-image: url(../images/icon-close.png), linear-gradient(bottom, #383838 0%, #666666 100%);
background-image: url(../images/icon-close.png), -o-linear-gradient(bottom, #383838 0%, #666666 100%);
@@ -429,7 +432,9 @@ div.panels-ipe-control input.panels-ipe-cancel {
}
div.panels-ipe-pseudobutton-container:hover,
div.panels-ipe-control .form-submit:hover {
div.panels-ipe-control .form-submit:hover,
div.panels-ipe-pseudobutton-container:focus,
div.panels-ipe-control .form-submit:focus {
background: #999999;
background-image: linear-gradient(bottom, #3D3D3D 0%, #999999 100%);
background-image: -o-linear-gradient(bottom, #3D3D3D 0%, #999999 100%);
@@ -447,11 +452,13 @@ div.panels-ipe-control .form-submit:hover {
color: #FFF;
}
div.panels-ipe-pseudobutton-container a:hover {
div.panels-ipe-pseudobutton-container a:hover,
div.panels-ipe-pseudobutton-container a:focus {
color: #FFF;
}
div.panels-ipe-control input.panels-ipe-cancel:hover {
div.panels-ipe-control .panels-ipe-cancel:hover,
div.panels-ipe-control .panels-ipe-cancel:focus {
background-image: url(../images/icon-close.png), linear-gradient(bottom, #3D3D3D 0%, #999999 100%);
background-image: url(../images/icon-close.png), -o-linear-gradient(bottom, #3D3D3D 0%, #999999 100%);
background-image: url(../images/icon-close.png), -moz-linear-gradient(bottom, #3D3D3D 0%, #999999 100%);
@@ -467,7 +474,8 @@ div.panels-ipe-control input.panels-ipe-cancel:hover {
);
}
div.panels-ipe-control input.panels-ipe-save:hover {
div.panels-ipe-control .panels-ipe-save:hover,
div.panels-ipe-control .panels-ipe-save:focus {
background-image: url(../images/icon-save.png), linear-gradient(bottom, #3D3D3D 0%, #999999 100%);
background-image: url(../images/icon-save.png), -o-linear-gradient(bottom, #3D3D3D 0%, #999999 100%);
background-image: url(../images/icon-save.png), -moz-linear-gradient(bottom, #3D3D3D 0%, #999999 100%);
@@ -507,7 +515,7 @@ div.panels-ipe-pseudobutton-container a:active {
color: #CCC;
}
div.panels-ipe-control input.panels-ipe-cancel:active {
div.panels-ipe-control .panels-ipe-cancel:active {
background-image: url(../images/icon-close.png), linear-gradient(bottom, #616161 0%, #333333 100%);
background-image: url(../images/icon-close.png), -o-linear-gradient(bottom, #616161 0%, #333333 100%);
background-image: url(../images/icon-close.png), -moz-linear-gradient(bottom, #616161 0%, #333333 100%);
@@ -523,7 +531,7 @@ div.panels-ipe-control input.panels-ipe-cancel:active {
);
}
div.panels-ipe-control input.panels-ipe-save:active {
div.panels-ipe-control .panels-ipe-save:active {
background-image: url(../images/icon-save.png), linear-gradient(bottom, #616161 0%, #333333 100%);
background-image: url(../images/icon-save.png), -o-linear-gradient(bottom, #616161 0%, #333333 100%);
background-image: url(../images/icon-save.png), -moz-linear-gradient(bottom, #616161 0%, #333333 100%);
@@ -539,6 +547,12 @@ div.panels-ipe-control input.panels-ipe-save:active {
);
}
div.panels-ipe-control .panels-ipe-save, div.panels-ipe-control .panels-ipe-cancel,
div.panels-ipe-control .panels-ipe-save:hover, div.panels-ipe-control .panels-ipe-cancel:hover,
div.panels-ipe-control .panels-ipe-save:active, div.panels-ipe-control .panels-ipe-cancel:active {
background-repeat: no-repeat;
}
div.panels-ipe-pseudobutton-container a.panels-ipe-startedit {
padding-left: 34px;
background: url(../images/icon-configure.png) no-repeat 10px 9px;
@@ -557,3 +571,7 @@ div.panels-ipe-button-container {
form#panels-ipe-edit-control-form {
text-align: center;
}
.panels-ipe-dragbar-admin-title{
font-size: 0.9em;
}

View File

@@ -2,12 +2,7 @@
// Ensure the $ alias is owned by jQuery.
(function($) {
// randomly lock a pane.
// @debug only
Drupal.settings.Panels = Drupal.settings.Panels || {};
Drupal.settings.Panels.RegionLock = {
10: { 'top': false, 'left': true, 'middle': true }
}
Drupal.PanelsIPE = {
editors: {},
@@ -31,6 +26,17 @@ Drupal.PanelsIPE = {
Drupal.behaviors.PanelsIPE = {
attach: function(context) {
// Remove any old editors.
for (var i in Drupal.PanelsIPE.editors) {
if (Drupal.settings.PanelsIPECacheKeys.indexOf(i) === -1) {
// Clean-up a little bit and remove it.
Drupal.PanelsIPE.editors[i].editing = false;
Drupal.PanelsIPE.editors[i].changed = false;
delete Drupal.PanelsIPE.editors[i];
}
}
// Initialize new editors.
for (var i in Drupal.settings.PanelsIPECacheKeys) {
var key = Drupal.settings.PanelsIPECacheKeys[i];
$('div#panels-ipe-display-' + key + ':not(.panels-ipe-processed)')
@@ -213,9 +219,11 @@ function DrupalPanelsIPE(cache_key, cfg) {
$('div.panels-ipe-sort-container', ipe.topParent).bind('sortstop', this.enableRegions);
// Refresh the control jQuery object.
ipe.control = $(ipe.control.selector);
$('.panels-ipe-form-container', ipe.control).append(formdata);
$('input:submit:not(.ajax-processed)', ipe.control).addClass('ajax-processed').each(function() {
$('input:submit:not(.ajax-processed), button:not(.ajax-processed)', ipe.control).addClass('ajax-processed').each(function() {
var element_settings = {};
element_settings.url = $(this.form).attr('action');
@@ -233,7 +241,7 @@ function DrupalPanelsIPE(cache_key, cfg) {
// it clears out inline styles.
$('.panels-ipe-on').show();
ipe.showForm();
ipe.topParent.addClass('panels-ipe-editing');
$('body').add(ipe.topParent).addClass('panels-ipe-editing');
};
@@ -264,12 +272,16 @@ function DrupalPanelsIPE(cache_key, cfg) {
// Re-show all the IPE non-editing meta-elements
$('div.panels-ipe-off').show('fast');
// Refresh the container and control jQuery objects.
ipe.container = $(ipe.container.selector);
ipe.control = $(ipe.control.selector);
ipe.showButtons();
// Re-hide all the IPE meta-elements
$('div.panels-ipe-on').hide();
$('.panels-ipe-editing').removeClass('panels-ipe-editing');
$('div.panels-ipe-sort-container', ipe.topParent).sortable("destroy");
$('div.panels-ipe-sort-container.ui-sortable', ipe.topParent).sortable("destroy");
};
this.saveEditing = function() {
@@ -285,7 +297,7 @@ function DrupalPanelsIPE(cache_key, cfg) {
val += id;
}
});
$('input[name="panel[pane][' + region + ']"]', ipe.control).val(val);
$('[name="panel[pane][' + region + ']"]', ipe.control).val(val);
});
}
@@ -322,7 +334,7 @@ function DrupalPanelsIPE(cache_key, cfg) {
this.createSortContainers = function() {
$('div.panels-ipe-region', this.topParent).each(function() {
$('div.panels-ipe-portlet-marker', this).parent()
$(this).children('div.panels-ipe-portlet-marker').parent()
.wrapInner('<div class="panels-ipe-sort-container" />');
// Move our gadgets outside of the sort container so that sortables
@@ -330,9 +342,6 @@ function DrupalPanelsIPE(cache_key, cfg) {
$('div.panels-ipe-portlet-static', this).each(function() {
$(this).prependTo($(this).parent().parent());
});
// Also remove the last panel separator.
$('div.panel-separator', this).filter(':last').remove();
});
}
@@ -386,6 +395,34 @@ $(function() {
}
};
Drupal.ajax.prototype.commands.insertNewPane = function(ajax, data, status) {
IPEContainerSelector = '#panels-ipe-regionid-' + data.regionId + ' div.panels-ipe-sort-container';
firstPaneSelector = IPEContainerSelector + ' div.panels-ipe-portlet-wrapper:first';
// Insert the new pane before the first existing pane in the region, if
// any.
if ($(firstPaneSelector).length) {
insertData = {
'method': 'before',
'selector': firstPaneSelector,
'data': data.renderedPane,
'settings': null
}
Drupal.ajax.prototype.commands.insert(ajax, insertData, status);
}
// Else, insert it as a first child of the container. Doing so might fall
// outside of the wrapping markup for the style, but it's the best we can
// do.
else {
insertData = {
'method': 'prepend',
'selector': IPEContainerSelector,
'data': data.renderedPane,
'settings': null
}
Drupal.ajax.prototype.commands.insert(ajax, insertData, status);
}
};
/**
* Override the eventResponse on ajax.js so we can add a little extra
* behavior.

View File

@@ -0,0 +1,31 @@
<?php
/**
* @file
* Hooks provided by Panels In-Place Editor.
*/
/**
* Allow modules to control access to the Panels IPE.
*
* @param panels_display $display
* The panels display about to be rendered.
*
* @return TRUE|FALSE|NULL
* Returns TRUE to allow access, FALSE to deny, or NULL if the module
* implementing this hook doesn't care about access for the given display.
*/
function hook_panels_ipe_access(panels_display $display) {
// We only care about displays with the 'panelizer' context.
if (!isset($display->context['panelizer'])) {
return NULL;
}
if ($display->context['panelizer']->type[0] == 'entity:node') {
// Allow or deny IPE access based on node type.
return $display->context['panelizer']->data->type == 'awesome_page';
}
// Otherwise, deny access to everything!
return FALSE;
}

View File

@@ -1,14 +1,15 @@
name = Panels In-Place Editor
description = Provide a UI for managing some Panels directly on the frontend, instead of having to use the backend.
package = "Panels"
version = PANELS_VERSION
dependencies[] = panels
core = 7.x
configure = admin/structure/panels
files[] = panels_ipe.module
; Information added by drupal.org packaging script on 2013-03-02
version = "7.x-3.3+39-dev"
; Information added by Drupal.org packaging script on 2016-08-20
version = "7.x-3.7"
core = "7.x"
project = "panels"
datestamp = "1362187383"
datestamp = "1471704242"

View File

@@ -133,18 +133,22 @@ function template_preprocess_panels_ipe_pane_wrapper(&$vars) {
function theme_panels_ipe_pane_wrapper($vars) {
$output = $vars['output'];
$pane = $vars['pane'];
$display = $vars['display'];
$attributes = array(
'class' => 'panels-ipe-linkbar',
);
$type = ctools_get_content_type($pane->type);
$title ='<span class = "panels-ipe-dragbar-admin-title">' . ctools_content_admin_title($type, $pane->subtype, $pane->configuration, $display->context) . '</span>';
$links = theme('links', array('links' => $vars['links'], 'attributes' => $attributes));
if (!empty($pane->locks['type']) && $pane->locks['type'] == 'immovable') {
$links = '<div class="panels-ipe-dragbar panels-ipe-nodraghandle clearfix">' . $links . '</div>';
$links = '<div class="panels-ipe-dragbar panels-ipe-nodraghandle clearfix">' . $links .$title .'</div>';
}
else {
$links = '<div class="panels-ipe-dragbar panels-ipe-draghandle clearfix">' . $links . '<span class="panels-ipe-draghandle-icon"><span class="panels-ipe-draghandle-icon-inner"></span></span></div>';
$links = '<div class="panels-ipe-dragbar panels-ipe-draghandle clearfix">' . $links . $title . '<span class="panels-ipe-draghandle-icon"><span class="panels-ipe-draghandle-icon-inner"></span></span></div>';
}
$handlebar = '<div class="panels-ipe-handlebar-wrapper panels-ipe-on">' . $links . '</div>';
@@ -217,6 +221,7 @@ function panels_ipe_get_cache_key($key = NULL) {
*/
function panels_ipe_toolbar_add_button($cache_key, $id, $button) {
$buttons = &drupal_static('panels_ipe_toolbar_buttons', array());
drupal_alter('panels_ipe_button', $button, $id, $cache_key);
$buttons[$cache_key][$id] = $button;
}
@@ -242,9 +247,11 @@ function panels_ipe_page_alter(&$page) {
function theme_panels_ipe_toolbar($vars) {
$buttons = $vars['buttons'];
ctools_include('cleanstring');
$output = "<div id='panels-ipe-control-container' class='clearfix'>";
foreach ($buttons as $key => $ipe_buttons) {
$key = ctools_cleanstring($key);
$output .= "<div id='panels-ipe-control-$key' class='panels-ipe-control'>";
// Controls in this container will appear when the IPE is not on.

View File

@@ -7,12 +7,44 @@ class panels_renderer_ipe extends panels_renderer_editor {
// The IPE operates in normal render mode, not admin mode.
var $admin = FALSE;
// Whether or not the user has access.
var $access = NULL;
function invoke_panels_ipe_access() {
if (user_access('bypass access in place editing')) {
return TRUE;
}
// Modules can return TRUE, FALSE or NULL, for allowed, disallowed,
// or don't care - respectively. On the first FALSE, we deny access,
// otherwise allow.
foreach (module_invoke_all('panels_ipe_access', $this->display) as $result) {
if ($result === FALSE) {
return FALSE;
}
}
return TRUE;
}
function access() {
if (is_null($this->access)) {
$this->access = $this->invoke_panels_ipe_access();
}
return $this->access;
}
function render() {
$output = parent::render();
return "<div id='panels-ipe-display-{$this->clean_key}' class='panels-ipe-display-container'>$output</div>";
if ($this->access()) {
return "<div id='panels-ipe-display-{$this->clean_key}' class='panels-ipe-display-container'>$output</div>";
}
return $output;
}
function add_meta() {
if (!$this->access()) {
return parent::add_meta();
}
ctools_include('display-edit', 'panels');
ctools_include('content');
@@ -29,6 +61,7 @@ class panels_renderer_ipe extends panels_renderer_editor {
'#type' => 'link',
'#title' => t('Customize this page'),
'#href' => $this->get_url('save_form'),
'#options' => array('query' => drupal_get_destination()),
'#id' => 'panels-ipe-customize-page',
'#attributes' => array(
'class' => array('panels-ipe-startedit', 'panels-ipe-pseudobutton'),
@@ -41,7 +74,7 @@ class panels_renderer_ipe extends panels_renderer_editor {
'#suffix' => '</div>',
);
panels_ipe_toolbar_add_button($this->clean_key, 'panels-ipe-startedit', $button);
panels_ipe_toolbar_add_button($this->display->cache_key, 'panels-ipe-startedit', $button);
// @todo this actually should be an IPE setting instead.
if (user_access('change layouts in place editing')) {
@@ -49,6 +82,7 @@ class panels_renderer_ipe extends panels_renderer_editor {
'#type' => 'link',
'#title' => t('Change layout'),
'#href' => $this->get_url('change_layout'),
'#options' => array('query' => drupal_get_destination()),
'#attributes' => array(
'class' => array('panels-ipe-change-layout', 'panels-ipe-pseudobutton', 'ctools-modal-layout'),
),
@@ -61,7 +95,7 @@ class panels_renderer_ipe extends panels_renderer_editor {
'#suffix' => '</div>',
);
panels_ipe_toolbar_add_button($this->clean_key, 'panels-ipe-change-layout', $button);
panels_ipe_toolbar_add_button($this->display->cache_key, 'panels-ipe-change-layout', $button);
}
ctools_include('ajax');
@@ -70,6 +104,7 @@ class panels_renderer_ipe extends panels_renderer_editor {
ctools_add_css('panels_dnd', 'panels');
ctools_add_css('panels_admin', 'panels');
ctools_add_js('panels-base', 'panels');
ctools_add_js('panels_ipe', 'panels_ipe');
ctools_add_css('panels_ipe', 'panels_ipe');
@@ -93,6 +128,9 @@ class panels_renderer_ipe extends panels_renderer_editor {
if (empty($output)) {
return;
}
if (!$this->access()) {
return $output;
}
// If there are region locks, add them.
if (!empty($pane->locks['type']) && $pane->locks['type'] == 'regions') {
@@ -135,6 +173,10 @@ class panels_renderer_ipe extends panels_renderer_editor {
}
function prepare_panes($panes) {
if (!$this->access()) {
return parent::prepare_panes($panes);
}
// Set to admin mode just for this to ensure all panes are represented.
$this->admin = TRUE;
$panes = parent::prepare_panes($panes);
@@ -142,6 +184,10 @@ class panels_renderer_ipe extends panels_renderer_editor {
}
function render_pane_content(&$pane) {
if (!$this->access()) {
return parent::render_pane_content($pane);
}
if (!empty($pane->shown) && panels_pane_access($pane, $this->display)) {
$content = parent::render_pane_content($pane);
}
@@ -172,6 +218,10 @@ class panels_renderer_ipe extends panels_renderer_editor {
* @param $panes
*/
function render_region($region_id, $panes) {
if (!$this->access()) {
return parent::render_region($region_id, $panes);
}
// Generate this region's 'empty' placeholder pane from the IPE plugin.
$empty_ph = theme('panels_ipe_placeholder_pane', array('region_id' => $region_id, 'region_title' => $this->plugins['layout']['regions'][$region_id]));
@@ -209,6 +259,19 @@ class panels_renderer_ipe extends panels_renderer_editor {
// Break the lock.
panels_edit_cache_break_lock($this->cache);
}
}
function get_panels_storage_op_for_ajax($method) {
switch ($method) {
case 'ajax_unlock_ipe':
case 'ajax_save_form':
return 'update';
case 'ajax_change_layout':
case 'ajax_set_layout':
return 'change layout';
}
return parent::get_panels_storage_op_for_ajax($method);
}
/**
@@ -282,6 +345,9 @@ class panels_renderer_ipe extends panels_renderer_editor {
// rendered.
$this->meta_location = 'inline';
$this->commands[] = ajax_command_replace("#panels-ipe-display-{$this->clean_key}", panels_render_display($this->display, $this));
$buttons = &drupal_static('panels_ipe_toolbar_buttons', array());
$output = theme('panels_ipe_toolbar', array('buttons' => $buttons));
$this->commands[] = ajax_command_replace('#panels-ipe-control-container', $output);
}
else {
// Cancelled. Clear the cache.
@@ -320,6 +386,9 @@ class panels_renderer_ipe extends panels_renderer_editor {
// Filter out builders
$layouts = array_filter($layouts, '_panels_builder_filter');
// Let other modules filter the layouts.
drupal_alter('panels_layouts_available', $layouts);
// Define the current layout
$current_layout = $this->plugins['layout']['name'];
@@ -358,7 +427,7 @@ class panels_renderer_ipe extends panels_renderer_editor {
if (!empty($form_state['clicked_button']['#save-display'])) {
// Saved. Save the cache.
panels_edit_cache_save($this->cache);
$this->display->skip_cache;
$this->display->skip_cache = TRUE;
// Since the layout changed, we have to update these things in the
// renderer in order to get the right settings.
@@ -405,7 +474,11 @@ class panels_renderer_ipe extends panels_renderer_editor {
$pane = $this->display->content[$pid];
}
$this->commands[] = ajax_command_prepend("#panels-ipe-regionid-{$pane->panel} div.panels-ipe-sort-container", $this->render_pane($pane));
$this->commands[] = array(
'command' => 'insertNewPane',
'regionId' => $pane->panel,
'renderedPane' => $this->render_pane($pane),
);
$this->commands[] = ajax_command_changed("#panels-ipe-display-{$this->clean_key}");
$this->commands[] = array(
'command' => 'addNewPane',