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:
2020-08-05 05:50:18 +02:00
parent 0c9d8a805f
commit e09edf9575
14 changed files with 21781 additions and 0 deletions

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 );
}
}
}