From: Mikael Nordfeldth Date: Wed, 9 Mar 2016 13:51:52 +0000 (+0100) Subject: Save allowed path/qstring/fragment characters in constants X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d179afa303ce83c2e8c8a1f4dc94e093eb44bcec;p=quix0rs-gnu-social.git Save allowed path/qstring/fragment characters in constants --- diff --git a/lib/framework.php b/lib/framework.php index 620730370f..3a62bb5d68 100644 --- a/lib/framework.php +++ b/lib/framework.php @@ -57,6 +57,10 @@ define('NOTICE_INBOX_SOURCE_FORWARD', 4); define('NOTICE_INBOX_SOURCE_PROFILE_TAG', 5); define('NOTICE_INBOX_SOURCE_GATEWAY', -1); +define('URL_REGEX_VALID_PATH_CHARS', '\pN\pL\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\@'); +define('URL_REGEX_VALID_QSTRING_CHARS', URL_REGEX_VALID_PATH_CHARS); +define('URL_REGEX_VALID_FRAGMENT_CHARS', URL_REGEX_VALID_PATH_CHARS . '\?\#'); + // append our extlib dir as the last-resort place to find libs set_include_path(get_include_path() . PATH_SEPARATOR . INSTALLDIR . '/extlib/'); diff --git a/lib/util.php b/lib/util.php index 05e3e732bd..977c55f4e6 100644 --- a/lib/util.php +++ b/lib/util.php @@ -1013,9 +1013,9 @@ function common_replace_urls_callback($text, $callback, $arg = null) { ')'. '(?:'. '(?:\:\d+)?'. //:port - '(?:/[\pN\pL$\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'@]*)?'. // /path - '(?:\?[\pN\pL\$\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'@\/]*)?'. // ?query string - '(?:\#[\pN\pL$\,\!\(\)\.\:\-\_\+\/\=\&\;\%\~\*\$\+\'\@/\?\#]*)?'. // #fragment + '(?:/[' . URL_REGEX_VALID_PATH_CHARS . ']*)?'. // path + '(?:\?[' . URL_REGEX_VALID_QSTRING_CHARS . ']*)?'. // ?query string + '(?:\#[' . URL_REGEX_VALID_FRAGMENT_CHARS . ']*)?'. // #fragment ')(?