diff --git a/app/Functions/functions.php b/app/Functions/functions.php index 0a76d83..a5cdc7c 100644 --- a/app/Functions/functions.php +++ b/app/Functions/functions.php @@ -138,4 +138,16 @@ function footer($key) $title = env('TITLE_FOOTER_'.$upperStr); } return $title; +} + +function strip_tags_except_allowed_protocols($str) { + preg_match_all('/]+>(.*?)<\/a>/i', $str, $matches, PREG_SET_ORDER); + + foreach ($matches as $val) { + if (!preg_match('/href=["\'](http:|https:|mailto:|tel:)[^"\']*["\']/', $val[0])) { + $str = str_replace($val[0], $val[1], $str); + } + } + + return $str; } \ No newline at end of file diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index f714378..2fbfd0d 100755 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -264,9 +264,13 @@ class UserController extends Controller 'button_id' => "42", ]); }elseif($linkType->typename == "text"){ + $sanitizedText = $request->text; + $sanitizedText = strip_tags($sanitizedText, '