mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-05-17 05:42:20 -04:00
switching to full JSON API without POST array use, ensure all JSON operations are done with error detection
This commit is contained in:
parent
be1e7babc0
commit
cc1c55129f
14 changed files with 187 additions and 103 deletions
|
@ -154,6 +154,7 @@ class Controller
|
|||
* initialize PrivateBin
|
||||
*
|
||||
* @access private
|
||||
* @throws Exception
|
||||
*/
|
||||
private function _init()
|
||||
{
|
||||
|
@ -206,7 +207,6 @@ class Controller
|
|||
);
|
||||
}
|
||||
|
||||
// Ensure content is not too big.
|
||||
$data = $this->_request->getData();
|
||||
$isComment = array_key_exists('pasteid', $data) &&
|
||||
!empty($data['pasteid']) &&
|
||||
|
@ -216,6 +216,7 @@ class Controller
|
|||
return $this->_return_message(1, 'Invalid data.');
|
||||
}
|
||||
$sizelimit = $this->_conf->getKey('sizelimit');
|
||||
// Ensure content is not too big.
|
||||
if (strlen($data['ct']) > $sizelimit) {
|
||||
return $this->_return_message(
|
||||
1,
|
||||
|
@ -432,6 +433,6 @@ class Controller
|
|||
$result['url'] = $this->_urlBase . '?' . $message;
|
||||
}
|
||||
$result += $other;
|
||||
$this->_json = json_encode($result);
|
||||
$this->_json = Json::encode($result);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue