mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-03-22 13:10:41 +08:00
Put PHP paste request into own function
This commit is contained in:
parent
6beea8f2f4
commit
541fff199a
|
@ -72,6 +72,19 @@ class Request
|
||||||
*/
|
*/
|
||||||
private $_isJsonApi = false;
|
private $_isJsonApi = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the paste ID of the current paste.
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
private function getPasteId()
|
||||||
|
{
|
||||||
|
return preg_match(
|
||||||
|
'/[a-f0-9]{16}/', $_SERVER['QUERY_STRING'], $match
|
||||||
|
) ? $match[0] : 'invalid id';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
|
@ -100,9 +113,7 @@ class Request
|
||||||
array_key_exists('QUERY_STRING', $_SERVER) &&
|
array_key_exists('QUERY_STRING', $_SERVER) &&
|
||||||
!empty($_SERVER['QUERY_STRING'])
|
!empty($_SERVER['QUERY_STRING'])
|
||||||
) {
|
) {
|
||||||
$this->_params['pasteid'] = preg_match(
|
$this->_params['pasteid'] = $this->getPasteId();
|
||||||
'/[a-f0-9]{16}/', $_SERVER['QUERY_STRING'], $match
|
|
||||||
) ? $match[0] : 'invalid id';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// prepare operation, depending on current parameters
|
// prepare operation, depending on current parameters
|
||||||
|
|
Loading…
Reference in New Issue
Block a user