0) { while ($path[strlen($path)-1]=='/') { $path=substr($path,0,-1); if (strlen($path)<1) break; } } //echo($_SERVER['HTTP_ACCEPT_LANGUAGE']);die(); $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\'" style="border-radius:0 0 5px 5px;"', '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']='Acerca de'; $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 Help’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 Help’s authors, contributors, license', 'es.home.atit'=>'Guía', 'es.home.desc'=>'Una introducción exhaustiva a Mastodon', 'es.instances.atit'=>'Instancias', 'es.instances.desc'=>'Instancias de Mastodon recomendadas', 'es.about.atit'=>'Acerca de', 'es.about.desc'=>'Informaciones sobre l@s autores y autoras de la página de inicio de Mastodon y su licencia', 'fr.home.atit'=>'Guide', 'fr.home.desc'=>'Une introduction approfondie à Mastodon', 'fr.instances.atit'=>'Instances', 'fr.instances.desc'=>'Instances Mastodon recommandées', 'fr.about.atit'=>'Infos', 'fr.about.desc'=>'Infos sur l‘auteur de Mastodon Help, contributeurs, licence', '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 Help' ); 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: http_response_code(404); $cont=array( 'fp'=>'404.php', 'atit'=>' - 404', 'desc'=>'Page not found', 'js'=>array() ); break; } /*
  • Guide
  • Instances
  • About us
  • Language
  • */ $menuout=''; function buildmenu($menu) { global $menuout; foreach ($menu as $key=>$arr) { $menuout.=''.$arr['title'].''; else $menuout.=$arr['title']; if (!is_null($arr['submenu'])) { // qui bisognerebbe aggiungere che a seconda del "livello" imposta class giusta: ula, oppure ulb per livello > 1 $menuout.=N.''.N; } $menuout.=''.N; } } buildmenu($menu); //echo(htmlentities($menuout)); $cjrand=rand(0,999999); ?> Mastodon Help<?php echo($cont['atit']); ?> '.N); ?>