mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2026-01-23 02:35:23 +00:00
Merge branch 'master' into webcrypto
This commit is contained in:
commit
e418b083e8
11 changed files with 173 additions and 35 deletions
|
|
@ -72,6 +72,27 @@ class Request
|
|||
*/
|
||||
private $_isJsonApi = false;
|
||||
|
||||
/**
|
||||
* Return the paste ID of the current paste.
|
||||
*
|
||||
* @access private
|
||||
* @return string
|
||||
*/
|
||||
private function getPasteId()
|
||||
{
|
||||
// RegEx to check for valid paste ID (16 base64 chars)
|
||||
$pasteIdRegEx = '/^[a-f0-9]{16}$/';
|
||||
|
||||
foreach ($_GET as $key => $value) {
|
||||
// only return if value is empty and key matches RegEx
|
||||
if (($value === '') and preg_match($pasteIdRegEx, $key, $match)) {
|
||||
return $match[0];
|
||||
}
|
||||
}
|
||||
|
||||
return 'invalid id';
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
|
@ -100,7 +121,7 @@ class Request
|
|||
array_key_exists('QUERY_STRING', $_SERVER) &&
|
||||
!empty($_SERVER['QUERY_STRING'])
|
||||
) {
|
||||
$this->_params['pasteid'] = $_SERVER['QUERY_STRING'];
|
||||
$this->_params['pasteid'] = $this->getPasteId();
|
||||
}
|
||||
|
||||
// prepare operation, depending on current parameters
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue