Пример #1
0
function lang_detect()
{
    if ($language = session::get_value('LANGUAGE')) {
        if (lang_set($language)) {
            return $language;
        }
    }
    $languages = array();
    if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
        $accepted = preg_split('/,\\s*/', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
        foreach ($accepted as $accept) {
            $matches_array = array();
            if (!preg_match('/^([a-z]{1,8}(?:[-_][a-z]{1,8})*)(?:;\\s*q=(0(?:\\.[0-9]{1,3})?|1(?:\\.0{1,3})?))?$/i', $accept, $matches_array)) {
                continue;
            }
            $quality = isset($matches_array[2]) ? (double) $matches_array[2] : 1.0;
            $countries = explode('-', $matches_array[1]);
            $region = array_shift($countries);
            $countries2 = explode('_', $region);
            $region = array_shift($countries2);
            foreach ($countries as $country) {
                $languages[$region . '_' . mb_strtoupper($country)] = $quality;
            }
            foreach ($countries2 as $country) {
                $languages[$region . '_' . mb_strtoupper($country)] = $quality;
            }
            if (!isset($languages[$region]) || $languages[$region] < $quality) {
                $languages[$region] = $quality;
            }
        }
    }
    foreach (array_keys($languages) as $language) {
        if (lang_set($language)) {
            return $language;
        }
    }
    return lang_set('en_GB');
}
Пример #2
0
                                     break;
                                 case 4:
                                     $output .= "<h1><font class=\"error\">{$lang_edit['error_updating']}</font></h1>";
                                     break;
                                 default:
                                     //no error
                                     $output .= "<h1>Credits Panel</h1>";
                             }
                             $output .= "</div>";
                             $action = isset($_GET['action']) ? $_GET['action'] : NULL;
                             switch ($action) {
                                 case "doedit_user":
                                     doedit_user();
                                     break;
                                 case "lang_set":
                                     lang_set();
                                     break;
                                 case "template_set":
                                     template_set();
                                     break;
                                 default:
                                     edit_user();
                             }
                             require_once "footer.php";
                         }
                     }
                 }
             }
         }
     }
 }
Пример #3
0
<?php

if (!defined('PHPHOTPIC')) {
    exit('Access Denied');
}
?>
<div id="head">
<?php 
echo lang_set();
?>
<h1><?php 
echo $base['lang']['head_head'];
?>
</h1><?php 
echo $base['lang']['head_detail'];
?>
</div>