コード例 #1
0
ファイル: index.php プロジェクト: sahartak/youtube
if (!empty(Config::$_authorizedDomains)) {
    array_walk(Config::$_authorizedDomains, function (&$domain) {
        $domain = strtolower($domain);
    });
    if (!in_array(strtolower($_SERVER['HTTP_HOST']), Config::$_authorizedDomains)) {
        die("This domain is not authorized to access this software!<br /><br />(Did you forget to add your domains/subdomains to the \$_authorizedDomains array in the configuration class file?)");
    }
}
// Configure localization
$countryCode = !isset($_GET['ccode']) ? !isset($_SESSION['ccode']) ? Config::_DEFAULT_COUNTRY : $_SESSION['ccode'] : trim($_GET['ccode']);
if (!isset($_SESSION['langs']) || !isset($_SESSION['translations']) || !isset($_SESSION['missingTranslations']) || !isset($_SESSION['ccode']) || $_SESSION['ccode'] != $countryCode) {
    $localize = new Localize($countryCode);
    $_SESSION['ccode'] = $countryCode;
    $_SESSION['langs'] = $localize->GetLocalizationInfo();
    $_SESSION['translations'] = $localize->GetTranslations();
    $_SESSION['missingTranslations'] = $localize->GetMissingTranslations();
}
foreach ($_SESSION['translations'] as $constant => $value) {
    $value = isset($_SESSION['missingTranslations'][$constant]) && $_SESSION['langs'][$_SESSION['ccode']]['direction'] == 'rtl' ? '<span dir="' . Localize::_FALLBACK_DIRECTION . '">' . $value . '</span>' : $value;
    define($constant, $value);
}
// If localization just changed, urldecode everything in $_GET that was encoded by http_build_query()
if (isset($_GET['ccode'])) {
    foreach ($_GET as $k => $v) {
        $_GET[$k] = urldecode($v);
    }
}
// Instantiate converter class and populate vars/arrays
$converter = new VideoConverter();
$videoHosts = $converter->GetVideoHosts();
$uniqueFtypes = $ftypes = $converter->GetConvertedFileTypes();