Project

General

Profile

« Previous | Next » 

Revision 490

Added by Matthias almost 17 years ago

Fixed issue with escaped single and double quotes in search result (Thanks to thorn)

View differences:

functions.php
341 341
// Function as replecement for php's htmlspecialchars()
342 342
function my_htmlspecialchars($string) {
343 343
	$string = preg_replace("/&(?=[#a-z0-9]+;)/i", "_x_", $string);
344
	$string = strtr($string, array("<"=>"&lt;", ">"=>"&gt;", "&"=>"&amp;", "\""=>"&quot;", "\'"=>"&#039;"));
344
	$string = strtr($string, array("<"=>"&lt;", ">"=>"&gt;", "&"=>"&amp;", "\""=>"&quot;", "\'"=>"&#39;"));
345 345
	$string = preg_replace("/_x_(?=[#a-z0-9]+;)/i", "&", $string);
346 346
	return($string);
347 347
}
......
431 431
				}
432 432
			}
433 433
		} else {
434
			$string = strtr($string, array("&lt;"=>"&_lt;", "&gt;"=>"&_gt;", "&amp;"=>"&_amp;", "&quot;"=>"&_quot;", "&#039;"=>"&_#039;"));
434
			$string = strtr($string, array("&lt;"=>"&_lt;", "&gt;"=>"&_gt;", "&amp;"=>"&_amp;", "&quot;"=>"&_quot;", "&#39;"=>"&_#39;"));
435 435
			$string=mb_convert_encoding($string, $charset_out, $charset_in);
436
			$string = strtr($string, array("&_lt;"=>"&lt;", "&_gt;"=>"&gt;", "&_amp;"=>"&amp;", "&_quot;"=>"&quot;", "&_#039;"=>"&#039;"));
436
			$string = strtr($string, array("&_lt;"=>"&lt;", "&_gt;"=>"&gt;", "&_amp;"=>"&amp;", "&_quot;"=>"&quot;", "&_#39;"=>"&#39;"));
437 437
		}
438 438
		return $string;
439 439
	}
......
613 613
	);
614 614
		
615 615
	if ($in == 'HTML-ENTITIES') {
616
		$string = strtr($string, array('&#039;'=>'&#39;')); // fix a broken entity
616 617
		$string = strtr($string, $named_to_numbered_entities);
617 618
		$string = preg_replace("/&#([0-9]+);/e", "code_to_utf8($1)", $string);
618 619
	}

Also available in: Unified diff