Commit 982f6c0f authored by Liam Morland's avatar Liam Morland
Browse files

RT#978179: Allow leading zeros in archive path dates

parent f1d3b72b
......@@ -794,8 +794,9 @@ function uw_ct_event_init() {
// Redirect events/archive/$PATH[2],
// when $PATH[2] is NOT in a date format we would pass.
// The number may include the leading zero.
if ($path[0] == 'events' && isset($path[1]) && ($path[1] == 'archive') && isset($path[2])) {
if (!preg_match('/^\d{4}(?:-(?:[1-9]|1[0-2]))?$/', $path[2])) {
if (!preg_match('/^\d{4}(?:-(?:0?[1-9]|1[0-2]))?$/', $path[2])) {
drupal_set_message(t('Invalid event date URL. You have been redirected to the main "events" page.'), 'warning');
drupal_goto('events', array(), 301);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment