diff options
| author | asiekierka <asiekierka@gmail.com> | 2012-12-23 18:37:44 +0100 |
|---|---|---|
| committer | asiekierka <asiekierka@gmail.com> | 2012-12-23 18:37:44 +0100 |
| commit | 94e472438c1ae917a4b18d7a781459c0d226c4b8 (patch) | |
| tree | d8830de5c4b4e2a81a9620832f1a47849202a303 | |
| parent | 89cb25faa900d87777b137a6f8cd565505ba5d8f (diff) | |
pasek atencji ukonczony
| -rw-r--r-- | atencja.php | 12 | ||||
| -rw-r--r-- | inc/config.php | 6 | ||||
| -rw-r--r-- | js/pasek_atencji.js | 8 | ||||
| -rw-r--r-- | templates/pasek_atencji.html | 9 |
4 files changed, 25 insertions, 10 deletions
diff --git a/atencja.php b/atencja.php index 34737c22..edbfad89 100644 --- a/atencja.php +++ b/atencja.php @@ -1,10 +1,10 @@ <?php require_once 'inc/functions.php'; checkBan(); // Wazne! - // Zwroc stare dane atencji - print file_get_contents("atencja.txt"); - // inb4 XSS - if(strlen($_POST["atencja"])>0) file_put_contents("atencja.txt",$_POST["atencja"]); - if(strlen($_SERVER['HTTP_REFERER'])>0) { header('Location: ' . $_SERVER['HTTP_REFERER']); } - else { header('Location: /'); } + if(@strlen($_POST["tekst"])>0) { + file_put_contents("atencja.txt",$_POST["tekst"]); + if(strlen($_SERVER['HTTP_REFERER'])>0) { header('Location: ' . $_SERVER['HTTP_REFERER']); } + else { header('Location: /'); } + } else print(file_get_contents("atencja.txt")); + return; ?> diff --git a/inc/config.php b/inc/config.php index 49cb137b..9d4532c5 100644 --- a/inc/config.php +++ b/inc/config.php @@ -499,7 +499,11 @@ // How many reports you can create in the same request. $config['report_limit'] = 3; - + + // Pasek atencji + // REMEMBER TO CHMOD atencja.txt PROPERLY + // Oh, and add jQuery in additional_javascript. + $config['pasek_atencji'] = false; /* * ==================== * Display settings diff --git a/js/pasek_atencji.js b/js/pasek_atencji.js new file mode 100644 index 00000000..26b3b8d9 --- /dev/null +++ b/js/pasek_atencji.js @@ -0,0 +1,8 @@ +$(document).ready(function(){ + $("#pasek_atencji").click(function(eO){ $("#pasek_atencji").css("display","none"); + $("#pasek_atencji_forma").css("display","block"); }); + $.get("/atencja.php", function(data) { + $("#pasek_atencji").text(data); + $("#pasek_atencji_input").val(data); + }); +}); diff --git a/templates/pasek_atencji.html b/templates/pasek_atencji.html index d54f334d..98f2e29b 100644 --- a/templates/pasek_atencji.html +++ b/templates/pasek_atencji.html @@ -1,9 +1,12 @@ {% if config.pasek_atencji %} -<div id="pasek_atencji" style="height: 1.5em; width: 90%; text-align: center; display: block;"> +<div id="pasek_atencji" style="height: 1.5em; width: 100%; padding: 0; margin: 0; text-align: center; display: block; onclick="pasekAtencjiKliku();"> </div> -<form method="post" action="/atencja.php" id="pasek_atencji_forma" style="display: none;"> - <input name="tekst" style="width: 90%; text-align: center;" value="" type="text"> +<form method="post" action="/atencja.php" id="pasek_atencji_forma" style="display: none; padding: 0; margin: 0;"> + <input id="pasek_atencji_input" name="tekst" style="width: 100%; padding: 0; margin: 0; text-align: center;" value="" type="text"> </form> +<style> +#pasek_atencji:hover { background-color: #fff; opacity: 0.8; } +</style> <script type="text/javascript" src="/js/pasek_atencji.js"></script> {% endif %} |
