mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-25 20:41:20 -05:00
parent
72e30a99c5
commit
b4291a1940
@ -104,12 +104,21 @@ class Pastes extends CI_Model
|
||||
}
|
||||
}
|
||||
while ($n == 0);
|
||||
$burn = false;
|
||||
|
||||
if ($this->input->post('expire') == 0)
|
||||
if ($this->input->post('expire') == '0')
|
||||
{
|
||||
$data['expire'] = 0;
|
||||
}
|
||||
else
|
||||
if ($this->input->post('expire') == 'burn')
|
||||
{
|
||||
$burn = true;
|
||||
$data['toexpire'] = 1;
|
||||
$data['expire'] = 0;
|
||||
$data['private'] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$format = 'Y-m-d H:i:s';
|
||||
$data['toexpire'] = 1;
|
||||
@ -128,7 +137,16 @@ class Pastes extends CI_Model
|
||||
}
|
||||
$data['ip_address'] = $this->input->ip_address();
|
||||
$this->db->insert('pastes', $data);
|
||||
return 'view/' . $data['pid'];
|
||||
|
||||
if ($burn)
|
||||
{
|
||||
echo 'copy this URL, it will become invalid on visit: ' . site_url('view/' . $data['pid']);
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 'view/' . $data['pid'];
|
||||
}
|
||||
}
|
||||
private
|
||||
function _get_url($pid)
|
||||
@ -235,6 +253,8 @@ class Pastes extends CI_Model
|
||||
$data['lang'] = $this->languages->code_to_description($row['lang']);
|
||||
$data['paste'] = $this->process->syntax(htmlspecialchars_decode($row['raw']) , $row['lang']);
|
||||
$data['created'] = $row['created'];
|
||||
$data['expire'] = $row['expire'];
|
||||
$data['toexpire'] = $row['toexpire'];
|
||||
$data['url'] = $this->_get_url($row['pid']);
|
||||
$data['raw'] = $row['raw'];
|
||||
$data['hits'] = $row['hits'];
|
||||
@ -358,6 +378,13 @@ class Pastes extends CI_Model
|
||||
{
|
||||
$this->calculate_hits($pid, $data['hits']);
|
||||
}
|
||||
|
||||
//burn if necessary
|
||||
|
||||
if ($data['expire'] == 0 and $data['toexpire'] == 1)
|
||||
{
|
||||
$this->delete_paste($data['pid']);
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,9 @@
|
||||
</label>
|
||||
<?php
|
||||
$expire_extra = 'id="expire" class="select" tabindex="7"';
|
||||
$default_expiration = '10080'; // 1 week
|
||||
$options = array(
|
||||
"burn" => lang('burn_on_reading'),
|
||||
"5" => lang('exp_5min'),
|
||||
"60" => lang('exp_1h'),
|
||||
"1440" => lang('exp_1d'),
|
||||
@ -102,8 +104,9 @@
|
||||
);
|
||||
if(! config_item('disable_keep_forever')) {
|
||||
$options['0'] = lang('exp_forever');
|
||||
$default_expiration = '0'; // forever
|
||||
}
|
||||
echo form_dropdown('expire', $options, $expire_set, $expire_extra); ?>
|
||||
echo form_dropdown('expire', $options, $default_expiration, $expire_extra); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -90,7 +90,9 @@
|
||||
</label>
|
||||
<?php
|
||||
$expire_extra = 'id="expire" class="select" tabindex="7"';
|
||||
$default_expiration = '10080'; // 1 week
|
||||
$options = array(
|
||||
"burn" => lang('burn_on_reading'),
|
||||
"5" => lang('exp_5min'),
|
||||
"60" => lang('exp_1h'),
|
||||
"1440" => lang('exp_1d'),
|
||||
@ -100,8 +102,9 @@
|
||||
);
|
||||
if(! config_item('disable_keep_forever')) {
|
||||
$options['0'] = lang('exp_forever');
|
||||
$default_expiration = '0'; // forever
|
||||
}
|
||||
echo form_dropdown('expire', $options, $expire_set, $expire_extra); ?>
|
||||
echo form_dropdown('expire', $options, $default_expiration, $expire_extra); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user