Project

General

Profile

« Previous | Next » 

Revision 442

Added by Matthias over 17 years ago

Fixed issues with some languages when UTF8 is used.
Removed all htmlentites from the code (revoked changeset [396]) and added new functions instead.
Adapted the search and the highlighting to use the new functions.
With this changes WB can now be used with charset UTF8 for all languages.

View differences:

trunk/CHANGELOG
36 36
27-Dec-2006 Matthias Gallas
37 37
#	Fixed form modul stores empty records
38 38
------------------------------------- 2.6.6 -------------------------------------
39
01-Apr-2007 Matthias Gallas
40
#	Fixed issues with some languages when UTF8 is used.	Removed all htmlentites
41
	from the code (revoked changeset 396) and added new functions instead. Adapted the
42
	search and the highlighting to use the new functions. With this changes WB can now
43
	be used with charset UTF8 for all languages.
39 44
12-Mar-2007 Matthias Gallas
40 45
+	Added multilingual support to search
41 46
03-Mar-2007 Matthias Gallas
trunk/wb/search/search.php
28 28
	exit(0);
29 29
}
30 30

  
31
// Include the WB functions file
32
require_once(WB_PATH.'/framework/functions.php');
33

  
31 34
// Check if search is enabled
32 35
if(SHOW_SEARCH != true) {
33 36
	echo $TEXT['SEARCH'].' '.$TEXT['DISABLED'];
......
55 58
		// Double backslashes (mySQL needs doubly escaped backslashes in LIKE comparisons)
56 59
		$string = addslashes($wb->escape_backslashes($original_string));
57 60
		// convert a copy of $string to HTML-ENTITIES
58
		$string_entities=mb_convert_encoding($string, 'UTF-8', 'HTML-ENTITIES');
59
		$string_entities=htmlspecialchars($string_entities,ENT_QUOTES);
60
		$string_entities=mb_convert_encoding($string_entities, 'HTML-ENTITIES', 'UTF-8');
61
		$string_entities = umlauts_to_entities($string);
61 62
		// and do some convertion to both
62 63
		require(WB_PATH.'/search/search_convert.php');
63
		$string=strtr($string,$string_conv);
64
		$string_entities=strtr($string_entities,$string_entities_conv);
64
		if(strcmp(DEFAULT_CHARSET, "iso-8859-1") == 0) {
65
			$string=strtr($string,$string_conv_iso88591);
66
			$string_entities=strtr($string_entities,$string_entities_conv_iso88591);
67
		}
65 68
		$search_string = $string_entities;
66 69
	} else {
67 70
		$string = '';
......
181 184
				$link = page_link($page['link']);
182 185
				
183 186
				//Add search string for highlighting
184
				$sstring = implode(" ", array_merge($string,$string_entities));
185
				//$link = $link."?searchresult=1&sstring=".$sstring;
186
				$link = $link."?searchresult=1&sstring=".urlencode($sstring);
187
				if ($match!='exact') {
188
					$sorted=array_merge($string,$string_entities);
189
					sort($sorted);
190
					$sstring = implode(" ", $sorted);
191
					$link = $link."?searchresult=1&sstring=".urlencode($sstring);
192
				}
193
				else {
194
					$sstring = strtr($string[0], " ", "_")." ".strtr($string_entities[0], " ","_");
195
					$link = $link."?searchresult=2&sstring=".urlencode($sstring);
196
				}
187 197
				
188 198
				// Set vars to be replaced by values
189 199
				$vars = array('[LINK]', '[TITLE]', '[DESCRIPTION]', '[USERNAME]','[DISPLAY_NAME]','[DATE]','[TIME]','[TEXT_LAST_UPDATED_BY]','[TEXT_ON]');
......
268 278
										$link = page_link($page[$fields['link']]);
269 279
										
270 280
										//Add search string for highlighting
271
										$sstring = implode(" ", array_merge($string,$string_entities));
272
										//$link = $link."?searchresult=1&sstring=".$sstring;
273
										$link = $link."?searchresult=1&sstring=".urlencode($sstring);
281
										if ($match!='exact') {
282
											$sorted=array_merge($string,$string_entities);
283
											sort($sorted);
284
											$sstring = implode(" ", $sorted);
285
											$link = $link."?searchresult=1&sstring=".urlencode($sstring);
286
										}
287
										else {
288
											$sstring = strtr($string[0], " ", "_")." ".strtr($string_entities[0], " ","_");
289
											$link = $link."?searchresult=2&sstring=".urlencode($sstring);
290
										}
274 291
										
275 292
										// Set vars to be replaced by values
276 293
										$vars = array('[LINK]', '[TITLE]', '[DESCRIPTION]', '[USERNAME]','[DISPLAY_NAME]','[DATE]','[TIME]','[TEXT_LAST_UPDATED_BY]','[TEXT_ON]');
trunk/wb/search/search_convert.php
33 33
}
34 34

  
35 35
//for Xinha, (htmlarea)
36
$string_conv=array(
36
$string_conv_iso88591=array(
37 37
	"?"=>"Š","?"=>"š","?"=>"Œ","?"=>"œ","?"=>"Ÿ",
38 38
	">"=>"&gt;","<"=>"&lt;",
39 39
	"?"=>"&bdquo;","?"=>"&bull;","?"=>"&circ;","&#925;"=>"&Nu;","&#957;"=>"&nu;",
......
61 61
);
62 62

  
63 63
//for fckeditor, (tiny_mce)
64
$string_entities_conv=array(
64
$string_entities_conv_iso88591=array(
65 65
	"&#140;"=>"&OElig;","&#156;"=>"&oelig;","&#138;"=>"&Scaron;","&#154;"=>"&scaron;",
66 66
	"&#159;"=>"&Yuml;",
67 67
	"&#152;"=>"&tilde;","&upsih;"=>"&#978;","&#149;"=>"&bull;","&#153;"=>"&trade;",
trunk/wb/admin/pages/settings.php
76 76
$template->set_block('page', 'main_block', 'main');
77 77
$template->set_var(array(
78 78
								'PAGE_ID' => $results_array['page_id'],
79
								'PAGE_TITLE' => (htmlentities($results_array['page_title'])),
80
								'MENU_TITLE' => (htmlentities($results_array['menu_title'])),
79
								'PAGE_TITLE' => ($results_array['page_title']),
80
								'MENU_TITLE' => ($results_array['menu_title']),
81 81
								'DESCRIPTION' => ($results_array['description']),
82 82
								'KEYWORDS' => ($results_array['keywords']),
83 83
								'MODIFIED_BY' => $user['display_name'],
......
249 249
			for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - '; }
250 250
			$template->set_var(array(
251 251
											'ID' => $page['page_id'],
252
											'TITLE' => ($title_prefix.htmlentities($page['page_title']))
252
											'TITLE' => ($title_prefix.$page['page_title'])
253 253
											)
254 254
									);
255 255
			if($results_array['parent'] == $page['page_id']) {
trunk/wb/admin/pages/index.php
166 166
				</td>
167 167
				<?php if($admin->get_permission('pages_modify') == true AND $can_modify == true) { ?>
168 168
				<td>
169
					<a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>"><?php echo (htmlentities($page['page_title'])); ?></a>				
169
					<a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>"><?php echo ($page['page_title']); ?></a>				
170 170
				</td>
171 171
				<?php } else { ?>
172 172
				<td>
173
					<?php echo (htmlentities($page['page_title'])); ?>
173
					<?php echo ($page['page_title']); ?>
174 174
				</td>
175 175
				<?php } ?>
176 176
				<td align="left" width="232">
177
					<font color="#999999"><?php echo (htmlentities($page['menu_title'])); ?></font>
177
					<font color="#999999"><?php echo ($page['menu_title']); ?></font>
178 178
				</td>
179 179
				<td align="center" valign="middle" width="90">
180 180
				<?php if($page['visibility'] == 'public') { ?>
......
462 462
			for($i = 1; $i <= $page['level']; $i++) { $title_prefix .= ' - '; }
463 463
				$template->set_var(array(
464 464
												'ID' => $page['page_id'],
465
												'TITLE' => ($title_prefix.htmlentities($page['page_title']))
465
												'TITLE' => ($title_prefix.$page['page_title'])
466 466
												)
467 467
										);
468 468
				if($can_modify == true) {
trunk/wb/admin/pages/trash.php
141 141
				</td>
142 142
				<?php if($admin->get_permission('pages_modify') == true AND $can_modify == true AND $page['visibility'] != 'heading') { ?>
143 143
				<td>
144
					<a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>"><?php echo (htmlentities($page['page_title'])); ?></a>
144
					<a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page['page_id']; ?>" title="<?php echo $TEXT['MODIFY']; ?>"><?php echo ($page['page_title']); ?></a>
145 145
				</td>
146 146
				<?php } else { ?>
147 147
				<td>
148 148
					<?php
149 149
					if($page['visibility'] != 'heading') {
150
						echo (htmlentities($page['page_title']));
150
						echo ($page['page_title']);
151 151
					} else {
152
						echo '<b>'.(htmlentities($page['page_title'])).'</b>';
152
						echo '<b>'.($page['page_title']).'</b>';
153 153
					}
154 154
					?>
155 155
				</td>
156 156
				<?php } ?>
157 157
				<td align="left" width="232">
158
					<font color="#999999"><?php echo htmlentities($page['menu_title']); ?></font>
158
					<font color="#999999"><?php echo $page['menu_title']; ?></font>
159 159
				</td>
160 160
				<td align="right" valign="middle" width="30" style="padding-right: 20px;">
161 161
				<?php if($page['visibility'] == 'public') { ?>
trunk/wb/admin/pages/settings2.php
41 41

  
42 42
// Get values
43 43
$page_title = $admin->add_slashes($admin->get_post_escaped('page_title'));
44
$page_title = my_htmlspecialchars($page_title);
44 45
$menu_title = $admin->add_slashes($admin->get_post_escaped('menu_title'));
46
$menu_title = my_htmlspecialchars($menu_title);
45 47
$description = $admin->add_slashes($admin->get_post('description'));
46 48
$keywords = $admin->add_slashes($admin->get_post('keywords'));
47 49
$parent = $admin->get_post('parent');
trunk/wb/admin/pages/sections.php
138 138
	</td>
139 139
	<td align="right">
140 140
		<?php echo $TEXT['CURRENT_PAGE']; ?>: 
141
		<b><?php echo (htmlentities($results_array['page_title'])); ?></b>
141
		<b><?php echo ($results_array['page_title']); ?></b>
142 142
		-
143 143
		<a href="<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>"><?php echo $HEADING['MODIFY_PAGE']; ?></a>
144 144
		-
trunk/wb/admin/pages/modify.php
60 60
$template->set_block('page', 'main_block', 'main');
61 61
$template->set_var(array(
62 62
								'PAGE_ID' => $results_array['page_id'],
63
								'PAGE_TITLE' => (htmlentities($results_array['page_title'])),
63
								'PAGE_TITLE' => ($results_array['page_title']),
64 64
								'MODIFIED_BY' => $user['display_name'],
65 65
								'MODIFIED_BY_USERNAME' => $user['username'],
66 66
								'MODIFIED_WHEN' => $modified_ts,
trunk/wb/admin/pages/add.php
33 33

  
34 34
// Get values
35 35
$title = $admin->add_slashes($admin->get_post_escaped('title'));
36
$title = my_htmlspecialchars($title);
36 37
$module = $admin->get_post('type');
37 38
$parent = $admin->get_post('parent');
38 39
$visibility = $admin->get_post('visibility');
trunk/wb/framework/convert.php
25 25

  
26 26
/*
27 27
Character Conversion file
28
This file helps convert possible error-causing
29
characters to equivalent non-error-causing ones
28
to convert some entities to there 7bit equivalents
30 29
*/
31 30
if(!defined('WB_URL')) {
32 31
	header('Location: ../index.php');
......
34 33
}
35 34

  
36 35
$conversion_array = array(
37
'À'=>'A','�?'=>'A','Â'=>'A','Ã'=>'A','Ä'=>'Ae', '&Auml;'=>'A',
38
'Å'=>'A','Ā'=>'A','Ą'=>'A','Ă'=>'A', 'Æ'=>'Ae',
39
'Ç'=>'C','Ć'=>'C','Č'=>'C','Ĉ'=>'C','Ċ'=>'C',
40
'Ď'=>'D','�?'=>'D','�?'=>'D',
41
'È'=>'E','É'=>'E','Ê'=>'E','Ë'=>'E','Ē'=>'E',
42
'Ę'=>'E','Ě'=>'E','Ĕ'=>'E','Ė'=>'E',
43
'Ĝ'=>'G','Ğ'=>'G','Ġ'=>'G','Ģ'=>'G',
44
'Ĥ'=>'H','Ħ'=>'H',
45
'Ì'=>'I','�?'=>'I','Î'=>'I','�?'=>'I','Ī'=>'I', 'Ĩ'=>'I','Ĭ'=>'I','Į'=>'I','İ'=>'I',
46
'IJ'=>'IJ','Ĵ'=>'J','Ķ'=>'K',
47
'�?'=>'K','Ľ'=>'K','Ĺ'=>'K','Ļ'=>'K','Ŀ'=>'K',
48
'Ñ'=>'N','Ń'=>'N','Ň'=>'N','Ņ'=>'N','Ŋ'=>'N',
49
'Ò'=>'O','Ó'=>'O','Ô'=>'O','Õ'=>'O','Ö'=>'Oe',
50
'&Ouml;'=>'Oe', 'Ø'=>'O','Ō'=>'O','�?'=>'O','Ŏ'=>'O',
51
'Œ'=>'OE', 'Ŕ'=>'R','Ř'=>'R','Ŗ'=>'R',
52
'Ś'=>'S','Š'=>'S','Ş'=>'S','Ŝ'=>'S','Ș'=>'S',
53
'Ť'=>'T','Ţ'=>'T','Ŧ'=>'T','Ț'=>'T',
54
'Ù'=>'U','Ú'=>'U','Û'=>'U','Ü'=>'Ue','Ū'=>'U',
55
'&Uuml;'=>'Ue', 'Ů'=>'U','Ű'=>'U','Ŭ'=>'U','Ũ'=>'U','Ų'=>'U',
56
'Ŵ'=>'W', '�?'=>'Y','Ŷ'=>'Y','Ÿ'=>'Y', 'Ź'=>'Z','Ž'=>'Z','Ż'=>'Z',
57
'Þ'=>'T','Þ'=>'T', 'à'=>'a','á'=>'a','â'=>'a','ã'=>'a','ä'=>'ae',
58
'&auml;'=>'ae', 'å'=>'a','�?'=>'a','ą'=>'a','ă'=>'a',
59
'æ'=>'ae', 'ç'=>'c','ć'=>'c','�?'=>'c','ĉ'=>'c','ċ'=>'c',
60
'�?'=>'d','đ'=>'d','ð'=>'d', 'è'=>'e','é'=>'e','ê'=>'e','ë'=>'e','ē'=>'e',
61
'ę'=>'e','ě'=>'e','ĕ'=>'e','ė'=>'e', 'ƒ'=>'f',
62
'�?'=>'g','ğ'=>'g','ġ'=>'g','ģ'=>'g', 'ĥ'=>'h','ħ'=>'h',
63
'ì'=>'i','í'=>'i','î'=>'i','ï'=>'i','ī'=>'i', 'ĩ'=>'i','ĭ'=>'i','į'=>'i','ı'=>'i',
64
'ij'=>'ij', 'ĵ'=>'j', 'ķ'=>'k','ĸ'=>'k', 'ł'=>'l','ľ'=>'l','ĺ'=>'l','ļ'=>'l','ŀ'=>'l',
65
'ñ'=>'n','ń'=>'n','ň'=>'n','ņ'=>'n','ʼn'=>'n', 'ŋ'=>'n',
66
'ò'=>'o','ó'=>'o','ô'=>'o','õ'=>'o','ö'=>'oe', '&ouml;'=>'oe',
67
'ø'=>'o','�?'=>'o','ő'=>'o','�?'=>'o', 'œ'=>'oe', 'ŕ'=>'r','ř'=>'r','ŗ'=>'r',
68
'š'=>'s', 'ù'=>'u','ú'=>'u','û'=>'u','ü'=>'ue','ū'=>'u', '&uuml;'=>'ue',
69
'ů'=>'u','ű'=>'u','ŭ'=>'u','ũ'=>'u','ų'=>'u', 'ŵ'=>'w',
70
'ý'=>'y','ÿ'=>'y','ŷ'=>'y', 'ž'=>'z','ż'=>'z','ź'=>'z', 'þ'=>'t', 'ß'=>'ss', 'ſ'=>'ss',
71
'ä'=>'ae', 'ö'=>'oe', 'ü'=>'ue', 'Ä'=>'Ae', 'Ö'=>'Oe', 'Ü'=>'Ue'
36

  
37
//### LATIN
38
'&Aacute;'=>'A','&aacute;'=>'a','&Acirc;'=>'A','&acirc;'=>'a','&AElig;'=>'AE','&aelig;'=>'ae','&Agrave;'=>'A','&agrave;'=>'a','&Aring;'=>'A','&aring;'=>'a','&Atilde;'=>'A','&atilde;'=>'a','&Auml;'=>'AE','&auml;'=>'ae',
39
'&Ccedil;'=>'C','&ccedil;'=>'c',
40
'&Eacute;'=>'E','&eacute;'=>'e','&Ecirc;'=>'E','&ecirc;'=>'e','&Egrave;'=>'E','&egrave;'=>'e','&Euml;'=>'E','&euml;'=>'e',
41
'&Iacute;'=>'I','&iacute;'=>'i','&Icirc;'=>'I','&icirc;'=>'i','&Igrave;'=>'I','&igrave;'=>'i','&Iuml;'=>'I','&iuml;'=>'i',
42
'&Ntilde;'=>'N','&ntilde;'=>'n',
43
'&Oacute;'=>'O','&oacute;'=>'o','&Ocirc;'=>'O','&ocirc;'=>'o','&OElig;'=>'OE','&oelig;'=>'oe','&Ograve;'=>'O','&ograve;'=>'o','&Otilde;'=>'O','&otilde;'=>'o','&Ouml;'=>'OE','&ouml;'=>'oe',
44
'&Scaron;'=>'S','&scaron;'=>'s',
45
'&szlig;'=>'ss',
46
'&Uacute;'=>'U','&uacute;'=>'u','&Ucirc;'=>'U','&ucirc;'=>'u','&Ugrave;'=>'U','&ugrave;'=>'u','&Uuml;'=>'UE','&uuml;'=>'ue',
47
'&Yacute;'=>'Y','&yacute;'=>'y','&Yuml;'=>'Y','&yuml;'=>'y',
48
'&#138;'=>'S',
49
'&#140;'=>'OE','&#156;'=>'oe',
50
'&#154;'=>'s',
51
'&#159;'=>'Y',
52
'&copy;'=>'(c)','&reg;'=>'(r)','&ETH;'=>'D','&times;'=>'x','&Oslash;'=>'O','&THORN;'=>'TH','&eth;'=>'d','&oslash;'=>'o','&thorn;'=>'th',
53

  
54
// latin extended-A
55
'&#256;'=>'A','&#257;'=>'a','&#258;'=>'A','&#259;'=>'a','&#260;'=>'A','&#261;'=>'a',
56
'&#262;'=>'C','&#263;'=>'c','&#264;'=>'C','&#265;'=>'c','&#269;'=>'c','&#268;'=>'C','&#267;'=>'c','&#266;'=>'C',
57
'&#273;'=>'d','&#272;'=>'D','&#271;'=>'d','&#270;'=>'D',
58
'&#275;'=>'e','&#274;'=>'E','&#276;'=>'E','&#277;'=>'e','&#278;'=>'E','&#279;'=>'e','&#280;'=>'E','&#281;'=>'e','&#282;'=>'E','&#283;'=>'e',
59
'&#284;'=>'G','&#285;'=>'g','&#286;'=>'G','&#287;'=>'g','&#288;'=>'G','&#289;'=>'g','&#290;'=>'G','&#291;'=>'g',
60
'&#292;'=>'H','&#293;'=>'h','&#294;'=>'H','&#295;'=>'h',
61
'&#296;'=>'I','&#297;'=>'i','&#298;'=>'I','&#299;'=>'i','&#300;'=>'I','&#301;'=>'i','&#302;'=>'I','&#303;'=>'i','&#304;'=>'I','&#305;'=>'i',
62
'&#306;'=>'IJ','&#307;'=>'ij',
63
'&#308;'=>'J','&#309;'=>'j',
64
'&#310;'=>'K','&#311;'=>'k','&#312;'=>'k',
65
'&#313;'=>'L','&#314;'=>'l','&#315;'=>'L','&#316;'=>'l','&#317;'=>'L','&#318;'=>'l','&#319;'=>'L','&#320;'=>'l','&#321;'=>'L','&#322;'=>'l',
66
'&#323;'=>'N','&#324;'=>'n','&#325;'=>'N','&#326;'=>'n','&#327;'=>'N','&#328;'=>'n','&#329;'=>'n','&#330;'=>'N','&#331;'=>'n',
67
'&#332;'=>'O','&#333;'=>'o','&#334;'=>'O','&#335;'=>'o','&#336;'=>'O','&#337;'=>'o',
68
'&#340;'=>'R','&#341;'=>'r','&#342;'=>'R','&#343;'=>'r','&#344;'=>'R','&#345;'=>'r',
69
'&#346;'=>'S','&#347;'=>'s','&#348;'=>'S','&#349;'=>'s','&#350;'=>'S','&#351;'=>'s',
70
'&#354;'=>'T','&#355;'=>'t','&#356;'=>'T','&#357;'=>'t','&#358;'=>'T','&#359;'=>'t',
71
'&#360;'=>'U','&#361;'=>'u','&#362;'=>'U','&#363;'=>'u','&#364;'=>'U','&#365;'=>'u','&#366;'=>'U','&#367;'=>'u','&#368;'=>'U','&#369;'=>'u','&#370;'=>'U','&#371;'=>'u',
72
'&#372;'=>'W','&#373;'=>'w',
73
'&#374;'=>'Y','&#375;'=>'y','&#376;'=>'Y',
74
'&#377;'=>'Z','&#378;'=>'z','&#379;'=>'Z','&#380;'=>'z','&#381;'=>'Z','&#382;'=>'z',
75
'&#383;'=>'s',
76
'&#64256;'=>'ff','&#64257;'=>'fi','&#64258;'=>'fl','&#64259;'=>'ffi','&#64260;'=>'ffl',
77
'&#64261;'=>'st',
78
'&#64262;'=>'st',
79
// latin extended-b
80
'&#384;'=>'b','&#385;'=>'B','&#386;'=>'B','&#387;'=>'b','&#388;'=>'6','&#389;'=>'6',
81
'&#390;'=>'O','&#391;'=>'C','&#392;'=>'c','&#393;'=>'D','&#394;'=>'D','&#395;'=>'D',
82
'&#396;'=>'d','&#397;'=>'d','&#398;'=>'E','&#399;'=>'e','&#400;'=>'E','&#401;'=>'F',
83
'&fnof;'=>'f','&#403;'=>'G','&#404;'=>'G','&#405;'=>'hw','&#406;'=>'I','&#407;'=>'I',
84
'&#408;'=>'K','&#409;'=>'k','&#410;'=>'l','&#411;'=>'l','&#412;'=>'M','&#413;'=>'N',
85
'&#414;'=>'n','&#415;'=>'O','&#416;'=>'O','&#417;'=>'o','&#418;'=>'OI','&#419;'=>'oi',
86
'&#420;'=>'P','&#421;'=>'p','&#422;'=>'YR','&#423;'=>'2','&#424;'=>'2','&#425;'=>'ESH',
87
'&#426;'=>'esh','&#427;'=>'t','&#428;'=>'T','&#429;'=>'t','&#430;'=>'T','&#431;'=>'U',
88
'&#432;'=>'u','&#433;'=>'V','&#434;'=>'v','&#435;'=>'Y','&#436;'=>'y','&#437;'=>'Z',
89
'&#438;'=>'z','&#439;'=>'EZH','&#440;'=>'EZH','&#441;'=>'ezh','&#442;'=>'ezh','&#443;'=>'2',
90
'&#444;'=>'5','&#445;'=>'5','&#446;'=>'-','&#447;'=>'w','&#448;'=>'-','&#449;'=>'-',
91
'&#450;'=>'-','&#451;'=>'-','&#452;'=>'DZ','&#453;'=>'DZ','&#454;'=>'dz','&#455;'=>'LJ',
92
'&#456;'=>'Lj','&#457;'=>'lj','&#458;'=>'NJ','&#459;'=>'Nj','&#460;'=>'nj','&#461;'=>'A',
93
'&#462;'=>'a','&#463;'=>'I','&#464;'=>'i','&#465;'=>'O','&#466;'=>'o','&#467;'=>'U',
94
'&#468;'=>'u','&#469;'=>'U','&#470;'=>'u','&#471;'=>'U','&#472;'=>'u','&#473;'=>'U',
95
'&#474;'=>'u','&#475;'=>'U','&#476;'=>'u','&#477;'=>'e','&#478;'=>'A','&#479;'=>'a',
96
'&#480;'=>'A','&#481;'=>'a','&#482;'=>'AE','&#483;'=>'ae','&#484;'=>'G','&#485;'=>'g',
97
'&#486;'=>'G','&#487;'=>'g','&#488;'=>'K','&#489;'=>'k','&#490;'=>'O','&#491;'=>'o',
98
'&#492;'=>'O','&#493;'=>'o','&#494;'=>'EZH','&#495;'=>'ezh','&#496;'=>'j','&#497;'=>'DZ',
99
'&#498;'=>'Dz','&#499;'=>'dz','&#500;'=>'G','&#501;'=>'g','&#502;'=>'HW','&#503;'=>'W',
100
'&#504;'=>'N','&#505;'=>'n','&#506;'=>'A','&#507;'=>'a','&#508;'=>'AE','&#509;'=>'ae',
101
'&#510;'=>'O','&#511;'=>'o','&#512;'=>'A','&#513;'=>'a','&#514;'=>'A','&#515;'=>'a',
102
'&#516;'=>'E','&#517;'=>'e','&#518;'=>'E','&#519;'=>'e','&#520;'=>'I','&#521;'=>'i',
103
'&#522;'=>'I','&#523;'=>'i','&#524;'=>'O','&#525;'=>'o','&#526;'=>'O','&#527;'=>'o',
104
'&#528;'=>'R','&#529;'=>'r','&#530;'=>'R','&#531;'=>'r','&#532;'=>'U','&#533;'=>'u',
105
'&#534;'=>'U','&#535;'=>'u','&#536;'=>'S','&#537;'=>'s','&#538;'=>'T','&#539;'=>'t',
106
'&#540;'=>'Y','&#541;'=>'y','&#542;'=>'H','&#543;'=>'h','&#544;'=>'n','&#545;'=>'d',
107
'&#546;'=>'OU','&#547;'=>'ou','&#548;'=>'Z','&#549;'=>'z','&#550;'=>'A','&#551;'=>'a',
108
'&#552;'=>'E','&#553;'=>'e','&#554;'=>'O','&#555;'=>'o','&#556;'=>'O','&#557;'=>'o',
109
'&#558;'=>'O','&#559;'=>'o','&#560;'=>'O','&#561;'=>'o','&#562;'=>'Y','&#563;'=>'y',
110
'&#564;'=>'l','&#565;'=>'n','&#566;'=>'t','&#567;'=>'j','&#568;'=>'db','&#569;'=>'qp',
111
'&#570;'=>'A','&#571;'=>'C','&#572;'=>'c','&#573;'=>'L','&#574;'=>'T','&#575;'=>'s',
112
'&#576;'=>'z','&#577;'=>'-',
113
// latin extended additional
114
'&#7680;'=>'A','&#7681;'=>'a',
115
'&#7682;'=>'B','&#7683;'=>'b','&#7684;'=>'B','&#7685;'=>'b','&#7686;'=>'B','&#7687;'=>'b',
116
'&#7688;'=>'C','&#7689;'=>'c',
117
'&#7690;'=>'D','&#7691;'=>'d','&#7692;'=>'D','&#7693;'=>'d','&#7694;'=>'D','&#7695;'=>'d','&#7696;'=>'D','&#7697;'=>'d','&#7698;'=>'D','&#7699;'=>'d',
118
'&#7700;'=>'E','&#7701;'=>'e','&#7702;'=>'E','&#7703;'=>'e','&#7704;'=>'E','&#7705;'=>'e','&#7706;'=>'E','&#7707;'=>'e','&#7708;'=>'E','&#7709;'=>'e',
119
'&#7710;'=>'F','&#7711;'=>'f',
120
'&#7712;'=>'G','&#7713;'=>'g',
121
'&#7714;'=>'H','&#7715;'=>'h','&#7716;'=>'H','&#7717;'=>'h','&#7718;'=>'H','&#7719;'=>'h','&#7720;'=>'H','&#7721;'=>'h','&#7722;'=>'H','&#7723;'=>'h',
122
'&#7724;'=>'I','&#7725;'=>'i','&#7726;'=>'I','&#7727;'=>'i',
123
'&#7728;'=>'K','&#7729;'=>'k','&#7730;'=>'K','&#7731;'=>'k','&#7732;'=>'K','&#7733;'=>'k',
124
'&#7734;'=>'L','&#7735;'=>'l','&#7736;'=>'L','&#7737;'=>'l','&#7738;'=>'L','&#7739;'=>'l','&#7740;'=>'L','&#7741;'=>'l',
125
'&#7742;'=>'M','&#7743;'=>'m','&#7744;'=>'M','&#7745;'=>'m','&#7746;'=>'M','&#7747;'=>'m',
126
'&#7748;'=>'N','&#7749;'=>'n','&#7750;'=>'N','&#7751;'=>'n','&#7752;'=>'N','&#7753;'=>'n','&#7754;'=>'N','&#7755;'=>'n',
127
'&#7756;'=>'O','&#7757;'=>'o','&#7758;'=>'O','&#7759;'=>'o','&#7760;'=>'O','&#7761;'=>'o','&#7762;'=>'O','&#7763;'=>'o',
128
'&#7764;'=>'P','&#7765;'=>'p','&#7766;'=>'P','&#7767;'=>'p',
129
'&#7768;'=>'R','&#7769;'=>'r','&#7770;'=>'R','&#7771;'=>'r','&#7772;'=>'R','&#7773;'=>'r','&#7774;'=>'R','&#7775;'=>'r',
130
'&#7776;'=>'S','&#7777;'=>'s','&#7778;'=>'S','&#7779;'=>'s','&#7780;'=>'S','&#7781;'=>'s','&#7782;'=>'S','&#7783;'=>'s','&#7784;'=>'S','&#7785;'=>'s',
131
'&#7786;'=>'T','&#7787;'=>'t','&#7788;'=>'T','&#7789;'=>'t','&#7790;'=>'T','&#7791;'=>'t','&#7792;'=>'T','&#7793;'=>'t',
132
'&#7794;'=>'U','&#7795;'=>'u','&#7796;'=>'U','&#7797;'=>'u','&#7798;'=>'U','&#7799;'=>'u','&#7800;'=>'U','&#7801;'=>'u','&#7802;'=>'U','&#7803;'=>'u',
133
'&#7804;'=>'V','&#7805;'=>'v','&#7806;'=>'V','&#7807;'=>'v',
134
'&#7808;'=>'W','&#7809;'=>'w','&#7810;'=>'W','&#7811;'=>'w','&#7812;'=>'W','&#7813;'=>'w','&#7814;'=>'W','&#7815;'=>'w','&#7816;'=>'W','&#7817;'=>'w',
135
'&#7818;'=>'X','&#7819;'=>'x','&#7820;'=>'X','&#7821;'=>'x',
136
'&#7822;'=>'Y','&#7823;'=>'y',
137
'&#7824;'=>'Z','&#7825;'=>'z','&#7826;'=>'Z','&#7827;'=>'z','&#7828;'=>'Z','&#7829;'=>'z',
138
'&#7830;'=>'h',
139
'&#7831;'=>'t',
140
'&#7832;'=>'w',
141
'&#7833;'=>'y',
142
'&#7834;'=>'a',
143
'&#7835;'=>'f',
144
'&#7840;'=>'A','&#7841;'=>'a','&#7842;'=>'A','&#7843;'=>'a','&#7844;'=>'A','&#7845;'=>'a','&#7846;'=>'A','&#7847;'=>'a','&#7848;'=>'A','&#7849;'=>'a',
145
'&#7850;'=>'A','&#7851;'=>'a','&#7852;'=>'A','&#7853;'=>'a','&#7854;'=>'A','&#7855;'=>'a','&#7856;'=>'A','&#7857;'=>'a','&#7858;'=>'A','&#7859;'=>'a','&#7860;'=>'A','&#7861;'=>'a','&#7862;'=>'A','&#7863;'=>'a',
146
'&#7864;'=>'E','&#7865;'=>'e','&#7866;'=>'E','&#7867;'=>'e','&#7868;'=>'E','&#7869;'=>'e','&#7870;'=>'E','&#7871;'=>'e','&#7872;'=>'E','&#7873;'=>'e','&#7874;'=>'E','&#7875;'=>'e','&#7876;'=>'E','&#7877;'=>'e','&#7878;'=>'E','&#7879;'=>'e',
147
'&#7880;'=>'I','&#7881;'=>'i','&#7882;'=>'I','&#7883;'=>'i',
148
'&#7884;'=>'O','&#7885;'=>'o','&#7886;'=>'O','&#7887;'=>'o','&#7888;'=>'O','&#7889;'=>'o','&#7890;'=>'O','&#7891;'=>'o','&#7892;'=>'O','&#7893;'=>'o','&#7894;'=>'O','&#7895;'=>'o',
149
'&#7896;'=>'O','&#7897;'=>'o','&#7898;'=>'O','&#7899;'=>'o','&#7900;'=>'O','&#7901;'=>'o','&#7902;'=>'O','&#7903;'=>'o','&#7904;'=>'O','&#7905;'=>'o','&#7906;'=>'O','&#7907;'=>'o',
150
'&#7908;'=>'U','&#7909;'=>'u','&#7910;'=>'U','&#7911;'=>'u','&#7912;'=>'U','&#7913;'=>'u','&#7914;'=>'U','&#7915;'=>'u','&#7916;'=>'U','&#7917;'=>'u','&#7918;'=>'U','&#7919;'=>'u','&#7920;'=>'U','&#7921;'=>'u',
151
'&#7922;'=>'Y','&#7923;'=>'y','&#7924;'=>'Y','&#7925;'=>'y','&#7926;'=>'Y','&#7927;'=>'y','&#7928;'=>'Y','&#7929;'=>'y',
152

  
153
//### CYRILLIC (transliteration following iso 9:1995)
154
'&#1040;'=>'A','&#1072;'=>'a',
155
'&#1232;'=>'A','&#1233;'=>'a',
156
'&#1234;'=>'A','&#1235;'=>'a',
157
'&#1240;'=>'A','&#1241;'=>'a',
158
'&#1041;'=>'B','&#1073;'=>'b',
159
'&#1042;'=>'V','&#1074;'=>'v',
160
'&#1043;'=>'G','&#1075;'=>'g',
161
'&#1168;'=>'G','&#1169;'=>'g',
162
'&#1172;'=>'G','&#1173;'=>'g',
163
'&#1170;'=>'G','&#1171;'=>'g',
164
'&#1044;'=>'D','&#1076;'=>'d',
165
'&#1026;'=>'D','&#1106;'=>'d',
166
'&#1027;'=>'G','&#1107;'=>'g',
167
'&#1045;'=>'E','&#1077;'=>'e',
168
'&#1025;'=>'E','&#1105;'=>'e',
169
'&#1238;'=>'E','&#1239;'=>'e',
170
'&#1028;'=>'E','&#1108;'=>'e',
171
'&#1212;'=>'C','&#1213;'=>'c',
172
'&#1214;'=>'C','&#1215;'=>'c',
173
'&#1046;'=>'Z','&#1078;'=>'z',
174
'&#1217;'=>'Z','&#1218;'=>'z',
175
'&#1244;'=>'Z','&#1245;'=>'z',
176
'&#1174;'=>'Z','&#1175;'=>'z',
177
'&#1047;'=>'Z','&#1079;'=>'z',
178
'&#1246;'=>'Z','&#1247;'=>'z',
179
'&#1029;'=>'Z','&#1109;'=>'z',
180
'&#1248;'=>'Z','&#1249;'=>'z',
181
'&#1048;'=>'I','&#1080;'=>'i',
182
'&#1252;'=>'I','&#1253;'=>'i',
183
'&#1030;'=>'I','&#1110;'=>'i',
184
'&#1031;'=>'I','&#1111;'=>'i',
185
'&#1049;'=>'J','&#1081;'=>'j',
186
'&#1032;'=>'J','&#1112;'=>'j',
187
'&#1050;'=>'K','&#1082;'=>'k',
188
'&#1178;'=>'K','&#1179;'=>'k',
189
'&#1182;'=>'K','&#1183;'=>'k',
190
'&#1051;'=>'L','&#1083;'=>'l',
191
'&#1033;'=>'L','&#1113;'=>'l',
192
'&#1052;'=>'M','&#1084;'=>'m',
193
'&#1053;'=>'N','&#1085;'=>'n',
194
'&#1034;'=>'N','&#1114;'=>'n',
195
'&#1188;'=>'N','&#1189;'=>'n',
196
'&#1186;'=>'N','&#1187;'=>'n',
197
'&#1054;'=>'O','&#1086;'=>'o',
198
'&#1254;'=>'O','&#1255;'=>'o',
199
'&#1256;'=>'O','&#1257;'=>'o',
200
'&#1055;'=>'P','&#1087;'=>'p',
201
'&#1190;'=>'P','&#1191;'=>'p',
202
'&#1056;'=>'R','&#1088;'=>'r',
203
'&#1057;'=>'S','&#1089;'=>'s',
204
'&#1194;'=>'C','&#1195;'=>'c',
205
'&#1058;'=>'T','&#1090;'=>'t',
206
'&#1196;'=>'T','&#1197;'=>'t',
207
'&#1035;'=>'C','&#1115;'=>'c',
208
'&#1036;'=>'K','&#1116;'=>'k',
209
'&#1059;'=>'U','&#1091;'=>'u',
210
'&#1038;'=>'U','&#1118;'=>'u',
211
'&#1264;'=>'U','&#1265;'=>'u',
212
'&#1266;'=>'U','&#1267;'=>'u',
213
'&#1198;'=>'U','&#1199;'=>'u',
214
'&#1060;'=>'F','&#1092;'=>'f',
215
'&#1061;'=>'H','&#1093;'=>'h',
216
'&#1202;'=>'H','&#1203;'=>'h',
217
'&#1210;'=>'H','&#1211;'=>'h',
218
'&#1062;'=>'C','&#1094;'=>'c',
219
'&#1204;'=>'C','&#1205;'=>'c',
220
'&#1063;'=>'C','&#1095;'=>'c',
221
'&#1268;'=>'C','&#1269;'=>'c',
222
'&#1206;'=>'C','&#1207;'=>'c',
223
'&#1039;'=>'D','&#1119;'=>'d',
224
'&#1064;'=>'S','&#1096;'=>'s',
225
'&#1065;'=>'S','&#1097;'=>'s',
226
'&#1067;'=>'Y','&#1099;'=>'y',
227
'&#1272;'=>'Y','&#1273;'=>'y',
228
'&#1069;'=>'E','&#1101;'=>'e',
229
'&#1070;'=>'U','&#1102;'=>'u',
230
'&#1071;'=>'A','&#1103;'=>'a',
231
'&#1122;'=>'E','&#1123;'=>'e',
232
'&#1130;'=>'A','&#1131;'=>'a',
233
'&#1138;'=>'F','&#1139;'=>'f',
234
'&#1140;'=>'Y','&#1141;'=>'y',
235
'&#1192;'=>'O','&#1193;'=>'o',
236
// ?
237
'&#1066;'=>'-',
238
'&#1068;'=>'-',
239
'&#1216;'=>'-',
240
'&#1100;'=>'-',
241
'&#769;'=>'',
242

  
243
//### (new) GREEK (transcription following wikipedia: http://de.wikipedia.org/w/index.php?title=Wikipedia:Namenskonventionen/Neugriechisch&oldid=29601735 )
244
// groups of two chars
245
'&alpha;&iota;'=>'e','&Alpha;&iota;'=>'E',
246
'&epsilon;&iota;'=>'i','&Epsilon;&iota;'=>'I',
247
'&omicron;&iota;'=>'i','&Omicron;&iota;'=>'I',
248
'&omicron;&upsilon;'=>'ou','&Omicron;&upsilon;'=>'Ou',
249
'&alpha;&upsilon;'=>'av','&Alpha;&upsilon;'=>'Av',
250
'&epsilon;&upsilon;'=>'ev','&Epsilon;&upsilon;'=>'Ev',
251
'&eta;&upsilon;'=>'iv','&Eta;&upsilon;'=>'Iv',
252
'&mu;&pi;'=>'mp','&Mu;&pi;'=>'B',
253
'&nu;&tau;'=>'nt','&Nu;&tau;'=>'D',
254
'&tau;&zeta;'=>'tz','&Tau;&zeta;'=>'Tz',
255
'&gamma;&kappa;'=>'ng','&Gamma;&kappa;'=>'G',
256
'&gamma;&gamma;'=>'ng','&Gamma;&gamma;'=>'Ng',
257
// single chars
258
'&#902;'=>'A','&#904;'=>'E','&#905;'=>'I','&#906;'=>'I','&#908;'=>'O','&#910;'=>'Y','&#911;'=>'O','&#912;'=>'i',
259
'&Alpha;'=>'A','&Beta;'=>'V','&Gamma;'=>'G','&Delta;'=>'D','&Epsilon;'=>'E','&Zeta;'=>'Z','&Eta;'=>'I','&Theta;'=>'Th','&Iota;'=>'I','&Kappa;'=>'K','&Lambda;'=>'L','&Mu;'=>'M','&Nu;'=>'N','&Xi;'=>'X','&Omicron;'=>'O','&Pi;'=>'P','&Rho;'=>'R','&Sigma;'=>'S','&Tau;'=>'T','&Upsilon;'=>'Y','&Phi;'=>'F','&Chi;'=>'Ch','&Psi;'=>'Ps','&Omega;'=>'O',
260
'&#938;'=>'I','&#939;'=>'Y','&#940;'=>'a','&#941;'=>'e','&#942;'=>'i','&#943;'=>'i','&#944;'=>'y',
261
'&alpha;'=>'a','&beta;'=>'v','&gamma;'=>'g','&delta;'=>'d','&epsilon;'=>'e','&zeta;'=>'z','&eta;'=>'i','&theta;'=>'th','&iota;'=>'i','&kappa;'=>'k','&lambda;'=>'l','&mu;'=>'m','&nu;'=>'n','&xi;'=>'x','&omicron;'=>'o','&pi;'=>'p','&rho;'=>'r','&sigmaf;'=>'s','&sigma;'=>'s','&tau;'=>'t','&upsilon;'=>'y','&phi;'=>'f','&chi;'=>'ch','&psi;'=>'ps','&omega;'=>'o',
262
'&#970;'=>'i','&#971;'=>'y','&#972;'=>'o','&#973;'=>'y','&#974;'=>'o','&#976;'=>'b','&thetasym;'=>'th','&upsih;'=>'y','&#979;'=>'y','&#980;'=>'y'
263

  
72 264
);
73 265

  
74 266
?>
trunk/wb/framework/class.frontend.php
72 72
				$content = @fread($handle, filesize($filename));
73 73
				@fclose($handle);
74 74
				$this->preprocess($content);
75
	      header("Location: pages/intro.php");   // send intro.php as header to allow parsing of php statements
75
				header("Location: pages/intro.php");   // send intro.php as header to allow parsing of php statements
76 76
				echo ($content);
77 77
				return false;
78 78
			}
......
140 140
			// Page ID
141 141
			define('PAGE_ID', $this->page['page_id']);
142 142
			// Page Title
143
			define('PAGE_TITLE', htmlentities(($this->page['page_title'])));
143
			define('PAGE_TITLE', $this->page['page_title']);
144 144
			$this->page_title=PAGE_TITLE;
145 145
			// Menu Title
146
			$menu_title = htmlentities($this->page['menu_title']);
146
			$menu_title = $this->page['menu_title'];
147 147
			if($menu_title != '') {
148 148
				define('MENU_TITLE', $menu_title);
149 149
			} else {
......
354 354
	            $link = $this->page_link($page['link']);
355 355
	         }
356 356
	         // Create values
357
	         $values = array($class,'<a href="'.$link.'" target="'.$page['target'].'" '.$class.'>', '</a>', htmlentities($page['menu_title']), htmlentities($page['page_title']));
357
	         $values = array($class,'<a href="'.$link.'" target="'.$page['target'].'" '.$class.'>', '</a>', $page['menu_title'], $page['page_title']);
358 358
	         // Replace vars with value and print
359 359
	         echo "\n".str_replace($vars, $values, $this->menu_item_template);
360 360
	         // Generate sub-menu
trunk/wb/framework/frontend.functions.php
73 73
		// filter meta-characters
74 74
		$string=preg_quote($string, '/');
75 75
		if ($string!=$last_string ) {
76
			$foo=preg_replace('/('.$string.')(?=[^>;]*(&|<))/iUS', '<span class="highlight">$1</span>',$foo);
76
			$foo=preg_replace('/((>|;)[^&<]*)('.$string.')(?=[^>;]*(&|<))/iUS', '$1<span class="highlight">$3</span>',$foo);
77 77
			$last_string=$string;
78 78
		}
79 79
	}
......
184 184
				if (isset($_GET['searchresult']) AND is_numeric($_GET['searchresult']) ) {
185 185
					if (isset($_GET['sstring']) AND !empty($_GET['sstring']) ){
186 186
						$arr_string = explode(" ", $_GET['sstring']);
187
						if($_GET['searchresult'] == 2) {
188
							// exact match
189
							$arr_string[0] = strtr($arr_string[0], "_"," ");
190
							$arr_string[1] = strtr($arr_string[1], "_"," ");
191
						}
187 192
						ob_start(); //start output buffer
188 193
						require(WB_PATH.'/modules/'.$module.'/view.php');
189 194
						$foo = ob_get_contents();    // put outputbuffer in $foo
......
223 228
					$query_menu=$database->query("SELECT menu_title,link FROM ".TABLE_PREFIX."pages WHERE page_id=$temp");
224 229
					$page=$query_menu->fetchRow();
225 230
					if ($links==true AND $temp!=$page_id)
226
						echo '<a href="'.page_link($page['link']).'">'.htmlentities($page['menu_title']).'</a>';
231
						echo '<a href="'.page_link($page['link']).'">'.$page['menu_title'].'</a>';
227 232
					else
228
					    echo htmlentities($page['menu_title']);
233
					    echo $page['menu_title'];
229 234
		        }
230 235
	            $counter++;
231 236
			}
trunk/wb/framework/functions.php
338 338
	return $subs;
339 339
}
340 340

  
341
// Function as replecement for php's htmlspecialchars()
342
function my_htmlspecialchars($string) {
343
	$string = umlauts_to_entities($string);
344
	$string = entities_to_umlauts($string);
345
	return($string);
346
}
347

  
348
// Function to get the DEFAULT_CHARSET
349
function get_wbcharset() {
350
	$charset=strtoupper(DEFAULT_CHARSET);
351
	if(strcmp($charset,"BIG5") == 0) {
352
		$charset="BIG-5";
353
	}
354
	return($charset);
355
}
356

  
357
// Function to convert a string from $from- to $to-encoding, using mysql
358
function my_mysql_iconv($string, $from, $to) {
359
	// keep current character set values:
360
	$character_set_database = mysql_result(mysql_query("SELECT @@character_set_client"),0,0);
361
	$character_set_results = mysql_result(mysql_query("SELECT @@character_set_results"),0,0);
362
	$collation_results = mysql_result(mysql_query("SELECT @@collation_connection"),0,0);
363
	mysql_query("SET character_set_client=$from");
364
	mysql_query("SET character_set_results=$to");
365
	mysql_query("SET collation_connection=utf8_unicode_ci");
366
	$string_escaped = mysql_real_escape_string($string);
367
	$converted_string = mysql_result(mysql_query("SELECT '$string_escaped'"),0,0);
368
	// restore previous character set values:
369
	mysql_query("SET character_set_client=$character_set_database");
370
	mysql_query("SET character_set_results=$character_set_results");
371
	mysql_query("SET collation_connection=$collation_results");
372
	return $converted_string;
373
}
374

  
375
// Function to convert a string from html-entities to umlauts
376
// and encode htmlspecialchars
377
function entities_to_umlauts($string) {
378
	$charset = get_wbcharset();
379
	// there's no GB2312 or ISO-8859-11 encoding in php's mb_* functions
380
	if (strcmp($charset,"GB2312") == 0) {
381
		if(function_exists('iconv')) {
382
			$string=mb_convert_encoding($string,'UTF-8','HTML-ENTITIES');
383
			$string=iconv("UTF-8","GB2312",$string);
384
		} else {
385
			$string=mb_convert_encoding($string,'UTF-8','HTML-ENTITIES');
386
			$string=my_mysql_iconv($string, 'utf8', 'gb2312');
387
		}
388
	} elseif (strcmp($charset,"ISO-8859-11") == 0) {
389
		if(function_exists('iconv')) {
390
			$string=mb_convert_encoding($string,'UTF-8','HTML-ENTITIES');
391
			$string=iconv("UTF-8","ISO-8859-11",$string);
392
		} else {
393
			$string=mb_convert_encoding($string,'UTF-8','HTML-ENTITIES');
394
			$string=my_mysql_iconv($string, 'utf8', 'tis620');
395
		}
396
	} else {
397
		$string=mb_convert_encoding($string,$charset,'HTML-ENTITIES');
398
	}
399
	$string=htmlspecialchars($string);
400
	return($string);
401
}
402

  
403
// Function to convert a string from umlauts to html-entities
404
// and encode htmlspecialchars
405
function umlauts_to_entities($string) {
406
	$charset=get_wbcharset();
407
	// there's no GB2312 or ISO-8859-11 encoding in php's mb_* functions
408
	if (strcmp($charset,"GB2312") == 0) {
409
		if(function_exists('iconv')) {
410
			$string=iconv("GB2312","UTF-8",$string);
411
			$charset="UTF-8";
412
		} else {
413
			$string=my_mysql_iconv($string, 'gb2312', 'utf8');
414
			$charset="UTF-8";
415
		}
416
	} elseif (strcmp($charset,"ISO-8859-11") == 0) {
417
		if(function_exists('iconv')) {
418
			$string=iconv("ISO-8859-11","UTF-8",$string);
419
			$charset="UTF-8";
420
		} else {
421
			$string=my_mysql_iconv($string, 'tis620', 'utf8');
422
			$charset="UTF-8";
423
		}
424
	}
425
	$string=mb_convert_encoding($string,'HTML-ENTITIES',$charset);
426
	$string=mb_convert_encoding($string,'UTF-8','HTML-ENTITIES');
427
	$string=htmlspecialchars($string,ENT_QUOTES);
428
	$string=mb_convert_encoding($string,'HTML-ENTITIES','UTF-8');
429
	return($string);
430
}
431

  
432
// translate any "latin" html-entities to their plain 7bit equivalents
433
function entities_to_7bit($string) {
434
	require(WB_PATH.'/framework/convert.php');
435
	$string = strtr($string, $conversion_array);
436
	return($string);
437
}
438

  
341 439
// Function to convert a page title to a page filename
342 440
function page_filename($string) {
343
	// First, translate any non-english characters to their english equivalents
344
	require(WB_PATH.'/framework/convert.php');
345
   $string = strtr($string, $conversion_array);
441
	$string = entities_to_7bit(umlauts_to_entities($string));
346 442
	// Now replace spaces with page spcacer
347 443
	$string = str_replace(' ', PAGE_SPACER, $string);
348 444
	// Now remove all bad characters
......
371 467

  
372 468
// Function to convert a desired media filename to a clean filename
373 469
function media_filename($string) {
374
	// First, translate any non-english characters to their english equivalents
375
	require(WB_PATH.'/framework/convert.php');
376
   $string = strtr($string, $conversion_array);
470
	$string = entities_to_7bit(umlauts_to_entities($string));
377 471
	// Now remove all bad characters
378 472
	$bad = array(
379 473
	'\'', // '

Also available in: Unified diff