Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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']))
{
Expand Down
13 changes: 9 additions & 4 deletions js/zerobin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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() {
Expand All @@ -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();

Expand Down Expand Up @@ -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();
Expand Down
9 changes: 7 additions & 2 deletions tpl/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,13 @@ <h3>{$VERSION}</h3>
<button id="rawtextbutton" onclick="rawText();return false;" style="display:none; "><img src="img/icon_raw.png#" width="15" height="15" style="padding:1px 0px 1px 0px;"/>Raw text</button>
<div id="expiration" style="display:none;">Expires:
<select id="pasteExpiration" name="pasteExpiration">
<option value="10sec">10 seconds</option>
<option value="5min">5 minutes</option>
<option value="10min">10 minutes</option>
<option value="1hour">1 hour</option>
<option value="1hour" selected="selected">1 hour</option>
<option value="1day">1 day</option>
<option value="1week">1 week</option>
<option value="1month" selected="selected">1 month</option>
<option value="1month">1 month</option>
<option value="1year">1 year</option>
<option value="never">Never</option>
</select>
Expand All @@ -72,6 +73,10 @@ <h3>{$VERSION}</h3>
<input type="checkbox" id="syntaxcoloring" name="syntaxcoloring" />
<label for="syntaxcoloring">Syntax coloring</label>
</div>
<div id="syntaxcoloringoption" class="button" style="display:none;">
<input type="checkbox" id="Confidential" name="Confidential" />
<label for="Confidential">Confidential</label>
</div>
</div>
<div id="pasteresult" style="display:none;">
<div id="deletelink"></div>
Expand Down