"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "Upload/inc/class_parser.php" between
mybb_1819.zip and mybb_1820.zip

About: MyBB is a multilingual, standards-compliant and free forum (discussion board) software.

class_parser.php  (mybb_1819):class_parser.php  (mybb_1820)
skipping to change at line 682 skipping to change at line 682
* @param string $badword The word defined to replace. * @param string $badword The word defined to replace.
* @return string The regex pattern to match the word or null on error. * @return string The regex pattern to match the word or null on error.
*/ */
function generate_regex($bad_word = "") function generate_regex($bad_word = "")
{ {
if($bad_word == "") if($bad_word == "")
{ {
return; return;
} }
// Neutralize multiple adjacent wildcards and generate pattern // Neutralize escape character, regex operators, multiple adjacen
$ptrn = array('/\*\++/', '/\++\*/', '/\*+/'); t wildcards and generate pattern
$rplc = array('*', '*', '[^\s\n]*'); $ptrn = array('/\\\\/', '/([\[\^\$\.\|\?\(\)\{\}]{1})/', '/\*\++/
', '/\++\*/', '/\*+/');
$rplc = array('\\\\\\\\','\\\\${1}', '*', '*', '[^\s\n]*');
$bad_word = preg_replace($ptrn, $rplc, $bad_word); $bad_word = preg_replace($ptrn, $rplc, $bad_word);
// Count + and generate pattern // Count + and generate pattern
$bad_word = explode('+', $bad_word); $bad_word = explode('+', $bad_word);
$trap = ""; $trap = "";
$plus = 0; $plus = 0;
foreach($bad_word as $bad_piece) foreach($bad_word as $bad_piece)
{ {
if($bad_piece) if($bad_piece)
{ {
skipping to change at line 1136 skipping to change at line 1136
{ {
$rel = " rel=\"noopener nofollow\""; $rel = " rel=\"noopener nofollow\"";
} }
else else
{ {
$rel = " rel=\"noopener\""; $rel = " rel=\"noopener\"";
} }
// Fix some entities in URLs // Fix some entities in URLs
$url = $this->encode_url($url); $url = $this->encode_url($url);
$name = $this->parse_badwords(preg_replace("#&\#([0-9]+);#si"
$name = preg_replace("#&\#([0-9]+);#si", "&#$1;", $name); // , "&#$1;", $name)); // Fix & but allow unicode, filter bad words
Fix & but allow unicode
eval("\$mycode_url = \"".$templates->get("mycode_url", 1, 0)."\"; "); eval("\$mycode_url = \"".$templates->get("mycode_url", 1, 0)."\"; ");
return $mycode_url; return $mycode_url;
} }
/** /**
* Parses URL MyCode. * Parses URL MyCode.
* *
* @param array $matches Matches. * @param array $matches Matches.
* @return string The built-up link. * @return string The built-up link.
 End of changes. 2 change blocks. 
6 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)