all contrib module security updates done

This commit is contained in:
2020-09-24 22:47:32 +02:00
parent 7d87153100
commit 0fbb9c4610
1612 changed files with 116663 additions and 32269 deletions
+111 -34
View File
@@ -17,6 +17,7 @@ function date_get_entity_bundle($entity_type, $entity) {
case 'field_collection_item':
$bundle = $entity->field_name;
break;
default:
$bundle = field_extract_bundle($entity_type, $entity);
break;
@@ -42,13 +43,20 @@ function date_default_format($type) {
* Wrapper function around each of the widget types for creating a date object.
*/
function date_input_date($field, $instance, $element, $input) {
// Trim extra spacing off user input of text fields.
if (isset($input['date'])) {
$input['date'] = trim($input['date']);
}
switch ($instance['widget']['type']) {
case 'date_text':
$function = 'date_text_input_date';
break;
case 'date_popup':
$function = 'date_popup_input_date';
break;
default:
$function = 'date_select_input_date';
}
@@ -68,6 +76,7 @@ function date_theme() {
);
$themes = array(
'date_combo' => $base + array('render element' => 'element'),
'date_form_element' => $base + array('render element' => 'element'),
'date_text_parts' => $base + array('render element' => 'element'),
'date' => $base + array('render element' => 'element'),
'date_display_single' => $base + array(
@@ -78,6 +87,8 @@ function date_theme() {
'attributes' => array(),
'rdf_mapping' => NULL,
'add_rdf' => NULL,
'microdata' => NULL,
'add_microdata' => NULL,
),
),
'date_display_range' => $base + array(
@@ -95,7 +106,15 @@ function date_theme() {
'attributes_end' => array(),
'rdf_mapping' => NULL,
'add_rdf' => NULL,
)),
'microdata' => NULL,
'add_microdata' => NULL,
),
),
'date_display_remaining' => $base + array(
'variables' => array(
'remaining_days' => NULL,
),
),
'date_display_combination' => $base + array(
'variables' => array(
'entity_type' => NULL,
@@ -110,6 +129,8 @@ function date_theme() {
'attributes' => array(),
'rdf_mapping' => NULL,
'add_rdf' => NULL,
'microdata' => NULL,
'add_microdata' => NULL,
),
),
'date_display_interval' => $base + array(
@@ -126,7 +147,7 @@ function date_theme() {
'attributes' => array(),
'rdf_mapping' => NULL,
'add_rdf' => NULL,
),
),
),
);
@@ -205,8 +226,10 @@ function date_formatter_process($formatter, $entity_type, $entity, $field, $inst
$settings = $display['settings'];
$field_name = $field['field_name'];
$format = date_formatter_format($formatter, $settings, $granularity, $langcode);
$timezone = isset($item['timezone']) ? $item['timezone'] : '';
$timezone = date_get_timezone($field['settings']['tz_handling'], $timezone);
if (!isset($field['settings']['tz_handling']) || $field['settings']['tz_handling'] !== 'utc') {
$timezone = isset($item['timezone']) ? $item['timezone'] : '';
$timezone = date_get_timezone($field['settings']['tz_handling'], $timezone);
}
$timezone_db = date_get_timezone_db($field['settings']['tz_handling']);
$db_format = date_type_format($field['type']);
$process = date_process_values($field);
@@ -242,22 +265,23 @@ function date_formatter_process($formatter, $entity_type, $entity, $field, $inst
$dates[$processed]['formatted_iso'] = date_format_date($date, 'custom', 'c');
if (is_object($date)) {
if ($format == 'format_interval') {
$dates[$processed]['interval'] = date_format_interval($date);
$dates[$processed]['interval'] = date_format_interval($date);
}
elseif ($format == 'format_calendar_day') {
$dates[$processed]['calendar_day'] = date_format_calendar_day($date);
$dates[$processed]['calendar_day'] = date_format_calendar_day($date);
}
elseif ($format == 'U') {
elseif ($format == 'U' || $format == 'r' || $format == 'c') {
$dates[$processed]['formatted'] = date_format_date($date, 'custom', $format);
$dates[$processed]['formatted_date'] = date_format_date($date, 'custom', $format);
$dates[$processed]['formatted_time'] = '';
$dates[$processed]['formatted_timezone'] = '';
}
elseif (!empty($format)) {
$dates[$processed]['formatted'] = date_format_date($date, 'custom', $format);
$dates[$processed]['formatted_date'] = date_format_date($date, 'custom', date_limit_format($format, array('year', 'month', 'day')));
$dates[$processed]['formatted_time'] = date_format_date($date, 'custom', date_limit_format($format, array('hour', 'minute', 'second')));
$dates[$processed]['formatted_timezone'] = date_format_date($date, 'custom', date_limit_format($format, array('timezone')));
$formats = _get_custom_date_format($date, $format);
$dates[$processed]['formatted'] = $formats['formatted'];
$dates[$processed]['formatted_date'] = $formats['date'];
$dates[$processed]['formatted_time'] = $formats['time'];
$dates[$processed]['formatted_timezone'] = $formats['zone'];
}
}
}
@@ -284,6 +308,30 @@ function date_formatter_process($formatter, $entity_type, $entity, $field, $inst
return $dates;
}
/**
* Get a custom date format.
*/
function _get_custom_date_format($date, $format) {
$custom = array();
$custom['granularities'] = array(
'date' => array('year', 'month', 'day'),
'time' => array('hour', 'minute', 'second'),
'zone' => array('timezone'),
);
$custom['limits'] = array(
'date' => date_limit_format($format, $custom['granularities']['date']),
'time' => date_limit_format($format, $custom['granularities']['time']),
'zone' => date_limit_format($format, $custom['granularities']['zone']),
);
return array(
'formatted' => date_format_date($date, 'custom', $format),
'date' => date_format_date($date, 'custom', $custom['limits']['date']),
'time' => date_format_date($date, 'custom', $custom['limits']['time']),
'zone' => date_format_date($date, 'custom', $custom['limits']['zone']),
);
}
/**
* Retrieves the granularity for a field.
*
@@ -297,14 +345,14 @@ function date_formatter_process($formatter, $entity_type, $entity, $field, $inst
*/
function date_granularity($field) {
if (!is_array($field) || !is_array($field['settings']['granularity'])) {
$field['settings']['granularity'] = drupal_map_assoc(array('year', 'month', 'day'));
$granularity = drupal_map_assoc(array('year', 'month', 'day'));
$field['settings']['granularity'] = $granularity;
}
return array_values(array_filter($field['settings']['granularity']));
}
/**
* Helper function to create an array of the date values in a
* field that need to be processed.
* Helper function to create an array of the date values in a field that need to be processed.
*/
function date_process_values($field) {
return $field['settings']['todate'] ? array('value', 'value2') : array('value');
@@ -390,12 +438,17 @@ function date_formatter_format($formatter, $settings, $granularity = array(), $l
switch ($formatter) {
case 'format_interval':
return 'format_interval';
break;
case 'date_plain':
return 'date_plain';
break;
default:
$format = date_format_type_format($format_type, $langcode);
if ($format_type == 'custom') {
$format = $settings['custom_date_format'];
}
else {
$format = date_format_type_format($format_type, $langcode);
}
break;
}
@@ -406,6 +459,7 @@ function date_formatter_format($formatter, $settings, $granularity = array(), $l
/**
* Helper function to get the right format for a format type.
*
* Checks for locale-based format first.
*/
function date_format_type_format($format_type, $langcode = NULL) {
@@ -428,27 +482,30 @@ function date_format_type_format($format_type, $langcode = NULL) {
case 'short':
$default = 'm/d/Y - H:i';
break;
case 'long':
$default = 'l, F j, Y - H:i';
break;
// If it's not one of the core date types and isn't stored in the
// database, we'll fall back on using the same default format as the
// 'medium' type.
case 'medium':
default:
// @todo: If a non-core module provides a date type and does not
// variable_set() a default for it, the default assumed here may
// not be correct (since the default format used by 'medium' may
// not even be one of the allowed formats for the date type in
// question). To fix this properly, we should really call
// system_get_date_formats($format_type) and take the first
// format from that list as the default. However, this function
// is called often (on many different page requests), so calling
// system_get_date_formats() from here would be a performance hit
// since that function writes several records to the database
// during each page request that calls it.
// variable_set() a default for it, the default assumed here may
// not be correct (since the default format used by 'medium' may
// not even be one of the allowed formats for the date type in
// question). To fix this properly, we should really call
// system_get_date_formats($format_type) and take the first
// format from that list as the default. However, this function
// is called often (on many different page requests), so calling
// system_get_date_formats() from here would be a performance hit
// since that function writes several records to the database
// during each page request that calls it.
$default = 'D, m/d/Y - H:i';
break;
}
$format = variable_get('date_format_' . $format_type, $default);
}
@@ -502,7 +559,7 @@ function date_prepare_entity($formatter, $entity_type, $entity, $field, $instanc
elseif ((!empty($max_count) && is_numeric($max_count) && $count >= $max_count) ||
(!empty($value['value']) && $value['value'] < $start) ||
(!empty($value['value2']) && $value['value2'] > $end)) {
unset($entity->{$field_name}[$langcode][$delta]);
unset($entity->{$field_name}[$langcode][$delta]);
}
else {
$count++;
@@ -532,6 +589,7 @@ function date_entity_metadata_property_info_alter(&$info, $entity_type, $field,
if (!empty($field['settings']['todate'])) {
// Define a simple data structure containing both dates.
$property['type'] = ($field['cardinality'] != 1) ? 'list<struct>' : 'struct';
$property['auto creation'] = 'date_entity_metadata_struct_create';
$property['getter callback'] = 'entity_metadata_field_verbatim_get';
$property['setter callback'] = 'entity_metadata_field_verbatim_set';
$property['property info'] = array(
@@ -543,6 +601,8 @@ function date_entity_metadata_property_info_alter(&$info, $entity_type, $field,
// The getter and setter callbacks for 'value' and 'value2'
// will not provide the field name as $name, we'll add it to $info.
'field_name' => $field['field_name'],
// Alert Microdata module that this value can be exposed in microdata.
'microdata' => TRUE,
),
'value2' => array(
'type' => 'date',
@@ -552,6 +612,8 @@ function date_entity_metadata_property_info_alter(&$info, $entity_type, $field,
// The getter and setter callbacks for 'value' and 'value2'
// will not provide the field name as $name, we'll add it to $info.
'field_name' => $field['field_name'],
// Alert Microdata module that this value can be exposed in microdata.
'microdata' => TRUE,
),
'duration' => array(
'type' => 'duration',
@@ -566,6 +628,11 @@ function date_entity_metadata_property_info_alter(&$info, $entity_type, $field,
);
unset($property['query callback']);
}
else {
// If this doesn't have a todate, it is handled as a date rather than a
// struct. Enable microdata on the field itself rather than the properties.
$property['microdata'] = TRUE;
}
}
/**
@@ -632,12 +699,22 @@ function date_entity_metadata_field_setter(&$entity, $name, $value, $langcode, $
drupal_static_reset('field_language');
}
/**
* Auto creation callback for fields which contain two date values in one.
*/
function date_entity_metadata_struct_create($name, $property_info) {
return array(
'date_type' => $property_info['field']['columns'][$name]['type'],
'timezone_db' => $property_info['field']['settings']['timezone_db'],
);
}
/**
* Callback for setting an individual field value if a to-date may be there too.
*
* Based on entity_property_verbatim_set().
*
* The passed in unix timestamp (UTC) is converted to the right value and
* format dependent on the field.
* The passed in unix timestamp (UTC) is converted to the right value and format dependent on the field.
*
* $name is either 'value' or 'value2'.
*/
@@ -659,9 +736,9 @@ function date_entity_metadata_struct_setter(&$item, $name, $value, $langcode, $t
}
/**
* Duplicate functionality of what is now date_all_day_field() in
* the Date All Day module. Copy left here to avoid breaking other
* modules that use this function.
* Duplicate functionality of what is now date_all_day_field() in the Date All Day module.
*
* Copy left here to avoid breaking other modules that use this function.
*
* DEPRECATED!, will be removed at some time in the future.
*/
@@ -735,7 +812,7 @@ function date_field_widget_properties_alter(&$widget, $context) {
$entity = $context['entity'];
$info = entity_get_info($entity_type);
$id = $info['entity keys']['id'];
$widget['is_new']= FALSE;
$widget['is_new'] = FALSE;
if (empty($entity->$id)) {
$widget['is_new'] = TRUE;
}