Created
June 12, 2014 11:36
-
-
Save msg7086/e003bdd095debf870b5e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/include/functions.php-20140612-bak.php b/include/functions.php | |
index 74cce2b..bff85a0 100644 | |
--- a/include/functions.php-20140612-bak.php | |
+++ b/include/functions.php | |
@@ -253,7 +253,7 @@ function formatFlv($src, $width, $height) { | |
return addTempCode("<object width=\"$width\" height=\"$height\"><param name=\"movie\" value=\"flvplayer.swf?file=$src\" /><param name=\"allowFullScreen\" value=\"true\" /><embed src=\"flvplayer.swf?file=$src\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" width=\"$width\" height=\"$height\"></embed></object>"); | |
} | |
function format_urls($text, $newWindow = false) { | |
- return preg_replace_callback("/((https?|ftp|gopher|news|telnet|mms|rtsp):\/\/[^()\[\]<>\s]+)/i", create_function('$matches', "return formatUrl('$matches[1]', ".($newWindow==true ? 1 : 0).", '', 'faqlink');"), $text); | |
+ return preg_replace_callback("/((https?|ftp|gopher|news|telnet|mms|rtsp):\/\/[^()\[\]<>\s]+)/i", function($matches) use ($newWindow) { return formatUrl($matches[1], $newWindow ? 1 : 0, '', 'faqlink');}, $text); | |
} | |
function format_comment($text, $strip_html = true, $xssclean = false, $newtab = false, $imageresizer = true, $image_max_width = 700, $enableimage = true, $enableflash = true , $imagenum = -1, $image_max_height = 0, $adid = 0) | |
{ | |
@@ -264,6 +264,7 @@ function format_comment($text, $strip_html = true, $xssclean = false, $newtab = | |
$tempCodeCount = 0; | |
$imageresizer = $imageresizer ? 1 : 0; | |
$s = $text; | |
+ $i = 0; | |
if ($strip_html) { | |
$s = htmlspecialchars($s); | |
@@ -285,12 +286,12 @@ function format_comment($text, $strip_html = true, $xssclean = false, $newtab = | |
if ($enableattach_attachment == 'yes' && $imagenum != 1){ | |
$limit = 20; | |
- $s = preg_replace_callback("/\[attach\]([0-9a-zA-z][0-9a-zA-z]*)\[\/attach\]/is", create_function('$matches', "return print_attachment('$matches[1]', '.($enableimage ? 1 : 0).', '.($imageresizer ? 1 : 0).');"), $s, $limit); | |
+ $s = preg_replace_callback("/\[attach\]([0-9a-zA-z][0-9a-zA-z]*)\[\/attach\]/is", function($matches) use ($enableimage, $imageresizer) {return print_attachment($matches[1], ($enableimage ? 1 : 0), ($imageresizer ? 1 : 0));}, $s, $limit); | |
} | |
if ($enableimage) { | |
- $s = preg_replace_callback("/\[img\]([^\<\r\n\"']+?)\[\/img\]/i", create_function('$matches', "return formatImg('$matches[1]',".$imageresizer.",".$image_max_width.",".$image_max_height.");"), $s, $imagenum, $imgReplaceCount); | |
- $s = preg_replace_callback("/\[img=([^\<\r\n\"']+?)\]/i", create_function('$matches', "return formatImg('$matches[1]',".$imageresizer.",".$image_max_width.",".$image_max_height.");"), $s, ($imagenum != -1 ? max($imagenum-$imgReplaceCount, 0) : -1)); | |
+ $s = preg_replace_callback("/\[img\]([^\<\r\n\"']+?)\[\/img\]/i", function($matches) use ($imageresizer, $image_max_width, $image_max_height) {return formatImg($matches[1], $imageresizer, $image_max_width, $image_max_height);}, $s, $imagenum, $imgReplaceCount); | |
+ $s = preg_replace_callback("/\[img=([^\<\r\n\"']+?)\]/i", function($matches) use ($imageresizer, $image_max_width, $image_max_height) {return formatImg($matches[1], $imageresizer, $image_max_width, $image_max_height);} , $s, ($imagenum != -1 ? max($imagenum-$imgReplaceCount, 0) : -1)); | |
} else { | |
$s = preg_replace("/\[img\]([^\<\r\n\"']+?)\[\/img\]/i", '', $s, -1); | |
$s = preg_replace("/\[img=([^\<\r\n\"']+?)\]/i", '', $s, -1); | |
@@ -315,13 +316,13 @@ function format_comment($text, $strip_html = true, $xssclean = false, $newtab = | |
// [url=http://www.example.com]Text[/url] | |
if ($adid) { | |
- $s = preg_replace_callback("/\[url=([^\[\s]+?)\](.+?)\[\/url\]/i", create_function('$matches', "return formatAdUrl(".$adid." ,'$matches[1]', '$matches[2]', ".($newtab==true ? 1 : 0).", 'faqlink');"), $s); | |
+ $s = preg_replace_callback("/\[url=([^\[\s]+?)\](.+?)\[\/url\]/i", function($matches) use ($newtab) {return formatAdUrl($adid ,$matches[1], $matches[2], ($newtab ? 1 : 0), 'faqlink');}, $s); | |
} else { | |
- $s = preg_replace_callback("/\[url=([^\[\s]+?)\](.+?)\[\/url\]/i", create_function('$matches', "return formatUrl('$matches[1]', ".($newtab==true ? 1 : 0).", '$matches[2]', 'faqlink');"), $s); | |
+ $s = preg_replace_callback("/\[url=([^\[\s]+?)\](.+?)\[\/url\]/i", function($matches) use ($newtab) {return formatUrl($matches[1], ($newtab ? 1 : 0), $matches[2], 'faqlink');}, $s); | |
} | |
// [url]http://www.example.com[/url] | |
- $s = preg_replace_callback("/\[url\]([^\[\s]+?)\[\/url\]/i", create_function('$matches', "return formatUrl('$matches[1]', ".($newtab==true ? 1 : 0).", '', 'faqlink');"), $s); | |
+ $s = preg_replace_callback("/\[url\]([^\[\s]+?)\[\/url\]/i", function($matches) use ($newtab) {return formatUrl($matches[1], ($newtab ? 1 : 0), '', 'faqlink');}, $s); | |
$s = format_urls($s); | |
// Quotes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment