From 19b1f522bbdff07b32e995f9a69c86eaffe2916c Mon Sep 17 00:00:00 2001 From: rurban Date: Thu, 29 Apr 2004 23:25:12 +0000 Subject: [PATCH] re-ordered locale init (as in 1.3.9) fixed loadfile with subpages, and merge/restore anyway (sf.net bug #844188) git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@3404 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/IniConfig.php | 14 ++++++++------ lib/config.php | 32 +++++++++++++++++--------------- lib/editpage.php | 10 ++++++++-- lib/loadsave.php | 11 ++++++----- lib/plugin/PopularNearby.php | 19 ++++++++++++------- 5 files changed, 51 insertions(+), 35 deletions(-) diff --git a/lib/IniConfig.php b/lib/IniConfig.php index 47ff60e17..0d1b0f453 100644 --- a/lib/IniConfig.php +++ b/lib/IniConfig.php @@ -1,5 +1,5 @@ "0-9A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\xff", - 'alpha' => "A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\xff", - 'upper' => "A-Z\xc0-\xd6\xd8-\xde", - 'lower' => "a-z\xdf-\xf6\xf8-\xff" - ); if (!isset($charset)) - $charset = CHARSET; // FIXME: get rid of constant. pref is dynamic and language specific + $charset = CHARSET; // get rid of constant. pref is dynamic and language specific if (in_array($GLOBALS['LANG'],array('ja','zh'))) $charset = 'utf-8'; if (strtolower($charset) == 'utf-8') { // thanks to John McPherson // until posix class names/pcre work with utf-8 + if (preg_match('/[[:upper:]]/', '\xc4\x80')) + return $regexp; // utf-8 non-ascii chars: most common (eg western) latin chars are 0xc380-0xc3bf // we currently ignore other less common non-ascii characters // (eg central/east european) latin chars are 0xc432-0xcdbf and 0xc580-0xc5be @@ -250,10 +241,18 @@ function pcre_fix_posix_classes ($regexp) { // this replaces [[:upper:]] with utf-8 match (Latin only) $regexp = preg_replace('/\[\[\:upper\:\]\]/','(?:[A-Z]|\xc3[\x80-\x9e]|\xc4[\x80\x82\x84\x86])', $regexp); + } elseif (preg_match('/[[:upper:]]/', 'Ä')) { + // First check to see if our PCRE lib supports POSIX character + // classes. If it does, there's nothing to do. + return $regexp; } - + static $classes = array( + 'alnum' => "0-9A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\xff", + 'alpha' => "A-Za-z\xc0-\xd6\xd8-\xf6\xf8-\xff", + 'upper' => "A-Z\xc0-\xd6\xd8-\xde", + 'lower' => "a-z\xdf-\xf6\xf8-\xff" + ); $keys = join('|', array_keys($classes)); - return preg_replace("/\[:($keys):]/e", '$classes["\1"]', $regexp); } @@ -283,6 +282,9 @@ function IsProbablyRedirectToIndex () { } // $Log: not supported by cvs2svn $ +// Revision 1.101 2004/04/26 13:22:32 rurban +// calculate bool old or dynamic constants later +// // Revision 1.100 2004/04/26 12:15:01 rurban // check default config values // diff --git a/lib/editpage.php b/lib/editpage.php index 6d048ddfe..9ef0d0a0a 100644 --- a/lib/editpage.php +++ b/lib/editpage.php @@ -1,5 +1,5 @@ _content = $initial_content; } } - header("Content-Type: text/html; charset=" . $GLOBALS['charset']); + if (!headers_sent()) + header("Content-Type: text/html; charset=" . $GLOBALS['charset']); } function editPage () { @@ -625,6 +626,11 @@ extends PageEditor /** $Log: not supported by cvs2svn $ + Revision 1.65 2004/04/18 01:11:52 rurban + more numeric pagename fixes. + fixed action=upload with merge conflict warnings. + charset changed from constant to global (dynamic utf-8 switching) + Revision 1.64 2004/04/06 19:48:56 rurban temp workaround for action=edit AddComment form diff --git a/lib/loadsave.php b/lib/loadsave.php index fd29806d9..7c7c42cc1 100644 --- a/lib/loadsave.php +++ b/lib/loadsave.php @@ -1,5 +1,5 @@ getArg('source'); - StartLoadDump($request, fmt("Loading '%s'", HTML(dirname($source), - "/", - WikiLink(basename($source), - 'auto')))); + $page = rawurldecode(basename($source)); + StartLoadDump($request, fmt("Loading '%s'", + HTML(dirname($source), + dirname($source) ? "/" : "", + WikiLink($page,'auto')))); echo "
\n"; LoadAny($request, $source); echo "
\n"; diff --git a/lib/plugin/PopularNearby.php b/lib/plugin/PopularNearby.php index 3354448ca..7213e7f6b 100644 --- a/lib/plugin/PopularNearby.php +++ b/lib/plugin/PopularNearby.php @@ -1,5 +1,5 @@ -* -* +* +* +* */ @@ -50,14 +50,14 @@ extends WikiPlugin function getVersion() { return preg_replace("/[Revision: $]/", '', - "\$Revision: 1.1 $"); + "\$Revision: 1.2 $"); } function getDefaultArguments() { return array('pagename' => '[pagename]', 'mode' => 'nearby', // or 'incoming' or 'outgoing' 'exclude' => '', - 'limit' => 5, // limit <0 returns least popular pages + 'limit' => 5, 'noheader' => 0, ); } @@ -88,7 +88,6 @@ extends WikiPlugin false,$limit); break; } - // if (count($links) > $limit) array_splice($links, $limit); $html = HTML($header); for ($i=0; $ipushContent($links[$i]['format'],$i