Compare commits
2 commits
443887dc10
...
97295fce69
Author | SHA1 | Date | |
---|---|---|---|
|
97295fce69 | ||
|
aea5136ef5 |
6 changed files with 52 additions and 2 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,2 +1,6 @@
|
||||||
|
# host (replit)
|
||||||
*replit*
|
*replit*
|
||||||
|
.cache
|
||||||
|
|
||||||
|
# sts data to not git
|
||||||
data/index
|
data/index
|
6
PHP.ini
Normal file
6
PHP.ini
Normal file
|
@ -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
|
8
data/xml/default.flags.xml
Normal file
8
data/xml/default.flags.xml
Normal file
|
@ -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>
|
24
index.php
24
index.php
|
@ -1,13 +1,14 @@
|
||||||
<?php
|
<?php
|
||||||
|
libxml_use_internal_errors(true);
|
||||||
// load config
|
// load config
|
||||||
$cfg=parse_ini_file("serve.ini", true);
|
$cfg=parse_ini_file("serve.ini", true);
|
||||||
|
|
||||||
// load locale
|
// load locale
|
||||||
#$lang=locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
#$lang=locale_accept_from_http($_SERVER['HTTP_ACCEPT_LANGUAGE']);
|
||||||
|
|
||||||
$lang="en_US";
|
$lang="en_US";
|
||||||
$strings=parse_ini_file("data/locale/".$lang."/strings/main.ini");
|
$strings=parse_ini_file("data/locale/".$lang."/strings/main.ini");
|
||||||
|
|
||||||
|
|
||||||
// cookies
|
// cookies
|
||||||
if(!isset($_COOKIE['sts_theme'])){
|
if(!isset($_COOKIE['sts_theme'])){
|
||||||
setcookie('sts_theme','default');
|
setcookie('sts_theme','default');
|
||||||
|
@ -17,6 +18,22 @@
|
||||||
setcookie('sts_scripting','none');
|
setcookie('sts_scripting','none');
|
||||||
$_COOKIE['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>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
@ -33,11 +50,14 @@
|
||||||
?>
|
?>
|
||||||
<?php
|
<?php
|
||||||
echo "<div class=\"searchbox\"><form id=\"searchbox\">\n";
|
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 "<input type=\"submit\" value=\"".$strings['interactions_basic_search']."\">\n";
|
||||||
echo "</form></div>"
|
echo "</form></div>"
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<iframe style="position:absolute;bottom:30px;right:10px;" src="dynamicGen.php?content=aboutserver" width="376" height="276"></iframe>
|
<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>
|
</body>
|
||||||
</html>
|
</html>
|
0
search.php
Normal file
0
search.php
Normal file
12
src/validateSTSXML.php
Normal file
12
src/validateSTSXML.php
Normal file
|
@ -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…
Reference in a new issue