$value) {
$fcontents = str_replace($key,$value,$fcontents);
}
return ($fcontents);
}
function langcheck(&$lang,$arrl = NULL)
{
GLOBAL $_SERVER;
GLOBAL $G_main_langs;
/* se non specificato assegna il default */
if ($arrl == NULL)
$arrl = $G_main_langs;
/* cerca il valore della var $lang nell'array */
$ct = count($arrl);
for ($i = 0 ; $i < $ct ; $i++) {
if ($lang == $arrl[$i]) {
if ($i == 0)
return("");
else
return ("_".$lang);
}
}
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$langs = array();
// break up string into pieces (languages and q factors)
preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $lang_parse);
if (count($lang_parse[1])) {
// create a list like "en" => 0.8
$langs = array_combine($lang_parse[1], $lang_parse[4]);
// set default to 1 for any without q factor
foreach ($langs as $lang => $val) {
if ($val === '') $langs[$lang] = 1;
}
// sort list based on value
arsort($langs, SORT_NUMERIC);
foreach ($langs as $lang_cur => $val) {
for ($i = 0 ; $i < $ct ; $i++) {
if (strpos($lang_cur, $arrl[$i]) === 0) {
if ($i == 0)
return(""); /* caso default */
else
return ("_".$arrl[$i]);
}
}
}
}
}
$lang = "";
return ("");
}
function main()
{
GLOBAL $lang;
$lng = langcheck($lang, array("it", "en"));
$nazio = ' ';
$nazio .= '';
$tmpl_page = '
#PAGE_TITLE#
ThreeGates Example
#TITLE#
#NAZIO#
Attendere prego ...
';
$tmpl_page_tit = array ( 'it' => 'Brisk: auto-garanzia',
'en' => 'Brisk: self-guarantee' );
$tmpl_title = array ( 'it' => 'Procedura di auto-garanzia.',
'en' => 'Self-guarantee procedure.' );
$tmpl_hili = array ( 'it' => 'briscola chiamata in salsa ajax',
'en' => 'declaration briscola in ajax sauce' );
$resp_retry = array ( 'it' => 'La lista dei certificati di revoca (CRL) indicata nel suo certificato non era tra quelle monitorate dal server; è stata aggiunta ed entro qualche minuto verrà processata.
Riprovi più tardi.',
'en' => 'The certificate revocation list (CRL) specified by your smartcard wasn\'t monitored by the server; it is added and will be processed within a few minutes.
Retry later.' );
$resp_false = array ( 'it' => 'Spiacenti, non siamo in possesso delle informazioni necessarie alla verifica del suo certificato.
Se vuole segnalare il tipo di certificato che sta usando Contatti l\'amministratore.',
'en' => 'Sorry, we haven\'t the required information to verify your certificate. If you want to report your certificate\'s type please contact the administrator.' );
$resp_error = array ( 'it' => 'Spiacenti, non siamo in possesso delle informazioni necessarie alla verifica del suo certificato o è occorso un errore sul server.
Se vuole segnalare il tipo di certificato che sta usando Contatti l\'amministratore. ',
'en' => 'Sorry, we haven\'t the information needed to verify your certificate or an error occured on the server.
If you want to report your certificate\'s type please contact the administrator.' );
$page_vars = array(
'#PAGE_TITLE#' => $tmpl_page_tit[$lang],
'#HILI#' => $tmpl_hili[$lang],
'#TITLE#' => $tmpl_title[$lang],
'#LANG#' => $lang,
'#NAZIO#' => $nazio,
'#RESP_RETRY#' => $resp_retry[$lang],
'#RESP_FALSE#' => $resp_false[$lang],
'#RESP_ERROR#' => $resp_error[$lang]
);
echo stemplala($tmpl_page, $page_vars);
}
main();
?>