Removing trailing “/” from “$path” with preg_replace is easier :-)
This commit is contained in:
parent
c5c76d1d9d
commit
786c832eb6
1 changed files with 2 additions and 8 deletions
|
@ -17,17 +17,11 @@ if (!array_key_exists('instpath',$conf))
|
|||
|
||||
$path=preg_replace('#\?.*$#','',$_SERVER['REQUEST_URI']);
|
||||
$path=preg_replace('/^'.preg_quote($conf['instpath'],'/').'/','',$path);
|
||||
$ndir=preg_match_all('/\//',$path)-1;
|
||||
$ndir=preg_match_all('#/#',$path)-1;
|
||||
$prepath='';
|
||||
for ($i=0; $i<$ndir; $i++)
|
||||
$prepath.='../';
|
||||
if (strlen($path)>0) {
|
||||
while ($path[strlen($path)-1]=='/') {
|
||||
$path=substr($path,0,-1);
|
||||
if (strlen($path)<1)
|
||||
break;
|
||||
}
|
||||
}
|
||||
$path=preg_replace('#/+$#','',$path);
|
||||
|
||||
$supplangs=['ca','de','en','es','fr','gl','it','pt_BR','uk'];// when adding a language code here, it is necessary to add it also to "$menu" in this same file, to "$hlmap" in stats.php, to "$hitslang" and "$langs" in ../clitools/mustool.php, to "langs" in ../clitools/updtrans.bash (if missing), to function "langs" in ../clitools/crawler.php; and to run "../clitools/addlang.php <new language code>" locally and on the server
|
||||
$dlang='en';
|
||||
|
|
Loading…
Reference in a new issue