Adding a lot of stuff, langauge thingi, website.html default thing, config.inc.php, main.inc.php, index.php, default construct of all things, the ability to saying hello world...

This commit is contained in:
Tobias Hopp 2020-08-05 05:50:18 +02:00
parent 0c9d8a805f
commit e09edf9575
14 changed files with 21781 additions and 0 deletions

4
.idea/php.xml generated Normal file
View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="PhpProjectSharedConfiguration" php_language_level="7.1" />
</project>

View File

@ -1,2 +1,7 @@
<?php
/**
* Configuration file of yourSecretsAreOurs
*/
define( 'LANG_DIRECTORY', __DIR__ . '/' . 'lang/' );

17
index.php Normal file
View File

@ -0,0 +1,17 @@
<?php
/**
* The Main file of the website
*/
require_once 'main.inc.php';
try
{
$website = new website();
$website->buildWebsite( language::$lang_file );
} catch( Exception $e )
{
if( $e->getCode() === 201 )
{
}
}

4
lang/de_DE.ini Normal file
View File

@ -0,0 +1,4 @@
; Langauge file for
;GERMAN - de_DE
[language]

4
lang/en_EN.ini Normal file
View File

@ -0,0 +1,4 @@
; Langauge file for
;ENGLISH - en_en
[language]

74
language.class.inc.php Normal file
View File

@ -0,0 +1,74 @@
<?php
/**
* Class language
*
* 1xx Error codes
*/
class language
{
public static $languages = array(
'de_DE' => 'German',
'en_EN' => 'English',
);
public const
TITLE = 'TITLE',
MAIN_TITLE = 'MAIN_TITLE',
DESCRIPTION = 'DESCRIPTION',
PROJECT_DESCRIPTION = 'PROJECT_DESCRIPTION',
HELP_US = 'HELP_US',
REQUEST_MORE = 'REQUEST_MORE',
SOCIAL_MEDIA = 'SOCIAL_MEDIA',
JOIN_DISCORD = 'JOIN_DISCORD'
;
public static $lang_file;
/**
* @var string
*/
public static $lang;
public static function checkLanguage ( ): void
{
// Check cookie
if( isset( $_GET['lang'] ) )
{
if( isset( $languages[$_GET['lang']] ) )
{
self::setLangauge( $_GET['lang'] );
}
else
{
self::setLangauge();
}
}
else if ( isset( $_COOKIE['lang'], self::$languages[$_COOKIE['lang']] ) )
{
self::setLangauge( $_COOKIE['lang'] );
}
else
{
self::setLangauge();
}
}
private static function setLangauge ( $a_language = 'en_en' )
{
self::$lang = $a_language;
setcookie( 'lang', $a_language, 0 );
try
{
self::$lang_file = parse_ini_file( LANG_DIRECTORY . $a_language . '.ini' );
} catch( Exception $e )
{
throw new RuntimeException( 'Cannot load the language file!', 101 );
}
}
}

70
main.inc.php Normal file
View File

