Page 7 of 7

Re: Multiple Languages

Posted: Tue Aug 30, 2016 1:52 pm
by happydg
Yes i do.

Re: Multiple Languages

Posted: Tue Aug 30, 2016 4:19 pm
by admin
You can use usort function to sort your array in any order.

Re: Multiple Languages

Posted: Tue Aug 30, 2016 8:29 pm
by happydg
I could use usort from my language template file directly but i need categories with at least a certain number of galleries.

Re: Multiple Languages

Posted: Wed Aug 31, 2016 8:15 am
by admin
You can create an array from
<categories

$category[name] = <!--TOTAL_GALLERIES-->;

</categories>


and then filter it.

Re: Multiple Languages

Posted: Mon Oct 24, 2016 11:24 am
by happydg
Hello, I have the code you gave me in common.php

Code: Select all

if (!strstr($_SERVER['HTTP_REFERER'], 'domain.com') and !$_GET['force_lng']) {

$str = $_SERVER['REQUEST_URI']; $str2 = substr($str, 3);

   if (strstr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'fr')) {
      header("Location: http://www.domain.com/fr".$str."");
      exit;
   } elseif (strstr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'de')) {
      header("Location: http://www.domain.com/de".$str."");
      exit;
.....
   } else {
      header("Location: http://www.domain.com/en".$str."");
      exit;
   }
}
It is working fine. But i see a lot of error in apache error logs:

Code: Select all

PHP Notice:  Undefined index: HTTP_REFERER in /data/www/domain.com/html/scj/cgi/common.php on line 16
PHP Notice:  Undefined index: HTTP_ACCEPT_LANGUAGE in /data/www/domain.com/html/scj/cgi/common.php on line 47
How can i fix it?

Thank you.

Re: Multiple Languages

Posted: Mon Oct 24, 2016 2:18 pm
by admin
Add

if (!isset($_SERVER['HTTP_REFERER'])) $_SERVER['HTTP_REFERER'] = '';

Re: Multiple Languages

Posted: Mon Oct 24, 2016 7:35 pm
by happydg
I also have this error:

Code: Select all

/data/www/pornyep.com/html/kli/cgi/common.php on line 58
[Mon Oct 24 20:44:16.087267 2016] [:error] [pid 4103] [client 157.55.39.88:45268] PHP Notice:  Undefined index: HTTP_ACCEPT_LANGUAGE in /data/www/domain.com/html/scj/cgi/common.php on line 61
[Mon Oct 24 20:44:16.087271 2016] [:error] [pid 4103] [client 157.55.39.88:45268] PHP Notice:  Undefined index: HTTP_ACCEPT_LANGUAGE in /data/www/domain.com/html/scj/cgi/common.php on line 64
[Mon Oct 24 20:44:16.087275 2016] [:error] [pid 4103] [client 157.55.39.88:45268] PHP Notice:  Undefined index: HTTP_ACCEPT_LANGUAGE in /data/www/domain.com/html/scj/cgi/common.php on line 67
[Mon Oct 24 20:44:16.087279 2016] [:error] [pid 4103] [client 157.55.39.88:45268] PHP Notice:  Undefined index: HTTP_ACCEPT_LANGUAGE in /data/www/domain.com/html/scj/cgi/common.php on line 70
[Mon Oct 24 20:44:16.087284 2016] [:error] [pid 4103] [client 157.55.39.88:45268] PHP Notice:  Undefined index: HTTP_ACCEPT_LANGUAGE in /data/www/domain.com/html/scj/cgi/common.php on line 73
But have else at the end:

Code: Select all

if (!strstr($_SERVER['HTTP_REFERER'], 'domain.com') and !$_GET['force_lng']) {

$str = $_SERVER['REQUEST_URI']; $str2 = substr($str, 3);

   if (strstr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'fr')) {
      header("Location: http://www.domain.com/fr".$str."");
      exit;
   } elseif (strstr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'de')) {
      header("Location: http://www.domain.com/de".$str."");
      exit;
.....
   } else {
      header("Location: http://www.domain.com/en".$str."");
      exit;
   }
}

Re: Multiple Languages

Posted: Tue Oct 25, 2016 6:32 am
by admin
if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) $_SERVER['HTTP_ACCEPT_LANGUAGE'] = '';

Re: Multiple Languages

Posted: Tue Oct 25, 2016 11:30 pm
by happydg
One last error i get:

PHP Notice: Undefined index: force_lng in /data/www/domain.com/html/scj/cgi/common.php on line 20

Code: Select all

if (!isset($_SERVER['HTTP_REFERER'])) $_SERVER['HTTP_REFERER'] = '';

if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) $_SERVER['HTTP_ACCEPT_LANGUAGE'] = '';

if (!strstr($_SERVER['HTTP_REFERER'], 'domain.com') and !$_GET['force_lng']) {

$str = $_SERVER['REQUEST_URI']; $str2 = substr($str, 3);

   if (strstr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'fr')) {
      header("Location: http://www.domain.com/fr".$str."");
      exit;
   } elseif (strstr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'de')) {
      header("Location: http://www.domain.com/de".$str."");
      exit;
....
   } else {
      header("Location: http://www.domain.com/en".$str."");
      exit;
   }
}
Line 20 is:

Code: Select all

if (!strstr($_SERVER['HTTP_REFERER'], 'domain.com') and !$_GET['force_lng']) {

Re: Multiple Languages

Posted: Wed Oct 26, 2016 5:49 am
by admin
if (!isset($_GET['force_lng'])) $_GET['force_lng'] = '';