mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-07-22 06:28:46 -04:00
- str_starts_with, str_contains used instead of strpos === 0, strpos !== 0, strpos === false, strpos !== false
- symfony/polyfill-php80 installed to introduce the polyfill and support php7.3 using php8 functions - symfony/polyfill-ctype installed to introduce ctype functions in case somebody doesn't have the ctype extension installed
This commit is contained in:
parent
15488d3405
commit
f9e2373e62
29 changed files with 1367 additions and 555 deletions
|
@ -146,7 +146,7 @@ class Request
|
|||
} elseif (array_key_exists('jsonld', $this->_params) && !empty($this->_params['jsonld'])) {
|
||||
$this->_operation = 'jsonld';
|
||||
} elseif (array_key_exists('link', $this->_params) && !empty($this->_params['link'])) {
|
||||
if (strpos($this->getRequestUri(), '/shortenviayourls') !== false || array_key_exists('shortenviayourls', $this->_params)) {
|
||||
if (str_contains($this->getRequestUri(), '/shortenviayourls') || array_key_exists('shortenviayourls', $this->_params)) {
|
||||
$this->_operation = 'yourlsproxy';
|
||||
}
|
||||
}
|
||||
|
@ -267,9 +267,9 @@ class Request
|
|||
(array_key_exists('HTTP_X_REQUESTED_WITH', $_SERVER) &&
|
||||
$_SERVER['HTTP_X_REQUESTED_WITH'] == 'JSONHttpRequest') ||
|
||||
($hasAcceptHeader &&
|
||||
strpos($acceptHeader, self::MIME_JSON) !== false &&
|
||||
strpos($acceptHeader, self::MIME_HTML) === false &&
|
||||
strpos($acceptHeader, self::MIME_XHTML) === false)
|
||||
str_contains($acceptHeader, self::MIME_JSON) &&
|
||||
!str_contains($acceptHeader, self::MIME_HTML) &&
|
||||
!str_contains($acceptHeader, self::MIME_XHTML))
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
@ -300,11 +300,11 @@ class Request
|
|||
foreach ($mediaTypes as $acceptedQuality => $acceptedValues) {
|
||||
foreach ($acceptedValues as $acceptedValue) {
|
||||
if (
|
||||
strpos($acceptedValue, self::MIME_HTML) === 0 ||
|
||||
strpos($acceptedValue, self::MIME_XHTML) === 0
|
||||
str_starts_with($acceptedValue, self::MIME_HTML) ||
|
||||
str_starts_with($acceptedValue, self::MIME_XHTML)
|
||||
) {
|
||||
return false;
|
||||
} elseif (strpos($acceptedValue, self::MIME_JSON) === 0) {
|
||||
} elseif (str_starts_with($acceptedValue, self::MIME_JSON)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue