security updates
have to check views and entityreference for custom patches
This commit is contained in:
@@ -7,9 +7,9 @@ php = 5.2
|
||||
files[] = tests/date_repeat.test
|
||||
files[] = tests/date_repeat_form.test
|
||||
|
||||
; Information added by drupal.org packaging script on 2012-08-13
|
||||
version = "7.x-2.6"
|
||||
; Information added by Drupal.org packaging script on 2014-07-29
|
||||
version = "7.x-2.8"
|
||||
core = "7.x"
|
||||
project = "date"
|
||||
datestamp = "1344850024"
|
||||
datestamp = "1406653438"
|
||||
|
||||
|
@@ -173,7 +173,7 @@ function _date_repeat_calc($rrule, $start, $end, $exceptions, $timezone, $additi
|
||||
}
|
||||
if ($rrule['FREQ'] == 'YEARLY') {
|
||||
// Back up to first of year and jump.
|
||||
$current_day = date_repeat_set_year_day($current_day, NULL, 1, '+', $timezone, $modify_time);
|
||||
$current_day = date_repeat_set_year_day($current_day, NULL, NULL, 1, '+', $timezone, $modify_time);
|
||||
date_modify($current_day, '+' . $jump . $modify_time);
|
||||
}
|
||||
$finished = date_repeat_is_finished($current_day, $days, $count, $end_date);
|
||||
@@ -223,18 +223,42 @@ function _date_repeat_calc($rrule, $start, $end, $exceptions, $timezone, $additi
|
||||
$ordered = date_repeat_days_ordered($week_start_rule);
|
||||
$ordered_keys = array_flip($ordered);
|
||||
|
||||
foreach ($rrule['BYDAY'] as $day) {
|
||||
preg_match("@(-)?([0-9]+)?([SU|MO|TU|WE|TH|FR|SA]{2})@", trim($day), $regs);
|
||||
if (!empty($regs[2])) {
|
||||
// Convert parameters into full day name, count, and direction.
|
||||
$direction_days[] = array(
|
||||
'day' => $day_names[$regs[3]],
|
||||
'direction' => !empty($regs[1]) ? $regs[1] : '+',
|
||||
'direction_count' => $regs[2],
|
||||
);
|
||||
if ($rrule['FREQ'] == 'YEARLY' && !empty($rrule['BYMONTH'])) {
|
||||
// Additional cycle to apply month preferences.
|
||||
foreach ($rrule['BYMONTH'] as $month) {
|
||||
foreach ($rrule['BYDAY'] as $day) {
|
||||
preg_match("@(-)?([0-9]+)?([SU|MO|TU|WE|TH|FR|SA]{2})@", trim($day), $regs);
|
||||
// Convert parameters into full day name, count, and direction.
|
||||
// Add leading zero to first 9 months.
|
||||
if (!empty($regs[2])) {
|
||||
$direction_days[] = array(
|
||||
'day' => $day_names[$regs[3]],
|
||||
'direction' => !empty($regs[1]) ? $regs[1] : '+',
|
||||
'direction_count' => $regs[2],
|
||||
'month' => strlen($month) > 1 ? $month : '0' . $month,
|
||||
);
|
||||
}
|
||||
else {
|
||||
$week_days[$ordered_keys[$regs[3]]] = $day_names[$regs[3]];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$week_days[$ordered_keys[$regs[3]]] = $day_names[$regs[3]];
|
||||
}
|
||||
else {
|
||||
foreach ($rrule['BYDAY'] as $day) {
|
||||
preg_match("@(-)?([0-9]+)?([SU|MO|TU|WE|TH|FR|SA]{2})@", trim($day), $regs);
|
||||
if (!empty($regs[2])) {
|
||||
// Convert parameters into full day name, count, and direction.
|
||||
$direction_days[] = array(
|
||||
'day' => $day_names[$regs[3]],
|
||||
'direction' => !empty($regs[1]) ? $regs[1] : '+',
|
||||
'direction_count' => $regs[2],
|
||||
'month' => NULL,
|
||||
);
|
||||
}
|
||||
else {
|
||||
$week_days[$ordered_keys[$regs[3]]] = $day_names[$regs[3]];
|
||||
}
|
||||
}
|
||||
}
|
||||
ksort($week_days);
|
||||
@@ -251,7 +275,7 @@ function _date_repeat_calc($rrule, $start, $end, $exceptions, $timezone, $additi
|
||||
$current_day = date_repeat_set_month_day($current_day, $day['day'], $day['direction_count'], $day['direction'], $timezone, $modify_time);
|
||||
}
|
||||
else {
|
||||
$current_day = date_repeat_set_year_day($current_day, $day['day'], $day['direction_count'], $day['direction'], $timezone, $modify_time);
|
||||
$current_day = date_repeat_set_year_day($current_day, $day['month'], $day['day'], $day['direction_count'], $day['direction'], $timezone, $modify_time);
|
||||
}
|
||||
date_repeat_add_dates($days, $current_day, $start_date, $end_date, $exceptions, $rrule);
|
||||
}
|
||||
@@ -543,24 +567,42 @@ function date_repeat_set_month_day($date_in, $day, $count = 1, $direction = '+',
|
||||
* If $day is empty, will set to the number of days from the
|
||||
* beginning or end of the year.
|
||||
*/
|
||||
function date_repeat_set_year_day($date_in, $day, $count = 1, $direction = '+', $timezone = 'UTC', $modify_time) {
|
||||
function date_repeat_set_year_day($date_in, $month, $day, $count = 1, $direction = '+', $timezone = 'UTC', $modify_time) {
|
||||
if (is_object($date_in)) {
|
||||
$current_year = date_format($date_in, 'Y');
|
||||
|
||||
// Reset to the start of the month.
|
||||
// See note above.
|
||||
$datetime = date_format($date_in, DATE_FORMAT_DATETIME);
|
||||
$datetime = substr_replace($datetime, '01-01', 5, 5);
|
||||
$month_key = isset($month) ? $month : '01';
|
||||
$datetime = substr_replace($datetime, $month_key . '-01', 5, 5);
|
||||
$date = new DateObject($datetime, $timezone);
|
||||
if ($direction == '-') {
|
||||
// For negative search, start from the end of the year.
|
||||
date_modify($date, '+1 year' . $modify_time);
|
||||
|
||||
if (isset($month)) {
|
||||
if ($direction == '-') {
|
||||
// For negative search, start from the end of the month.
|
||||
$modifier = '+1 month';
|
||||
}
|
||||
else {
|
||||
// For positive search, back up one day to get outside the
|
||||
// current month, so we can catch the first of the month.
|
||||
$modifier = '-1 day';
|
||||
}
|
||||
}
|
||||
else {
|
||||
// For positive search, back up one day to get outside the
|
||||
// current year, so we can catch the first of the year.
|
||||
date_modify($date, '-1 day' . $modify_time);
|
||||
if ($direction == '-') {
|
||||
// For negative search, start from the end of the year.
|
||||
$modifier = '+1 year';
|
||||
}
|
||||
else {
|
||||
// For positive search, back up one day to get outside the
|
||||
// current year, so we can catch the first of the year.
|
||||
$modifier = '-1 day';
|
||||
}
|
||||
}
|
||||
|
||||
date_modify($date, $modifier . $modify_time);
|
||||
|
||||
if (empty($day)) {
|
||||
date_modify($date, $direction . $count . ' days' . $modify_time);
|
||||
}
|
||||
|
@@ -941,7 +941,6 @@ function theme_date_repeat_current_additions($rows = array()) {
|
||||
*/
|
||||
function theme_date_repeat_rrule($vars) {
|
||||
$element = $vars['element'];
|
||||
$class = $element['#date_repeat_collapsed'] ? array('date-no-float', 'collapsible', 'collapsed') : array('date-no-float', 'collapsible');
|
||||
$id = drupal_html_id('repeat-settings-fieldset');
|
||||
$parents = $element['#parents'];
|
||||
$selector = "{$parents[0]}[{$parents[1]}][{$parents[2]}][show_repeat_settings]";
|
||||
@@ -949,11 +948,10 @@ function theme_date_repeat_rrule($vars) {
|
||||
'#type' => 'item',
|
||||
'#title' => t('Repeat settings'),
|
||||
'#title_display' => 'invisible',
|
||||
'#attributes' => array('class' => $class),
|
||||
'#markup' => $element['#children'],
|
||||
'#states' => array(
|
||||
'visible' => array(
|
||||
":input[name=\"{$selector}\"]" => array('checked' => TRUE),
|
||||
'invisible' => array(
|
||||
":input[name=\"{$selector}\"]" => array('checked' => FALSE),
|
||||
),
|
||||
),
|
||||
'#id' => $id,
|
||||
|
@@ -377,6 +377,19 @@ class DateRepeatTestCase extends DrupalWebTestCase {
|
||||
$result = implode(', ', $dates);
|
||||
$this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . '; results: ' . $result);
|
||||
|
||||
//Every Last Thursday in November, every year, five times:
|
||||
$start = "2014-11-27 00:00:00";
|
||||
$rule = 'FREQ=YEARLY;INTERVAL=1;BYDAY=-1TH;BYMONTH=11;COUNT=5;WKST=SU';
|
||||
// ==> (2014 00:00 AM EDT)November 27
|
||||
// (2015 00:00 AM EDT)November 26
|
||||
// (2016 00:00 AM EDT)November 24
|
||||
// (2017 00:00 AM EDT)November 30
|
||||
// (2018 00:00 AM EDT)November 29
|
||||
$dates = date_repeat_calc($rule, $start, NULL, array());
|
||||
$shouldbe = '2014-11-27 00:00:00, 2015-11-26 00:00:00, 2016-11-24 00:00:00, 2017-11-30 00:00:00, 2018-11-29 00:00:00';
|
||||
$result = implode(', ', $dates);
|
||||
$this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . '; results: ' . $result);
|
||||
|
||||
return;
|
||||
|
||||
//Every Thanksgiving, forever:
|
||||
|
@@ -195,20 +195,22 @@ class DateRepeatFormTestCase extends DrupalWebTestCase {
|
||||
$edit = array();
|
||||
$edit['title'] = $this->randomName(8);
|
||||
$edit['body[und][0][value]'] = $this->randomName(16);
|
||||
$current_year = date('Y');
|
||||
|
||||
|
||||
switch ($options) {
|
||||
case 'select':
|
||||
$edit['field_test[und][0][value][year]'] = '2010';
|
||||
$edit['field_test[und][0][value][year]'] = $current_year;
|
||||
$edit['field_test[und][0][value][month]'] = '10';
|
||||
$edit['field_test[und][0][value][day]'] = '7';
|
||||
$edit['field_test[und][0][value][hour]'] = '10';
|
||||
$edit['field_test[und][0][value][minute]'] = '30';
|
||||
break;
|
||||
case 'text':
|
||||
$edit['field_test[und][0][value][date]'] = '2010-10-07 10:30';
|
||||
$edit['field_test[und][0][value][date]'] = format_string('!year-10-07 10:30', array('!year' => $current_year));
|
||||
break;
|
||||
case 'popup':
|
||||
$edit['field_test[und][0][value][date]'] = '2010-10-07';
|
||||
$edit['field_test[und][0][value][date]'] = format_string('!year-10-07', array('!year' => $current_year));
|
||||
$edit['field_test[und][0][value][time]'] = '10:30';
|
||||
break;
|
||||
}
|
||||
@@ -378,7 +380,7 @@ class DateRepeatFormTestCase extends DrupalWebTestCase {
|
||||
else {
|
||||
$edit['field_test[und][0][rrule][range_of_repeat]'] = 'UNTIL';
|
||||
$date = array(
|
||||
'year' => '2011',
|
||||
'year' => $current_year + 1,
|
||||
'month' => '10',
|
||||
'day' => '07'
|
||||
);
|
||||
@@ -392,7 +394,7 @@ class DateRepeatFormTestCase extends DrupalWebTestCase {
|
||||
case 'exclude':
|
||||
$exclude_include_edit['field_test[und][0][rrule][show_exceptions]'] = TRUE;
|
||||
$date = array(
|
||||
'year' => '2010',
|
||||
'year' => $current_year,
|
||||
'month' => '10',
|
||||
'day' => '07'
|
||||
);
|
||||
@@ -401,7 +403,7 @@ class DateRepeatFormTestCase extends DrupalWebTestCase {
|
||||
case 'include':
|
||||
$exclude_include_edit['field_test[und][0][rrule][show_additions]'] = TRUE;
|
||||
$date = array(
|
||||
'year' => '2013',
|
||||
'year' => $current_year + 3,
|
||||
'month' => '10',
|
||||
'day' => '07'
|
||||
);
|
||||
@@ -410,7 +412,7 @@ class DateRepeatFormTestCase extends DrupalWebTestCase {
|
||||
case 'exclude_include':
|
||||
$exclude_include_edit['field_test[und][0][rrule][show_exceptions]'] = TRUE;
|
||||
$date = array(
|
||||
'year' => '2010',
|
||||
'year' => $current_year,
|
||||
'month' => '10',
|
||||
'day' => '07'
|
||||
);
|
||||
@@ -418,7 +420,7 @@ class DateRepeatFormTestCase extends DrupalWebTestCase {
|
||||
|
||||
$exclude_include_edit['field_test[und][0][rrule][show_additions]'] = TRUE;
|
||||
$date = array(
|
||||
'year' => '2013',
|
||||
'year' => $current_year + 3,
|
||||
'month' => '10',
|
||||
'day' => '07'
|
||||
);
|
||||
@@ -510,7 +512,6 @@ class DateRepeatFormTestCase extends DrupalWebTestCase {
|
||||
break;
|
||||
case 'text':
|
||||
case 'popup':
|
||||
//$return["{$field_name}[datetime][date]"] = '2011-10-07';
|
||||
$return["{$form_field_name}[datetime][date]"] = "{$date['year']}-{$date['month']}-{$date['day']}";
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user