|
Server : Apache/2.4.62 System : FreeBSD fbsdweb2.web.rcn.net 14.1-RELEASE FreeBSD 14.1-RELEASE releng/14.1-n267679-10e31f0946d8 GENERIC amd64 User : www ( 80) PHP Version : 8.3.8 Disable Function : NONE Directory : /domains/astrosfm/pmwiki/scripts/ |
Upload File : |
<?php
/* Copyright 2004 Patrick R. Michaud ([email protected])
This file is part of PmWiki; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. See pmwiki.php for full details.
This file is used to enable the iso-8859-2 character set in PmWiki.
The first part converts the charset to iso-8859-2 and removes
conflicts for newline and keep tokens; the second part
handles the conversion of pagenames from utf-8 (sent by browsers)
into iso-8859-2 if needed.
*/
global $HTTPHeaders, $pagename, $KeepToken;
$HTTPHeaders[] = "Content-Type: text/html; charset=iso-8859-2;";
$KeepToken = "\263\263\263";
$pagename = $_REQUEST['n'];
if (!$pagename) $pagename = @$_GET['pagename'];
if ($pagename=='' && $EnablePathInfo)
$pagename = @substr($_SERVER['PATH_INFO'],1);
if (!$pagename &&
preg_match('!^'.preg_quote($_SERVER['SCRIPT_NAME'],'!').'/?([^?]*)!',
$_SERVER['REQUEST_URI'],$match))
$pagename = urldecode($match[1]);
$pagename = preg_replace('!/+$!','',$pagename);
if (!preg_match('/[\\x80-\\x9f]/', $pagename)) return;
if (function_exists('iconv'))
$pagename = iconv('UTF-8','ISO-8859-2',$pagename);
else {
$conv = array(
' '=>'�', 'Ą'=>'�', '˘'=>'�', 'Ł'=>'�',
'¤'=>'�', 'Ľ'=>'�', 'Ś'=>'�', '§'=>'�',
'¨'=>'�', 'Š'=>'�', 'Ş'=>'�', 'Ť'=>'�',
'Ź'=>'�', ''=>'�', 'Ž'=>'�', 'Ż'=>'�',
'°'=>'�', 'ą'=>'�', '˛'=>'�', 'ł'=>'�',
'´'=>'�', 'ľ'=>'�', 'ś'=>'�', 'ˇ'=>'�',
'¸'=>'�', 'š'=>'�', 'ş'=>'�', 'ť'=>'�',
'ź'=>'�', '˝'=>'�', 'ž'=>'�', 'ż'=>'�',
'Ŕ'=>'�', 'Á'=>'�', 'Â'=>'�', 'Ă'=>'�',
'Ä'=>'�', 'Ĺ'=>'�', 'Ć'=>'�', 'Ç'=>'�',
'Č'=>'�', 'É'=>'�', 'Ę'=>'�', 'Ë'=>'�',
'Ě'=>'�', 'Í'=>'�', 'Î'=>'�', 'Ď'=>'�',
'Đ'=>'�', 'Ń'=>'�', 'Ň'=>'�', 'Ó'=>'�',
'Ô'=>'�', 'Ő'=>'�', 'Ö'=>'�', '×'=>'�',
'Ř'=>'�', 'Ů'=>'�', 'Ú'=>'�', 'Ű'=>'�',
'Ü'=>'�', 'Ý'=>'�', 'Ţ'=>'�', 'ß'=>'�',
'ŕ'=>'�', 'á'=>'�', 'â'=>'�', 'ă'=>'�',
'ä'=>'�', 'ĺ'=>'�', 'ć'=>'�', 'ç'=>'�',
'č'=>'�', 'é'=>'�', 'ę'=>'�', 'ë'=>'�',
'ě'=>'�', 'í'=>'�', 'î'=>'�', 'ď'=>'�',
'đ'=>'�', 'ń'=>'�', 'ň'=>'�', 'ó'=>'�',
'ô'=>'�', 'ő'=>'�', 'ö'=>'�', '÷'=>'�',
'ř'=>'�', 'ů'=>'�', 'ú'=>'�', 'ű'=>'�',
'ü'=>'�', 'ý'=>'�', 'ţ'=>'�', '˙'=>'�',
);
$pagename = str_replace(array_keys($conv),array_values($conv),$pagename);
}