@ -0,0 +1,70 @@
<?php
require_once 'config.inc.php';
try
{
language::checkLanguage();
} catch ( Exception $e )
{
if( $e->getCode() === 101 )
{
HTTPStatus( 503 );
echo 'We encountered an critical error.<br>The langauge file cannot be loaded!';
return;
}
}
function HTTPStatus($num) {
$http = array(
100 => 'HTTP/1.1 100 Continue',
101 => 'HTTP/1.1 101 Switching Protocols',
200 => 'HTTP/1.1 200 OK',
201 => 'HTTP/1.1 201 Created',
202 => 'HTTP/1.1 202 Accepted',
203 => 'HTTP/1.1 203 Non-Authoritative Information',
204 => 'HTTP/1.1 204 No Content',
205 => 'HTTP/1.1 205 Reset Content',
206 => 'HTTP/1.1 206 Partial Content',
300 => 'HTTP/1.1 300 Multiple Choices',
301 => 'HTTP/1.1 301 Moved Permanently',
302 => 'HTTP/1.1 302 Found',
303 => 'HTTP/1.1 303 See Other',
304 => 'HTTP/1.1 304 Not Modified',
305 => 'HTTP/1.1 305 Use Proxy',
307 => 'HTTP/1.1 307 Temporary Redirect',
400 => 'HTTP/1.1 400 Bad Request',
401 => 'HTTP/1.1 401 Unauthorized',
402 => 'HTTP/1.1 402 Payment Required',
403 => 'HTTP/1.1 403 Forbidden',
404 => 'HTTP/1.1 404 Not Found',
405 => 'HTTP/1.1 405 Method Not Allowed',
406 => 'HTTP/1.1 406 Not Acceptable',
407 => 'HTTP/1.1 407 Proxy Authentication Required',
408 => 'HTTP/1.1 408 Request Time-out',
409 => 'HTTP/1.1 409 Conflict',
410 => 'HTTP/1.1 410 Gone',
411 => 'HTTP/1.1 411 Length Required',
412 => 'HTTP/1.1 412 Precondition Failed',
413 => 'HTTP/1.1 413 Request Entity Too Large',
414 => 'HTTP/1.1 414 Request-URI Too Large',
415 => 'HTTP/1.1 415 Unsupported Media Type',
416 => 'HTTP/1.1 416 Requested Range Not Satisfiable',
417 => 'HTTP/1.1 417 Expectation Failed',
500 => 'HTTP/1.1 500 Internal Server Error',
501 => 'HTTP/1.1 501 Not Implemented',
502 => 'HTTP/1.1 502 Bad Gateway',
503 => 'HTTP/1.1 503 Service Unavailable',
504 => 'HTTP/1.1 504 Gateway Time-out',
505 => 'HTTP/1.1 505 HTTP Version Not Supported',
);
header($http[$num]);
return
array(
'code' => $num,
'error' => $http[$num],
);
}

23
vendor/css/material-icons.css vendored Normal file
View File

@ -0,0 +1,23 @@
/* fallback */
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
src: url(https://fonts.gstatic.com/s/materialicons/v54/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2) format('woff2');
}
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
-moz-font-feature-settings: 'liga';
-moz-osx-font-smoothing: grayscale;
}

9067
vendor/css/materialize.css vendored Normal file

File diff suppressed because it is too large Load Diff

13
vendor/css/materialize.min.css vendored Normal file

File diff suppressed because one or more lines are too long

12374
vendor/js/materialize.js vendored Normal file

File diff suppressed because it is too large Load Diff

6
vendor/js/materialize.min.js vendored Normal file

File diff suppressed because one or more lines are too long

75
website.html Normal file
View File

@ -0,0 +1,75 @@
<!DOCTYPE html>
<html lang="[LANG]">
<head>
<meta charset="UTF-8">
<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"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body>
<div class="section no-pad-bot" id="index-banner">
<div class="container">
<br><br>
<h1 class="header center orange-text">[MAIN_TITLE]</h1>
<div class="row center">
<h5 class="header col s12 light">[DESCRIPTION]</h5>
</div>
<br><br>
</div>
</div>
<div class="container">
<div class="section">
[QUESTIONS]
<br>
<br>
[DONE]
</div>
<br><br>
</div>
<footer class="page-footer orange">
<div class="container">
<div class="row">
<div class="col l6 s12">
<h5 class="white-text">YourSecretsAreOurs</h5>
<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" 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>
<ul>
<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>
</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>
</div>
</div>
</footer>
<script type="text/javascript" src="vendor/js/materialize.min.js"></script>
</body>
</html>

45
website.inc.php Normal file
View File

@ -0,0 +1,45 @@
<?php
/**
* Class website
* 2xx error codes
*/
class website
{
public $html = '';
public function buildWebsite( $a_languageFile ): void
{
try
{
$website = file_get_contents( __DIR__ . '/website.html' );
$website = $this->replaceDefaultThings( $website );
} catch( Exception $e )
{
throw new RuntimeException( 'Cannot load the website.html file', 201 );
}
}
public function replaceDefaultThings( $website )
{
$website = str_replace(
array(
'[LANG]', '[TITLE]', '[MAIN_TITLE]', '[DESCRIPTION]', '[PROJECT_DESCRIPTION]', '[HELP_US]', '[REQUEST_MORE]','[SOCIAL_MEDIA]', '[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::PROJECT_DESCRIPTION],
language::$lang_file[language::HELP_US],
language::$lang_file[language::REQUEST_MORE],
language::$lang_file[language::SOCIAL_MEDIA],
language::$lang_file[language::JOIN_DISCORD]
), $website );
return $website;
}
}