contrib modules security updates
This commit is contained in:
12
sites/all/modules/panels/panels_mini/panels_mini.css
Normal file
12
sites/all/modules/panels/panels_mini/panels_mini.css
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @file
|
||||
* Custom CSS for the Mini Panels module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Customize the CTools wizard trail / breadcrumb used on the edit pages for
|
||||
* Mini Panels as a stop-gap measure until the UX can be completely re-done.
|
||||
*/
|
||||
.wizard-trail {
|
||||
text-align: right;
|
||||
}
|
@@ -1,12 +1,13 @@
|
||||
name = Mini panels
|
||||
description = Create mini panels that can be used as blocks by Drupal and panes by other panel modules.
|
||||
package = "Panels"
|
||||
version = PANELS_VERSION
|
||||
dependencies[] = panels
|
||||
core = 7.x
|
||||
files[] = plugins/export_ui/panels_mini_ui.class.php
|
||||
; 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"
|
||||
|
||||
|
@@ -114,7 +114,7 @@ function panels_mini_uninstall() {
|
||||
$deltas[] = $panel_mini->pid;
|
||||
}
|
||||
|
||||
if ($deltas) {
|
||||
if (db_table_exists('block') && $deltas) {
|
||||
// Delete all configured blocks.
|
||||
db_delete('block')
|
||||
->condition('module', 'panels_mini')
|
||||
@@ -122,3 +122,61 @@ function panels_mini_uninstall() {
|
||||
->execute();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_update_dependencies().
|
||||
*/
|
||||
function panels_mini_update_dependencies() {
|
||||
// Update 7301 requires panels storage support
|
||||
$dependencies['panels_mini'][7301] = array(
|
||||
'panels' => 7305,
|
||||
);
|
||||
|
||||
return $dependencies;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the storage type and id on existing mini panels.
|
||||
*/
|
||||
function panels_mini_update_7301() {
|
||||
if (!isset($sandbox['progress'])) {
|
||||
// Initialize batch update information.
|
||||
$sandbox['progress'] = (float)0;
|
||||
$sandbox['current_did'] = -1;
|
||||
$sandbox['max'] = db_query("SELECT COUNT(pd.did)
|
||||
FROM {panels_display} pd
|
||||
JOIN {panels_mini} pm ON pm.did = pd.did
|
||||
WHERE pd.storage_type = ''")->fetchField();
|
||||
}
|
||||
|
||||
// Set a limit of how many rows to process per batch.
|
||||
$limit = 1000;
|
||||
|
||||
// Run the query
|
||||
$result = db_query_range("SELECT pd.did, pm.name
|
||||
FROM {panels_display} pd
|
||||
JOIN {panels_mini} pm ON pm.did = pd.did
|
||||
WHERE pd.storage_type = '' AND pd.did > :current_did", 0, $limit, array(':current_did' => $sandbox['current_did']));
|
||||
|
||||
foreach ($result as $row) {
|
||||
db_update('panels_display')
|
||||
->fields(array(
|
||||
'storage_type' => 'panels_mini',
|
||||
'storage_id' => $row->name,
|
||||
))
|
||||
->condition('did', $row->did)
|
||||
->execute();
|
||||
|
||||
// Update our progress information.
|
||||
$sandbox['progress']++;
|
||||
$sandbox['current_did'] = $row->did;
|
||||
}
|
||||
|
||||
// Set the "finished" status, to tell batch engine whether this function
|
||||
// needs to run again.
|
||||
$sandbox['#finished'] = ($sandbox['progress'] >= $sandbox['max']) ? TRUE : ($sandbox['progress'] / $sandbox['max']);
|
||||
|
||||
if ($sandbox['#finished']) {
|
||||
return t('Added the storage type for panels_mini to relevant panels displays');
|
||||
}
|
||||
}
|
||||
|
@@ -112,9 +112,11 @@ function panels_mini_block_view($delta = 0) {
|
||||
$contexts = ctools_context_match_required_contexts($panel_mini->requiredcontexts, $current_page['contexts']);
|
||||
}
|
||||
}
|
||||
drupal_alter('panels_mini_block_contexts', $contexts, $panel_mini);
|
||||
|
||||
$panel_mini->context = $panel_mini->display->context = ctools_context_load_contexts($panel_mini, FALSE, $contexts);
|
||||
$panel_mini->display->css_id = panels_mini_get_id($panel_mini->name);
|
||||
$panel_mini->display->owner = $panel_mini;
|
||||
|
||||
$block = array();
|
||||
|
||||
@@ -145,6 +147,10 @@ function panels_mini_block_list_alter(&$blocks) {
|
||||
if (module_exists('page_manager')) {
|
||||
$current_page = page_manager_get_current_page();
|
||||
}
|
||||
|
||||
// Load add at once to save time.
|
||||
panels_mini_load_all();
|
||||
|
||||
foreach ($blocks as $key => $block) {
|
||||
if ($block->module != 'panels_mini') {
|
||||
// This block was added by a contrib module, leave it in the list.
|
||||
@@ -178,6 +184,44 @@ function panels_mini_block_list_alter(&$blocks) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_get_pane_links_alter().
|
||||
*/
|
||||
function panels_mini_get_pane_links_alter(&$links, $pane, $content_type) {
|
||||
if ($pane->type == 'panels_mini') {
|
||||
$links['top']['edit_panels_mini'] = array(
|
||||
'title' => t('Edit mini panel'),
|
||||
'href' => url('admin/structure/mini-panels/list/' . $pane->subtype . '/edit/content', array('absolute' => TRUE)),
|
||||
'attributes' => array('target' => array('_blank')),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_contextual_links_view_alter().
|
||||
*/
|
||||
function panels_mini_contextual_links_view_alter(&$element, $items) {
|
||||
|
||||
// Add contextual links to all mini panel blocks with bid property.
|
||||
if (isset($element['#element']['#block']) && isset($element['#element']['#block']->bid) && strpos((string) $element['#element']['#block']->bid, 'panels_mini') === 0) {
|
||||
|
||||
$admin_pages = array(
|
||||
t('Configure mini panel settings') => 'basic',
|
||||
t('Configure mini panel context') => 'context',
|
||||
t('Configure mini panel layout') => 'layout',
|
||||
t('Configure mini panel content') => 'content',
|
||||
);
|
||||
|
||||
foreach ($admin_pages as $title => $tail) {
|
||||
$element['#links']['mini-panels-' . $tail] = array(
|
||||
'title' => $title,
|
||||
'href' => 'admin/structure/mini-panels/list/' . $element['#element']['#block']->delta . '/edit/' . $tail,
|
||||
'query' => drupal_get_destination(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Statically store all used IDs to ensure all mini panels get a unique id.
|
||||
*/
|
||||
@@ -215,22 +259,30 @@ function panels_mini_load($name) {
|
||||
// We use array_key_exists because failed loads will be NULL and
|
||||
// isset() will try to load it again.
|
||||
if (!array_key_exists($name, $cache)) {
|
||||
ctools_include('export');
|
||||
$result = ctools_export_load_object('panels_mini', 'names', array($name));
|
||||
if (isset($result[$name])) {
|
||||
if (empty($result[$name]->display)) {
|
||||
$result[$name]->display = panels_load_display($result[$name]->did);
|
||||
if (!empty($result[$name]->title) && empty($result[$name]->display->title)) {
|
||||
$result[$name]->display->title = $result[$name]->title;
|
||||
}
|
||||
}
|
||||
$cache[$name] = $result[$name];
|
||||
if (!empty($result[$name]->title) && empty($result[$name]->admin_title)) {
|
||||
$cache[$name]->admin_title = $result[$name]->title;
|
||||
}
|
||||
$cid = 'panels_mini_load:' . $name;
|
||||
$result = cache_get($cid, 'cache_panels');
|
||||
if (!empty($result->data)) {
|
||||
$cache[$name] = $result->data;
|
||||
}
|
||||
else {
|
||||
$cache[$name] = NULL;
|
||||
ctools_include('export');
|
||||
$result = ctools_export_load_object('panels_mini', 'names', array($name));
|
||||
if (isset($result[$name])) {
|
||||
if (empty($result[$name]->display)) {
|
||||
$result[$name]->display = panels_load_display($result[$name]->did);
|
||||
if (!empty($result[$name]->title) && empty($result[$name]->display->title)) {
|
||||
$result[$name]->display->title = $result[$name]->title;
|
||||
}
|
||||
}
|
||||
$cache[$name] = $result[$name];
|
||||
if (!empty($result[$name]->title) && empty($result[$name]->admin_title)) {
|
||||
$cache[$name]->admin_title = $result[$name]->title;
|
||||
}
|
||||
cache_set($cid, $cache[$name], 'cache_panels', CACHE_TEMPORARY);
|
||||
}
|
||||
else {
|
||||
$cache[$name] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,6 +305,22 @@ function panels_mini_load_all($reset = FALSE) {
|
||||
if ($reset) {
|
||||
$cache = array();
|
||||
}
|
||||
else {
|
||||
$panel_names = db_select('panels_mini', 'pm')
|
||||
->fields('pm', array('name'))
|
||||
->execute();
|
||||
$cids = array();
|
||||
foreach ($panel_names as $name) {
|
||||
$cids[] = 'panels_mini_load:' . $name->name;
|
||||
}
|
||||
$output = cache_get_multiple($cids, 'cache_panels');
|
||||
foreach ($output as $mini) {
|
||||
if (!empty($mini->data)) {
|
||||
$mini = $mini->data;
|
||||
$cache[$mini->name] = $mini;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ctools_include('export');
|
||||
$minis = ctools_export_load_object('panels_mini');
|
||||
@@ -294,10 +362,14 @@ function panels_mini_load_all($reset = FALSE) {
|
||||
*/
|
||||
function panels_mini_save(&$mini) {
|
||||
if (!empty($mini->display)) {
|
||||
$mini->display->storage_id = $mini->name;
|
||||
$display = panels_save_display($mini->display);
|
||||
$mini->did = $display->did;
|
||||
}
|
||||
|
||||
// Clear the panels_mini_load cache.
|
||||
cache_clear_all('panels_mini_load:', 'cache_panels', TRUE);
|
||||
|
||||
$update = (isset($mini->pid) && $mini->pid != 'new') ? array('pid') : array();
|
||||
drupal_write_record('panels_mini', $mini, $update);
|
||||
|
||||
@@ -350,6 +422,24 @@ function panels_mini_ctools_plugin_directory($module, $plugin) {
|
||||
if ($module == 'ctools' && ($plugin == 'content_types' || $plugin == 'export_ui')) {
|
||||
return 'plugins/' . $plugin;
|
||||
}
|
||||
if ($module == 'panels' && $plugin == 'panels_storage') {
|
||||
return 'plugins/' . $plugin;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_default_panels_mini_alter().
|
||||
*
|
||||
* If a default Panels display has no storage type, set it.
|
||||
*/
|
||||
function panels_default_panels_mini_alter(&$mini_panels) {
|
||||
foreach ($mini_panels as &$mini_panel) {
|
||||
$display =& $mini_panel->display;
|
||||
if (empty($display->storage_type)) {
|
||||
$display->storage_type = 'panels_mini';
|
||||
$display->storage_id = $mini_panel->name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -388,6 +478,9 @@ function panels_mini_panels_cache_get($key) {
|
||||
$cache->display = $item->display;
|
||||
$cache->display->context = ctools_context_load_contexts($item);
|
||||
$cache->display->cache_key = 'panels_mini:' . $key;
|
||||
$cache->display->storage_type = 'panels_mini';
|
||||
// Temporary storage id that's replaced in panels_mini_save().
|
||||
$cache->display->storage_id = 'panels_mini';
|
||||
$cache->content_types = panels_common_get_allowed_types('panels_mini', $cache->display->context);
|
||||
$cache->display_title = TRUE;
|
||||
|
||||
@@ -431,6 +524,15 @@ function panels_mini_panels_cache_save($key, $cache) {
|
||||
function panels_mini_panels_cache_break_lock($key, $cache) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_panels_pre_render().
|
||||
*/
|
||||
function panels_mini_panels_pre_render($display, $renderer) {
|
||||
if (isset($display->owner->table) && $display->owner->table == 'panels_mini' && $renderer instanceof panels_renderer_standard) {
|
||||
$renderer->show_empty_layout = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_panels_dashboard_blocks().
|
||||
*
|
||||
@@ -480,3 +582,14 @@ function panels_mini_panels_dashboard_blocks(&$vars) {
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements template_preprocess_ctools_wizard_trail().
|
||||
*
|
||||
* Customize the divider used in the CTools wizard to build the edit pages for
|
||||
* Mini Panels as a stop-gap measure until the UX can be completely re-done.
|
||||
*/
|
||||
function panels_mini_preprocess_ctools_wizard_trail(&$variables) {
|
||||
$variables['divider'] = ' | ';
|
||||
drupal_add_css(drupal_get_path('module', 'panels_mini') . '/panels_mini.css');
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@
|
||||
* @file
|
||||
* Contains the content type plugin for a mini panel. While this does not
|
||||
* need to be broken out into a .inc file, it's convenient that we do so
|
||||
* that we don't load code unneccessarily. Plus it demonstrates plugins
|
||||
* that we don't load code unnecessarily. Plus it demonstrates plugins
|
||||
* in modules other than Panels itself.
|
||||
*
|
||||
*/
|
||||
@@ -68,8 +68,13 @@ function _panels_mini_panels_mini_content_type_content_type($mini) {
|
||||
$type['required context'] = array();
|
||||
foreach ($mini->requiredcontexts as $context) {
|
||||
$info = ctools_get_context($context['name']);
|
||||
// TODO: allow an optional setting
|
||||
$type['required context'][] = new ctools_context_required($context['identifier'], $info['context name']);
|
||||
// Check if the required context is actually required.
|
||||
if (!empty($context['optional'])) {
|
||||
$type['required context'][] = new ctools_context_optional($context['identifier'], $info['context name']);
|
||||
}
|
||||
else {
|
||||
$type['required context'][] = new ctools_context_required($context['identifier'], $info['context name']);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $type;
|
||||
|
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Provides a panels_storage plugin for mini panels.
|
||||
*/
|
||||
|
||||
// Plugin definition
|
||||
$plugin = array(
|
||||
'access callback' => 'panels_mini_panels_storage_access',
|
||||
);
|
||||
|
||||
/**
|
||||
* Access callback for panels storage.
|
||||
*/
|
||||
function panels_mini_panels_storage_access($storage_type, $storage_id, $op, $account) {
|
||||
if ($op == 'create') {
|
||||
return user_access('create mini panels', $account);
|
||||
}
|
||||
|
||||
return user_access('administer mini panels', $account);
|
||||
}
|
Reference in New Issue
Block a user