adding option to hide clone button on expiring pastes, resolves #34

This commit is contained in:
El RIDO
2015-10-18 17:56:45 +02:00
parent f96b0c0afe
commit ca07398b66
8 changed files with 26 additions and 9 deletions

View File

@@ -46,6 +46,7 @@ class configuration
),
'expire' => array(
'default' => '1week',
'clone' => true,
),
'expire_options' => array(
'5min' => 300,

View File

@@ -47,6 +47,14 @@ class zerobin
*/
private $_data = '';
/**
* does the paste expire
*
* @access private
* @var bool
*/
private $_doesExpire = false;
/**
* formatter
*
@@ -354,7 +362,9 @@ class zerobin
$paste = $this->_model->getPaste($dataid);
if ($paste->exists())
{
$this->_data = json_encode($paste->get());
$data = $paste->get();
$this->_doesExpire = property_exists($data, 'meta') && property_exists($data->meta, 'expire_date');
$this->_data = json_encode($data);
}
else
{
@@ -434,6 +444,7 @@ class zerobin
$page->assign('LANGUAGES', i18n::getLanguageLabels(i18n::getAvailableLanguages()));
$page->assign('EXPIRE', $expire);
$page->assign('EXPIREDEFAULT', $this->_conf->getKey('default', 'expire'));
$page->assign('EXPIRECLONE', !$this->_doesExpire || ($this->_doesExpire && $this->_conf->getKey('clone', 'expire')));
$page->draw($this->_conf->getKey('template'));
}