diff --git a/css/style.css b/css/style.css index 6188b0c..7ff37ec 100644 --- a/css/style.css +++ b/css/style.css @@ -78,6 +78,38 @@ body { } } +.toc +{ + margin-top: 56px; + left:auto; + background: #eee; + width: 20%; + border: 1px solid #ddd; + color: #333; +} +.toc > ul +{ + list-style-type: none; + margin: 8px; + padding: 0px; +} +.toc a { + color: #333; +} +.toc .toc-h3 { + margin-left: 10px +} +.toc .toc-h4 { + margin-left: 20px +} +.toc-active { + color: #000; + font-weight: bold; +} +.toc.right { + right: 0 +} + blockquote { font-style: normal; @@ -197,9 +229,12 @@ flex-wrap: wrap; .alert { display: none; position: fixed; + font-weight: bold; + font-size: 1.5rem; top: 10px; right: 10px; cursor: pointer; + z-index: 1500000; } .imagepreview img diff --git a/hosts/localhost/config.php b/hosts/localhost/config.php index b9a1112..a9159fd 100644 --- a/hosts/localhost/config.php +++ b/hosts/localhost/config.php @@ -8,7 +8,7 @@ define('ALLOWED_EXT','jpg,svg,gif,png,c,tgz,tar.gz,gz,tar,sql,ico'); define('PASSWORD', 'c7ad44cbad762a5da0a452f9e854fdc1e0e7a52a38015f23f3eab1d80b931dd472634dfac71cd34ebc35d16ab7fb8a90c81f975113d6c7538dc69dd8de9077ec'); define('LOG_FILE', 'log.txt'); define('ACCESS_IP', ''); -define('HISTORY_FILE', 'history.txt'); +define('HISTORY_FILE', 'history'); define('MAX_HISTORY_FILES', 5); define('LANGUAGE', 'en'); \ No newline at end of file diff --git a/hosts/localhost/content/dependencies.md b/hosts/localhost/content/dependencies.md index 1ee73ca..4fcaee8 100644 --- a/hosts/localhost/content/dependencies.md +++ b/hosts/localhost/content/dependencies.md @@ -25,14 +25,21 @@ * https://github.com/PrismLibrary/Prism +## Table of Contents + + * https://github.com/jgallen23/toc + ## Icons * https://github.com/FortAwesome/Font-Awesome +## Interface + * https://github.com/mobify/magnifik + * https://github.com/codepo8/css-fork-on-github-ribbon + ## Essential * https://github.com/twbs/bootstrap * https://github.com/jquery/jquery * https://github.com/popperjs/popper-core - * https://github.com/zenorocha/clipboard.js - * https://github.com/codepo8/css-fork-on-github-ribbon \ No newline at end of file + * https://github.com/zenorocha/clipboard.js \ No newline at end of file diff --git a/hosts/localhost/content/features.md b/hosts/localhost/content/features.md index f16b4d7..5b18729 100644 --- a/hosts/localhost/content/features.md +++ b/hosts/localhost/content/features.md @@ -9,6 +9,7 @@ 3. Integrated Image viewer 4. Restricted access by ip address 5. Admin access logging +6. Table of contents ## Planned diff --git a/hosts/localhost/content/index.md b/hosts/localhost/content/index.md index 55d3103..2c818cd 100644 --- a/hosts/localhost/content/index.md +++ b/hosts/localhost/content/index.md @@ -7,7 +7,7 @@ This website is heavily formated with markdown format ! __ __ _ _____ | \/ | | | | __ \ | \ / | __ _ _ __| | _| | | | ___ ___ - | |\/| |/ _` | \'__| |/ / | | |/ _ \ / __| + | |\/| |/ _` | '__| |/ / | | |/ _ \ / __| | | | | (_| | | | <| |__| | (_) | (__ |_| |_|\__,_|_| |_|\_\_____/ \___/ \___| ``` diff --git a/hosts/localhost/content/usage.md b/hosts/localhost/content/usage.md index 726b0b6..3e1641b 100644 --- a/hosts/localhost/content/usage.md +++ b/hosts/localhost/content/usage.md @@ -17,7 +17,7 @@ unzip v6.0.0.zip mv emoji-data-v6.0.0 emoji-data ``` -## Configuration +## Multiples hosts There is a sample website in the "[website_root]/hosts/locahost" directory. It's easy to add a new one, you create one subfolder by name served by your webserver. diff --git a/index.php b/index.php index 6cd9564..b064527 100644 --- a/index.php +++ b/index.php @@ -24,12 +24,16 @@ include LIB_DIR."/ParsedownExtra.php"; include LIB_DIR."/ParsedownExtraPlus.php"; include LIB_DIR."/functions.php"; +### Translations +loadlang(LANGUAGE); +global $LANG; + ### Security testip(); logprotect(); ### Sessions -session_name($_SERVER['SERVER_NAME']); +session_name(markdoc); session_start(); /*var_dump($_POST); @@ -57,17 +61,17 @@ else if (isset($_POST['action'])) } else { - $content = '
There is %s results :
", + "404" : "Error 404: file not found !", + "404X2" : "Error 404 on searching customized 404 error file !", + "CONFIG" : "Configuration", + "PASSWORD" : "Admin password", + "LOGOUT" : "Logout", + "LOADING" : "Loading...", + "AJAXERROR" : "Ajax error when loading data !", + "SELECTERROR" : "Error when selecting item.", + "NOTCODED" : "Fonction is not yet implemented.", + "BLOCKIP" : "This IP address is blocked due to unsuccessful login attempts." +} \ No newline at end of file diff --git a/lang/en.php b/lang/en.php deleted file mode 100644 index 7c97cda..0000000 --- a/lang/en.php +++ /dev/null @@ -1,24 +0,0 @@ -There is %s results :'; -$lang['404'] ='Error 404: file not found !'; -$lang['404X2'] ='Error 404 on searching customized 404 error file !'; -$lang['CONFIG'] ='Configuration'; -$lang['PASSWORD'] ='Admin password'; -$lang['LOGOUT'] ='Logout'; -$lang['LOADING'] ='Loading...'; -$lang['AJAXERROR'] ='Ajax error when loading data !'; -$lang['SELECTERROR']='Error when selecting item.' -$lang['NOTCODED'] ='Fonction is not yet implemented.' \ No newline at end of file diff --git a/lang/fr.json b/lang/fr.json new file mode 100644 index 0000000..f334692 --- /dev/null +++ b/lang/fr.json @@ -0,0 +1,26 @@ +{ + "MENU": "Menu", + "HOME" : "Accueil", + "GLOSSARY" : "Glossaire", + "MARKDOC" : "A propos de MarKdoc", + "ADMIN" : "Admin", + "ABOUT" : "A propos", + "SEARCH" : "Rechercher", + "VIEW" : "Voir", + "SAVE" : "Sauver", + "LOGIN" : "Se connecter", + "NOPASS" : "Aucun mot de passe n'a été saisi !", + "ALREADYLOG" : "Vous êtes déjà connecté !", + "BADPASS" : "Le mot de passe est incorrect !", + "FOUND" : "
Il y a %s occurence(s) trouvée(s):
", + "404" : "Erreur 404: fichier non trouvé !", + "404X2" : "Erreur 404 sur fichier 404 personnalisé !", + "CONFIG" : "Configuration", + "PASSWORD" : "Mot de passe", + "LOGOUT" : "Se déconnecter", + "LOADING" : "Chargement...", + "AJAXERROR" : "Erreur ajax durant chargement !", + "SELECTERROR" : "Erreur de selection.", + "NOTCODED" : "La fonction n'est pas implementée.", + "BLOCKIP" : "Cette adresse IP est bloquée à cause de trop de tentatives de connexion non réussies." +} diff --git a/lang/fr.php b/lang/fr.php deleted file mode 100644 index 5aeb765..0000000 --- a/lang/fr.php +++ /dev/null @@ -1,15 +0,0 @@ -Il y a %s occurence(s) trouvée(s):' \ No newline at end of file diff --git a/lib/functions.php b/lib/functions.php index 394dd4b..640f8dd 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -178,15 +178,21 @@ function searchstr($path, $string){ return array('files' => $files, 'totalFiles' => $totalFiles); } +function loadlang($language) +{ + global $LANG; + $LANG=json_decode(file_get_contents(ROOT_DIR."lang/".$language.".json"),true); +} + function history($file) { if (is_numeric(MAX_HISTORY_FILES) && MAX_HISTORY_FILES > 0) { - $file_dir = dirname($file); + $file_dir = str_replace(CONTENT_DIR,"",dirname($file)."/"); $file_name = basename($file); - $file_history_dir = HISTORY_DIR . '/' . str_replace(MAIN_DIR, '', $file_dir); + $file_history_dir = HISTORY_DIR . $file_dir; foreach ([HISTORY_DIR, $file_history_dir] as $dir) { if (file_exists($dir) === false || is_dir($dir) === false) { - mkdir($dir); + mkdir($dir,0755,true); } } $history_files = scandir($file_history_dir); @@ -199,14 +205,15 @@ function history($file) if (count($history_files) >= MAX_HISTORY_FILES) { foreach ($history_files as $key => $history_file) { if ($key < 1) { - unlink($file_history_dir . DS . $history_file); + unlink($file_history_dir . '/' . $history_file); unset($history_files[$key]); } else { - rename($file_history_dir . DS . $history_file, $file_history_dir . DS . $file_name . '.' . ($key - 1)); + $newfile_name=pathinfo(basename($history_file))['filename']; + rename($file_history_dir . '/' . $history_file, $file_history_dir . '/' . $newfile_name . '.' . ($key - 1)); } } } - copy($file, $file_history_dir . DS . $file_name . '.' . count($history_files)); + copy($file, $file_history_dir . '/' . $file_name . '.' . count($history_files)); } } @@ -222,7 +229,7 @@ function setcontent($url,$data) else if (is_writable($file)) { file_put_contents($file, $data); - //history($file); + history($file); $content='success|Fichier enregistré.'; } else if (!is_writable($file)) diff --git a/readme.md b/readme.md index 55d3103..2c818cd 100644 --- a/readme.md +++ b/readme.md @@ -7,7 +7,7 @@ This website is heavily formated with markdown format ! __ __ _ _____ | \/ | | | | __ \ | \ / | __ _ _ __| | _| | | | ___ ___ - | |\/| |/ _` | \'__| |/ / | | |/ _ \ / __| + | |\/| |/ _` | '__| |/ / | | |/ _ \ / __| | | | | (_| | | | <| |__| | (_) | (__ |_| |_|\__,_|_| |_|\_\_____/ \___/ \___| ```