0) { while ($path[strlen($path)-1]=='/') { $path=substr($path,0,-1); if (strlen($path)<1) break; } } $supplangs=['ca','en','es','fr','it']; if (preg_match('#/('.implode('|',$supplangs).')$#',$path,$lang)===1) { $dlang=$lang[1]; $path=substr($path,0,-3); } else { $dlang=substr($_SERVER['HTTP_ACCEPT_LANGUAGE'],0,2); $dlang=in_array($dlang,$supplangs) ? $dlang : 'en'; } $menu=array( 'guide'=>array('liadd'=>null, 'href'=>$conf['instpath'].'/'.$dlang, 'title'=>'Guide', 'selected'=>false, 'submenu'=>null), 'instances'=>array('liadd'=>null, 'href'=>$conf['instpath'].'/instances/'.$dlang, 'title'=>'Instances', 'selected'=>false, 'submenu'=>null), 'about'=>array('liadd'=>null, 'href'=>$conf['instpath'].'/about/'.$dlang, 'title'=>'About', 'selected'=>false, 'submenu'=>null), 'language'=>array('liadd'=>null, 'href'=>null, 'title'=>'Language', 'selected'=>false, 'submenu'=>array( 'ca'=>array('liadd'=>'onmouseover="this.style.cursor=\'pointer\'"', 'href'=>null, 'title'=>'Català', 'selected'=>false, 'submenu'=>null), 'en'=>array('liadd'=>'onmouseover="this.style.cursor=\'pointer\'"', 'href'=>null, 'title'=>'English', 'selected'=>false, 'submenu'=>null), 'es'=>array('liadd'=>'onmouseover="this.style.cursor=\'pointer\'"', 'href'=>null, 'title'=>'Español', 'selected'=>false, 'submenu'=>null), 'fr'=>array('liadd'=>'onmouseover="this.style.cursor=\'pointer\'"', 'href'=>null, 'title'=>'Français', 'selected'=>false, 'submenu'=>null), 'it'=>array('liadd'=>'onmouseover="this.style.cursor=\'pointer\'"', 'href'=>null, 'title'=>'Italiano', 'selected'=>false, 'submenu'=>null) ) ) ); foreach ($supplangs as $lang) $menu['language']['submenu'][$lang]['href']=$conf['instpath'].$path.'/'.$lang; $menu['language']['submenu'][$dlang]['href']=null; $menu['language']['submenu'][$dlang]['liadd']=null; $menu['language']['submenu'][$dlang]['selected']=true; switch ($dlang) { case 'ca': $menu['guide']['title']='Guia'; $menu['instances']['title']='Instàncies'; $menu['about']['title']='Info'; $menu['language']['title']='Idioma'; break; case 'en': $menu['guide']['title']='Guide'; $menu['instances']['title']='Instances'; $menu['about']['title']='About'; $menu['language']['title']='Language'; break; case 'es': $menu['guide']['title']='Guía'; $menu['instances']['title']='Instancias'; $menu['about']['title']='Info'; $menu['language']['title']='Idioma'; break; case 'fr': $menu['guide']['title']='Guide'; $menu['instances']['title']='Instances'; $menu['about']['title']='Infos'; $menu['language']['title']='Langue'; break; case 'it': $menu['guide']['title']='Guida'; $menu['instances']['title']='Istanze'; $menu['about']['title']='Info'; $menu['language']['title']='Lingua'; break; } $data=array( 'ca.home.atit'=>'Guia', 'ca.home.desc'=>'A thorough introduction to Mastodon', // needs translation 'ca.instances.atit'=>'Instàncies', 'ca.instances.desc'=>'Recommended Mastodon instances', // needs translation 'ca.about.atit'=>'Info', 'ca.about.desc'=>'Info about Mastodon Startpage’s authors, contributors, license', // needs translation 'en.home.atit'=>'Guide', 'en.home.desc'=>'A thorough introduction to Mastodon', 'en.instances.atit'=>'Instancias', 'en.instances.desc'=>'Recommended Mastodon instances', 'en.about.atit'=>'About', 'en.about.desc'=>'Info about Mastodon Startpage’s authors, contributors, license', 'es.home.atit'=>'Guide', 'es.home.desc'=>'A thorough introduction to Mastodon', // needs translation 'es.instances.atit'=>'Instances', 'es.instances.desc'=>'Recommended Mastodon instances', // needs translation 'es.about.atit'=>'Info', 'es.about.desc'=>'Info about Mastodon Startpage’s authors, contributors, license', // needs translation 'fr.home.atit'=>'Guía', 'fr.home.desc'=>'A thorough introduction to Mastodon', // needs translation 'fr.instances.atit'=>'Instances', 'fr.instances.desc'=>'Recommended Mastodon instances', // needs translation 'fr.about.atit'=>'Infos', 'fr.about.desc'=>'Info about Mastodon Startpage’s authors, contributors, license', // needs translation 'it.home.atit'=>'Guida', 'it.home.desc'=>'Una approfondita introduzione a Mastodon', 'it.instances.atit'=>'Istanze', 'it.instances.desc'=>'Istanze Mastodon consigliate', 'it.about.atit'=>'Info', 'it.about.desc'=>'Informazioni sugli autori, i collaboratori e la licenza di Mastodon Startpage' ); switch($path) { case '': $cont=array( 'fp'=>'home_'.$dlang.'.php', 'atit'=>' - '.$data[$dlang.'.home.atit'], 'desc'=>$data[$dlang.'.home.desc'], 'js'=>array('shsum','guideanchors','scrolltrack') ); $menu['guide']['liadd']='onclick="shsum()" onmouseover="this.style.cursor=\'pointer\'; this.style.textDecoration=\'underline\'" onmouseout="this.style.textDecoration=\'none\'"'; $menu['guide']['href']=null; $menu['guide']['selected']=true; break; case '/instances': $cont=array( 'fp'=>'instances_'.$dlang.'.php', 'atit'=>' - '.$data[$dlang.'.instances.atit'], 'desc'=>$data[$dlang.'.instances.desc'], 'js'=>array() ); $menu['instances']['href']=null; $menu['instances']['selected']=true; break; case '/about': $cont=array( 'fp'=>'about_'.$dlang.'.php', 'atit'=>' - '.$data[$dlang.'.about.atit'], 'desc'=>$data[$dlang.'.about.desc'], 'js'=>array() ); $menu['about']['href']=null; $menu['about']['selected']=true; break; default: $cont=array( 'fp'=>'404.php', 'atit'=>' - 404', 'desc'=>'Page not found', 'js'=>array() ); break; } /*