Fixed URL matching with double dashes in hostname

This commit is contained in:
Savetheinternet 2011-01-02 22:14:51 +11:00
parent cff02371ce
commit 7ae3678554

View File

@ -285,6 +285,9 @@
function markup(&$body) { function markup(&$body) {
global $board; global $board;
if(MARKUP_URLS)
$body = preg_replace(URL_REGEX, "<a href=\"$0\">$0</a>", $body);
if(AUTO_UNICODE) { if(AUTO_UNICODE) {
$body = str_replace('...', '…', $body); $body = str_replace('...', '…', $body);
$body = str_replace('<--', '←', $body); $body = str_replace('<--', '←', $body);
@ -321,12 +324,16 @@
// Find the position of the cite // Find the position of the cite
$position = strpos($body, $cites[0][$index]); $position = strpos($body, $cites[0][$index]);
// Replace the found string with "xxxx[...]". (allows duplicate tags). Keeps whitespace. // Replace the found string with "xxxx[...]". (allows duplicate tags). Keeps whitespace.
$body = substr_replace($body, str_repeat('x', strlen($cites[0][$index]) - $whitespace[0] - $whitespace[1]), $position + $whitespace[0], strlen($cites[0][$index]) - $whitespace[0] - $whitespace[1]); $body = substr_replace($body, str_repeat('x', strlen($cites[0][$index]) - $whitespace[0] - $whitespace[1]), $position + $whitespace[0], strlen($cites[0][$index]) - $whitespace[0] - $whitespace[1]);
$temp .= substr($body, $previousPosition, $position-$previousPosition) . $cites[1][$index] . $replacement . $cites[3][$index]; $temp .= substr($body, $previousPosition, $position-$previousPosition) . $cites[1][$index] . $replacement . $cites[3][$index];
$previousPosition = $position+strlen($cites[0][$index]); $previousPosition = $position+strlen($cites[0][$index]);
} }
// The rest // The rest
$temp .= substr($body, $previousPosition); $temp .= substr($body, $previousPosition);
@ -335,8 +342,6 @@
$body = str_replace("\r", '', $body); $body = str_replace("\r", '', $body);
if(MARKUP_URLS)
$body = preg_replace(URL_REGEX, "<a href=\"$0\">$0</a>", $body);
$body = preg_replace("/(^|\n)([\s]+)?(&gt;)([^\n]+)?($|\n)/m", '$1$2<span class="quote">$3$4</span>$5', $body); $body = preg_replace("/(^|\n)([\s]+)?(&gt;)([^\n]+)?($|\n)/m", '$1$2<span class="quote">$3$4</span>$5', $body);
if(WIKI_MARKUP) { if(WIKI_MARKUP) {