diff --git a/addressbook/inc/class.addressbook_vcal.inc.php b/addressbook/inc/class.addressbook_vcal.inc.php index 5f1f7d7e78..24dac95dba 100644 --- a/addressbook/inc/class.addressbook_vcal.inc.php +++ b/addressbook/inc/class.addressbook_vcal.inc.php @@ -388,7 +388,7 @@ class addressbook_vcal extends addressbook_bo { $options['ENCODING'] = 'FUNAMBOL-QP'; } - elseif (preg_match('/([\000-\012\015\016\020-\037\075])/', $value)) + elseif (preg_match(Api\CalDAV\Handler::REQUIRE_QUOTED_PRINTABLE_ENCODING, $value)) { $options['ENCODING'] = 'QUOTED-PRINTABLE'; } @@ -467,7 +467,7 @@ class addressbook_vcal extends addressbook_bo { $options['ENCODING'] = 'FUNAMBOL-QP'; } - elseif (preg_match('/([\000-\012\015\016\020-\037\075])/', $value)) + elseif (preg_match(Api\CalDAV\Handler::REQUIRE_QUOTED_PRINTABLE_ENCODING, $value)) { $options['ENCODING'] = 'QUOTED-PRINTABLE'; } diff --git a/api/src/CalDAV/Handler.php b/api/src/CalDAV/Handler.php index 1999c82243..c7d5983083 100644 --- a/api/src/CalDAV/Handler.php +++ b/api/src/CalDAV/Handler.php @@ -114,6 +114,13 @@ abstract class Handler */ var $new_id; + /** + * Regular expression to identify content requiring QUOTED-PRINTABLE encoding + * + * Used in {addressbook,calendar,infolog}/inc/class.*cal.inc.php + */ + const REQUIRE_QUOTED_PRINTABLE_ENCODING = '/([\000-\012\013\015\016\020-\037\075])/'; + /** * Constructor * diff --git a/calendar/inc/class.calendar_ical.inc.php b/calendar/inc/class.calendar_ical.inc.php index d0dce20c22..65bf664fb7 100644 --- a/calendar/inc/class.calendar_ical.inc.php +++ b/calendar/inc/class.calendar_ical.inc.php @@ -1034,7 +1034,7 @@ class calendar_ical extends calendar_boupdate else { $paramData['CHARSET'] = ''; - if (preg_match('/([\000-\012\015\016\020-\037\075])/', $valueData)) + if (preg_match(Api\CalDAV\Handler::REQUIRE_QUOTED_PRINTABLE_ENCODING, $valueData)) { $paramData['ENCODING'] = 'QUOTED-PRINTABLE'; } diff --git a/infolog/inc/class.infolog_ical.inc.php b/infolog/inc/class.infolog_ical.inc.php index be83e4cb4f..79c5ee6f8c 100644 --- a/infolog/inc/class.infolog_ical.inc.php +++ b/infolog/inc/class.infolog_ical.inc.php @@ -299,7 +299,7 @@ class infolog_ical extends infolog_bo { $options['CHARSET'] = ''; - if (preg_match('/([\000-\012\015\016\020-\037\075])/', $value)) + if (preg_match(Api\CalDAV\Handler::REQUIRE_QUOTED_PRINTABLE_ENCODING, $value)) { $options['ENCODING'] = 'QUOTED-PRINTABLE'; } @@ -972,7 +972,7 @@ class infolog_ical extends infolog_bo { $options['CHARSET'] = ''; - if (preg_match('/([\000-\012\015\016\020-\037\075])/', $value)) + if (preg_match(Api\CalDAV\Handler::REQUIRE_QUOTED_PRINTABLE_ENCODING, $value)) { $options['ENCODING'] = 'QUOTED-PRINTABLE'; }