} $mimeTypes[$key] = $ftype['mimeType']; }); // If bookmarklet conversion, then refresh page to initialize session cookie if (isset($_POST['bookmarklet']) || isset($_SESSION['bookmarklet'])) { if (!isset($_SESSION['bookmarklet'])) { $_SESSION['bookmarklet'] = $_POST; header('Location: http://' . $_SERVER['HTTP_HOST'] . Config::_APPROOT); } else { $_POST = $_SESSION['bookmarklet']; unset($_SESSION['bookmarklet']); } } // On download of converted file if (isset($_GET['output'])) { $converter->DownloadConvertedFile($_GET['output'], Config::_CONVERTED_FILEDIR); } // Initiate conversion with GET rather than POST if (isset($_GET['url']) && !empty($_GET['url']) || isset($_GET['vidID']) && !empty($_GET['vidID']) && isset($_GET['vidHost']) && !empty($_GET['vidHost'])) { $_POST['submitForm'] = 1; if (isset($_GET['url'])) { $urlInQueryString = urldecode(trim($_GET['url'])); foreach ($videoHosts as $host) { $urlRootPattern = array(); array_walk($host['url_root'], function ($urlRoot) use(&$urlRootPattern, $host) { $rootUrlPattern = preg_replace('/#wildcard#/', "[^\\\\/]+", preg_quote($urlRoot, '/')); $urlRootPattern[] = $host['allow_https_urls'] ? preg_replace('/^(http)/', "https?", $rootUrlPattern) : $rootUrlPattern; }); if (preg_match('/^((' . implode("|", $urlRootPattern) . ')([^\\?]{1}.*))$/i', $urlInQueryString, $qsMatches) == 1) { $_GET['vidHost'] = strtolower($host['name']); $_GET['vidID'] = trim(preg_replace('/(\\?.+)$/', "", $qsMatches[3]), '/');
$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 $converter = new VideoConverter(); $vidHosts = array_values($converter->GetVideoHosts()); $ftypes = $converter->GetConvertedFileTypes(); // On download of edited file if (isset($_GET['dload'])) { $converter->DownloadConvertedFile($_GET['dload'], Config::_EDITED_CONVERTED_FILEDIR); } // Determine jPlayer media type $mediaType = $fileExt = 'mp3'; $mediaTypeArr = array($mediaType); $avFormat = 'audio'; $solutionOrder = 'html, flash'; $enableMetadataEditor = false; if (isset($_GET['vid_name'])) { $fileExt = end(explode(".", $_GET['vid_name'])); foreach ($ftypes as $ftype) { if ($ftype['fileExt'] == $fileExt) { $mediaType = $ftype['jPlayerName']; $mediaTypeArr = explode(",", $mediaType); $avFormat = current(explode("/", $ftype['mimeType'])); $solutionOrder = isset($ftype['jPlayerSolutionOrder']) ? $ftype['jPlayerSolutionOrder'] : $solutionOrder;