Updating a lot of stuff

Took 2 hours 31 minutes
This commit is contained in:
Tobias Hopp 2020-08-05 21:41:48 +02:00
parent 74d64f93ba
commit 5ca301ea18
36 changed files with 220 additions and 24 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/vendor/images/background.xcf

View File

@ -6,9 +6,20 @@ require_once 'main.inc.php';
try
{
// Better Cache-Control
$etag = filesize( LANG_DIRECTORY . language::$lang . '.ini' ) + filesize( 'website.html' ) . filesize( 'website.class.inc.php' );
header( 'Cache-Control: max-age=86400' );
header( 'ETag: ' . $etag );
if( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && $_SERVER['HTTP_IF_NONE_MATCH'] === $etag )
{
header( 'HTTP/1.1 304 Not Modified', true, 304 );
exit();
}
$website = new website();
$content = $website->buildWebsite();
@ob_clean();
//@ob_clean();
echo $content;
} catch( Exception $e )
@ -16,7 +27,24 @@ try
if( $e->getCode() === 201 )
{
HTTPStatus( 503 );
echo 'We encountered an critical error.<br>The system file cannot be loaded!';
echo 'We encountered an critical error.<br>The website file cannot be loaded!';
return;
}
if ( $e->getCode() === 202 )
{
HTTPStatus( 503 );
echo 'We encountered a critical error.<br>The language file cannot be loaded!';
return;
}
if( $e->getCode() === 203 )
{
HTTPStatus( 503 );
echo 'We encountered a critical error<br>The questions cannot be loaded!';
return;
}
HTTPStatus( 500 );
echo 'We encountered a critical error.<br>That\'s all what we known!';
}

View File

@ -1,4 +1,19 @@
; Langauge file for
;GERMAN - de_DE
[language]
TITLE = "YourSecretsAreOurs"
MAIN_TITLE = "YourSecretsAreOurs"
DESCRIPTION = "Berechne jetzt, wie unschuldig du noch bist!"
EXPLANATION = "Wähle aus, welche Dinge du bereits getan hast.<br>Wenn du fertig bist, bestätige einfach mit dem Knopf unten!"
PROJECT_DESCRIPTION = "YourSecretsAreOurs ist ein kleines Projekt, welches von ein paar Schülern geleitet wird.<br>Es dient lediglich zur Belustigung und sollte nicht zu ernst genommen werden.<br>Aber.. wie unschuldig bist du? - Das ist doch eine gute Frage oder?<br>Versuche <strong>nicht</strong> alles durchzuführen!<br>Wenn du alles angekreuzt hast wird es im Tod enden."
HELP_US = "Hilf mit!"
REQUEST_MORE = "Beim erweitern der Fragen helfen"
SOCIAL_MEDIA = "Social Media"
JOIN_DISCORD = "Tritt unserem Discord bei!"
LANGUAGE_CHOOSE = "Wähle deine Sprache aus"
CALCULATE = "Berechne meine Punkte!"
[questions]
1 = "Hast du schon mal einen Schwangerschaftstest benutzt?"
2 = "Hast du dich schon mal selbst befriedigt?"
3 = ""

View File

@ -1,4 +1,18 @@
; Langauge file for
;ENGLISH - en_en
;ENGLISH - en_EN
[language]
TITLE = "YourSecretsAreOurs"
MAIN_TITLE = "YourSecretsAreOurs"
DESCRIPTION = "Calculate how innocent you still are!"
EXPLANATION = "Choose which things you have already done.<br>When you are done, just confirm with the button below!"
PROJECT_DESCRIPTION = "YourSecretsAreOurs is a small project, which is managed by a few students.<br>It is just for fun and should not be taken too seriously.<br>But... how innocent are you? - That's a good question, isn't it?<br>Do not try to do everything!<br>If you check all the boxes it will result in death."
HELP_US = "Help us!"
REQUEST_MORE = "Request a question"
SOCIAL_MEDIA = "Social Media"
JOIN_DISCORD = "Join our Discord!"
LANGUAGE_CHOOSE = "Choose your langauge"
CALCULATE = "Calculate my score!"
[questions]
1 = "Have you ever used a pregnancy test before?"
2 = "Did you ever masturbated?"

View File

