Commit 774c38f26527509894e3bf877d453cc5d781439f

Authored by Neil Blakey-Milner
1 parent f18d2e19

Remove use of print_r that will fail on PHP < 4.3.0


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3166 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 4 additions and 25 deletions
lib/i18n/accept-to-gettext.inc
... ... @@ -53,23 +53,6 @@
53 53 * And the supplied parameter contains (amongst others) nl_BE.UTF-8
54 54 * and nl.ISO-8859-15, then nl_BE.UTF-8 will be picked.
55 55 *
56   - * $Log$
57   - * Revision 1.2 2004/11/04 09:55:00 nbm
58   - * Be wildly unfair, and if the character set hasn't been detected
59   - * properly, assume iso-8859-1.
60   - *
61   - * Revision 1.1 2004/05/10 15:58:37 michael
62   - * Type: i18n Framework.
63   - * Description: Added i18n support functions.
64   - *
65   - * Revision 1.1.1.1 2003/11/19 19:31:15 wouter
66   - * * moved to new CVS repo after death of the old
67   - * * Fixed code to apply a default to both Accept-Charset and
68   - * Accept-Language if none of those headers are supplied; patch from
69   - * Dominic Chambers <dominic@encasa.com>
70   - *
71   - * Revision 1.2 2003/08/14 10:23:59 wouter
72   - * Removed little error in Content-Type header syntaxis.
73 56 *
74 57 */
75 58  
... ... @@ -94,10 +77,8 @@ function find_match($curlscore,$curcscore,$curgtlang,$langval,$charval,
94 77 function al2gt($gettextlangs, $mime) {
95 78 global $default;
96 79 /* default to "everything is acceptable", as RFC2616 specifies */
97   - $acceptLang=(($_SERVER["HTTP_ACCEPT_LANGUAGE"] == '') ? '*' :
98   - $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
99   - $acceptChar=(($_SERVER["HTTP_ACCEPT_CHARSET"] == '') ? '*' :
100   - $_SERVER["HTTP_ACCEPT_CHARSET"]);
  80 + $acceptLang = KTUtil::arrayGet($_SERVER, "HTTP_ACCEPT_LANGUAGE", "*");
  81 + $acceptChar = KTUtil::arrayGet($_SERVER, "HTTP_ACCEPT_CHARSET", "*");
101 82 $alparts=@preg_split("/,/",$acceptLang);
102 83 $acparts=@preg_split("/,/",$acceptChar);
103 84  
... ... @@ -152,7 +133,7 @@ function al2gt($gettextlangs, $mime) {
152 133 $tmp1=preg_replace("/\_/","-",$gtlang);
153 134 $tmp2=@preg_split("/\./",$tmp1);
154 135 $allang=strtolower($tmp2[0]);
155   - $gtcs=strtoupper($tmp2[1]);
  136 + $gtcs=strtoupper(KTUtil::arrayGet($tmp2, 1, null));
156 137 $noct=@preg_split("/-/",$allang);
157 138  
158 139 $testvals=array(
... ... @@ -183,9 +164,7 @@ function al2gt($gettextlangs, $mime) {
183 164 $gtparts=@preg_split("/\./",$curgtlang);
184 165 $tmp=strtolower($gtparts[0]);
185 166 $lang=preg_replace("/\_/", "-", $tmp);
186   - $charset=$gtparts[1];
187   -
188   - $default->log->debug("gtparts: " . print_r($aInstalledLocalesgtparts, true));
  167 + $charset= KTUtil::arrayGet($gtparts, 1, null);
189 168  
190 169 if (is_null($charset) || ($charset === "")) {
191 170 $charset = "iso-8859-1";
... ...