feat: translation is operationnal. History files are OK

This commit is contained in:
Nicolas Hordé 2021-01-02 19:58:35 +01:00
parent 98b6dfe500
commit 4b77c534cc
17 changed files with 204 additions and 65 deletions

View File

@ -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 blockquote
{ {
font-style: normal; font-style: normal;
@ -197,9 +229,12 @@ flex-wrap: wrap;
.alert { .alert {
display: none; display: none;
position: fixed; position: fixed;
font-weight: bold;
font-size: 1.5rem;
top: 10px; top: 10px;
right: 10px; right: 10px;
cursor: pointer; cursor: pointer;
z-index: 1500000;
} }
.imagepreview img .imagepreview img

View File

@ -8,7 +8,7 @@ define('ALLOWED_EXT','jpg,svg,gif,png,c,tgz,tar.gz,gz,tar,sql,ico');
define('PASSWORD', 'c7ad44cbad762a5da0a452f9e854fdc1e0e7a52a38015f23f3eab1d80b931dd472634dfac71cd34ebc35d16ab7fb8a90c81f975113d6c7538dc69dd8de9077ec'); define('PASSWORD', 'c7ad44cbad762a5da0a452f9e854fdc1e0e7a52a38015f23f3eab1d80b931dd472634dfac71cd34ebc35d16ab7fb8a90c81f975113d6c7538dc69dd8de9077ec');
define('LOG_FILE', 'log.txt'); define('LOG_FILE', 'log.txt');
define('ACCESS_IP', ''); define('ACCESS_IP', '');
define('HISTORY_FILE', 'history.txt'); define('HISTORY_FILE', 'history');
define('MAX_HISTORY_FILES', 5); define('MAX_HISTORY_FILES', 5);
define('LANGUAGE', 'en'); define('LANGUAGE', 'en');

View File

@ -25,14 +25,21 @@
* https://github.com/PrismLibrary/Prism * https://github.com/PrismLibrary/Prism
## Table of Contents
* https://github.com/jgallen23/toc
## Icons ## Icons
* https://github.com/FortAwesome/Font-Awesome * https://github.com/FortAwesome/Font-Awesome
## Interface
* https://github.com/mobify/magnifik
* https://github.com/codepo8/css-fork-on-github-ribbon
## Essential ## Essential
* https://github.com/twbs/bootstrap * https://github.com/twbs/bootstrap
* https://github.com/jquery/jquery * https://github.com/jquery/jquery
* https://github.com/popperjs/popper-core * https://github.com/popperjs/popper-core
* https://github.com/zenorocha/clipboard.js * https://github.com/zenorocha/clipboard.js
* https://github.com/codepo8/css-fork-on-github-ribbon

View File

@ -9,6 +9,7 @@
3. Integrated Image viewer 3. Integrated Image viewer
4. Restricted access by ip address 4. Restricted access by ip address
5. Admin access logging 5. Admin access logging
6. Table of contents
## Planned ## Planned

View File

@ -7,7 +7,7 @@ This website is heavily formated with markdown format !
__ __ _ _____ __ __ _ _____
| \/ | | | | __ \ | \/ | | | | __ \
| \ / | __ _ _ __| | _| | | | ___ ___ | \ / | __ _ _ __| | _| | | | ___ ___
| |\/| |/ _` | \'__| |/ / | | |/ _ \ / __| | |\/| |/ _` | '__| |/ / | | |/ _ \ / __|
| | | | (_| | | | <| |__| | (_) | (__ | | | | (_| | | | <| |__| | (_) | (__
|_| |_|\__,_|_| |_|\_\_____/ \___/ \___| |_| |_|\__,_|_| |_|\_\_____/ \___/ \___|
``` ```

View File

@ -17,7 +17,7 @@ unzip v6.0.0.zip
mv emoji-data-v6.0.0 emoji-data 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. 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.

View File

@ -24,12 +24,16 @@ include LIB_DIR."/ParsedownExtra.php";
include LIB_DIR."/ParsedownExtraPlus.php"; include LIB_DIR."/ParsedownExtraPlus.php";
include LIB_DIR."/functions.php"; include LIB_DIR."/functions.php";
### Translations
loadlang(LANGUAGE);
global $LANG;
### Security ### Security
testip(); testip();
logprotect(); logprotect();
### Sessions ### Sessions
session_name($_SERVER['SERVER_NAME']); session_name(markdoc);
session_start(); session_start();
/*var_dump($_POST); /*var_dump($_POST);
@ -57,17 +61,17 @@ else if (isset($_POST['action']))
} }
else else
{ {
$content = '<h1>Mot de passe incorrect.</h1>'; $content = '<h1>'.$LANG['BADPASS'].'</h1>';
$log = file_exists(LOG_FILE) ? unserialize(file_get_contents(LOG_FILE)) : array(); $log = file_exists(LOG_DIR) ? unserialize(file_get_contents(LOG_DIR)) : array();
if (isset($log[$_SERVER['REMOTE_ADDR']]) === false) if (isset($log[$_SERVER['REMOTE_ADDR']]) === false)
{ {
$log[$_SERVER['REMOTE_ADDR']] = array('num' => 0, 'time' => 0); $log[$_SERVER['REMOTE_ADDR']] = array('num' => 0, 'time' => 0);
} }
$log[$_SERVER['REMOTE_ADDR']]['num'] += 1; $log[$_SERVER['REMOTE_ADDR']]['num'] += 1;
$log[$_SERVER['REMOTE_ADDR']]['time'] = time(); $log[$_SERVER['REMOTE_ADDR']]['time'] = time();
file_put_contents(LOG_FILE, serialize($log)); file_put_contents(LOG_DIR, serialize($log));
} }
} }
else else
$content='<h1>Aucun mot de passe renseigné !</h1>'; $content='<h1>Aucun mot de passe renseigné !</h1>';
} }
@ -181,15 +185,16 @@ print(($_SESSION['md_admin'] == true)?'<li class="nav-item dropdown">
</ul> </ul>
<form class="form-inline" id="form" name="form" action="/index.php" method="POST"> <form class="form-inline" id="form" name="form" action="/index.php" method="POST">
<input type="hidden" id="action" name="action" value="search"/> <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"/>&nbsp;&nbsp;<input class="btn btn-outline-light" my-2 my-sm-0" value="Sauver" name="save" id="save" type="submit"/>&nbsp;&nbsp;':''); ?> <?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"/>&nbsp;&nbsp;<input class="btn btn-outline-light" my-2 my-sm-0" value="Sauver" name="save" id="save" type="button"/>&nbsp;&nbsp;':''); ?>
<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"/>&nbsp;&nbsp;
<input class="form-control mr-sm-2" type="text" id="search" name="search"/> <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="Chercher" name="submit" id="submit" type="submit"/>
</form> </form>
</div> </div>
</nav> </nav>
</div> </div>
<div class="container-fluid"> <div class="container-fluid">
<div class="float-right d-none d-md-block d-lg-block"><div class="toc fixed-top"></div></div>
<div class="row"> <div class="row">
<div id="files" class="col-xs-12 order-last order-sm-last order-sm-last order-md-first order-lg-first col-md-4 col-lg-2"></div> <div id="files" class="col-xs-12 order-last order-sm-last order-sm-last order-md-first order-lg-first col-md-4 col-lg-2"></div>
<div id="separate" class="bg-dark text-white col-xs-12 col-sm-12 order-3 d-md-none d-lg-none container">Documentations</div> <div id="separate" class="bg-dark text-white col-xs-12 col-sm-12 order-3 d-md-none d-lg-none container">Documentations</div>
@ -199,7 +204,6 @@ print(($_SESSION['md_admin'] == true)?'<li class="nav-item dropdown">
print($content); print($content);
?><br><br> ?><br><br>
</div> </div>
<div id="toc"></div>
<div id="image" class="imagepreview"><img></div><div id="editor"><textarea data-file="" class="form-control"></textarea></div> <div id="image" class="imagepreview"><img></div><div id="editor"><textarea data-file="" class="form-control"></textarea></div>
</div> </div>
</div> </div>
@ -217,6 +221,8 @@ print(($_SESSION['md_admin'] == true)?'<li class="nav-item dropdown">
<script type="text/javascript" src="/js/jstree.min.js"></script> <script type="text/javascript" src="/js/jstree.min.js"></script>
<script type="text/javascript" src="/js/prism.js"></script> <script type="text/javascript" src="/js/prism.js"></script>
<script type="text/javascript" src="/js/emoji.min.js"></script> <script type="text/javascript" src="/js/emoji.min.js"></script>
<script type="text/javascript" src="/js/toc.bundle.js"></script>
<script type="text/javascript" src="/js/magnifik.js"></script>
<?php print(($_SESSION['md_admin'] == true)?'<link rel="stylesheet" href="/css/simplemde.min.css"> <?php print(($_SESSION['md_admin'] == true)?'<link rel="stylesheet" href="/css/simplemde.min.css">
<script src="/js/simplemde.min.js"></script> <script src="/js/simplemde.min.js"></script>
<script type="text/javascript" src="/js/functionsadmin.js"></script>':'<script type="text/javascript" src="/js/functions.js"></script>'); ?> <script type="text/javascript" src="/js/functionsadmin.js"></script>':'<script type="text/javascript" src="/js/functions.js"></script>'); ?>

View File

@ -34,7 +34,8 @@ $(function(){
$("#image").hide(); $("#image").hide();
$("#save").hide(); $("#save").hide();
setTimeout(function(){ $("#forkongithub").fadeOut(1500); }, 5000); setTimeout(function(){ $("#forkongithub").fadeOut(1500); }, 5000);
$("#toc").tocify(); $('#content > p> img').magnifik({ratio:1.0});
tocgenerate();
$("#files").on("select_node.jstree", function (e, nodes) { $("#files").on("select_node.jstree", function (e, nodes) {
file="/"+$("#files").jstree("get_path",nodes.node,"/").replace(/^.+?[/]/, ''); file="/"+$("#files").jstree("get_path",nodes.node,"/").replace(/^.+?[/]/, '');
@ -47,6 +48,11 @@ $(function(){
search($("#search").val()); search($("#search").val());
}); });
$("input[name=toc]").click(function(e) {
e.preventDefault();
tocshow();
});
majlink('head'); majlink('head');
}); });
@ -62,6 +68,8 @@ function openlink(dest,majtree)
majlink('content'); majlink('content');
$(window).scrollTop(0); $(window).scrollTop(0);
if (majtree) searchtree(dest); if (majtree) searchtree(dest);
$('#content > p> img').magnifik({ratio:1.00});
tocgenerate();
}, },
error: function(XMLHttpRequest, textStatus, errorThrown) { error: function(XMLHttpRequest, textStatus, errorThrown) {
if (dest!="special/404.md") if (dest!="special/404.md")
@ -72,6 +80,32 @@ function openlink(dest,majtree)
}); });
} }
function tocgenerate()
{
tocshow();
$('.toc').toc({
'selectors': 'h2,h3,h4',
'container': '#content'
})
$('.toc').append('<i class="fa fa-2x fa-caret-up" aria-hidden="true"></i>');
$('.toc > i').off().hover(function(e) {
e.preventDefault();
tochide();
});
}
function tochide()
{
$('.toc').slideUp()
$('#toc').show();
}
function tocshow()
{
$('.toc').slideDown()
$('#toc').hide();
}
function alertBox(message, className) { function alertBox(message, className) {
$(".alert").removeClass("alert-success alert-warning alert-danger"); $(".alert").removeClass("alert-success alert-warning alert-danger");
$(".alert").html(message).addClass("alert-" + className).fadeIn(); $(".alert").html(message).addClass("alert-" + className).fadeIn();
@ -133,6 +167,7 @@ function search(arg)
Prism.highlightAll(); Prism.highlightAll();
majlink('content'); majlink('content');
$(window).scrollTop(0); $(window).scrollTop(0);
tocgenerate();
}, },
error: function(XMLHttpRequest, textStatus, errorThrown) { error: function(XMLHttpRequest, textStatus, errorThrown) {
if (dest!="special/404.md") if (dest!="special/404.md")

View File

@ -111,6 +111,8 @@ $(function(){
$("#save").hide(); $("#save").hide();
$("#content").html(emoji.replace_colons($("#content").html())); $("#content").html(emoji.replace_colons($("#content").html()));
setTimeout(function(){ $("#forkongithub").fadeOut(1500); }, 5000); setTimeout(function(){ $("#forkongithub").fadeOut(1500); }, 5000);
$('#content > p> img').magnifik({ratio:1.0});
tocgenerate();
$("#files").on("ready.jstree", function (e) { $("#files").on("ready.jstree", function (e) {
const urlParams = new URLSearchParams(window.location.search); const urlParams = new URLSearchParams(window.location.search);
@ -139,10 +141,8 @@ $(function(){
else else
editlink(file) editlink(file)
} }
} }
}); });
$("#save").click(function(e){ $("#save").click(function(e){
e.preventDefault(); e.preventDefault();
@ -182,9 +182,40 @@ $(function(){
search($("#search").val()); search($("#search").val());
}); });
$("input[name=toc]").click(function(e) {
e.preventDefault();
tocshow();
});
majlink('head'); majlink('head');
}); });
function tocgenerate()
{
tocshow();
$('.toc').toc({
'selectors': 'h2,h3,h4',
'container': '#content'
})
$('.toc').append('<i class="fa fa-2x fa-caret-up" aria-hidden="true"></i>');
$('.toc > i').hover(function(e) {
e.preventDefault();
tochide();
});
}
function tochide()
{
$('.toc').slideUp()
$('#toc').show();
}
function tocshow()
{
$('.toc').slideDown()
$('#toc').hide();
}
function alertBox(message, className) { function alertBox(message, className) {
$(".alert").removeClass("alert-success alert-warning alert-danger"); $(".alert").removeClass("alert-success alert-warning alert-danger");
$(".alert").html(message).addClass("alert-" + className).fadeIn(); $(".alert").html(message).addClass("alert-" + className).fadeIn();
@ -270,7 +301,9 @@ function viewmode(data)
if (data !== undefined) { if (data !== undefined) {
$("#content").html(emoji.replace_colons(data)); $("#content").html(emoji.replace_colons(data));
Prism.highlightAll(); Prism.highlightAll();
$('#content > p> img').magnifik({ratio:1.00});
} }
tocgenerate();
majlink('content'); majlink('content');
$(window).scrollTop(0); $(window).scrollTop(0);
$("#editor").hide(); $("#editor").hide();

1
js/magnifik.js Normal file
View File

@ -0,0 +1 @@
!function(){var t=window.Adaptive||{},s=window.Mobify=window.Mobify||{};void 0===t.$&&(s.$=s.$||window.$||window.Zepto||window.jQuery);var i,e,o=t.$||s.$;s.UI=s.UI||{classPrefix:"m-"},s.UI.Magnifik=((e=function(t,s){this.options=o.extend({},e.defaults,s),this.options.classNames=o.extend(i.classNames,this.options.classNames),this.options.imageStyle.width=100*this.options.ratio+"%",this.options.stage||(this.options.stage=o("body"),this.options.global=!0),this.$element=o(t),this.bind()}).defaults=i={stage:void 0,classNames:{zooming:"zooming",close:"close",control:"magnifikControl",canvas:"magnifikCanvas",thumb:"magnifikThumb",full:"magnifikFull"},ratio:2,seekImage:!0,clickCloses:!0,activationEvent:"click",canvasStyle:{position:"absolute",width:"100%",height:"100%",overflow:"auto","-webkit-overflow-scrolling":"touch"},imageStyle:{position:"absolute",top:"0",left:"0",maxWidth:"none",maxHeight:"none"},stageHTML:function(){return'<div class="'+this._getClass("canvas")+'"><img class="'+this._getClass("thumb")+'"><img class="'+this._getClass("full")+'"></div>'},globalStyle:function(){var t="."+this._getClass("zooming");return t+" { overflow: hidden; padding-top:0px}"+t+" > * { display: none !important; }"+t+" > ."+this._getClass("control")+" { display: block !important; }"}},e.prototype.unbind=function(){return this.bind(!0)},e.prototype.makeElems=function(){if(this.$stage=this.options.stage,this.$canvas=o(this.options.stageHTML.call(this)).addClass(this._getClass("control")),this.$canvas.first().css(this.options.canvasStyle),this.$thumb=this.$canvas.find("."+this._getClass("thumb")).css(this.options.imageStyle),this.$full=this.$canvas.find("."+this._getClass("full")).css(this.options.imageStyle),this.options.clickCloses&&this.$canvas.first().addClass(this._getClass("close")),this.options.global){if(!o('style[data-magnifik="'+this._getClass("zooming")+'"]').length){var t=document.createElement("style"),s=this.options.globalStyle.call(this);t.setAttribute("type","text/css"),t.styleSheet?t.styleSheet.cssText=s:t.appendChild(document.createTextNode(s)),o("head")[0].appendChild(t)}}else this.$stage.css("position","relative");var i="."+this._getClass("close");this.$close=this.$canvas.find(i).add(this.$canvas.filter(i)),this.bindClose("bind")},e.prototype.close=function(t){this.isOpen&&(this.isOpen=!1,this.$element.trigger("magnifik:closing"),this.$canvas.detach(),this.$stage.removeClass(this._getClass("zooming")),this.options.global&&(document.body.scrollTop=this.oldScrollTop),this.$element.trigger("magnifik:close"))},e.prototype.open=function(t){if(t.preventDefault(),!this.isOpen){this.isOpen=!0,this.$element.trigger("magnifik:opening"),this.$stage||this.makeElems();var s,i,e=.5,n=.5,a=o(t.target);if("IMG"!==t.target.tagName){var l=this.$element;this.options.seekImage&&(l=l.add(this.$element.parents()));for(var h=0;h<l.length;++h)if((s=o(l[h]).find("img")).length){a=s;break}}else e=t.offsetX/a.prop("offsetWidth"),n=t.offsetY/a.prop("offsetHeight");i=a.filter("[href]").add(a.parent("[href]")).attr("href")||a.attr("src"),this.$thumb.attr("src",a.attr("src")),this.$full.attr("src",i),this.options.global&&(this.oldScrollTop=document.body.scrollTop),this.$stage.append(this.$canvas),this.$stage.addClass(this._getClass("zooming"));var r=a.prop("naturalHeight")/a.prop("naturalWidth"),p=this.$thumb.prop("offsetWidth"),c=this.$canvas.prop("offsetWidth"),d=p,g=this.$canvas.prop("offsetHeight"),f=p*r;this.$canvas.prop("scrollLeft",Math.max(0,Math.min(d-c,d*e-c/2))),this.$canvas.prop("scrollTop",Math.max(0,Math.min(f-g,f*n-g/2))),this.$element.trigger("magnifik:open")}},e.prototype.bindClose=function(t){this.$close&&this.$close[t](this.options.activationEvent,this.boundClose)},e.prototype.bind=function(t){var s=this,i=t?"unbind":"bind";this.boundClose=this.boundClose||function(t){return s.close.apply(s,arguments)},this.boundOpen=this.boundOpen||function(t){return s.open.apply(s,arguments)},this.$element[i](this.options.activationEvent,this.boundOpen),this.bindClose(i)},e.prototype._getClass=function(t){var i=this.options.classPrefix;return void 0===i&&(i=s.UI.classPrefix),i+this.options.classNames[t]},e),o.fn.magnifik=function(t,i){var e="Mobify.UI.Magnifik",n=o.extend({},o.fn.magnifik.defaults);return"object"==typeof t&&(n=t,i=null,t=null),this.each(function(){var a=o(this),l=a.data(e);l||(l=new s.UI.Magnifik(this,n)),t&&(l[t](i),"destroy"===t&&(a.data(e,null),a.$canvas.remove())),a.data(e,l)}),this}}();

1
js/toc.bundle.js Normal file
View File

@ -0,0 +1 @@
!function(t){t.fn.smoothScroller=function(e){e=t.extend({},t.fn.smoothScroller.defaults,e);var o=t(this);return t(e.scrollEl).animate({scrollTop:o.offset().top-t(e.scrollEl).offset().top-e.offset},e.speed,e.ease,function(){var t=o.attr("id");t.length&&(history.pushState?history.pushState(null,null,"#"+t):document.location.hash=t),o.trigger("smoothScrollerComplete")}),this},t.fn.smoothScroller.defaults={speed:400,ease:"swing",scrollEl:"body,html",offset:0},t("body").on("click","[data-smoothscroller]",function(e){e.preventDefault();var o=t(this).attr("href");0===o.indexOf("#")&&t(o).smoothScroller()})}(jQuery),function(t){var e={};t.fn.toc=function(e){var o,r=this,l=t.extend({},jQuery.fn.toc.defaults,e),n=t(l.container),i=t(l.selectors,n),s=[],a=l.activeClass,c=function(e){o&&clearTimeout(o),o=setTimeout(function(){for(var e,o=t(window).scrollTop(),n=Number.MAX_VALUE,i=0,c=0,f=s.length;c<f;c++){var h=Math.abs(s[c]-o);h<n&&(i=c,n=h)}t("li",r).removeClass(a),e=t("li:eq("+i+")",r).addClass(a),l.onHighlight(e)},50)};return l.highlightOnScroll&&(t(window).bind("scroll",c),c()),this.each(function(){var e=t(this),o=t(l.listType);i.each(function(n,i){var f=t(i);s.push(f.offset().top-l.highlightOffset);var h=l.anchorName(n,i,l.prefix);if(i.id!==h)t("<span/>").attr("id",h).insertBefore(f);var u=t("<a/>").text(l.headerText(n,i,f)).attr("href","#"+h).bind("click",function(o){t(window).unbind("scroll",c),function(e,o){if(l.smoothScrolling&&"function"==typeof l.smoothScrolling){e.preventDefault();var n=t(e.target).attr("href");l.smoothScrolling(n,l,o)}t("li",r).removeClass(a),t(e.target).parent().addClass(a)}(o,function(){t(window).bind("scroll",c)}),e.trigger("selected",t(this).attr("href"))}),d=t("<li/>").addClass(l.itemClass(n,i,f,l.prefix)).append(u);o.append(d)}),e.html(o)})},jQuery.fn.toc.defaults={container:"body",listType:"<ul/>",selectors:"h1,h2,h3",smoothScrolling:function(e,o,r){t(e).smoothScroller({offset:o.scrollToOffset}).on("smoothScrollerComplete",function(){r()})},scrollToOffset:0,prefix:"toc",activeClass:"toc-active",onHighlight:function(){},highlightOnScroll:!0,highlightOffset:100,anchorName:function(o,r,l){if(r.id.length)return r.id;var n=t(r).text().replace(/[^a-z0-9]/gi," ").replace(/\s+/g,"-").toLowerCase();if(e[n]){for(var i=2;e[n+i];)i++;n=n+"-"+i}return e[n]=!0,l+"-"+n},headerText:function(t,e,o){return o.text()},itemClass:function(t,e,o,r){return r+"-"+o[0].tagName.toLowerCase()}}}(jQuery);

26
lang/en.json Normal file
View File

@ -0,0 +1,26 @@
{
"MENU": "Menu",
"HOME" : "Home",
"GLOSSARY" : "Glossary",
"MARKDOC" : "About MarKdoc",
"ADMIN" : "Admin",
"ABOUT" : "About...",
"SEARCH" : "Search",
"VIEW" : "View",
"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>",
"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."
}

View File

@ -1,24 +0,0 @@
<?php
$lang['MENU'] ='Menu';
$lang['HOME'] ='Home';
$lang['GLOSSARY'] ='Glossary';
$lang['MARKDOC'] ='About MarKdoc';
$lang['ADMIN'] ='Admin';
$lang['ABOUT'] ='About...';
$lang['SEARCH' ]='Search';
$lang['VIEW'] ='View';
$lang['SAVE'] ='Save';
$lang['LOGIN'] ='Login';
$lang['NOPASS'] ='No password is given !';
$lang['ALREADYLOG'] ='You\'re already connected !';
$lang['BADPASS'] ='The password is incorrect !';
$lang['FOUND'] ='Search results</h1><p>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.'

26
lang/fr.json Normal file
View File

@ -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" : "<h1>Résultats de recherche</h1><p>Il y a %s occurence(s) trouvée(s):</p>",
"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."
}

View File

@ -1,15 +0,0 @@
<?php
$lang['MENU'] ='Menu';
$lang['HOME'] ='Accueil';
$lang['GLOSSARY'] ='Glossaire';
$lang['MARKDOC'] ='A propos de MarKdoc';
$lang['ADMIN'] ='Admin';
$lang['ABOUT'] ='A propos';
$lang['SEARCH' ]='Rechercher';
$lang['VIEW'] ='Voir';
$lang['SAVE'] ='Sauver';
$lang['LOGIN'] ='Se connecter';
$lang['NOPASS'] ='Aucun mot de passe n\'a été saisi !';
$lang['ALREADYLOG'] ='Vous êtes déjà connecté !';
$lang['BADPASS'] ='Le mot de passe est incorrect !';
$lang['FOUND'] ='Résultats de recherche</h1><p>Il y a %s occurence(s) trouvée(s):'

View File

@ -178,15 +178,21 @@ function searchstr($path, $string){
return array('files' => $files, 'totalFiles' => $totalFiles); 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) function history($file)
{ {
if (is_numeric(MAX_HISTORY_FILES) && MAX_HISTORY_FILES > 0) { 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_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) { foreach ([HISTORY_DIR, $file_history_dir] as $dir) {
if (file_exists($dir) === false || is_dir($dir) === false) { if (file_exists($dir) === false || is_dir($dir) === false) {
mkdir($dir); mkdir($dir,0755,true);
} }
} }
$history_files = scandir($file_history_dir); $history_files = scandir($file_history_dir);
@ -199,14 +205,15 @@ function history($file)
if (count($history_files) >= MAX_HISTORY_FILES) { if (count($history_files) >= MAX_HISTORY_FILES) {
foreach ($history_files as $key => $history_file) { foreach ($history_files as $key => $history_file) {
if ($key < 1) { if ($key < 1) {
unlink($file_history_dir . DS . $history_file); unlink($file_history_dir . '/' . $history_file);
unset($history_files[$key]); unset($history_files[$key]);
} else { } 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)) else if (is_writable($file))
{ {
file_put_contents($file, $data); file_put_contents($file, $data);
//history($file); history($file);
$content='success|Fichier enregistré.'; $content='success|Fichier enregistré.';
} }
else if (!is_writable($file)) else if (!is_writable($file))

View File

@ -7,7 +7,7 @@ This website is heavily formated with markdown format !
__ __ _ _____ __ __ _ _____
| \/ | | | | __ \ | \/ | | | | __ \
| \ / | __ _ _ __| | _| | | | ___ ___ | \ / | __ _ _ __| | _| | | | ___ ___
| |\/| |/ _` | \'__| |/ / | | |/ _ \ / __| | |\/| |/ _` | '__| |/ / | | |/ _ \ / __|
| | | | (_| | | | <| |__| | (_) | (__ | | | | (_| | | | <| |__| | (_) | (__
|_| |_|\__,_|_| |_|\_\_____/ \___/ \___| |_| |_|\__,_|_| |_|\_\_____/ \___/ \___|
``` ```