@ -19,11 +19,13 @@ class language
TITLE = 'TITLE',
MAIN_TITLE = 'MAIN_TITLE',
DESCRIPTION = 'DESCRIPTION',
EXPLANATION = 'EXPLANATION',
PROJECT_DESCRIPTION = 'PROJECT_DESCRIPTION',
HELP_US = 'HELP_US',
REQUEST_MORE = 'REQUEST_MORE',
SOCIAL_MEDIA = 'SOCIAL_MEDIA',
JOIN_DISCORD = 'JOIN_DISCORD'
JOIN_DISCORD = 'JOIN_DISCORD',
LANGUAGE_CHOOSE = 'LANGUAGE_CHOOSE',
CALCULATE = 'CALCULATE'
;
public static $lang_file;
@ -38,9 +40,11 @@ class language
// Check cookie
if( isset( $_GET['lang'] ) )
{
if( isset( $languages[$_GET['lang']] ) )
if( isset( self::$languages[$_GET['lang']] ) )
{
self::setLangauge( $_GET['lang'] );
header( 'Location: ?' );
}
else
{
@ -57,13 +61,16 @@ class language
}
}
private static function setLangauge ( $a_language = 'en_en' ): void
private static function setLangauge ( $a_language = 'en_EN' ): void
{
self::$lang = $a_language;
setcookie( 'lang', $a_language, 0 );
if( !isset( $_COOKIE['lang'] ) || $_COOKIE['lang'] !== $a_language )
{
setcookie( 'lang', $a_language, 0 );
}
try
{
self::$lang_file = parse_ini_file( LANG_DIRECTORY . $a_language . '.ini' );
self::$lang_file = parse_ini_file( LANG_DIRECTORY . $a_language . '.ini', true );
} catch( Exception $e )
{

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

BIN
metas/apple-icon-57x57.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
metas/apple-icon-60x60.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
metas/apple-icon-72x72.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
metas/apple-icon-76x76.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
metas/apple-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

2
metas/browserconfig.xml Normal file
View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig><msapplication><tile><square70x70logo src="/ms-icon-70x70.png"/><square150x150logo src="/ms-icon-150x150.png"/><square310x310logo src="/ms-icon-310x310.png"/><TileColor>#ffffff</TileColor></tile></msapplication></browserconfig>

BIN
metas/favicon-16x16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1020 B

BIN
metas/favicon-32x32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
metas/favicon-96x96.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
metas/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

41
metas/manifest.json Normal file
View File

@ -0,0 +1,41 @@
{
"name": "App",
"icons": [
{
"src": "\/android-icon-36x36.png",
"sizes": "36x36",
"type": "image\/png",
"density": "0.75"
},
{
"src": "\/android-icon-48x48.png",
"sizes": "48x48",
"type": "image\/png",
"density": "1.0"
},
{
"src": "\/android-icon-72x72.png",
"sizes": "72x72",
"type": "image\/png",
"density": "1.5"
},
{
"src": "\/android-icon-96x96.png",
"sizes": "96x96",
"type": "image\/png",
"density": "2.0"
},
{
"src": "\/android-icon-144x144.png",
"sizes": "144x144",
"type": "image\/png",
"density": "3.0"
},
{
"src": "\/android-icon-192x192.png",
"sizes": "192x192",
"type": "image\/png",
"density": "4.0"
}
]
}

BIN
metas/ms-icon-144x144.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
metas/ms-icon-150x150.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
metas/ms-icon-310x310.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
metas/ms-icon-70x70.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

6
vendor/css/default.css vendored Normal file
View File

@ -0,0 +1,6 @@
/* Default CSS File for YourSecretsAreOurs */
body {
background-image: url('/vendor/images/background.png');
}

BIN
vendor/images/background.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

View File

@ -21,31 +21,89 @@ class website
} catch( Exception $e )
{
if( ( $code = $e->getCode() ) === 202 || $code === 203 )
{
throw new RuntimeException( $e->getMessage(), $code );
}
throw new RuntimeException( 'Cannot load the website.html file', 201 );
}
}
private function replaceDefaultThings( $website )
{
if( !isset( language::$lang_file[language::TITLE],
language::$lang_file[language::MAIN_TITLE],
language::$lang_file[language::DESCRIPTION],
language::$lang_file[language::EXPLANATION],
language::$lang_file[language::PROJECT_DESCRIPTION],
language::$lang_file[language::HELP_US],
language::$lang_file[language::REQUEST_MORE],
language::$lang_file[language::LANGUAGE_CHOOSE],
language::$lang_file[language::JOIN_DISCORD] ) )
{
throw new RuntimeException( 'Cannot load default langauge replacements', 202 );
}
$website = str_replace(
array(
'[LANG]', '[TITLE]', '[MAIN_TITLE]', '[DESCRIPTION]', '[PROJECT_DESCRIPTION]', '[HELP_US]', '[REQUEST_MORE]','[SOCIAL_MEDIA]', '[JOIN_DISCORD]' ),
'[LANG]', '[TITLE]', '[MAIN_TITLE]', '[DESCRIPTION]', '[EXPLANATION]', '[PROJECT_DESCRIPTION]', '[HELP_US]', '[REQUEST_MORE]','[LANGUAGE_CHOOSE]', '[JOIN_DISCORD]' ),
array(
substr( language::$lang, 0, 2 ),
language::$lang_file[language::TITLE],
language::$lang_file[language::MAIN_TITLE],
language::$lang_file[language::DESCRIPTION],
language::$lang_file[language::EXPLANATION],
language::$lang_file[language::PROJECT_DESCRIPTION],
language::$lang_file[language::HELP_US],
language::$lang_file[language::REQUEST_MORE],
language::$lang_file[language::SOCIAL_MEDIA],
language::$lang_file[language::LANGUAGE_CHOOSE],
language::$lang_file[language::JOIN_DISCORD]
), $website );
$languages = '';
foreach( language::$languages as $code => $language )
{
$languages .= <<<HTML
<li><a class="blue-text" href="?lang=$code">$language</a></li>
HTML;
}
$website = str_replace( '[LANGUAGES]', $languages, $website );
return $website;
}
private function setQuestions( $website ) : string
{
return $website; // todo
if( !isset( language::$lang_file['questions'] ) )
{
throw new RuntimeException( 'Error while reading the questions in langauge file', 203 );
}
$questions = '';
foreach( language::$lang_file['questions'] as $number => $question )
{
$questions .= <<<CHECKBOX
<label>
<input name="question_$number" type="checkbox" class="filled-in z-depth-4" />
<span>$question</span>
</label><br>
CHECKBOX;
}
$form_start = <<<HTML
<form action="" method="post">
HTML;
$submit = language::$lang_file[language::CALCULATE];
$form_end = <<<HTML
<br>
<button class="btn waves-effect btn-large waves-light " type="submit" name="action">{$submit}
<i class="material-icons right">send</i>
</button>
</form>
HTML;
$questions = $form_start . $questions . $form_end;
$website = str_replace( '[QUESTIONS]', $questions, $website );
return $website;
}
}

