diff --git a/index.php b/index.php index 8e8bdf81..207d1d92 100644 --- a/index.php +++ b/index.php @@ -176,7 +176,8 @@ function deletePaste($pasteid) if (!empty($_POST['expire'])) { $expire=$_POST['expire']; - if ($expire=='5min') $meta['expire_date']=time()+5*60; + if ($expire=='10sec') $meta['expire_date']=time()+10; + elseif ($expire=='5min') $meta['expire_date']=time()+5*60; elseif ($expire=='10min') $meta['expire_date']=time()+10*60; elseif ($expire=='1hour') $meta['expire_date']=time()+60*60; elseif ($expire=='1day') $meta['expire_date']=time()+24*60*60; @@ -209,9 +210,20 @@ function deletePaste($pasteid) if ($syntaxcoloring!='0') { $meta['syntaxcoloring']=true; } } + // If confidential mode, we cannot change anything + if (!empty($_POST['confidential'])) + { + $confidential = $_POST['confidential']; + if ($confidential!='0' && $confidential!='1') { $error=true; } + if ($confidential!='0') { $meta['confidential']=true; } + } + // You can't have an open discussion on a "Burn after reading" paste: if (isset($meta['burnafterreading'])) unset($meta['opendiscussion']); + // Everything is disable on confidential mode + if (isset($meta['confidential'])) unset($meta['opendiscussion']); + // Optional nickname for comments if (!empty($_POST['nickname'])) { diff --git a/js/zerobin.js b/js/zerobin.js index 2b2497ff..5940234e 100644 --- a/js/zerobin.js +++ b/js/zerobin.js @@ -201,6 +201,8 @@ function displayMessages(key, comments) { setElementText($('div#cleartext'), cleartext); urls2links($('div#cleartext')); // Convert URLs to clickable links. + if (comments[0].meta.confidential) $('button#clonebutton').hide(); + // comments[0] is the paste itself. if (comments[0].meta.syntaxcoloring) applySyntaxColoring(); @@ -346,7 +348,8 @@ function send_data() { expire: $('select#pasteExpiration').val(), burnafterreading: $('input#burnafterreading').is(':checked') ? 1 : 0, opendiscussion: $('input#opendiscussion').is(':checked') ? 1 : 0, - syntaxcoloring: $('input#syntaxcoloring').is(':checked') ? 1 : 0 + syntaxcoloring: $('input#syntaxcoloring').is(':checked') ? 1 : 0, + confidential: $('input#confidential').is(':checked') ? 1 : 0 }; $.post(scriptLocation(), data_to_send, 'json') .error(function() { @@ -366,7 +369,8 @@ function send_data() { setElementText($('div#cleartext'), $('textarea#message').val()); urls2links($('div#cleartext')); - + // Don't clone if confidential + if ($('input#confidential').is(':checked')) $('button#clonebutton').hide(); // FIXME: Add option to remove syntax highlighting ? if ($('input#syntaxcoloring').is(':checked')) applySyntaxColoring(); @@ -430,13 +434,14 @@ function stateNewPaste() { function stateExistingPaste() { $('button#sendbutton').hide(); - // No "clone" for IE<10. - if ($('div#oldienotice').is(":visible")) { + // No "clone" for IE<10. + if ($('div#oldienotice').is(":visible") ) { $('button#clonebutton').hide(); } else { $('button#clonebutton').show(); } + $('button#rawtextbutton').show(); $('div#expiration').hide(); diff --git a/tpl/page.html b/tpl/page.html index 5499847f..c24f1be5 100644 --- a/tpl/page.html +++ b/tpl/page.html @@ -49,12 +49,13 @@