From 119cd9c0cee5e416199da900016609259598cb0b Mon Sep 17 00:00:00 2001 From: Friendika Date: Tue, 20 Sep 2011 04:07:24 -0700 Subject: [PATCH] more multiline regex fixes --- include/bbcode.php | 10 +++++----- mod/item.php | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/bbcode.php b/include/bbcode.php index cbe19de54a..9abc7c4396 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -43,11 +43,11 @@ function bbcode($Text,$preserve_nl = false) { // Perform URL Search - $Text = preg_replace("/([^\]\=]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/", '$1$2', $Text); + $Text = preg_replace("/([^\]\=]|^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1$2', $Text); - $Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/m", '$1', $Text); - $Text = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/m", '$2', $Text); - //$Text = preg_replace("/\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[\/url\]/m", '$2', $Text); + $Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/ism", '$1', $Text); + $Text = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '$2', $Text); + //$Text = preg_replace("/\[url\=([$URLSearchString]*)\]([$URLSearchString]*)\[\/url\]/ism", '$2', $Text); // Perform MAIL Search @@ -95,7 +95,7 @@ function bbcode($Text,$preserve_nl = false) { // $Text = str_replace("[*]", "
  • ", $Text); // Check for font change text - $Text = preg_replace("/\[font=(.*?)\](.*?)\[\/font\]/m","$2",$Text); + $Text = preg_replace("/\[font=(.*?)\](.*?)\[\/font\]/sm","$2",$Text); // Declare the format for [code] layout diff --git a/mod/item.php b/mod/item.php index cad72122b8..e5d4eea820 100644 --- a/mod/item.php +++ b/mod/item.php @@ -336,9 +336,9 @@ function item_post(&$a) { // embedded bookmark in post? convert to regular url and set bookmark flag $bookmark = 0; - if(preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/m",$body,$match)) { + if(preg_match_all("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",$body,$match)) { $bookmark = 1; - $body = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/m",'[url=$1]$2[/url]',$body); + $body = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism",'[url=$1]$2[/url]',$body); } @@ -346,7 +346,7 @@ function item_post(&$a) { * Fold multi-line [code] sequences */ - $body = preg_replace('/\[\/code\]\s*\[code\]/m',"\n",$body); + $body = preg_replace('/\[\/code\]\s*\[code\]/ism',"\n",$body); /** * Look for any tags and linkify them