[DMN-commit] web/htdocs index.php,1.6,1.7
Status: Beta
Brought to you by:
xoseotero
|
From: Xos? O. <xos...@us...> - 2004-04-29 01:49:54
|
Update of /cvsroot/dmn/web/htdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7904 Modified Files: index.php Log Message: 2 things: -Using explode in the right way... -Cut the REQUEST_URI until the parameters Index: index.php =================================================================== RCS file: /cvsroot/dmn/web/htdocs/index.php,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- index.php 29 Apr 2004 01:25:37 -0000 1.6 +++ index.php 29 Apr 2004 01:49:45 -0000 1.7 @@ -10,12 +10,9 @@ } else if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) { // from navigator // In mozilla: code, code, code;q=0.5 // Get all the string until ";" - $pos = strpos($_SERVER["HTTP_ACCEPT_LANGUAGE"], ";"); - if ($pos === false) // Not found ";" - $pos = strlen($_SERVER["HTTP_ACCEPT_LANGUAGE"]); - $languages = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"], 0, $pos); + $languages = explode(";" , $_SERVER["HTTP_ACCEPT_LANGUAGE"]); // Split the string into the codes - $languages = explode(",", $languages); + $languages = explode(",", $languages[0]); $lang_code = ""; foreach ($languages as $language) { if (valid_language(trim($language))) { @@ -125,7 +122,9 @@ continue; } $lang = open_language($lang['codes'][$i]); - echo "<a href=\"" . $_SERVER['REQUEST_URI'] . "?" . SID . "&lang=" . $lang['LANG_CODE'] . "\">" . $lang['LANG_NAME'] . "</a> "; + $this_url = explode("/?" , $_SERVER['REQUEST_URI']); + $this_url = $this_url[0]; + echo "<a href=\"" . $this_url . "?" . SID . "&lang=" . $lang['LANG_CODE'] . "\">" . $lang['LANG_NAME'] . "</a> "; } ?> </h6> |