mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
N°3750 data-input-type : change XHR detection method
I added WebPage::IsAjaxPage, but this wasn't a good idea as XHR isn't really related to the Page impl used ! Instead we're now using the new method \utils::IsXmlHttpRequest which is a copy of \Symfony\Component\HttpFoundation\Request::isXmlHttpRequest Many thanks @Molkobain !
This commit is contained in:
@@ -189,16 +189,26 @@ class utils
|
||||
{
|
||||
$sSAPIName = php_sapi_name();
|
||||
$sCleanName = strtolower(trim($sSAPIName));
|
||||
if ($sCleanName == 'cli')
|
||||
{
|
||||
if ($sCleanName == 'cli') {
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool true if we're in an XHR query
|
||||
* @see \Symfony\Component\HttpFoundation\Request::IsXmlHttpRequest
|
||||
*/
|
||||
public static function IsXmlHttpRequest()
|
||||
{
|
||||
$sXhrHeaderName = 'X-Requested-With';
|
||||
$sXhrHeaderIndexName = 'HTTP_'.str_replace('-', '_', strtoupper($sXhrHeaderName));
|
||||
$sXhrHeader = $_SERVER[$sXhrHeaderIndexName] ?? null;
|
||||
|
||||
return ('XMLHttpRequest' === $sXhrHeader);
|
||||
}
|
||||
|
||||
protected static $bPageMode = null;
|
||||
/**
|
||||
* @var boolean[]
|
||||
|
||||
Reference in New Issue
Block a user