X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Futil.php;h=629d8326fd2e0669c629587e7b3931d20ce0a4bd;hb=65bf58be806d19bc7fe962c0824160deab07d5c3;hp=1e73ff9ac9b0c1428ef2c0b25d444476c54d5b05;hpb=a5154bf612887d599d8517095da3f6fd2e0a9b28;p=quix0rs-gnu-social.git diff --git a/lib/util.php b/lib/util.php index 1e73ff9ac9..629d8326fd 100644 --- a/lib/util.php +++ b/lib/util.php @@ -787,7 +787,7 @@ function common_render_text($text) $r = preg_replace('/[\x{0}-\x{8}\x{b}-\x{c}\x{e}-\x{19}]/', '', $r); $r = common_replace_urls_callback($r, 'common_linkify'); - $r = preg_replace('/(^|\"\;|\'|\(|\[|\{|\s+)#([\pL\pN_\-\.]{1,64})/e', "'\\1#'.common_tag_link('\\2')", $r); + $r = preg_replace('/(^|\"\;|\'|\(|\[|\{|\s+)#([\pL\pN_\-\.]{1,64})/ue', "'\\1#'.common_tag_link('\\2')", $r); // XXX: machine tags return $r; } @@ -925,11 +925,11 @@ function common_linkify($url) { // functions $url = htmlspecialchars_decode($url); - if(strpos($url, '@') !== false && strpos($url, ':') === false) { - //url is an email address without the mailto: protocol - $canon = "mailto:$url"; - $longurl = "mailto:$url"; - }else{ + if (strpos($url, '@') !== false && strpos($url, ':') === false && Validate::email($url)) { + //url is an email address without the mailto: protocol + $canon = "mailto:$url"; + $longurl = "mailto:$url"; + } else { $canon = File_redirection::_canonUrl($url); @@ -1096,8 +1096,11 @@ function common_tag_link($tag) function common_canonical_tag($tag) { + // only alphanum + $tag = preg_replace('/[^\pL\pN]/u', '', $tag); $tag = mb_convert_case($tag, MB_CASE_LOWER, "UTF-8"); - return str_replace(array('-', '_', '.'), '', $tag); + $tag = substr($tag, 0, 64); + return $tag; } function common_valid_profile_tag($str)