From: Geoffrey T. D. <da...@us...> - 2001-05-31 17:39:04
|
Update of /cvsroot/phpwiki/phpwiki/lib In directory usw-pr-cvs1:/tmp/cvs-serv6597/lib Modified Files: config.php Log Message: Revert $LANG back to being a global rather than an environment variable (as per patches from Jan Nieuwenhuizen <ja...@gn...>.) Use constants LC_ALL (&c) rather than literal "LC_ALL" as first argument to setlocale(). Define constants LC_ALL and LC_CTYPE if needed (for PHP < 4.0.5). Index: config.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/config.php,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -r1.39 -r1.40 *** config.php 2001/04/07 00:34:30 1.39 --- config.php 2001/05/31 17:39:02 1.40 *************** *** 8,13 **** */ ! // essential internal stuff set_magic_quotes_runtime(0); --- 8,18 ---- */ ! if (!defined("LC_ALL")) { ! // Backward compatibility (for PHP < 4.0.5) ! define("LC_ALL", "LC_ALL"); ! define("LC_CTYPE", "LC_CTYPE"); ! } + // essential internal stuff set_magic_quotes_runtime(0); *************** *** 23,32 **** define("FLAG_PAGE_LOCKED", 1); - ////////////////////////////////////////////////////////////////// - // - // Set up localization - // - setlocale('LC_ALL', ""); - // Search PHP's include_path to find file or directory. function FindFile ($file, $missing_okay = false) --- 28,31 ---- *************** *** 60,65 **** function FindLocalizedFile ($file, $missing_okay = false) { ! $language = getenv("LC_ALL"); if (empty($language)) $language = getenv("LC_MESSAGES"); if (empty($language)) --- 59,67 ---- function FindLocalizedFile ($file, $missing_okay = false) { ! $language = $GLOBALS['LANG']; ! if (empty($language)) + $language = getenv("LC_ALL"); + if (empty($language)) $language = getenv("LC_MESSAGES"); if (empty($language)) *************** *** 69,73 **** if (empty($language)) $language = "C"; - // FIXME: This wont work for DOS filenames. --- 71,74 ---- *************** *** 107,110 **** --- 108,114 ---- else { + // Setup localisation + setlocale(LC_ALL, "$LANG"); + putenv("LC_ALL=$LANG"); bindtextdomain ("phpwiki", FindFile("locale")); textdomain ("phpwiki"); *************** *** 131,136 **** // FIXME: Not all environments may support en_US? We should probably // have a list of locales to try. ! if (setlocale('LC_CTYPE', 0) == 'C') ! setlocale('LC_CTYPE', 'en_US.iso-8859-1'); /** string pcre_fix_posix_classes (string $regexp) --- 135,140 ---- // FIXME: Not all environments may support en_US? We should probably // have a list of locales to try. ! if (setlocale(LC_CTYPE, 0) == 'C') ! setlocale(LC_CTYPE, 'en_US.iso-8859-1'); /** string pcre_fix_posix_classes (string $regexp) |