View File

@ -5,11 +5,31 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>[TITLE]</title>
<link href="vendor/css/material-icons.css" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="vendor/css/materialize.min.css" media="screen,projection"/>
<link type="text/css" rel="stylesheet" href="vendor/css/materialize.min.css" media="screen,projection"/>
<link type="text/css" rel="stylesheet" href="vendor/css/default.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="apple-touch-icon" sizes="57x57" href="/metas/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/metas/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/metas/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/metas/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/metas/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/metas/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/metas/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/metas/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/metas/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/metas/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/metas/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/metas/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/metas/favicon-16x16.png">
<link rel="manifest" href="/metas/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/metas/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
</head>
<body>
<div class="content">
<div class="section no-pad-bot" id="index-banner">
<div class="container">
<br><br>
@ -17,18 +37,21 @@
<div class="row center">
<h5 class="header col s12 light">[DESCRIPTION]</h5>
</div>
<br><br>
</div>
</div>
<div class="container">
<div class="section">
<h5 class=" light">[EXPLANATION]</h5>
</div>
<br>
<div class="section">
[QUESTIONS]
<br>
<br>
[DONE]
</div>
<br><br>
</div>
@ -38,23 +61,24 @@
<div class="row">
<div class="col l6 s12">
<h5 class="white-text">YourSecretsAreOurs</h5>
<p class="grey-text text-lighten-4">[PROJECT_DESCRIPTION].</p>
<p class="grey-text text-lighten-4">[PROJECT_DESCRIPTION]</p>
</div>
<div class="col l3 s12">
<h5 class="white-text">[HELP_US]</h5>
<ul>
<li><a class="white-text disabled" href="#!">[REQUEST_MORE]]</a></li>
<li><a class="white-text disabled" href="#!">[REQUEST_MORE]</a></li>
<li><a class="white-text" href="https://discord.gg/ybxZ2g8">[JOIN_DISCORD]</a></li>
<!--<li><a class="white-text" href="#!">Link 2</a></li>
<li><a class="white-text" href="#!">Link 3</a></li>
<li><a class="white-text" href="#!">Link 4</a></li>-->
</ul>
</div>
<div class="col l3 s12">
<h5 class="white-text">[SOCIAL_MEDIA]</h5>
<h5 class="white-text">[LANGUAGE_CHOOSE]</h5>
<ul>
<li><a class="white-text" href="https://discord.gg/ybxZ2g8">[JOIN_DISCORD]</a></li>
[LANGUAGES]
<!--<li><a class="white-text" href="#!">Link 2</a></li>
<li><a class="white-text" href="#!">Link 3</a></li>
<li><a class="white-text" href="#!">Link 4</a></li>-->
@ -64,11 +88,11 @@
</div>
<div class="footer-copyright">
<div class="container">
Made with <i class="small material-icons">free_breakfast</i> by <a class="orange-text text-lighten-3" href="http://gaminggeneration.de">GamingGeneration.de-Devs</a>
Made with <i class="small material-icons brown-text">free_breakfast</i> by <a class="orange-text text-lighten-3" href="http://gaminggeneration.de">GamingGeneration.de-Devs</a>
</div>
</div>
</footer>
</div>
<script type="text/javascript" src="vendor/js/materialize.min.js"></script>
</body>