Automatically add missing protocol
authorAlexander Ebert <ebert@woltlab.com>
Fri, 26 Aug 2016 10:02:11 +0000 (12:02 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 26 Aug 2016 10:02:17 +0000 (12:02 +0200)
wcfsetup/install/files/lib/system/html/input/node/HtmlInputNodeTextParser.class.php

index 4d6102ab3c57b0d15ebea2a21591b4811df94c68..2e75b09faff439d5d2376edbd2fa937a92d96732 100644 (file)
@@ -364,6 +364,9 @@ class HtmlInputNodeTextParser {
                        }
                        else {
                                if ($allowURL) {
+                                       // add protocol if necessary
+                                       if (!preg_match('/[a-z]:\/\//si', $link)) $link = 'http://'.$link;
+                                       
                                        $element = $text->ownerDocument->createElement('a');
                                        $element->setAttribute('href', $link);
                                        $element->textContent = $link;