"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:
committed by
El RIDO
parent
1b95d6fff7
commit
cff4d99f05
@@ -191,15 +191,24 @@ 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'])) {
|
||||
$expire = $this->_conf['expire_options'][$_POST['expire']];
|
||||
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']];
|
||||
}
|
||||
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']))
|
||||
@@ -320,16 +329,16 @@ class zerobin
|
||||
$this->_return_message(1, 'Server error.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an existing paste
|
||||
*
|
||||
* @access private
|
||||
/**
|
||||
* Delete an existing paste
|
||||
*
|
||||
* @access private
|
||||
* @param string $dataid
|
||||
* @param string $deletetoken
|
||||
* @return void
|
||||
*/
|
||||
private function _delete($dataid, $deletetoken)
|
||||
{
|
||||
* @return void
|
||||
*/
|
||||
private function _delete($dataid, $deletetoken)
|
||||
{
|
||||
// Is this a valid paste identifier?
|
||||
if (preg_match('\A[a-f\d]{16}\z', $dataid))
|
||||
{
|
||||
@@ -428,12 +437,12 @@ class zerobin
|
||||
private function _view()
|
||||
{
|
||||
// set headers to disable caching
|
||||
$time = gmdate('D, d M Y H:i:s \G\M\T');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Pragma: no-cache');
|
||||
header('Expires: ' . $time);
|
||||
header('Last-Modified: ' . $time);
|
||||
header('Vary: Accept');
|
||||
$time = gmdate('D, d M Y H:i:s \G\M\T');
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Pragma: no-cache');
|
||||
header('Expires: ' . $time);
|
||||
header('Last-Modified: ' . $time);
|
||||
header('Vary: Accept');
|
||||
|
||||
// label all the expiration options
|
||||
$expire = array();
|
||||
|
||||
Reference in New Issue
Block a user