You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.3 KiB
PHP
40 lines
1.3 KiB
PHP
<?php
|
|
libxml_use_internal_errors(true);
|
|
// load config
|
|
$cfg=parse_ini_file("serve.ini", true);
|
|
|
|
// load locale
|
|
#$lang=locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
|
$lang="en_US";
|
|
$strings=parse_ini_file("data/locale/".$lang.".ini");
|
|
|
|
|
|
// cookies
|
|
if(!isset($_COOKIE['sts_theme'])){
|
|
setcookie('sts_theme','default');
|
|
$_COOKIE['sts_theme'] = 'default';
|
|
}
|
|
if(!isset($_COOKIE['sts_scripting'])){
|
|
setcookie('sts_scripting','none');
|
|
$_COOKIE['sts_scripting'] = 'none';
|
|
}
|
|
if(!isset($_COOKIE['sts_flags'])){
|
|
setcookie('sts_flags',file_get_contents('data/xml/default.flags.xml'));
|
|
$_COOKIE['sts_flags'] = simplexml_load_file('data/xml/default.flags.xml') or die('failed loading an xml file!');
|
|
}else{
|
|
$_COOKIE['sts_flags'] = simplexml_load_string($_COOKIE['sts_flags']);
|
|
}
|
|
|
|
if ($_COOKIE['sts_flags'] === false) {
|
|
http_response_code(500);
|
|
header('Content-Type: text/plain; charset=utf-8');
|
|
echo "An error occured within superTinySearch!\n\nWhat happened:\tfailed to parse cookie 'sts_flags'!\n\nAdditional info:\n";
|
|
foreach(libxml_get_errors() as $error) {
|
|
echo "\n\t", $error->message;
|
|
}
|
|
die(sprintf("\n\ncontact %s @ %s",$cfg['MAINTAINERS_0']['name'],$cfg['MAINTAINERS_0']['email']));
|
|
}else{
|
|
require 'src/validateSTSXML.php';
|
|
validateXML($_COOKIE['sts_flags'],'flags');
|
|
}
|
|
?>
|