Commit cf918996 authored by Erase's avatar Erase

Adds a JS bug display management

parent 1591c924
......@@ -7,7 +7,7 @@
//~ Check token
session_start();
if(empty($_SESSION['csrf_token'])){
$_SESSION['csrf_token'] = uniqid(rand(), true);
$_SESSION['csrf_token'] = uniqid(mt_rand(), true);
}
$headers = apache_request_headers();
......@@ -79,7 +79,7 @@
'_badWords' => \Config::get('_badWords')
));
$conf_name = str_replace('.', '', uniqid(rand(), true));
$conf_name = str_replace('.', '', uniqid(mt_rand(), true));
$path = TL_ROOT . '/../../c/';
if(file_put_contents($path.$conf_name, $conf_storage)){
......
<?php
<?php
//~ Include RSS Fusion
require_once 'vendor/RSS-Fusion/index.php';
//~ Generate token
session_start();
if(empty($_SESSION['csrf_token'])) {
......@@ -61,11 +64,8 @@
<div class="contact-form shadow" id="form">
<form id="contact_form" method="POST" action="" accept-charset="UTF-8">
<fieldset class="full-form">
<label for="flux">URL des flux RSS à fusionner(*)</label>
<label for="flux">URL des flux RSS à fusionner (un lien par ligne)</label>
<textarea id="flux" name="flux"></textarea>
<span class="note">
(*) Un lien par ligne
</span>
</fieldset>
<div class="clear"></div>
......@@ -121,6 +121,11 @@
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/modernizr.custom.js" type="text/javascript"></script>
<script src="js/jquery.scrollTo-1.4.3.1.js" type="text/javascript"></script>
<?php if(\Config::get('displayErrors')) : ?>
<script>
var debugShow = true;
</script>
<?php endif;?>
<script src="js/custom.js" type="text/javascript"></script>
</body>
</html>
\ No newline at end of file
......@@ -40,6 +40,17 @@ $(document).ready(function(){
},
statusCode: {
404: function() {
show_error("La page cible est introuvable.");
},
500: function(){
show_error("Erreur serveur sur la page cible.");
},
204: function(){
show_error("Aucun retour serveur");
}
},
error: function(){
show_msg("Impossible de réaliser le traitement distant.");
}
......@@ -60,3 +71,43 @@ function show_msg(msg) {
}
$('#ajax-message').css('display','block').html(msg);
}
function show_error(msg){
if(typeof(debugShow) !== 'undefined' && debugShow){
$('.modal-background').remove();
$('body').append('<div class="modal-background"><div class="modal-body"><h2 style="font-weight:bold;text-decoration:underline;font-size:120%;margin-bottom:12px;">Une erreur est survenue :</h2><pre>'+msg+'</pre></div></div>');
$('.modal-background')
.css({
'position': 'fixed',
'left': 0,
'top': 0,
'right': 0,
'bottom': 0,
'background': 'rgba(0, 0, 0, 0.75)',
'display': 'none',
'cursor':'pointer'
})
.fadeIn()
.click(function(){
$(this).fadeOut().find('.modal-body').slideUp();
})
.find('.modal-body')
.css({
'position': 'fixed',
'width': '350px',
'height': '200px',
'left': '50%',
'top': '50%',
'margin-left': '-195px',
'margin-top': '-170px',
'background': '#fff',
'display': 'none',
'padding': '15px',
'cursor': 'default'
})
.click(function(event){
event.stopPropagation();
})
.slideDown();
}
}
\ No newline at end of file
......@@ -16,7 +16,7 @@
*/
$GLOBALS['TL_CONFIG']['characterSet'] = 'utf-8';
$GLOBALS['TL_CONFIG']['displayErrors'] = false;
$GLOBALS['TL_CONFIG']['displayErrors'] = true;
$GLOBALS['TL_CONFIG']['logErrors'] = true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment