some stuff :3
adding support for text / terminal browsers redone some strings
This commit is contained in:
parent
97295fce69
commit
b201dbfc75
17 changed files with 169 additions and 73 deletions
0
about.php
Normal file
0
about.php
Normal file
|
@ -2,6 +2,18 @@ body {
|
|||
background-color: #262631;
|
||||
color: white;
|
||||
}
|
||||
div.header{
|
||||
top: 0%;
|
||||
}
|
||||
div.header.left{
|
||||
left: 0%;
|
||||
}
|
||||
div.header.right{
|
||||
right: 0%;
|
||||
}
|
||||
hr{
|
||||
width: 100%;
|
||||
}
|
||||
a:link {
|
||||
color: cyan;
|
||||
}
|
||||
|
|
0
assets/themes/default/search.css
Normal file
0
assets/themes/default/search.css
Normal file
25
data/locale/en_US.ini
Normal file
25
data/locale/en_US.ini
Normal file
|
@ -0,0 +1,25 @@
|
|||
aboutpage_a = '<hr><a href="%s">%s</a>: %s'
|
||||
aboutpage_b = 'running v%s'
|
||||
aboutpage_ca = 'if there are problems with this page or any other page, contact'
|
||||
aboutpage_cb = 'if there are problems with this page or any other page, contact either'
|
||||
aboutpage_d = ' %s (<a href="mailto:%s">email</a>)'
|
||||
interactions_adv_aboutx = "About $"
|
||||
interactions_basic_about = "About"
|
||||
interactions_basic_cancel = "Cancel"
|
||||
interactions_basic_no = "No"
|
||||
interactions_basic_okay = "OK"
|
||||
interactions_basic_search = "Search"
|
||||
interactions_basic_yes = "Yes"
|
||||
interactions_choose_tp_acceptnew = "Accept"
|
||||
interactions_searcharea_hint = "Search query"
|
||||
locale_en_native = "English"
|
||||
locale_en_this = "English"
|
||||
meta_project_desc = "a super lightweight and privacy-centered search engine!"
|
||||
meta_project_name = "super tiny search"
|
||||
misc_stslogohover = "sts logo"
|
||||
region_br = "Brazil"
|
||||
region_ca = "Canada"
|
||||
region_us = "United States"
|
||||
results_found = "found %n results"
|
||||
results_foundonlyone = "found 1 result"
|
||||
results_none = "no results found"
|
|
@ -1,5 +0,0 @@
|
|||
a = '<hr><a href="%s">%s</a>: %s'
|
||||
b = 'running v%s'
|
||||
ca = 'if there are problems with this page or any other page, contact'
|
||||
cb = 'if there are problems with this page or any other page, contact either'
|
||||
d = ' %s (<a href="mailto:%s">email</a>)'
|
|
@ -1,15 +0,0 @@
|
|||
locale_en_native = "English"
|
||||
locale_en_this = "English"
|
||||
region_us_native = "United States"
|
||||
region_us_this = "United States"
|
||||
misc_stslogohover = "sts logo"
|
||||
meta_project_name = "super tiny search"
|
||||
meta_project_desc = "a super lightweight and privacy-centered search engine!"
|
||||
interactions_basic_cancel = "Cancel"
|
||||
interactions_basic_no = "No"
|
||||
interactions_basic_okay = "OK"
|
||||
interactions_basic_yes = "Yes"
|
||||
interactions_basic_search = "Search"
|
||||
interactions_basic_about = "About"
|
||||
interactions_adv_aboutx = "About $"
|
||||
interactions_searcharea_hint = "Search query"
|
|
@ -1,3 +0,0 @@
|
|||
results_found = "found $ results"
|
||||
results_foundonlyone = "found 1 result"
|
||||
results_none = "no results found"
|
|
@ -1 +0,0 @@
|
|||
interactions_choose_tp_acceptnew = "Accept"
|
55
index.php
55
index.php
|
@ -1,40 +1,4 @@
|
|||
<?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');
|
||||
$_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']));
|
||||
}
|
||||
?>
|
||||
<?php require 'src/loadEnv.php';?>-
|
||||
<html>
|
||||
<head>
|
||||
<title><?php echo $cfg['META']['name']; ?></title>
|
||||
|
@ -46,18 +10,11 @@
|
|||
</head>
|
||||
<body>
|
||||
<?php
|
||||
echo "<h1 title=\"".$strings['misc_stslogohover']."\">".file_get_contents("data/misc/icon/html.html")."</h1><br>";
|
||||
if ($_GET['fpage']==="text"){
|
||||
require 'src/pages/text/index.php';
|
||||
}else{
|
||||
require 'src/pages/modern/index.php';
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
echo "<div class=\"searchbox\"><form id=\"searchbox\">\n";
|
||||
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>
|
52
search.php
52
search.php
|
@ -0,0 +1,52 @@
|
|||
<?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=array_merge(
|
||||
parse_ini_file("data/locale/".$lang."/strings/main.ini"),
|
||||
parse_ini_file("data/locale/".$lang."/strings/search.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');
|
||||
}
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title><?php echo sprintf('%s - %s',$_GET['query'],$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']."/search.css\">";
|
||||
?>
|
||||
</head>
|
||||
</html>
|
40
src/loadEnv.php
Normal file
40
src/loadEnv.php
Normal file
|
@ -0,0 +1,40 @@
|
|||
<?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');
|
||||
}
|
||||
?>
|
15
src/pages/modern/index.php
Normal file
15
src/pages/modern/index.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?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";
|
||||
echo "<input class=\"sbox\" type=\"".$_COOKIE['sts_flags']['index']['sbox_type']."\" placeholder=\"".$strings['interactions_searcharea_hint']."\" name=\"query\">";
|
||||
echo "<input type=\"submit\" action=\"search.php\" formmethod=\"get\" 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">
|
||||
</div>
|
||||
</div>
|
0
src/pages/text/about.php
Normal file
0
src/pages/text/about.php
Normal file
9
src/pages/text/footer.php
Normal file
9
src/pages/text/footer.php
Normal file
|
@ -0,0 +1,9 @@
|
|||
<hr>
|
||||
<footer>
|
||||
<div class="footer left">
|
||||
|
||||
</div>
|
||||
<div class="footer right">
|
||||
|
||||
</div>
|
||||
</footer>
|
9
src/pages/text/header.php
Normal file
9
src/pages/text/header.php
Normal file
|
@ -0,0 +1,9 @@
|
|||
<header>
|
||||
<div class="header left">
|
||||
<a href="index.php">[sts]</a>
|
||||
</div>
|
||||
<div class="header right">
|
||||
<a href="about.php">About</a>
|
||||
</div>
|
||||
</header>
|
||||
<hr>
|
1
src/pages/text/index.php
Normal file
1
src/pages/text/index.php
Normal file
|
@ -0,0 +1 @@
|
|||
<?php include 'header.php'; ?>
|
Loading…
Reference in a new issue