Put PHP paste request into own function

This commit is contained in:
rugk 2019-01-21 23:06:25 +01:00
parent 6beea8f2f4
commit 541fff199a
No known key found for this signature in database
GPG Key ID: 05D40A636AFAB34D
1 changed files with 14 additions and 3 deletions

View File

@ -72,6 +72,19 @@ class Request
*/
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
*
@ -100,9 +113,7 @@ class Request
array_key_exists('QUERY_STRING', $_SERVER) &&
!empty($_SERVER['QUERY_STRING'])
) {
$this->_params['pasteid'] = preg_match(
'/[a-f0-9]{16}/', $_SERVER['QUERY_STRING'], $match
) ? $match[0] : 'invalid id';
$this->_params['pasteid'] = $this->getPasteId();
}
// prepare operation, depending on current parameters