]> git.wh0rd.org - tt-rss.git/commitdiff
lib: Upgrade accept-to-gettext.php from 2003-08-14 to 2007-04-01
authorAnders Kaseorg <andersk@mit.edu>
Fri, 20 Jan 2017 20:03:04 +0000 (15:03 -0500)
committerAnders Kaseorg <andersk@mit.edu>
Sat, 21 Jan 2017 20:01:14 +0000 (15:01 -0500)
http://grep.be/data/accept-to-gettext.inc

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
lib/accept-to-gettext.php

index 6f366d06a54f7286f462a76070f3d5f3d74c2b25..c909497cb31747e55378ce474200df8afc7fdc8a 100644 (file)
@@ -63,6 +63,8 @@
  * Revision 1.2  2003/08/14 10:23:59  wouter
  * Removed little error in Content-Type header syntaxis.
  *
+ * 2007-04-01
+ * add '@' before use of arrays, to avoid PHP warnings.
  */
 
 /* not really important, this one; perhaps I could've put it inline with
@@ -86,9 +88,9 @@ function find_match($curlscore,$curcscore,$curgtlang,$langval,$charval,
 function al2gt($gettextlangs, $mime) {
   /* default to "everything is acceptable", as RFC2616 specifies */
   $acceptLang=(($_SERVER["HTTP_ACCEPT_LANGUAGE"] == '') ? '*' :
-       $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
+      $_SERVER["HTTP_ACCEPT_LANGUAGE"]);
   $acceptChar=(($_SERVER["HTTP_ACCEPT_CHARSET"] == '') ? '*' :
-       $_SERVER["HTTP_ACCEPT_CHARSET"]);
+      $_SERVER["HTTP_ACCEPT_CHARSET"]);
   $alparts=@preg_split("/,/",$acceptLang);
   $acparts=@preg_split("/,/",$acceptChar);
   
@@ -147,22 +149,22 @@ function al2gt($gettextlangs, $mime) {
     $noct=@preg_split("/-/",$allang);
 
     $testvals=array(
-         array($alscores[$allang], $acscores[$gtcs]),
-        array($alscores[$noct[0]], $acscores[$gtcs]),
-        array($alscores[$allang], $acscores["*"]),
-        array($alscores[$noct[0]], $acscores["*"]),
-        array($alscores["*"], $acscores[$gtcs]),
-        array($alscores["*"], $acscores["*"]));
+         array(@$alscores[$allang], @$acscores[$gtcs]),
+     array(@$alscores[$noct[0]], @$acscores[$gtcs]),
+     array(@$alscores[$allang], @$acscores["*"]),
+     array(@$alscores[$noct[0]], @$acscores["*"]),
+     array(@$alscores["*"], @$acscores[$gtcs]),
+     array(@$alscores["*"], @$acscores["*"]));
 
     $found=FALSE;
     foreach($testvals as $tval) {
       if(!$found && isset($tval[0]) && isset($tval[1])) {
         $arr=find_match($curlscore, $curcscore, $curgtlang, $tval[0],
-                 $tval[1], $gtlang);
+              $tval[1], $gtlang);
         $curlscore=$arr[0];
         $curcscore=$arr[1];
         $curgtlang=$arr[2];
-       $found=TRUE;
+    $found=TRUE;
       }
     }
   }