X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=index.php;h=174f52034a62c9b839f38c632f9fd8166f8ed837;hb=refs%2Fpull%2F195%2Fhead;hp=7795a5974388e20b8a7f11b10ae5691950748fb7;hpb=880cbf92ca0ee87a4b10a0621e44aa70d019aff7;p=github%2Fshaarli%2FShaarli.git diff --git a/index.php b/index.php index 7795a597..174f5203 100644 --- a/index.php +++ b/index.php @@ -307,9 +307,10 @@ function autoLocale() { // (It's a bit crude, but it works very well. Preferred language is always presented first.) if (preg_match('/([a-z]{2})-?([a-z]{2})?/i',$_SERVER['HTTP_ACCEPT_LANGUAGE'],$matches)) { $loc = $matches[1] . (!empty($matches[2]) ? '_' . strtoupper($matches[2]) : ''); - $attempts = array($loc, str_replace('_', '-', $loc), - $loc . '_' . strtoupper($loc), $loc . '_' . $loc, - $loc . '-' . strtoupper($loc), $loc . '-' . $loc); + $attempts = array($loc.'.UTF-8', $loc, str_replace('_', '-', $loc).'.UTF-8', str_replace('_', '-', $loc), + $loc . '_' . strtoupper($loc).'.UTF-8', $loc . '_' . strtoupper($loc), + $loc . '_' . $loc.'.UTF-8', $loc . '_' . $loc, $loc . '-' . strtoupper($loc).'.UTF-8', + $loc . '-' . strtoupper($loc), $loc . '-' . $loc.'.UTF-8', $loc . '-' . $loc); } } setlocale(LC_TIME, $attempts); // LC_TIME = Set local for date/time format only. @@ -1943,6 +1944,12 @@ function buildLinkList($PAGE,$LINKSDB) $taglist = explode(' ',$link['tags']); uasort($taglist, 'strcasecmp'); $link['taglist']=$taglist; + + if ($link["url"][0] === '?' && // Check for both signs of a note: starting with ? and 7 chars long. I doubt that you'll post any links that look like this. + strlen($link["url"]) === 7) { + $link["url"] = indexUrl() . $link["url"]; + } + $linkDisp[$keys[$i]] = $link; $i++; }