Index: trunk/extensions/RSS/RSS.php |
— | — | @@ -326,7 +326,7 @@ |
327 | 327 | } |
328 | 328 | |
329 | 329 | if ( isset( $item[$left] ) ) { |
330 | | - $leftValue = preg_replace( '#{{{' . $left . '}}}#', |
| 330 | + $leftValue = preg_replace( '/{{{' . preg_quote( $left, '/' ) . '}}}/', |
331 | 331 | $item[$left], $bits[1] ); |
332 | 332 | $rendered[] = implode( '=', array( $left, $leftValue ) ); |
333 | 333 | } else { |
— | — | @@ -388,13 +388,15 @@ |
389 | 389 | |
390 | 390 | if ( count( $filter ) == 0 ) return $filterType !== 'filterOut'; |
391 | 391 | |
392 | | - $match = preg_match( '#(' . implode( "|", $filter ) . ')#i', $text ); |
393 | | - if ( $match ) { |
| 392 | + /* Using : for delimiter here since it'll be quoted automatically. */ |
| 393 | + $match = preg_match( ':(' . implode( "|", array_map('preg_quote', $filter ) ) . '):i', $text ) ; |
| 394 | + if ( $match ) { |
394 | 395 | return true; |
395 | | - } |
| 396 | + } |
396 | 397 | return false; |
397 | | - } |
| 398 | + } |
398 | 399 | |
| 400 | + |
399 | 401 | function highlightTerms( $text ) { |
400 | 402 | $i = 0; |
401 | 403 | $starttag = 'v8x5u3t3u8h'; |
— | — | @@ -409,7 +411,7 @@ |
410 | 412 | |
411 | 413 | foreach ( $this->highlight as $term ) { |
412 | 414 | if ( $term ) { |
413 | | - $text = preg_replace( "|\b(\w*?" . $term . "\w*?)\b|i", "$starttag" . "_" . $i . "\\1$endtag", $text ); |
| 415 | + $text = preg_replace( "/\b(\w*?" . preg_quote( $term, '/' ) . "\w*?)\b/i", "$starttag" . "_" . $i . "\\1$endtag", $text ); |
414 | 416 | $i++; |
415 | 417 | if ( $i == $count_color ) { |
416 | 418 | $i = 0; |
— | — | @@ -419,7 +421,8 @@ |
420 | 422 | |
421 | 423 | # To avoid trouble should someone wants to highlight the terms "span", "style", … |
422 | 424 | for ( $i = 0; $i < 5; $i++ ) { |
423 | | - $text = preg_replace( "|$starttag" . "_" . $i . "|", "<span style=\"background-color:" . $color[$i] . "; font-weight: bold;\">", $text ); |
| 425 | + $text = preg_replace( "/$starttag" . "_" . preg_quote( $i, '/' ) . "/", |
| 426 | + "<span style=\"background-color:" . $color[$i] . "; font-weight: bold;\">", $text ); |
424 | 427 | $text = preg_replace( "|$endtag|", '</span>', $text ); |
425 | 428 | } |
426 | 429 | |