mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-03-22 13:10:41 +08:00
"Burn after reading" as a checkbox
"Burn after reading" option has been moved out of Expiration combo to a separate checkbox. Reason is: You can prevent a read-once paste to be available ad vitam eternam on the net. (cherry picked from commit 190b278402c086ebc4d1a78aae27d1e2666e3e7a) Conflicts: css/zerobin.css index.php js/zerobin.js tpl/page.html
This commit is contained in:
parent
1b95d6fff7
commit
cff4d99f05
|
@ -178,7 +178,7 @@ button img {
|
|||
top: 2px;
|
||||
}
|
||||
|
||||
#expiration, #language, #opendisc {
|
||||
#expiration, #language, #burnafterreadingoption, #opendisc {
|
||||
background-color: #414d5a;
|
||||
padding: 6px 8px;
|
||||
margin: 0 5px 0 0;
|
||||
|
|
|
@ -319,6 +319,7 @@ function send_data() {
|
|||
var cipherdata = zeroCipher(randomkey, $('textarea#message').val());
|
||||
var data_to_send = { data: cipherdata,
|
||||
expire: $('select#pasteExpiration').val(),
|
||||
burnafterreading: $('input#burnafterreading').is(':checked') ? 1 : 0,
|
||||
opendiscussion: $('input#opendiscussion').is(':checked') ? 1 : 0
|
||||
};
|
||||
$.post(scriptLocation(), data_to_send, 'json')
|
||||
|
@ -384,6 +385,7 @@ function stateNewPaste() {
|
|||
$('div#remainingtime').addClass('hidden');
|
||||
$('div#language').addClass('hidden'); // $('#language').removeClass('hidden');
|
||||
$('input#password').addClass('hidden'); //$('#password').removeClass('hidden');
|
||||
$('div#burnafterreadingoption').removeClass('hidden');
|
||||
$('div#opendisc').removeClass('hidden');
|
||||
$('button#newbutton').removeClass('hidden');
|
||||
$('div#pasteresult').addClass('hidden');
|
||||
|
@ -412,6 +414,7 @@ function stateExistingPaste() {
|
|||
$('div#expiration').addClass('hidden');
|
||||
$('div#language').addClass('hidden');
|
||||
$('input#password').addClass('hidden');
|
||||
$('div#burnafterreadingoption').addClass('hidden');
|
||||
$('div#opendisc').addClass('hidden');
|
||||
$('button#newbutton').removeClass('hidden');
|
||||
$('div#pasteresult').addClass('hidden');
|
||||
|
@ -523,9 +526,11 @@ $(function() {
|
|||
// hide "no javascript" message
|
||||
$('#noscript').hide();
|
||||
|
||||
$('select#pasteExpiration').change(function() {
|
||||
if ($(this).val() == 'burn') {
|
||||
// If "burn after reading" is checked, disable discussion.
|
||||
$('input#burnafterreading').change(function() {
|
||||
if ($(this).is(':checked') ) {
|
||||
$('div#opendisc').addClass('buttondisabled');
|
||||
$('input#opendiscussion').attr({checked: false});
|
||||
$('input#opendiscussion').attr('disabled',true);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -191,9 +191,7 @@ class zerobin
|
|||
// Read expiration date
|
||||
if (!empty($_POST['expire']))
|
||||
{
|
||||
if ($_POST['expire'] == 'burn') {
|
||||
$meta['burnafterreading'] = true;
|
||||
} elseif (array_key_exists($_POST['expire'], $this->_conf['expire_options'])) {
|
||||
if (array_key_exists($_POST['expire'], $this->_conf['expire_options'])) {
|
||||
$expire = $this->_conf['expire_options'][$_POST['expire']];
|
||||
} else {
|
||||
$expire = $this->_conf['expire_options'][$this->_conf['expire']['default']];
|
||||
|
@ -201,6 +199,17 @@ class zerobin
|
|||
if ($expire > 0) $meta['expire_date'] = time() + $expire;
|
||||
}
|
||||
|
||||
// Destroy the paste when it is read.
|
||||
if (!empty($_POST['burnafterreading']))
|
||||
{
|
||||
$burnafterreading = $_POST['burnafterreading'];
|
||||
if ($burnafterreading != '0')
|
||||
{
|
||||
if ($burnafterreading != '1') $error = true;
|
||||
$meta['burnafterreading'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Read open discussion flag.
|
||||
if ($this->_conf['main']['opendiscussion'] && !empty($_POST['opendiscussion']))
|
||||
{
|
||||
|
|
|
@ -49,10 +49,10 @@
|
|||
<button id="newbutton" onclick="window.location.href=scriptLocation();return false;" class="hidden"><img src="img/icon_new.png#" width="11" height="15" alt="" />New</button>
|
||||
<button id="sendbutton" onclick="send_data();return false;" class="hidden"><img src="img/icon_send.png#" width="18" height="15" alt="" />Send</button>
|
||||
<button id="clonebutton" onclick="clonePaste();return false;" class="hidden"><img src="img/icon_clone.png#" width="15" height="17" alt="" />Clone</button>
|
||||
<div id="expiration" class="hidden">Expire:
|
||||
<div id="expiration" class="hidden">Expires:
|
||||
<select id="pasteExpiration" name="pasteExpiration">
|
||||
<option value="burn"{if="$BURNAFTERREADINGSELECTED"} selected="selected"{/if}>Burn after reading</option>{loop="EXPIRE"}
|
||||
<option value="{$key}"{if="!$BURNAFTERREADINGSELECTED && $key == $EXPIREDEFAULT"} selected="selected"{/if}>{$value}</option>{/loop}
|
||||
{loop="EXPIRE"}
|
||||
<option value="{$key}"{if="$key == $EXPIREDEFAULT"} selected="selected"{/if}>{$value}</option>{/loop}
|
||||
</select>
|
||||
</div>
|
||||
<div id="remainingtime" class="hidden"></div>
|
||||
|
@ -64,6 +64,10 @@
|
|||
<option value="python">Python</option>
|
||||
</select>
|
||||
</div>
|
||||
<div id="burnafterreadingoption" class="button" style="display:none;">
|
||||
<input type="checkbox" id="burnafterreading" name="burnafterreading" {if="$BURNAFTERREADINGSELECTED"} checked="checked"{/if} />
|
||||
<label for="burnafterreading">Burn after reading</label>
|
||||
</div>
|
||||
<input id="password" value="Optional password..." class="hidden" />
|
||||
<div id="opendisc" class="button hidden">
|
||||
<input type="checkbox" id="opendiscussion" name="opendiscussion" {if="!$OPENDISCUSSION"} disabled="disabled"{/if} />
|
||||
|
|
Loading…
Reference in New Issue
Block a user