security update core+modules
This commit is contained in:
@@ -9,13 +9,12 @@ files[] = includes/date_views_argument_handler.inc
|
||||
files[] = includes/date_views_argument_handler_simple.inc
|
||||
files[] = includes/date_views_filter_handler.inc
|
||||
files[] = includes/date_views_filter_handler_simple.inc
|
||||
files[] = includes/date_views.views_default.inc
|
||||
files[] = includes/date_views.views.inc
|
||||
files[] = includes/date_views_plugin_pager.inc
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-09-30
|
||||
version = "7.x-2.6+2-dev"
|
||||
; Information added by Drupal.org packaging script on 2014-07-29
|
||||
version = "7.x-2.8"
|
||||
core = "7.x"
|
||||
project = "date"
|
||||
datestamp = "1348964349"
|
||||
datestamp = "1406653438"
|
||||
|
||||
|
30
sites/all/modules/date/date_views/date_views.install
Normal file
30
sites/all/modules/date/date_views/date_views.install
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Install, update and uninstall functions for the Date Views module.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_install().
|
||||
*/
|
||||
function date_views_install() {
|
||||
variable_set('date_views_month_format_with_year', 'F Y');
|
||||
variable_set('date_views_month_format_without_year', 'F');
|
||||
variable_set('date_views_day_format_with_year', 'l, F j, Y');
|
||||
variable_set('date_views_day_format_without_year', 'l, F j');
|
||||
variable_set('date_views_week_format_with_year', 'F j, Y');
|
||||
variable_set('date_views_week_format_without_year', 'F j');
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_uninstall().
|
||||
*/
|
||||
function date_views_uninstall() {
|
||||
variable_del('date_views_month_format_with_year');
|
||||
variable_del('date_views_month_format_without_year');
|
||||
variable_del('date_views_day_format_with_year');
|
||||
variable_del('date_views_day_format_without_year');
|
||||
variable_del('date_views_week_format_with_year');
|
||||
variable_del('date_views_week_format_without_year');
|
||||
}
|
@@ -1,5 +1,80 @@
|
||||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_menu().
|
||||
*/
|
||||
function date_views_menu() {
|
||||
// Used to import files from a local filesystem into Drupal.
|
||||
$items['admin/config/regional/date-time/date-views'] = array(
|
||||
'title' => 'Date views',
|
||||
'description' => 'Configure settings for date views.',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('date_views_settings'),
|
||||
'access arguments' => array('administer site configuration '),
|
||||
'type' => MENU_LOCAL_TASK,
|
||||
);
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Form callback for date views settings.
|
||||
*/
|
||||
function date_views_settings($form, &$form_state) {
|
||||
|
||||
$form['date_views_month_format_with_year'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Date views month format with year'),
|
||||
'#size' => 10,
|
||||
'#default_value' => variable_get('date_views_month_format_with_year', 'F Y'),
|
||||
'#description' => t('Date views month format with year, default value : F Y'),
|
||||
);
|
||||
|
||||
$form['date_views_month_format_without_year'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Date views month format without year'),
|
||||
'#size' => 10,
|
||||
'#default_value' => variable_get('date_views_month_format_without_year', 'F'),
|
||||
'#description' => t('Date views month format without year, default value : F'),
|
||||
);
|
||||
|
||||
$form['date_views_day_format_with_year'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Date views day format with year'),
|
||||
'#size' => 10,
|
||||
'#default_value' => variable_get('date_views_day_format_with_year', 'l, F j, Y'),
|
||||
'#description' => t('Date views day format with year, default value : l, F j, Y'),
|
||||
);
|
||||
|
||||
$form['date_views_day_format_without_year'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Date views day format without year'),
|
||||
'#size' => 10,
|
||||
'#default_value' => variable_get('date_views_day_format_without_year', 'l, F j'),
|
||||
'#description' => t('Date views day format without year, default value : l, F j'),
|
||||
);
|
||||
|
||||
$form['date_views_week_format_with_year'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Date views week format with year'),
|
||||
'#size' => 10,
|
||||
'#default_value' => variable_get('date_views_week_format_with_year', 'F j, Y'),
|
||||
'#description' => t('Date views week format with year, default value : F j, Y'),
|
||||
);
|
||||
|
||||
$form['date_views_week_format_without_year'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Date views week format without year'),
|
||||
'#size' => 10,
|
||||
'#default_value' => variable_get('date_views_week_format_without_year', 'F j'),
|
||||
'#description' => t('Date views week format without year, default value : F j'),
|
||||
);
|
||||
|
||||
return system_settings_form($form);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_views_api().
|
||||
*
|
||||
|
@@ -128,7 +128,7 @@ function date_views_views_data_alter(&$data) {
|
||||
// Mark all the core date handlers as date fields.
|
||||
// This will identify all handlers that directly use the _date handlers,
|
||||
// will not pick up any that extend those handlers.
|
||||
foreach ($data as $module => &$table) {
|
||||
foreach ($data as $base_table => &$table) {
|
||||
foreach ($table as $id => &$field) {
|
||||
foreach (array('field', 'sort', 'filter', 'argument') as $type) {
|
||||
if (isset($field[$type]) && isset($field[$type]['handler']) && ($field[$type]['handler'] == 'views_handler_' . $type . '_date')) {
|
||||
|
@@ -64,7 +64,7 @@ class date_views_argument_handler_simple extends views_handler_argument_date {
|
||||
if ($granularity == 'week') {
|
||||
$now = date_now();
|
||||
$week = date_week(date_format($now, 'Y-m-d'));
|
||||
$value = date_format($now, 'Y') . '-W' . $week;
|
||||
$value = date_format($now, 'o') . '-W' . date_pad($week);
|
||||
}
|
||||
else {
|
||||
$value = date($this->arg_format, REQUEST_TIME);
|
||||
@@ -85,7 +85,7 @@ class date_views_argument_handler_simple extends views_handler_argument_date {
|
||||
$options = parent::option_definition();
|
||||
$options['year_range'] = array('default' => '-3:+3');
|
||||
$options['granularity'] = array('default' => 'month');
|
||||
$options['default_argument_type'] = array('default' => 'date');
|
||||
$options['default_argument_type']['default'] = 'date';
|
||||
$options['add_delta'] = array('default' => '');
|
||||
$options['use_fromto'] = array('default' => '');
|
||||
$options['title_format'] = array('default' => '');
|
||||
|
@@ -36,6 +36,10 @@ class date_views_filter_handler extends date_views_filter_handler_simple {
|
||||
$this->date_combine_conditions('op_simple');
|
||||
}
|
||||
|
||||
function op_contains($field) {
|
||||
$this->date_combine_conditions('op_contains');
|
||||
}
|
||||
|
||||
/**
|
||||
* Combines multiple date WHERE expressions into a single WHERE expression.
|
||||
*
|
||||
|
@@ -42,6 +42,17 @@ class date_views_filter_handler_simple extends views_handler_filter_date {
|
||||
return $options;
|
||||
}
|
||||
|
||||
function operators() {
|
||||
$operators = parent::operators();
|
||||
$operators['contains'] = array(
|
||||
'title' => t('Contains'),
|
||||
'method' => 'op_contains',
|
||||
'short' => t('contains'),
|
||||
'values' => 1,
|
||||
);
|
||||
return $operators;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to find a default value.
|
||||
*/
|
||||
@@ -53,8 +64,8 @@ class date_views_filter_handler_simple extends views_handler_filter_date {
|
||||
// If this is a remembered value, use the value from the SESSION.
|
||||
if (!empty($this->options['expose']['remember'])) {
|
||||
$display_id = ($this->view->display_handler->is_defaulted('filters')) ? 'default' : $this->view->current_display;
|
||||
if (!empty($_SESSION['views'][$this->view->name][$display_id]['date_filter'][$prefix])) {
|
||||
return $_SESSION['views'][$this->view->name][$display_id]['date_filter'][$prefix];
|
||||
if (!empty($_SESSION['views'][$this->view->name][$display_id][$this->options['expose']['identifier']][$prefix])) {
|
||||
return $_SESSION['views'][$this->view->name][$display_id][$this->options['expose']['identifier']][$prefix];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,8 +115,12 @@ class date_views_filter_handler_simple extends views_handler_filter_date {
|
||||
$element_input['value'] = $this->get_filter_value('value', !empty($element_input['value']) ? $element_input['value'] : '');
|
||||
$element_input['min'] = $this->get_filter_value('min', !empty($element_input['min']) ? $element_input['min'] : '');
|
||||
$element_input['max'] = $this->get_filter_value('max', !empty($element_input['max']) ? $element_input['max'] : '');
|
||||
unset($element_input['default_date']);
|
||||
unset($element_input['default_to_date']);
|
||||
if (is_array($element_input) && isset($element_input['default_date'])) {
|
||||
unset($element_input['default_date']);
|
||||
}
|
||||
if (is_array($element_input) && isset($element_input['default_to_date'])) {
|
||||
unset($element_input['default_to_date']);
|
||||
}
|
||||
|
||||
$input[$this->options['expose']['identifier']] = $element_input;
|
||||
}
|
||||
@@ -163,6 +178,29 @@ class date_views_filter_handler_simple extends views_handler_filter_date {
|
||||
$this->query->add_where_expression($group, "$field $this->operator $placeholder", array($placeholder => $value));
|
||||
}
|
||||
|
||||
function op_contains($field) {
|
||||
|
||||
// Add the delta field to the view so we can later find the value that matched our query.
|
||||
list($table_name, $field_name) = explode('.', $field);
|
||||
if (!empty($this->options['add_delta']) && (substr($field_name, -6) == '_value' || substr($field_name, -7) == '_value2')) {
|
||||
$this->query->add_field($table_name, 'delta');
|
||||
}
|
||||
|
||||
$value = $this->get_filter_value('value', $this->value['value']);
|
||||
$comp_date = new DateObject($value, date_default_timezone(), $this->format);
|
||||
$fields = date_views_fields($this->base_table);
|
||||
$fields = $fields['name'];
|
||||
$fromto = $fields[$field]['fromto'];
|
||||
$field_min = $this->date_handler->sql_field($fromto[0], NULL, $comp_date);
|
||||
$field_min = $this->date_handler->sql_format($this->format, $field_min);
|
||||
$field_max = $this->date_handler->sql_field($fromto[1], NULL, $comp_date);
|
||||
$field_max = $this->date_handler->sql_format($this->format, $field_max);
|
||||
$placeholder_min = $this->placeholder();
|
||||
$placeholder_max = $this->placeholder();
|
||||
$group = !empty($this->options['date_group']) ? $this->options['date_group'] : $this->options['group'];
|
||||
$this->query->add_where_expression($group, "$field_max >= $placeholder_min AND $field_min <= $placeholder_max", array($placeholder_min => $value, $placeholder_max => $value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the granularity of the date parts to use in the filter.
|
||||
*/
|
||||
@@ -316,7 +354,7 @@ class date_views_filter_handler_simple extends views_handler_filter_date {
|
||||
$type = 'date_text';
|
||||
}
|
||||
|
||||
$format = $this->date_handler->views_formats($this->options['granularity'], 'sql');
|
||||
$format = $this->date_handler->views_formats($this->options['granularity'], 'display');
|
||||
$granularity = array_keys($this->date_handler->date_parts($this->options['granularity']));
|
||||
$relative_value = ($prefix == 'max' ? $this->options['default_to_date'] : $this->options['default_date']);
|
||||
|
||||
@@ -333,7 +371,7 @@ class date_views_filter_handler_simple extends views_handler_filter_date {
|
||||
'#date_label_position' => 'within',
|
||||
'#date_year_range' => $this->options['year_range'],
|
||||
'#process' => array($type . '_element_process'),
|
||||
'#prefix' => '<div id="' . $id . '-wrapper"><div id="' . $id . '">',
|
||||
'#prefix' => '<div id="' . $id . '-wrapper"><div id="' . $id . '-inside-wrapper">',
|
||||
'#suffix' => '</div></div>',
|
||||
);
|
||||
if ($which == 'all') {
|
||||
@@ -368,7 +406,7 @@ class date_views_filter_handler_simple extends views_handler_filter_date {
|
||||
'#date_label_position' => 'within',
|
||||
'#date_year_range' => $this->options['year_range'],
|
||||
'#process' => array($type . '_element_process'),
|
||||
'#prefix' => '<div id="' . $id . '-wrapper"><div id="' . $id . '">',
|
||||
'#prefix' => '<div id="' . $id . '-wrapper"><div id="' . $id . '-inside-wrapper">',
|
||||
'#suffix' => '</div></div>',
|
||||
'#states' => array(
|
||||
'visible' => array(
|
||||
|
@@ -37,10 +37,10 @@
|
||||
<?php if (!empty($prev_url)) : ?>
|
||||
<li class="date-prev">
|
||||
<?php print l('«' . ($mini ? '' : ' ' . t('Prev', array(), array('context' => 'date_nav'))), $prev_url, $prev_options); ?>
|
||||
</li>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($next_url)) : ?>
|
||||
<li class="date-next">
|
||||
<li class="date-next">
|
||||
<?php print l(($mini ? '' : t('Next', array(), array('context' => 'date_nav')) . ' ') . '»', $next_url, $next_options); ?>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
|
@@ -75,8 +75,8 @@ function template_preprocess_date_views_pager(&$vars) {
|
||||
case 'week':
|
||||
$next_week = date_week(date_format($next_date, 'Y-m-d'));
|
||||
$prev_week = date_week(date_format($prev_date, 'Y-m-d'));
|
||||
$next_arg = date_format($next_date, 'Y-\W') . date_pad($next_week);
|
||||
$prev_arg = date_format($prev_date, 'Y-\W') . date_pad($prev_week);
|
||||
$next_arg = date_format($next_date, 'o-\W') . date_pad($next_week);
|
||||
$prev_arg = date_format($prev_date, 'o-\W') . date_pad($prev_week);
|
||||
break;
|
||||
default:
|
||||
$next_arg = date_format($next_date, $format[$granularity]);
|
||||
@@ -165,23 +165,25 @@ function theme_date_nav_title($params) {
|
||||
$date_info = $view->date_info;
|
||||
$link = !empty($params['link']) ? $params['link'] : FALSE;
|
||||
$format = !empty($params['format']) ? $params['format'] : NULL;
|
||||
$format_with_year = variable_get('date_views_' . $granularity . 'format_with_year', 'l, F j, Y');
|
||||
$format_without_year = variable_get('date_views_' . $granularity . 'format_without_year', 'l, F j');
|
||||
switch ($granularity) {
|
||||
case 'year':
|
||||
$title = $date_info->year;
|
||||
$date_arg = $date_info->year;
|
||||
break;
|
||||
case 'month':
|
||||
$format = !empty($format) ? $format : (empty($date_info->mini) ? 'F Y' : 'F');
|
||||
$format = !empty($format) ? $format : (empty($date_info->mini) ? $format_with_year : $format_without_year);
|
||||
$title = date_format_date($date_info->min_date, 'custom', $format);
|
||||
$date_arg = $date_info->year . '-' . date_pad($date_info->month);
|
||||
break;
|
||||
case 'day':
|
||||
$format = !empty($format) ? $format : (empty($date_info->mini) ? 'l, F j, Y' : 'l, F j');
|
||||
$format = !empty($format) ? $format : (empty($date_info->mini) ? $format_with_year : $format_without_year);
|
||||
$title = date_format_date($date_info->min_date, 'custom', $format);
|
||||
$date_arg = $date_info->year . '-' . date_pad($date_info->month) . '-' . date_pad($date_info->day);
|
||||
break;
|
||||
case 'week':
|
||||
$format = !empty($format) ? $format : (empty($date_info->mini) ? 'F j, Y' : 'F j');
|
||||
$format = !empty($format) ? $format : (empty($date_info->mini) ? $format_with_year : $format_without_year);
|
||||
$title = t('Week of @date', array('@date' => date_format_date($date_info->min_date, 'custom', $format)));
|
||||
$date_arg = $date_info->year . '-W' . date_pad($date_info->week);
|
||||
break;
|
||||
|
Reference in New Issue
Block a user