yayy new stuffs

master
whotookelburg 1 year ago
parent 443887dc10
commit aea5136ef5

@ -0,0 +1,6 @@
display_errors = "stderr"
display_startup_errors = true
html_errors = true
error_reporting = 'E_ALL'
zlib.output_compression = 1
zlib.output_compression_level = 9

@ -0,0 +1,8 @@
<?xml version='1.0' encoding='UTF-8'?>
<flags>
<any>
<sbox>
<input_type valid="text;search;" default="text">text</input_type>
</sbox>
</any>
</flags>

@ -1,13 +1,14 @@
<?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."/strings/main.ini");
// cookies
if(!isset($_COOKIE['sts_theme'])){
setcookie('sts_theme','default');
@ -17,6 +18,22 @@
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']));
}
?>
<html>
<head>
@ -33,11 +50,14 @@
?>
<?php
echo "<div class=\"searchbox\"><form id=\"searchbox\">\n";
echo "<input class=\"sbox\" type=\"text\" placeholder=\"".$strings['interactions_searcharea_hint']."\" name=\"query\">";
echo "<input class=\"sbox\" type=\"".$_COOKIE['sts_flags']['index']['sbox_type']."\" placeholder=\"".$strings['interactions_searcharea_hint']."\" name=\"query\">";
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>
<div class="footer">
<div class="footeri right">
<a
</body>
</html>

@ -0,0 +1,12 @@
<?php
libxml_use_internal_errors(true);
function validateXML($xmlstr,$type): bool{
if($type=="flags"){
$_xml=simplexml_load_string($xmlstr);
if($_xml===false){
return false;
}
return true;
}
}
?>
Loading…
Cancel
Save