Changeset View
Changeset View
Standalone View
Standalone View
src/applications/calendar/parser/data/PhutilCalendarRecurrenceRule.php
Context not available. | |||||
} | } | ||||
public static function newFromRRULE($rrule) { | public static function newFromRRULE($rrule) { | ||||
$parts = explode(';', $rrule); | $parts = @explode(';', $rrule); | ||||
$dict = array(); | $dict = array(); | ||||
foreach ($parts as $part) { | foreach ($parts as $part) { | ||||
list($key, $value) = explode('=', $part, 2); | list($key, $value) = @explode('=', $part, 2); | ||||
switch ($key) { | switch ($key) { | ||||
case 'FREQ': | case 'FREQ': | ||||
case 'INTERVAL': | case 'INTERVAL': | ||||
Context not available. | |||||
case 'UNTIL'; | case 'UNTIL'; | ||||
break; | break; | ||||
default: | default: | ||||
$value = explode(',', $value); | $value = @explode(',', $value); | ||||
break; | break; | ||||
} | } | ||||
$dict[$key] = $value; | $dict[$key] = $value; | ||||
Context not available. | |||||
foreach ($dict as $key => $value) { | foreach ($dict as $key => $value) { | ||||
if (isset($int_values[$key])) { | if (isset($int_values[$key])) { | ||||
// None of these values may be negative. | // None of these values may be negative. | ||||
if (!preg_match('/^\d+\z/', $value)) { | if (!@preg_match('/^\d+\z/', $value)) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Unexpected value "%s" in "%s" RULE property: expected an '. | 'Unexpected value "%s" in "%s" RULE property: expected an '. | ||||
Context not available. | |||||
if (isset($int_lists[$key])) { | if (isset($int_lists[$key])) { | ||||
foreach ($value as $k => $v) { | foreach ($value as $k => $v) { | ||||
if (!preg_match('/^-?\d+\z/', $v)) { | if (!@preg_match('/^-?\d+\z/', $v)) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Unexpected value "%s" in "%s" RRULE property: expected '. | 'Unexpected value "%s" in "%s" RRULE property: expected '. | ||||
Context not available. | |||||
$pattern = '/^(?:[+-]?([1-9]\d?))?('.$constants.')\z/'; | $pattern = '/^(?:[+-]?([1-9]\d?))?('.$constants.')\z/'; | ||||
foreach ($by_day as $key => $value) { | foreach ($by_day as $key => $value) { | ||||
$matches = null; | $matches = null; | ||||
if (!preg_match($pattern, $value, $matches)) { | if (!@preg_match($pattern, $value, $matches)) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'RRULE BYDAY value "%s" is invalid: rule part must be in the '. | 'RRULE BYDAY value "%s" is invalid: rule part must be in the '. | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0