Translation on php finished
This commit is contained in:
parent
4b77c534cc
commit
ed15b416a9
|
@ -43,6 +43,7 @@ define('LOG_FILE', 'log.txt');
|
|||
define('ACCESS_IP', '');
|
||||
define('HISTORY_FILE', 'history.txt');
|
||||
define('MAX_HISTORY_FILES', 5);
|
||||
define('LANG', 'en');
|
||||
```
|
||||
|
||||
**NOTE**:
|
||||
|
|
26
index.php
26
index.php
|
@ -102,7 +102,7 @@ else if (isset($_POST['action']))
|
|||
case 'search':
|
||||
$results=searchstr(CONTENT_DIR,$_POST['search']);
|
||||
//print_r($results);
|
||||
$content="<h1>Résultats de recherche</h1><p>Il y a ".$results['totalFiles']." occurence(s) trouvée(s):</p>";
|
||||
$content=sprintf($LANG['FOUND'],$results['totalFiles']);
|
||||
foreach($results['files'] as $key => $value)
|
||||
$content.='<p class="filefound"><a href="'.$key.'">'.$key.'</a></p><p class="textfound">'.$value.'</p>';
|
||||
if ($_POST['type']=="js")
|
||||
|
@ -155,7 +155,7 @@ else
|
|||
</head>
|
||||
<body>
|
||||
<div id="head" class="">
|
||||
<span id="forkongithub"><a href="https://github.com/dahut87/MarkDoc">Fork me on GitHub</a></span>
|
||||
<span id="forkongithub"><a href="https://github.com/dahut87/MarkDoc"><?php print($LANG['FORK']); ?></a></span>
|
||||
<nav class="navbar fixed-top navbar-expand-md <?php print(($_SESSION['md_admin'] == true)?"navbar-custom":"bg-dark navbar-dark"); ?>">
|
||||
<a class="navbar-brand" href="/index.md"><i class="fas <?php echo ICON; ?>"></i> <?php echo TITLE; ?></a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
|
||||
|
@ -164,7 +164,7 @@ else
|
|||
<div class="collapse navbar-collapse" id="navbarSupportedContent">
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" role="button">Menu</a>
|
||||
<a class="nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" role="button"><?php print($LANG['MENU']); ?></a>
|
||||
<div class="dropdown-menu">
|
||||
<?php
|
||||
print(getnav());
|
||||
|
@ -173,22 +173,22 @@ else
|
|||
</li>
|
||||
<?php
|
||||
print(($_SESSION['md_admin'] == true)?'<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" role="button">Admin</a>
|
||||
<a class="nav-link dropdown-toggle" href="javascript:void(0)" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" role="button">'.$LANG['ADMIN'].'</a>
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" href=":CONFIG">Configuration</a>
|
||||
<a class="dropdown-item" href=":PASSWORD">Mot de passe</a>
|
||||
<a class="dropdown-item" href=":CONFIG">'.$LANG['CONFIG'].'</a>
|
||||
<a class="dropdown-item" href=":PASSWORD">'.$LANG['PASSWORD'].'</a>
|
||||
<hr>
|
||||
<a class="dropdown-item" href="https://'.$_SERVER['SERVER_NAME'].'?logout">Se déconnecter</a>
|
||||
</div></li>':'<li class="nav-item"><a class="nav-link " href=":ADMIN">Admin</a></li>');
|
||||
<a class="dropdown-item" href="https://'.$_SERVER['SERVER_NAME'].'?logout">'.$LANG['LOGOUT'].'</a>
|
||||
</div></li>':'<li class="nav-item"><a class="nav-link " href=":ADMIN">'.$LANG['ADMIN'].'</a></li>');
|
||||
?>
|
||||
<li class="nav-item"><a class="nav-link " href="/apropos.md">A propos</a></li>
|
||||
<li class="nav-item"><a class="nav-link " href="<?php print($LANG['ABOUTMD'].'">'.$LANG['ABOUT']); ?></a></li>
|
||||
</ul>
|
||||
<form class="form-inline" id="form" name="form" action="/index.php" method="POST">
|
||||
<input type="hidden" id="action" name="action" value="search"/>
|
||||
<?php print(($_SESSION['md_admin'] == true)?'<input class="btn btn-outline-light" my-2 my-sm-0" value="Voir" name="voir" id="voir" type="submit"/> <input class="btn btn-outline-light" my-2 my-sm-0" value="Sauver" name="save" id="save" type="button"/> ':''); ?>
|
||||
<input class="btn <?php print(($_SESSION['md_admin'] == true)?"btn-outline-light":"btn-outline-info"); ?> my-2 my-sm-0" value="TOC" name="toc" id="toc" type="button"/>
|
||||
<?php print(($_SESSION['md_admin'] == true)?'<input class="btn btn-outline-light" my-2 my-sm-0" value="'.$LANG['VIEW'].'" name="voir" id="voir" type="submit"/> <input class="btn btn-outline-light" my-2 my-sm-0" value="'.$LANG['SAVE'].'" name="save" id="save" type="button"/> ':''); ?>
|
||||
<input class="btn <?php print(($_SESSION['md_admin'] == true)?"btn-outline-light":"btn-outline-info"); ?> my-2 my-sm-0" value="<?php print($LANG['TOC']); ?>" name="toc" id="toc" type="button" style="display: none;"/>
|
||||
<input class="form-control mr-sm-2" type="text" id="search" name="search"/>
|
||||
<input class="btn <?php print(($_SESSION['md_admin'] == true)?"btn-outline-light":"btn-outline-info"); ?> my-2 my-sm-0" value="Chercher" name="submit" id="submit" type="submit"/>
|
||||
<input class="btn <?php print(($_SESSION['md_admin'] == true)?"btn-outline-light":"btn-outline-info"); ?> my-2 my-sm-0" value="<?php print($LANG['SEARCH']); ?>" name="submit" id="submit" type="submit"/>
|
||||
</form>
|
||||
</div>
|
||||
</nav>
|
||||
|
@ -204,7 +204,7 @@ print(($_SESSION['md_admin'] == true)?'<li class="nav-item dropdown">
|
|||
print($content);
|
||||
?><br><br>
|
||||
</div>
|
||||
<div id="image" class="imagepreview"><img></div><div id="editor"><textarea data-file="" class="form-control"></textarea></div>
|
||||
<div id="image" class="imagepreview" style="display: none;"><img></div><div id="editor" style="display: none;"><textarea data-file="" class="form-control"></textarea></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -48,7 +48,7 @@ $(function(){
|
|||
search($("#search").val());
|
||||
});
|
||||
|
||||
$("input[name=toc]").click(function(e) {
|
||||
$("input[name=toc]").hover(function(e) {
|
||||
e.preventDefault();
|
||||
tocshow();
|
||||
});
|
||||
|
|
|
@ -182,7 +182,7 @@ $(function(){
|
|||
search($("#search").val());
|
||||
});
|
||||
|
||||
$("input[name=toc]").click(function(e) {
|
||||
$("input[name=toc]").hover(function(e) {
|
||||
e.preventDefault();
|
||||
tocshow();
|
||||
});
|
||||
|
|
15
lang/en.json
15
lang/en.json
|
@ -2,17 +2,20 @@
|
|||
"MENU": "Menu",
|
||||
"HOME" : "Home",
|
||||
"GLOSSARY" : "Glossary",
|
||||
"MARKDOC" : "About MarKdoc",
|
||||
"MARKDOC" : "About MarkDoc",
|
||||
"ABOUTMARKDOC" : "# MarkDoc\r\n\r\n**PHP Markdown-based documentation management system, Free & OpenSource :heart_eyes: for easily create your documentation website**\r\n \r\nThis website is heavily formated with markdown format !\r\n```\r\n __ __ _ _____ \r\n | \\\/ | | | | __ \\ \r\n | \\ \/ | __ _ _ __| | _| | | | ___ ___ \r\n | |\\\/| |\/ _` | '__| |\/ \/ | | |\/ _ \\ \/ __|\r\n | | | | (_| | | | <| |__| | (_) | (__ \r\n |_| |_|\\__,_|_| |_|\\_\\_____\/ \\___\/ \\___|\r\n``` \r\n\r\n![gplV3](https:\/\/www.gnu.org\/graphics\/gplv3-127x51.png) Sous licence GPLv3 [Licence](\/special\/gpl-3.0.md) - *Sources downloadables on [GitHub](https:\/\/github.com\/dahut87\/MarkDoc)*\r\n \r\nBased on Pheditor \"PHP file editor\" released under MIT license\r\n \r\n *Specials thanks to Hamid Samak*\r\n \r\n Made in 2020 by Nicolas H.\r\n \r\n---\r\n \r\nFor more informations, visit the demo website running MarkDoc engine at : [https:\/\/markdoc.palon.fr](https:\/\/markdoc.palon.fr)",
|
||||
"ADMIN" : "Admin",
|
||||
"ABOUT" : "About...",
|
||||
"ABOUTMD" : "about.md",
|
||||
"SEARCH" : "Search",
|
||||
"VIEW" : "View",
|
||||
"TOC" : "Toc",
|
||||
"SAVE" : "Save",
|
||||
"LOGIN" : "Login",
|
||||
"NOPASS" : "No password is given !",
|
||||
"ALREADYLOG" : "You're already connected !",
|
||||
"BADPASS" : "The password is incorrect !",
|
||||
"FOUND" : "<h1>Search results</h1><p>There is %s results :</p>",
|
||||
"FOUND" : "<h1>Search results</h1><p>There is(are) %d results for this search:</p>",
|
||||
"404" : "Error 404: file not found !",
|
||||
"404X2" : "Error 404 on searching customized 404 error file !",
|
||||
"CONFIG" : "Configuration",
|
||||
|
@ -22,5 +25,11 @@
|
|||
"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."
|
||||
"BLOCKIP" : "This IP address is blocked due to unsuccessful login attempts.",
|
||||
"NOIP": "Your IP address is not allowed to access this page.",
|
||||
"FORK": "Fork me on GitHub",
|
||||
"CREATED": "File created.",
|
||||
"SAVED": "Filed saved.",
|
||||
"PROTECTED": "File is protected.",
|
||||
"INDETERMINED": "Indeterminated Error."
|
||||
}
|
17
lang/fr.json
17
lang/fr.json
|
@ -2,17 +2,20 @@
|
|||
"MENU": "Menu",
|
||||
"HOME" : "Accueil",
|
||||
"GLOSSARY" : "Glossaire",
|
||||
"MARKDOC" : "A propos de MarKdoc",
|
||||
"MARKDOC" : "A propos de MarkDoc",
|
||||
"ABOUTMARKDOC" : "# MarkDoc\r\n\r\n**Syst\u00E8me de gestion de documents Mardown \u00E9crits en PHP, Gratuit & OpenSource :heart_eyes: afin de facilement cr\u00E9er vos sites internet de documentation**\r\n \r\nCe site est lourdement format\u00E9 au format Markdown !\r\n```\r\n __ __ _ _____ \r\n | \\\/ | | | | __ \\ \r\n | \\ \/ | __ _ _ __| | _| | | | ___ ___ \r\n | |\\\/| |\/ _` | '__| |\/ \/ | | |\/ _ \\ \/ __|\r\n | | | | (_| | | | <| |__| | (_) | (__ \r\n |_| |_|\\__,_|_| |_|\\_\\_____\/ \\___\/ \\___|\r\n``` \r\n \r\n![gplV3](https:\/\/www.gnu.org\/graphics\/gplv3-127x51.png) Sous licence GPLv3 [Licence](\/special\/gpl-3.0.md) - *Sources t\u00E9l\u00E9chargeables sur [GitHub](https:\/\/github.com\/dahut87\/MarkDoc)*\r\n \r\nBas\u00E9 sur Pheditor \"PHP file editor\" sous licence MIT\r\n \r\n*Merci \u00E0 Hamid Samak*\r\n \r\nR\u00E9alis\u00E9 en 2020 par Nicolas H.\r\n \r\n---\r\n \r\nPour plus d'informations, visitez le site internet de d\u00E9monstration \u00E0 l'url suivante : [https:\/\/markdoc.palon.fr](https:\/\/markdoc.palon.fr)",
|
||||
"ADMIN" : "Admin",
|
||||
"ABOUT" : "A propos",
|
||||
"SEARCH" : "Rechercher",
|
||||
"ABOUTMD" : "apropos.md",
|
||||
"SEARCH" : "Chercher",
|
||||
"VIEW" : "Voir",
|
||||
"TOC" : "TDM",
|
||||
"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" : "<h1>Résultats de recherche</h1><p>Il y a %s occurence(s) trouvée(s):</p>",
|
||||
"FOUND" : "<h1>Résultats de recherche</h1><p>Il y a %d occurence(s) trouvée(s):</p>",
|
||||
"404" : "Erreur 404: fichier non trouvé !",
|
||||
"404X2" : "Erreur 404 sur fichier 404 personnalisé !",
|
||||
"CONFIG" : "Configuration",
|
||||
|
@ -22,5 +25,11 @@
|
|||
"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."
|
||||
"BLOCKIP" : "Cette adresse IP est bloquée à cause de trop de tentatives de connexion non réussies.",
|
||||
"NOIP": "Cette adresse IP n'est pas autorisée à consulter cette page.",
|
||||
"FORK": "Fork moi sur GitHub",
|
||||
"CREATED": "Fichier créé.",
|
||||
"SAVED": "Fichier enregistré.",
|
||||
"PROTECTED": "Fichier protégé.",
|
||||
"INDETERMINED": "Erreur indéterminée."
|
||||
}
|
||||
|
|
|
@ -11,19 +11,21 @@
|
|||
|
||||
function testip()
|
||||
{
|
||||
global $LANG;
|
||||
if (empty(ACCESS_IP) === false && ACCESS_IP != $_SERVER['REMOTE_ADDR'])
|
||||
die('Your IP address is not allowed to access this page.');
|
||||
die($LANG['NOIP']);
|
||||
}
|
||||
|
||||
function logprotect()
|
||||
{
|
||||
global $LANG;
|
||||
if (file_exists(LOG_DIR)) {
|
||||
$log = unserialize(file_get_contents(LOG_DIR));
|
||||
if (empty($log)) {
|
||||
$log = [];
|
||||
}
|
||||
if (isset($log[$_SERVER['REMOTE_ADDR']]) && $log[$_SERVER['REMOTE_ADDR']]['num'] > 3 && time() - $log[$_SERVER['REMOTE_ADDR']]['time'] < 86400) {
|
||||
die('This IP address is blocked due to unsuccessful login attempts.');
|
||||
die($LANG['BLOCKIP']);
|
||||
}
|
||||
foreach ($log as $key => $value) {
|
||||
if (time() - $value['time'] > 86400) {
|
||||
|
@ -50,60 +52,35 @@ function redirect($address = null)
|
|||
|
||||
function specialurl($url)
|
||||
{
|
||||
switch ($url) {
|
||||
global $LANG;
|
||||
switch ($url)
|
||||
{
|
||||
case ':APROPOS':
|
||||
$content = '# MarkDoc
|
||||
|
||||
**PHP Markdown-based documentation management system, Free & OpenSource :heart_eyes: for easily create your documentation website**
|
||||
|
||||
This website is heavily formated with markdown format !
|
||||
```
|
||||
__ __ _ _____
|
||||
| \/ | | | | __ \
|
||||
| \ / | __ _ _ __| | _| | | | ___ ___
|
||||
| |\/| |/ _` | \'__| |/ / | | |/ _ \ / __|
|
||||
| | | | (_| | | | <| |__| | (_) | (__
|
||||
|_| |_|\__,_|_| |_|\_\_____/ \___/ \___|
|
||||
```
|
||||
|
||||
![gplV3](https://www.gnu.org/graphics/gplv3-127x51.png) Sous licence GPLv3 [Licence](/special/gpl-3.0.md) - *Sources downloadables on [GitHub](https://github.com/dahut87/MarkDoc)*
|
||||
|
||||
Based on Pheditor "PHP file editor" released under MIT license
|
||||
|
||||
*Specials thanks to Hamid Samak*
|
||||
|
||||
Made in 2020 by Nicolas H.
|
||||
|
||||
---
|
||||
|
||||
For more informations, visit the demo website running MarkDoc engine at : [https://markdoc.palon.fr](https://markdoc.palon.fr)';
|
||||
$extra = new ParsedownExtraplus();
|
||||
print($extra->text($content));
|
||||
exit;
|
||||
$content = $LANG['ABOUTMARKDOC'];
|
||||
$extra = new ParsedownExtraplus();
|
||||
print($extra->text($content));
|
||||
exit;
|
||||
case ':ADMIN':
|
||||
if (isset($_SESSION['md_admin']) === false || $_SESSION['md_admin'] !== true)
|
||||
$content = '<form method="post"><div style="text-align:center"><h1></h1>' . (isset($error) ? '<p style="color:#dd0000">' . $error . '</p>' : null) . '<input id="mdsimple_password" name="md_password" type="password" value="" placeholder="Password…" tabindex="1"><br><br><input type="hidden" id="action" name="action" value="ident"><input type="submit" value="Login" tabindex="2"></div></form><script type="text/javascript">$("#md_password").focus();</script>';
|
||||
else
|
||||
$content = "<h1>Vous êtes déjà logué !</h1>";
|
||||
print($content);
|
||||
exit;
|
||||
if (isset($_SESSION['md_admin']) === false || $_SESSION['md_admin'] !== true)
|
||||
$content = '<form method="post"><div style="text-align:center"><h1></h1>' . (isset($error) ? '<p style="color:#dd0000">' . $error . '</p>' : null) . '<input id="mdsimple_password" name="md_password" type="password" value="" placeholder="Password…" tabindex="1"><br><br><input type="hidden" id="action" name="action" value="ident"><input type="submit" value="'.$LANG['LOGIN'].'" tabindex="2"></div></form><script type="text/javascript">$("#md_password").focus();</script>';
|
||||
else
|
||||
$content = '<h1>'.$LANG['ALREADYLOG'].'</h1>';
|
||||
print($content);
|
||||
exit;
|
||||
case ':SITEMAP':
|
||||
$content="<h1>Plan de site</h1>";
|
||||
foreach(plan(CONTENT_DIR) as $file)
|
||||
$content.='<p class="fileletter"><a href="'.$file.'">'.$file.'</a></p>' ;
|
||||
$content='<h1>'.$LANG['SITEMAP'].'</h1>';
|
||||
foreach(plan(CONTENT_DIR) as $file)
|
||||
$content.='<p class="fileletter"><a href="'.$file.'">'.$file.'</a></p>' ;
|
||||
return $content;
|
||||
case ':GLOSSAIRE':
|
||||
$content='<h1>'.$LANG['GLOSSARY'].'</h1>';
|
||||
foreach(glossary(CONTENT_DIR) as $letter => $files)
|
||||
{
|
||||
$content.='<p class="letter">'.$letter.'</p>';
|
||||
foreach($files as $file)
|
||||
$content.='<p class="fileletter"><a href="'.$file.'">'.$file.'</a></p>' ;
|
||||
}
|
||||
return $content;
|
||||
case ':GLOSSAIRE':
|
||||
$content="<h1>Glossaire</h1>";
|
||||
foreach(glossary(CONTENT_DIR) as $letter => $files)
|
||||
{
|
||||
$content.='<p class="letter">'.$letter.'</p>';
|
||||
foreach($files as $file)
|
||||
$content.='<p class="fileletter"><a href="'.$file.'">'.$file.'</a></p>' ;
|
||||
}
|
||||
return $content;
|
||||
case ':GLOSSAIRE':
|
||||
|
||||
return $content;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -220,27 +197,29 @@ function history($file)
|
|||
|
||||
function setcontent($url,$data)
|
||||
{
|
||||
global $LANG;
|
||||
$file = CONTENT_DIR.$url;
|
||||
if (!file_exists($file))
|
||||
{
|
||||
file_put_contents($file, $data);
|
||||
$content='success|Fichier créé.';
|
||||
$content='success|'.$LANG['CREATED'];
|
||||
}
|
||||
else if (is_writable($file))
|
||||
{
|
||||
file_put_contents($file, $data);
|
||||
history($file);
|
||||
$content='success|Fichier enregistré.';
|
||||
$content='success|'.$LANG['SAVED'];
|
||||
}
|
||||
else if (!is_writable($file))
|
||||
$content='danger|Fichier protégé.';
|
||||
$content='danger|'.$LANG['PROTECTED'];
|
||||
else
|
||||
$content='danger|Erreur indéterminée.';
|
||||
$content='danger|'.$LANG['INDETERMINED'];
|
||||
return $content;
|
||||
}
|
||||
|
||||
function getcontent($url,$md=true)
|
||||
{
|
||||
global $LANG;
|
||||
$file = CONTENT_DIR.$url;
|
||||
if (file_exists($file))
|
||||
$content=file_get_contents($file);
|
||||
|
@ -250,7 +229,7 @@ function getcontent($url,$md=true)
|
|||
if (file_exists(CONTENT_DIR . "special/404.md"))
|
||||
$content=getcontent("special/404.md");
|
||||
else
|
||||
$content="** Erreur 404 sur erreur 404 : pas de fichier 404.md**";
|
||||
$content='**'.$LANG['404X2'].'**';
|
||||
}
|
||||
if ($md==true)
|
||||
{
|
||||
|
@ -295,6 +274,7 @@ function filesJSON($path,$all,$first=true)
|
|||
|
||||
function getnav()
|
||||
{
|
||||
global $LANG;
|
||||
$menu=getcontent("special/nav.md");
|
||||
$menuitems=explode("\n",$menu);
|
||||
$data="";
|
||||
|
@ -304,6 +284,6 @@ function getnav()
|
|||
$a = new SimpleXMLElement($item);
|
||||
$data.='<a class="dropdown-item" href="'.$a['href'].'">'.$a[0].'</a>';
|
||||
}
|
||||
$data.='<a class="dropdown-item" href=":APROPOS">Sur MarkDoc...</a>';
|
||||
$data.='<a class="dropdown-item" href=":APROPOS">'.$LANG['MARKDOC'].'</a>';
|
||||
return $data;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue