Initial commit
This commit is contained in:
commit
6b5a84dfa4
33 changed files with 1535 additions and 0 deletions
45
index.php
Executable file
45
index.php
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
//Get parameters
|
||||
$parameters = $_SERVER['REQUEST_URI'];
|
||||
$regex = '/^\/winapp\/((\w{2})\/)?([\w-]+)\/(\d{4})\/?$/m';
|
||||
preg_match_all($regex, $parameters, $matches, PREG_SET_ORDER, 0);
|
||||
|
||||
$isOK = true;
|
||||
|
||||
if (sizeof($matches) === 1 && sizeof($matches[0]) === 5) {
|
||||
//Init parameters
|
||||
$lang = $matches[0][2];
|
||||
$product = $matches[0][3];
|
||||
$year = $matches[0][4];
|
||||
|
||||
$acceptLang = ['bg', 'cs', 'da', 'de', 'el', 'en', 'es', 'et', 'fi', 'fr',
|
||||
'ga', 'hr', 'hu', 'it', 'lt', 'lv', 'mt', 'pl', 'ro', 'sk',
|
||||
'sl', 'sv'];
|
||||
|
||||
if ($lang != null) {
|
||||
$isOK = in_array($lang, $acceptLang);
|
||||
} else {
|
||||
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
|
||||
}
|
||||
|
||||
if ($isOK) {
|
||||
require 'core/core.php';
|
||||
$lang = in_array($lang, $acceptLang) ? $lang : 'en';
|
||||
$isOK = file_exists(dirname(__FILE__) . "/" . $data_path);
|
||||
}
|
||||
} else {
|
||||
$isOK = false;
|
||||
}
|
||||
|
||||
if (!$isOK) {
|
||||
http_response_code(404);
|
||||
require '404.html';
|
||||
} else {
|
||||
require 'core/layout.php';
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue