contrib modules security updates
This commit is contained in:
@@ -385,8 +385,8 @@ class views_ui extends ctools_export_ui {
|
||||
$output = parent::list_page($js, $input);
|
||||
if (is_string($output)) {
|
||||
$output = '<div id="views-ui-list-page">' . $output . '</div>';
|
||||
return $output;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -86,7 +86,7 @@ class views_plugin_argument_validate extends views_plugin {
|
||||
/**
|
||||
* Process the summary arguments for displaying.
|
||||
*
|
||||
* Some plugins alter the argument so it uses something else interal.
|
||||
* Some plugins alter the argument so it uses something else internally.
|
||||
* For example the user validation set's the argument to the uid,
|
||||
* for a faster query. But there are use cases where you want to use
|
||||
* the old value again, for example the summary.
|
||||
|
@@ -206,14 +206,14 @@ class views_plugin_cache extends views_plugin {
|
||||
// Slightly less simple for CSS:
|
||||
$css = drupal_add_css();
|
||||
$css_start = isset($this->storage['css']) ? $this->storage['css'] : array();
|
||||
$this->storage['css'] = $array_mapping_func($css, $css_start);
|
||||
$this->storage['css'] = $this->assetDiff($css, $css_start, $array_mapping_func);
|
||||
|
||||
// Get javascript after/before views renders.
|
||||
$js = drupal_add_js();
|
||||
$js_start = isset($this->storage['js']) ? $this->storage['js'] : array();
|
||||
// If there are any differences between the old and the new javascript then
|
||||
// store them to be added later.
|
||||
$this->storage['js'] = $array_mapping_func($js, $js_start);
|
||||
$this->storage['js'] = $this->assetDiff($js, $js_start, $array_mapping_func);
|
||||
|
||||
// Special case the settings key and get the difference of the data.
|
||||
$settings = isset($js['settings']['data']) ? $js['settings']['data'] : array();
|
||||
@@ -224,6 +224,38 @@ class views_plugin_cache extends views_plugin {
|
||||
$this->storage['headers'] = $array_mapping_func(drupal_get_http_header(), $this->storage['headers']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the differences between two JS/CSS asset arrays.
|
||||
*
|
||||
* @param array $assets
|
||||
* The current asset array.
|
||||
* @param array $start_assets
|
||||
* The original asset array.
|
||||
* @param string $diff_function
|
||||
* The function that should be used for computing the diff.
|
||||
*
|
||||
* @return array
|
||||
* A CSS or JS asset array that contains all entries that are new/different
|
||||
* in $assets.
|
||||
*/
|
||||
protected function assetDiff(array $assets, array $start_assets, $diff_function) {
|
||||
$diff = $diff_function($assets, $start_assets);
|
||||
|
||||
// Cleanup the resulting array since drupal_array_diff_assoc_recursive() can
|
||||
// leave half populated arrays behind.
|
||||
foreach ($diff as $key => $entry) {
|
||||
// If only the weight was different we can remove this entry.
|
||||
if (count($entry) == 1 && isset($entry['weight'])) {
|
||||
unset($diff[$key]);
|
||||
}
|
||||
// If there are other differences we override with the latest entry.
|
||||
elseif ($entry != $assets[$key]) {
|
||||
$diff[$key] = $assets[$key];
|
||||
}
|
||||
}
|
||||
return $diff;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore out of band data saved to cache. Copied from Panels.
|
||||
*/
|
||||
|
@@ -107,4 +107,21 @@ class views_plugin_cache_time extends views_plugin_cache {
|
||||
return CACHE_PERMANENT;
|
||||
}
|
||||
}
|
||||
|
||||
function cache_set($type) {
|
||||
$lifespan = $this->get_lifespan($type);
|
||||
if ($lifespan >= 0) {
|
||||
parent::cache_set($type);
|
||||
}
|
||||
}
|
||||
|
||||
function cache_get($type) {
|
||||
$lifespan = $this->get_lifespan($type);
|
||||
if ($lifespan >= 0) {
|
||||
return parent::cache_get($type);
|
||||
}
|
||||
else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -53,7 +53,7 @@ class views_plugin_display extends views_plugin {
|
||||
$this->extender[$extender] = $plugin;
|
||||
}
|
||||
else {
|
||||
vpr('Invalid display extender @extender', array('@handler' => $extender));
|
||||
vpr('Invalid display extender @extender', array('@extender' => $extender));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -739,7 +739,7 @@ class views_plugin_display extends views_plugin {
|
||||
function uses_link_display() { return !$this->has_path(); }
|
||||
|
||||
/**
|
||||
* Check to see if the display can put the exposed formin a block.
|
||||
* Check to see if the display can put the exposed form in a block.
|
||||
*
|
||||
* By default, displays that do not have a path cannot disconnect
|
||||
* the exposed form and put it in a block, because the form has no
|
||||
@@ -1150,7 +1150,7 @@ class views_plugin_display extends views_plugin {
|
||||
);
|
||||
}
|
||||
|
||||
$display_comment = check_plain(drupal_substr($this->get_option('display_comment'), 0, 10));
|
||||
$display_comment = check_plain(views_ui_truncate($this->get_option('display_comment'), 80));
|
||||
$options['display_comment'] = array(
|
||||
'category' => 'other',
|
||||
'title' => t('Comment'),
|
||||
@@ -1419,7 +1419,7 @@ class views_plugin_display extends views_plugin {
|
||||
}
|
||||
$form['#title'] = check_plain($this->display->display_title) . ': ';
|
||||
|
||||
// Set the 'section' to hilite on the form.
|
||||
// Set the 'section' to highlight on the form.
|
||||
// If it's the item we're looking at is pulling from the default display,
|
||||
// reflect that. Don't use is_defaulted since we want it to show up even
|
||||
// on the default display.
|
||||
@@ -1573,8 +1573,12 @@ class views_plugin_display extends views_plugin {
|
||||
$plugin = $this->get_plugin('access');
|
||||
$form['#title'] .= t('Access options');
|
||||
if ($plugin) {
|
||||
$form['#help_topic'] = $plugin->definition['help topic'];
|
||||
$form['#help_module'] = $plugin->definition['module'];
|
||||
if (!empty($plugin->definition['help topic'])) {
|
||||
$form['#help_topic'] = $plugin->definition['help topic'];
|
||||
}
|
||||
if (!empty($plugin->definition['module'])) {
|
||||
$form['#help_module'] = $plugin->definition['module'];
|
||||
}
|
||||
|
||||
$form['access_options'] = array(
|
||||
'#tree' => TRUE,
|
||||
@@ -1615,8 +1619,12 @@ class views_plugin_display extends views_plugin {
|
||||
$plugin = $this->get_plugin('cache');
|
||||
$form['#title'] .= t('Caching options');
|
||||
if ($plugin) {
|
||||
$form['#help_topic'] = $plugin->definition['help topic'];
|
||||
$form['#help_module'] = $plugin->definition['module'];
|
||||
if (!empty($plugin->definition['help topic'])) {
|
||||
$form['#help_topic'] = $plugin->definition['help topic'];
|
||||
}
|
||||
if (!empty($plugin->definition['module'])) {
|
||||
$form['#help_module'] = $plugin->definition['module'];
|
||||
}
|
||||
|
||||
$form['cache_options'] = array(
|
||||
'#tree' => TRUE,
|
||||
@@ -1635,11 +1643,10 @@ class views_plugin_display extends views_plugin {
|
||||
$form['#title'] .= t('Query options');
|
||||
$this->view->init_query();
|
||||
if ($this->view->query) {
|
||||
if (isset($this->view->query->definition['help topic'])) {
|
||||
if (!empty($this->view->query->definition['help topic'])) {
|
||||
$form['#help_topic'] = $this->view->query->definition['help topic'];
|
||||
}
|
||||
|
||||
if (isset($this->view->query->definition['module'])) {
|
||||
if (!empty($this->view->query->definition['module'])) {
|
||||
$form['#help_module'] = $this->view->query->definition['module'];
|
||||
}
|
||||
|
||||
@@ -1734,8 +1741,10 @@ class views_plugin_display extends views_plugin {
|
||||
}
|
||||
$plugin = $this->get_plugin(empty($style) ? 'row' : 'style');
|
||||
if ($plugin) {
|
||||
if (isset($plugin->definition['help topic'])) {
|
||||
if (!empty($plugin->definition['help topic'])) {
|
||||
$form['#help_topic'] = $plugin->definition['help topic'];
|
||||
}
|
||||
if (!empty($plugin->definition['module'])) {
|
||||
$form['#help_module'] = $plugin->definition['module'];
|
||||
}
|
||||
$form[$form_state['section']] = array(
|
||||
@@ -2117,7 +2126,12 @@ class views_plugin_display extends views_plugin {
|
||||
$plugin = $this->get_plugin('exposed_form');
|
||||
$form['#title'] .= t('Exposed form options');
|
||||
if ($plugin) {
|
||||
$form['#help_topic'] = $plugin->definition['help topic'];
|
||||
if (!empty($plugin->definition['help topic'])) {
|
||||
$form['#help_topic'] = $plugin->definition['help topic'];
|
||||
}
|
||||
if (!empty($plugin->definition['module'])) {
|
||||
$form['#help_module'] = $plugin->definition['module'];
|
||||
}
|
||||
|
||||
$form['exposed_form_options'] = array(
|
||||
'#tree' => TRUE,
|
||||
@@ -2140,7 +2154,7 @@ class views_plugin_display extends views_plugin {
|
||||
'#default_value' => $pager['type'],
|
||||
);
|
||||
|
||||
$pager_plugin = views_fetch_plugin_data('pager', $pager['type'], array($this->view->base_table));
|
||||
$pager_plugin = views_fetch_plugin_data('pager', $pager['type']);
|
||||
if (!empty($pager_plugin['uses options'])) {
|
||||
$form['markup'] = array(
|
||||
'#prefix' => '<div class="form-item description">',
|
||||
@@ -2154,7 +2168,12 @@ class views_plugin_display extends views_plugin {
|
||||
$plugin = $this->get_plugin('pager');
|
||||
$form['#title'] .= t('Pager options');
|
||||
if ($plugin) {
|
||||
$form['#help_topic'] = $plugin->definition['help topic'];
|
||||
if (!empty($plugin->definition['help topic'])) {
|
||||
$form['#help_topic'] = $plugin->definition['help topic'];
|
||||
}
|
||||
if (!empty($plugin->definition['module'])) {
|
||||
$form['#help_module'] = $plugin->definition['module'];
|
||||
}
|
||||
|
||||
$form['pager_options'] = array(
|
||||
'#tree' => TRUE,
|
||||
@@ -2556,6 +2575,23 @@ class views_plugin_display extends views_plugin {
|
||||
$url_options['query'] = $this->view->exposed_raw_input;
|
||||
}
|
||||
$theme = views_theme_functions('views_more', $this->view, $this->display);
|
||||
|
||||
$parsed_url = drupal_parse_url($path);
|
||||
// Preserve the query string from url.
|
||||
if (!empty($parsed_url['query'])) {
|
||||
if (!empty($url_options['query'])) {
|
||||
$url_options['query'] = array_merge($parsed_url['query'], $url_options['query']);
|
||||
}
|
||||
else {
|
||||
$url_options['query'] = $parsed_url['query'];
|
||||
}
|
||||
$path = $parsed_url['path'];
|
||||
}
|
||||
// Add fragment if applicable.
|
||||
if (!empty($parsed_url['fragment'])) {
|
||||
$url_options['fragment'] = $parsed_url['fragment'];
|
||||
}
|
||||
|
||||
$path = check_url(url($path, $url_options));
|
||||
|
||||
return theme($theme, array('more_url' => $path, 'link_text' => check_plain($this->use_more_text()), 'view' => $this->view));
|
||||
|
@@ -227,6 +227,8 @@ class views_plugin_display_attachment extends views_plugin_display {
|
||||
|
||||
$args = $this->get_option('inherit_arguments') ? $this->view->args : array();
|
||||
$view->set_arguments($args);
|
||||
$exposed_input = $this->get_option('inherit_exposed_filters') ? $this->view->exposed_input : array();
|
||||
$view->set_exposed_input($exposed_input);
|
||||
$view->set_display($this->display->id);
|
||||
if ($this->get_option('inherit_pager')) {
|
||||
$view->display_handler->use_pager = $this->view->display[$display_id]->handler->use_pager();
|
||||
|
@@ -222,8 +222,8 @@ class views_plugin_display_block extends views_plugin_display {
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the block cache setting in the blocks table if this block allready
|
||||
* exists in the blocks table. Dirty fix untill http://drupal.org/node/235673 gets in.
|
||||
* Save the block cache setting in the blocks table if this block already
|
||||
* exists in the blocks table. Dirty fix until http://drupal.org/node/235673 gets in.
|
||||
*/
|
||||
function save_block_cache($delta, $cache_setting) {
|
||||
if (strlen($delta) >= 32) {
|
||||
|
@@ -143,7 +143,7 @@ class views_plugin_query_default extends views_plugin_query {
|
||||
);
|
||||
|
||||
/**
|
||||
* -- we no longer want the base field to appear automatigically.
|
||||
* -- we no longer want the base field to appear automatically.
|
||||
if ($base_field) {
|
||||
$this->fields[$base_field] = array(
|
||||
'table' => $base_table,
|
||||
@@ -888,7 +888,7 @@ class views_plugin_query_default extends views_plugin_query {
|
||||
/**
|
||||
* Add a complex WHERE clause to the query.
|
||||
*
|
||||
* The caller is reponsible for ensuring that all fields are fully qualified
|
||||
* The caller is responsible for ensuring that all fields are fully qualified
|
||||
* (TABLE.FIELD) and that the table already exists in the query.
|
||||
* Internally the dbtng method "where" is used.
|
||||
*
|
||||
@@ -1322,6 +1322,10 @@ class views_plugin_query_default extends views_plugin_query {
|
||||
if (count($this->having)) {
|
||||
$this->has_aggregate = TRUE;
|
||||
}
|
||||
elseif (!$this->has_aggregate) {
|
||||
// Allow 'GROUP BY' even no aggregation function has been set.
|
||||
$this->has_aggregate = $this->view->display_handler->get_option('group_by');
|
||||
}
|
||||
if ($this->has_aggregate && (!empty($this->groupby) || !empty($non_aggregates))) {
|
||||
$groupby = array_unique(array_merge($this->groupby, $non_aggregates));
|
||||
foreach ($groupby as $field) {
|
||||
@@ -1588,7 +1592,7 @@ class views_plugin_query_default extends views_plugin_query {
|
||||
'sort' => 'views_handler_sort_group_by_numeric',
|
||||
),
|
||||
)
|
||||
);
|
||||
) + views_fetch_plugin_data('query_aggregate');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1616,7 +1620,8 @@ class views_plugin_query_default extends views_plugin_query {
|
||||
}
|
||||
$entity_type = $table_data['table']['entity type'];
|
||||
$info = entity_get_info($entity_type);
|
||||
$id_alias = $this->get_field_alias($base_table_alias, $info['entity keys']['id']);
|
||||
$is_revision = !empty($table_data['table']['revision']);
|
||||
$id_alias = $this->get_field_alias($base_table_alias, $info['entity keys'][$is_revision ? 'revision' : 'id']);
|
||||
|
||||
// Assemble the ids of the entities to load.
|
||||
$ids = array();
|
||||
@@ -1626,12 +1631,34 @@ class views_plugin_query_default extends views_plugin_query {
|
||||
}
|
||||
}
|
||||
|
||||
$entities = entity_load($entity_type, $ids);
|
||||
// Re-key the array by row-index.
|
||||
$result = array();
|
||||
foreach ($ids as $key => $id) {
|
||||
$result[$key] = isset($entities[$id]) ? $entities[$id] : FALSE;
|
||||
if (!$is_revision) {
|
||||
$entities = entity_load($entity_type, $ids);
|
||||
|
||||
// Re-key the array by row-index.
|
||||
$result = array();
|
||||
foreach ($ids as $key => $id) {
|
||||
$result[$key] = isset($entities[$id]) ? $entities[$id] : FALSE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// There's no way in core to load revisions in bulk.
|
||||
$result = array();
|
||||
foreach ($ids as $key => $id) {
|
||||
// Nodes can be dealt with in core.
|
||||
if ($entity_type == 'node') {
|
||||
$result[$key] = node_load(NULL, $id);
|
||||
}
|
||||
// Otherwise see if entity is enabled.
|
||||
elseif (module_exists('entity')) {
|
||||
$result[$key] = entity_revision_load($entity_type, $id);
|
||||
}
|
||||
else {
|
||||
// Otherwise this isn't supported.
|
||||
watchdog('views', 'Attempt to load a revision on an unsupported entity type @entity_type.', array('@entity_type' => $entity_type), WATCHDOG_WARNING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array($entity_type, $result);
|
||||
}
|
||||
}
|
||||
|
@@ -123,13 +123,23 @@ class views_plugin_style extends views_plugin {
|
||||
function get_row_class($row_index) {
|
||||
if ($this->uses_row_class()) {
|
||||
$class = $this->options['row_class'];
|
||||
|
||||
if ($this->uses_fields() && $this->view->field) {
|
||||
$class = strip_tags($this->tokenize_value($class, $row_index));
|
||||
$classes = array();
|
||||
|
||||
// Explode the value by whitespace, this allows the function to handle
|
||||
// a single class name and multiple class names that are then tokenized.
|
||||
foreach(explode(' ', $class) as $token_class) {
|
||||
$classes[] = strip_tags($this->tokenize_value($token_class, $row_index));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$classes = explode(' ', $class);
|
||||
}
|
||||
|
||||
$classes = explode(' ', $class);
|
||||
// Convert whatever the result is to a nice clean class name
|
||||
foreach ($classes as &$class) {
|
||||
$class = drupal_clean_css_identifier($class);
|
||||
$class = drupal_html_class($class);
|
||||
}
|
||||
return implode(' ', $classes);
|
||||
}
|
||||
@@ -182,7 +192,7 @@ class views_plugin_style extends views_plugin {
|
||||
function options_form(&$form, &$form_state) {
|
||||
parent::options_form($form, $form_state);
|
||||
// Only fields-based views can handle grouping. Style plugins can also exclude
|
||||
// themselves from being groupable by setting their "use grouping" definiton
|
||||
// themselves from being groupable by setting their "use grouping" definition
|
||||
// key to FALSE.
|
||||
// @TODO: Document "uses grouping" in docs.php when docs.php is written.
|
||||
if ($this->uses_fields() && $this->definition['uses grouping']) {
|
||||
@@ -191,7 +201,7 @@ class views_plugin_style extends views_plugin {
|
||||
$options += $field_labels;
|
||||
// If there are no fields, we can't group on them.
|
||||
if (count($options) > 1) {
|
||||
// This is for backward compability, when there was just a single select form.
|
||||
// This is for backward compatibility, when there was just a single select form.
|
||||
if (is_string($this->options['grouping'])) {
|
||||
$grouping = $this->options['grouping'];
|
||||
$this->options['grouping'] = array();
|
||||
@@ -419,7 +429,7 @@ class views_plugin_style extends views_plugin {
|
||||
* @endcode
|
||||
*/
|
||||
function render_grouping($records, $groupings = array(), $group_rendered = NULL) {
|
||||
// This is for backward compability, when $groupings was a string containing
|
||||
// This is for backward compatibility, when $groupings was a string containing
|
||||
// the ID of a single field.
|
||||
if (is_string($groupings)) {
|
||||
$rendered = $group_rendered === NULL ? TRUE : $group_rendered;
|
||||
@@ -486,7 +496,7 @@ class views_plugin_style extends views_plugin {
|
||||
);
|
||||
}
|
||||
|
||||
// If this parameter isn't explicitely set modify the output to be fully
|
||||
// If this parameter isn't explicitly set modify the output to be fully
|
||||
// backward compatible to code before Views 7.x-3.0-rc2.
|
||||
// @TODO Remove this as soon as possible e.g. October 2020
|
||||
if ($group_rendered === NULL) {
|
||||
|
@@ -71,6 +71,36 @@ class views_plugin_style_rss extends views_plugin_style {
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an atom:link XHTML element to add to the channel to comply with
|
||||
* the RSS 2.0 specification.
|
||||
*
|
||||
* @see http://validator.w3.org/feed/docs/warning/MissingAtomSelfLink.html
|
||||
*
|
||||
* @return
|
||||
* An array that can be passed to format_xml_elements().
|
||||
*/
|
||||
function get_channel_elements_atom_link() {
|
||||
$url_options = array('absolute' => TRUE);
|
||||
$input = $this->view->get_exposed_input();
|
||||
if ($input) {
|
||||
$url_options['query'] = $input;
|
||||
}
|
||||
$url = url($this->view->get_url(), $url_options);
|
||||
|
||||
return array(
|
||||
array(
|
||||
'namespace' => array('xmlns:atom' => 'http://www.w3.org/2005/Atom'),
|
||||
'key' => 'atom:link',
|
||||
'attributes' => array(
|
||||
'href' => $url,
|
||||
'rel' => 'self',
|
||||
'type' => 'application/rss+xml',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get RSS feed description.
|
||||
*
|
||||
@@ -99,7 +129,10 @@ class views_plugin_style_rss extends views_plugin_style {
|
||||
|
||||
// Fetch any additional elements for the channel and merge in their
|
||||
// namespaces.
|
||||
$this->channel_elements = $this->get_channel_elements();
|
||||
$this->channel_elements = array_merge(
|
||||
$this->get_channel_elements(),
|
||||
$this->get_channel_elements_atom_link()
|
||||
);
|
||||
foreach ($this->channel_elements as $element) {
|
||||
if (isset($element['namespace'])) {
|
||||
$this->namespaces = array_merge($this->namespaces, $element['namespace']);
|
||||
|
Reference in New Issue
Block a user