adding option to hide clone button on expiring pastes, resolves #34
This commit is contained in:
@@ -46,6 +46,7 @@ class configuration
|
||||
),
|
||||
'expire' => array(
|
||||
'default' => '1week',
|
||||
'clone' => true,
|
||||
),
|
||||
'expire_options' => array(
|
||||
'5min' => 300,
|
||||
|
||||
@@ -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'));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user