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

@@ -4961,6 +4961,13 @@ function views_ui_admin_settings_advanced() {
'#description' => t('Select a translation method to use for Views data like header, footer, and empty text.'),
);
$form['locale']['views_localize_all'] = array(
'#type' => 'checkbox',
'#title' => t('Use same translation method for exported views'),
'#description' => t('Exported views will use Core translation by default. Enable this to always use the configured translation method.'),
'#default_value' => variable_get('views_localize_all', FALSE),
);
$regions = array();
$regions['watchdog'] = t('Watchdog');
if (module_exists('devel')) {

View File

@@ -48,12 +48,12 @@ function views_ajax() {
// Add all $_POST data, because AJAX is always a post and many things,
// such as tablesorts, exposed filters and paging assume $_GET.
$_GET = $_POST + $_GET;
$_GET = $_POST + drupal_get_query_parameters($_GET, array('page'));
// Overwrite the destination.
// @see drupal_get_destination()
$origin_destination = $path;
$query = drupal_http_build_query($_REQUEST);
$query = drupal_http_build_query(drupal_get_query_parameters());
if ($query != '') {
$origin_destination .= '?' . $query;
}

View File

@@ -67,12 +67,11 @@ function _views_fetch_data($table = NULL, $move = TRUE, $reset = FALSE) {
}
else {
if (!$fully_loaded) {
$data = views_cache_get('views_data', TRUE);
if (!empty($data->data)) {
if ($data = views_cache_get('views_data', TRUE)) {
$cache = $data->data;
}
if (empty($cache)) {
else {
// No cache entry, rebuild.
$cache = _views_fetch_data_build();
}
$fully_loaded = TRUE;
@@ -127,12 +126,25 @@ function _views_data_process_entity_types(&$data) {
function _views_fetch_plugin_data($type = NULL, $plugin = NULL, $reset = FALSE) {
static $cache = NULL;
if (!isset($cache) || $reset) {
$start = microtime(TRUE);
views_include('plugins');
views_include_handlers();
$cache = views_discover_plugins();
// Load necessary code once.
if (!isset($cache)) {
views_include('plugins');
views_include_handlers();
}
// Because plugin data contains translated strings, and as such can be
// expensive to build, the results are cached per language.
global $language;
$cache_key = 'views:plugin_data:' . $language->language;
if (!$reset) {
if ($cache = cache_get($cache_key)) {
$cache = $cache->data;
}
}
// If not available in the cache, build it and cache it.
if (!$cache || $reset) {
$cache = views_discover_plugins();
cache_set($cache_key, $cache);
}
}
if (!$type && !$plugin) {

View File

@@ -758,7 +758,7 @@ class views_many_to_one_helper {
*/
public $placeholders = array();
function views_many_to_one_helper(&$handler) {
function __construct(&$handler) {
$this->handler = &$handler;
}
@@ -1547,7 +1547,6 @@ class views_join {
if (is_array($this->extra)) {
$extras = array();
foreach ($this->extra as $info) {
$extra = '';
// Figure out the table name. Remember, only use aliases provided
// if at all possible.
$join_table = '';
@@ -1565,36 +1564,63 @@ class views_join {
}
}
// Convert a single-valued array of values to the single-value case,
// and transform from IN() notation to = notation
if (is_array($info['value']) && count($info['value']) == 1) {
if (empty($info['operator'])) {
$operator = '=';
// If left_field is set use it for a field-to-field condition.
if (!empty($info['left_field'])) {
$operator = !empty($info['operator']) ? $info['operator'] : '=';
$left_table = (isset($info['left_table'])) ? $info['left_table'] : $left['alias'];
$extras[] = "$join_table$info[field] $operator $left_table.$info[left_field]";
}
// Else if formula is set, us it for a flexible on clause.
elseif (!empty($info['formula'])) {
// If a field is given, we build a "$field $op $formula".
// Without it would only be "$formula".
$extra = '';
if (isset($info['field'])) {
// With a single value, the '=' operator is implicit.
$operator = !empty($info['operator']) ? $info['operator'] : '=';
$extra .= "$join_table$info[field] $operator ";
}
$extra .= $info['formula'];
// Add placeholder arguments.
if (isset($info['formula_arguments']) && is_array($info['formula_arguments'])) {
$arguments = array_merge($arguments, $info['formula_arguments']);
}
$extras[] = $extra;
}
// Otherwise - and if we have a value - use it for a field-to-value condition.
elseif (!empty($info['value'])) {
// Convert a single-valued array of values to the single-value case,
// and transform from IN() notation to = notation
if (is_array($info['value']) && count($info['value']) == 1) {
if (empty($info['operator'])) {
$operator = '=';
}
else {
$operator = $info['operator'] == 'NOT IN' ? '!=' : '=';
}
$info['value'] = array_shift($info['value']);
}
if (is_array($info['value'])) {
// With an array of values, we need multiple placeholders and the
// 'IN' operator is implicit.
foreach ($info['value'] as $value) {
$placeholder_i = ':views_join_condition_' . $select_query->nextPlaceholder();
$arguments[$placeholder_i] = $value;
}
$operator = !empty($info['operator']) ? $info['operator'] : 'IN';
$placeholder = '( ' . implode(', ', array_keys($arguments)) . ' )';
}
else {
$operator = $info['operator'] == 'NOT IN' ? '!=' : '=';
}
$info['value'] = array_shift($info['value']);
}
if (is_array($info['value'])) {
// With an array of values, we need multiple placeholders and the
// 'IN' operator is implicit.
foreach ($info['value'] as $value) {
$placeholder_i = $view_query->placeholder('views_join_condition_');
$arguments[$placeholder_i] = $value;
// With a single value, the '=' operator is implicit.
$operator = !empty($info['operator']) ? $info['operator'] : '=';
$placeholder = ':views_join_condition_' . $select_query->nextPlaceholder();
$arguments[$placeholder] = $info['value'];
}
$operator = !empty($info['operator']) ? $info['operator'] : 'IN';
$placeholder = '( ' . implode(', ', array_keys($arguments)) . ' )';
$extras[] = "$join_table$info[field] $operator $placeholder";
}
else {
// With a single value, the '=' operator is implicit.
$operator = !empty($info['operator']) ? $info['operator'] : '=';
$placeholder = $view_query->placeholder('views_join_condition_');
$arguments[$placeholder] = $info['value'];
}
$extras[] = "$join_table$info[field] $operator $placeholder";
}
if ($extras) {
@@ -1660,7 +1686,6 @@ class views_join_subquery extends views_join {
if (is_array($this->extra)) {
$extras = array();
foreach ($this->extra as $info) {
$extra = '';
// Figure out the table name. Remember, only use aliases provided
// if at all possible.
$join_table = '';

View File

@@ -408,7 +408,7 @@ function views_views_plugins() {
*/
function views_discover_plugins() {
$cache = array('display' => array(), 'style' => array(), 'row' => array(), 'argument default' => array(), 'argument validator' => array(), 'access' => array(), 'cache' => array(), 'exposed_form' => array());
// Get plugins from all mdoules.
// Get plugins from all modules.
foreach (module_implements('views_plugins') as $module) {
$function = $module . '_views_plugins';
$result = $function();
@@ -526,6 +526,9 @@ class views_plugin extends views_object {
* Provide a full list of possible theme templates used by this style.
*/
function theme_functions() {
if (empty($this->definition['theme'])) {
$this->definition['theme'] = 'views_view';
}
return views_theme_functions($this->definition['theme'], $this->view, $this->display);
}

View File

@@ -812,8 +812,6 @@ class view extends views_db_object {
if (isset($arg)) {
$this->args[$position] = $arg;
}
// remember that this argument was computed, not passed on the URL.
$argument->is_default = TRUE;
}
// Set the argument, which will also validate that the argument can be set.
@@ -1150,7 +1148,7 @@ class view extends views_db_object {
$cache = $this->display_handler->get_plugin('cache');
}
if ($cache && $cache->cache_get('results')) {
if($this->query->pager->use_pager()) {
if($this->query->pager->use_pager() || !empty($this->get_total_rows)) {
$this->query->pager->total_items = $this->total_rows;
$this->query->pager->update_page_info();
}
@@ -1593,7 +1591,7 @@ class view extends views_db_object {
$position = 0;
if (!empty($this->argument)) {
foreach ($this->argument as $argument_id => $argument) {
if (!empty($argument->is_default) && !empty($argument->options['default_argument_skip_url'])) {
if (!empty($argument->options['default_argument_skip_url'])) {
unset($args[$position]);
}
$position++;
@@ -1818,6 +1816,9 @@ class view extends views_db_object {
$this->vid = $vid ? $vid : NULL;
}
// Let modules modify the view just prior to saving it.
module_invoke_all('views_view_presave', $this);
$transaction = db_transaction();
try {
@@ -1848,6 +1849,9 @@ class view extends views_db_object {
// Clear caches.
views_invalidate_cache();
// Notify modules that this view has been saved.
module_invoke_all('views_view_save', $this);
}
/**
@@ -1887,6 +1891,9 @@ class view extends views_db_object {
// Clear caches.
views_invalidate_cache();
}
// Notify modules that this view has been deleted.
module_invoke_all('views_view_delete', $this);
}
/**
@@ -2076,25 +2083,26 @@ class view extends views_db_object {
}
/**
* Find and initialize the localizer plugin.
* Find and initialize the localization plugin.
*/
function init_localization() {
if (isset($this->localization_plugin) && is_object($this->localization_plugin)) {
return TRUE;
// If the translate attribute isn't set, init the localization plugin.
if (!isset($this->localization_plugin->translate)) {
$this->localization_plugin = views_get_plugin('localization', views_get_localization_plugin());
// If the plugin is still not set, turn off all localization by using the
// views_plugin_localization_none plugin. This plugin has the translate
// property set to FALSE, signifying localization should not occur.
if (empty($this->localization_plugin)) {
$this->localization_plugin = views_get_plugin('localization', 'none');
}
// Init the plugin.
$this->localization_plugin->init($this);
}
$this->localization_plugin = views_get_plugin('localization', views_get_localization_plugin());
if (empty($this->localization_plugin)) {
$this->localization_plugin = views_get_plugin('localization', 'none');
return FALSE;
}
/**
* Figure out whether there should be options.
*/
$this->localization_plugin->init($this);
// Return the value of the translate property. This is set to FALSE if
// localization is off.
return $this->localization_plugin->translate;
}
@@ -2102,6 +2110,10 @@ class view extends views_db_object {
* Determine whether a view supports admin string translation.
*/
function is_translatable() {
// Use translation no matter what type of view.
if (variable_get('views_localize_all', FALSE)) {
return TRUE;
}
// If the view is normal or overridden, use admin string translation.
// A newly created view won't have a type. Accept this.
return (!isset($this->type) || in_array($this->type, array(t('Normal'), t('Overridden')))) ? TRUE : FALSE;
@@ -2566,7 +2578,7 @@ class views_display extends views_db_object {
var $display_options;
var $db_table = 'views_display';
function views_display($init = TRUE) {
function __construct($init = TRUE) {
parent::init($init);
}