Compare commits
No commits in common. "aaa9eb154cc095e0b860b73e00eb9e0a488e57b3" and "0b6425dd02fb50e15b4cc7b2622722b3a561e82d" have entirely different histories.
aaa9eb154c
...
0b6425dd02
21 changed files with 69 additions and 293 deletions
|
@ -2,18 +2,6 @@ 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;
|
||||
}
|
||||
|
|
5
data/locale/en_US/strings/aboutpage.ini
Normal file
5
data/locale/en_US/strings/aboutpage.ini
Normal file
|
@ -0,0 +1,5 @@
|
|||
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,20 +1,15 @@
|
|||
interactions_adv_aboutx = "About $"
|
||||
interactions_basic_about = "About"
|
||||
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_search = "Search"
|
||||
interactions_basic_yes = "Yes"
|
||||
interactions_choose_tp_acceptnew = "Accept"
|
||||
interactions_basic_search = "Search"
|
||||
interactions_basic_about = "About"
|
||||
interactions_adv_aboutx = "About $"
|
||||
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"
|
3
data/locale/en_US/strings/search.ini
Normal file
3
data/locale/en_US/strings/search.ini
Normal file
|
@ -0,0 +1,3 @@
|
|||
results_found = "found $ results"
|
||||
results_foundonlyone = "found 1 result"
|
||||
results_none = "no results found"
|
1
data/locale/en_US/strings/theme.ini
Normal file
1
data/locale/en_US/strings/theme.ini
Normal file
|
@ -0,0 +1 @@
|
|||
interactions_choose_tp_acceptnew = "Accept"
|
|
@ -1 +0,0 @@
|
|||
/^w3m/
|
|
@ -1,7 +1,6 @@
|
|||
<?php require 'src/loadEnv.php';
|
||||
<?php
|
||||
if(!$_GET && !$_POST){
|
||||
http_response_code(400);
|
||||
include 'src/debug/dumpSuperGlobals.php';
|
||||
die;
|
||||
}
|
||||
if($_GET['content']=='aboutserver'){
|
||||
|
@ -13,7 +12,5 @@
|
|||
echo $out;
|
||||
echo '</body></html>';
|
||||
die;
|
||||
}else{
|
||||
include 'src/debug/dumpSuperGlobals.php';
|
||||
}
|
||||
?>
|
56
index.php
56
index.php
|
@ -1,5 +1,40 @@
|
|||
<?php require 'src/loadEnv.php';?>
|
||||
<!--<?php $_SERVER['HTTP_USER_AGET'];?>-->
|
||||
<?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']));
|
||||
}
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<title><?php echo $cfg['META']['name']; ?></title>
|
||||
|
@ -11,11 +46,18 @@
|
|||
</head>
|
||||
<body>
|
||||
<?php
|
||||
if ($_GET['fpage']==="text"){
|
||||
require 'src/pages/text/index.php';
|
||||
}else{
|
||||
require 'src/pages/modern/index.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\" 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
|
@ -1,52 +0,0 @@
|
|||
<?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>
|
|
@ -1,118 +0,0 @@
|
|||
<table>
|
||||
<tr>
|
||||
<th>Key</th>
|
||||
<th>Type</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
<?php
|
||||
$femboysAreCute=true;
|
||||
$_SERVER;$_REQUEST;$_SESSION;$_ENV;
|
||||
function calcRows($str){
|
||||
return preg_match_all("/\n/",$str)+1;
|
||||
}
|
||||
function calcCols($str){
|
||||
$cur=0;
|
||||
$top=0;
|
||||
|
||||
foreach(mb_str_split($str) as $char){
|
||||
if ($char=="\n"){
|
||||
$cur=0;
|
||||
}else{
|
||||
$cur++;
|
||||
if ($cur>=$top){
|
||||
$top=$cur;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $top;
|
||||
}
|
||||
function row($k,$v){
|
||||
// echo "<!--\trow() called!\t\$k:\t$k\t\t\$v:\t$v\t-->\n";
|
||||
echo "<tr>\n";
|
||||
echo "\t<td>$k</td>\n";
|
||||
echo sprintf("\t<td>%s</td>\n",gettype($v));
|
||||
echo "\t<td>";
|
||||
if (gettype($v)=="string"){
|
||||
echo "<textarea rows=\"".calcRows($v)."\" cols=\"".calcCols($v)."\" readonly=\"true\">$v</textarea>";
|
||||
}elseif (gettype($v)=="array"){
|
||||
echo "";
|
||||
}elseif (gettype($v)=="boolean"){
|
||||
echo "<font style=\"color:";
|
||||
if ($v){
|
||||
echo "green\">True";
|
||||
}else{
|
||||
echo "red\">False";
|
||||
}
|
||||
echo "</font>";
|
||||
}else{
|
||||
echo $v;
|
||||
}
|
||||
echo "</td>\n</tr>\n";
|
||||
}
|
||||
function loop($kn,$a){
|
||||
// echo "<!--\tloop() called!\t\$kn:\t$kn\t\t\$a:\t$a\t-->\n";
|
||||
foreach ($a as $key => $val) {
|
||||
// echo "<!--\tforeach() called!\t\$key:\t$key\t\t\t\$val:\t$val\t-->\n";
|
||||
if($key!="GLOBALS"){
|
||||
row($kn."/$".$key,$val);
|
||||
if(gettype($val)=="array"){
|
||||
loop($kn."/\$".$key,$val);
|
||||
}
|
||||
}else{
|
||||
echo "";
|
||||
}
|
||||
}
|
||||
}
|
||||
loop("\$GLOBALS",$GLOBALS);
|
||||
// foreach ($_SERVER as $key => $val) {
|
||||
// echo "\t<tr>";
|
||||
// echo $b."\$_SERVER".$c."td>";
|
||||
// echo $b.$key.$c."td>";
|
||||
// echo $b.$val.$c."td>\n";
|
||||
// echo "\t".$c."tr>\n";
|
||||
// }
|
||||
// foreach ($_GET as $key => $val) {
|
||||
// echo "\t<tr>";
|
||||
// echo $b."\$_GET".$c."td>";
|
||||
// echo $b.$key.$c."td>";
|
||||
// echo $b.$val.$c."td>\n";
|
||||
// echo "\t".$c."tr>\n";
|
||||
// }
|
||||
// foreach ($_POST as $key => $val) {
|
||||
// echo "\t<tr>";
|
||||
// echo $b."\$_POST".$c."td>";
|
||||
// echo $b.$key.$c."td>";
|
||||
// echo $b.$val.$c."td>\n";
|
||||
// echo "\t".$c."tr>\n";
|
||||
// }
|
||||
// foreach ($_FILES as $key => $val) {
|
||||
// echo "\t<tr>";
|
||||
// echo $b."\$_FILES".$c."td>";
|
||||
// echo $b.$key.$c."td>";
|
||||
// echo $b.$val.$c."td>\n";
|
||||
// echo "\t".$c."tr>\n";
|
||||
// }
|
||||
// foreach ($_COOKIE as $key => $val) {
|
||||
// echo "\t<tr>";
|
||||
// echo $b."\$_COOKIE".$c."td>";
|
||||
// echo $b.$key.$c."td>";
|
||||
// echo $b.$val.$c."td>\n";
|
||||
// echo "\t".$c."tr>\n";
|
||||
// }
|
||||
// foreach ($_REQUEST as $key => $val) {
|
||||
// echo "\t<tr>";
|
||||
// echo $b."\$_REQUEST".$c."td>";
|
||||
// echo $b.$key.$c."td>";
|
||||
// echo $b.$val.$c."td>\n";
|
||||
// echo "\t".$c."tr>\n";
|
||||
// }
|
||||
// foreach ($_ENV as $key => $val) {
|
||||
// echo "\t<tr>";
|
||||
// echo $b."\$_ENV".$c."td>";
|
||||
// echo $b.$key.$c."td>";
|
||||
// echo $b.$val.$c."td>\n";
|
||||
// echo "\t".$c."tr>\n";
|
||||
// }
|
||||
?>
|
||||
</table>
|
|
@ -1,5 +0,0 @@
|
|||
<?php
|
||||
function &parseUserAgent(ua_string): ?string {
|
||||
|
||||
}
|
||||
?>
|
|
@ -1,40 +0,0 @@
|
|||
<?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');
|
||||
}
|
||||
?>
|
|
@ -1,8 +1,3 @@
|
|||
# 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>)'
|
||||
<?php
|
||||
function &genAbout($language): ?string{
|
||||
$strings=array_merge(
|
|
@ -1,15 +0,0 @@
|
|||
<?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>
|
|
@ -1,9 +0,0 @@
|
|||
<hr>
|
||||
<footer>
|
||||
<div class="footer left">
|
||||
|
||||
</div>
|
||||
<div class="footer right">
|
||||
|
||||
</div>
|
||||
</footer>
|
|
@ -1,9 +0,0 @@
|
|||
<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 +0,0 @@
|
|||
<?php include 'header.php'; ?>
|
Loading…
Reference in a new issue