mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-25 12:31:06 -05:00
API respects validation rules
This commit is contained in:
parent
5b288c6511
commit
df134cdbac
@ -37,6 +37,8 @@ class Api extends Main
|
||||
function create()
|
||||
{
|
||||
$this->load->model('pastes');
|
||||
$this->load->library('form_validation'); //needed by parent class
|
||||
|
||||
|
||||
if (!$this->input->post('text'))
|
||||
{
|
||||
@ -56,6 +58,20 @@ class Api extends Main
|
||||
{
|
||||
$_POST['private'] = 1;
|
||||
}
|
||||
|
||||
//validations
|
||||
|
||||
if (!$this->_valid_ip())
|
||||
{
|
||||
die("You are not allowed to paste\n");
|
||||
}
|
||||
|
||||
if (!$this->_blockwords_check())
|
||||
{
|
||||
die("Your paste contains blocked words\n");
|
||||
}
|
||||
|
||||
//create paste
|
||||
$paste_url = $this->pastes->createPaste();
|
||||
$data['msg'] = base_url() . $paste_url;
|
||||
$this->load->view('view/api', $data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user