sts/index.php

63 lines
2.4 KiB
PHP
Raw Normal View History

2023-01-27 00:08:50 +01:00
<?php
2023-01-30 19:33:10 +01:00
libxml_use_internal_errors(true);
2023-01-27 00:08:50 +01:00
// 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."/strings/main.ini");
2023-01-30 19:33:10 +01:00
2023-01-27 00:08:50 +01:00
// 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';
}
2023-01-30 19:33:10 +01:00
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']));
}
2023-01-27 00:08:50 +01:00
?>
2023-01-26 19:09:07 +01:00
<html>
<head>
2023-01-27 00:08:50 +01:00
<title><?php echo $cfg['META']['name']; ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php
echo "<link rel=\"stylesheet\" href=\"assets/themes/".$_COOKIE['sts_theme']."/main.css\">";
echo "<link rel=\"stylesheet\" href=\"assets/themes/".$_COOKIE['sts_theme']."/index.css\">";
?>
2023-01-26 19:09:07 +01:00
</head>
<body>
2023-01-27 00:08:50 +01:00
<?php
echo "<h1 title=\"".$strings['misc_stslogohover']."\">".file_get_contents("data/misc/icon/html.html")."</h1><br>";
?>
<?php
echo "<div class=\"searchbox\"><form id=\"searchbox\">\n";
2023-01-30 19:33:10 +01:00
echo "<input class=\"sbox\" type=\"".$_COOKIE['sts_flags']['index']['sbox_type']."\" placeholder=\"".$strings['interactions_searcharea_hint']."\" name=\"query\">";
2023-01-27 00:08:50 +01:00
echo "<input type=\"submit\" value=\"".$strings['interactions_basic_search']."\">\n";
echo "</form></div>"
?>
<iframe style="position:absolute;bottom:30px;right:10px;" src="dynamicGen.php?content=aboutserver" width="376" height="276"></iframe>
2023-01-30 19:33:10 +01:00
<div class="footer">
<div class="footeri right">
<a
2023-01-26 19:09:07 +01:00
</body>
</html>