Project

General

Profile

« Previous | Next » 

Revision 661

Added by thorn almost 17 years ago

search will show email-addresses, even if email-filter is activated (on page with highlighting). Fixed.

View differences:

trunk/CHANGELOG
14 14
02-Feb-2008 Christian Sommer
15 15
#	fixed wrong redirect in /admin/images
16 16
02-Feb-2008 Thomas Hornik
17
!	search will show email-addresses, even if email-filter is activated (on page with highlighting). Fixed.
17 18
+	Added missing text in languages files for jscalendar
18 19
!	settings: pages-directory '/' will be converted to '' (empty string) on save.
19 20
!	changed last remaining call to my_htmlspecialchars() to htmlspecialchars()
trunk/wb/framework/frontend.functions.php
82 82
	
83 83
	// the highlighting
84 84
	// match $string, but not inside <style>...</style>, <script>...</script>, <!--...--> or HTML-Tags
85
	// split $string into pieces - "cut away" styles, scripts, comments, and HTML-tags
86
	$matches = preg_split("/(<style.*<\/style>|<script.*<\/script>|<!--.*-->|<.*>)/iUs",$foo,-1,(PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY));
85
	// split $string into pieces - "cut away" styles, scripts, comments, HTML-tags and eMail-addresses
86
	$matches = preg_split("/(<style.*<\/style>|<script.*<\/script>|<!--.*-->|<.*>|\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}\b)/iUs",$foo,-1,(PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY));
87 87
	if(is_array($matches) && $matches != array()) {
88 88
		$foo = "";
89 89
		$string = strtr($string, array('&lt;'=>'<', '&gt;'=>'>', '&amp;'=>'&', '&quot;'=>'"', '&#39;'=>'\'', '&nbsp;'=>"\xC2\xA0"));
90 90
		foreach($matches as $match) {
91
			if($match{0}!="<") {
91
			if($match{0}!="<" && !preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i', $match)) {
92 92
				$match = strtr($match, array('&lt;'=>'<', '&gt;'=>'>', '&amp;'=>'&', '&quot;'=>'"', '&#39;'=>'\'', '&nbsp;'=>"\xC2\xA0"));
93 93
				$match = preg_replace('/('.$string.')/iS', '_span class=_highlight__$1_/span_',$match);
94 94
				$match = strtr($match, array('<'=>'&lt;', '>'=>'&gt;', '&'=>'&amp;', '"'=>'&quot;', '\''=>'&#39;', "\xC2\xA0"=>'&nbsp;'));

Also available in: Unified diff