aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xinclude/items.php5
-rw-r--r--mod/item.php11
2 files changed, 11 insertions, 5 deletions
diff --git a/include/items.php b/include/items.php
index d78792839..97994854a 100755
--- a/include/items.php
+++ b/include/items.php
@@ -180,11 +180,12 @@ function red_escape_zrl_callback($matches) {
}
function red_escape_codeblock($m) {
- return '[code]' . base64_encode($m[1]) . '[/code]';
+ return '[$b64' . $m[2] . base64_encode($m[1]) . '[/' . $m[2] . ']';
}
function red_unescape_codeblock($m) {
- return '[code]' . base64_decode($m[1]) . '[/code]';
+ return '[' . $m[2] . base64_decode($m[1]) . '[/' . $m[2] . ']';
+
}
diff --git a/mod/item.php b/mod/item.php
index 784ee31b4..a9c0d80d3 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -429,13 +429,18 @@ function item_post(&$a) {
* otherwise http://elsewhere.com becomes #^[url=http://elsewhere.com]http://elsewhere.com[/url]
*/
- $body = preg_replace_callback('/\[code\](.*?)\[\/code\]/ism','red_escape_codeblock',$body);
+ $body = preg_replace_callback('/\[code(.*?)\[\/(code)\]/ism','red_escape_codeblock',$body);
+ $body = preg_replace_callback('/\[url(.*?)\[\/(url)\]/ism','red_escape_codeblock',$body);
+ $body = preg_replace_callback('/\[zrl(.*?)\[\/(zrl)\]/ism','red_escape_codeblock',$body);
- $body = preg_replace_callback('/\[([uz])rl(.*?)\](.*?)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\+\,]+)(.*?)\[\/([uz])rl\]/ism','red_escape_zrl_callback',$body);
+// no longer needed
+// $body = preg_replace_callback('/\[([uz])rl(.*?)\](.*?)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\+\,]+)(.*?)\[\/([uz])rl\]/ism','red_escape_zrl_callback',$body);
$body = preg_replace_callback("/([^\]\='".'"'."]|^|\#\^)(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\@\_\~\#\%\$\!\+\,]+)/ism", 'red_zrl_callback', $body);
- $body = preg_replace_callback('/\[code\](.*?)\[\/code\]/ism','red_unescape_codeblock',$body);
+ $body = preg_replace_callback('/\[\$b64zrl(.*?)\[\/(zrl)\]/ism','red_unescape_codeblock',$body);
+ $body = preg_replace_callback('/\[\$b64url(.*?)\[\/(url)\]/ism','red_unescape_codeblock',$body);
+ $body = preg_replace_callback('/\[\$b64code(.*?)\[\/(code)\]/ism','red_unescape_codeblock',$body);
/**