mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 18:48:21 -07:00
Check if request is ajax
Проверяет является ли запрос AJAX запросом. Через проверку наличия X-Requested-With: XMLHttpRequest.
This commit is contained in:
parent
b740a5465a
commit
e340305d69
3 changed files with 10 additions and 0 deletions
|
@ -198,6 +198,11 @@ switch ($bb_cfg['datastore_type']) {
|
|||
$datastore = new TorrentPier\Legacy\Datastore\File($bb_cfg['cache']['db_dir'] . 'datastore/', $bb_cfg['cache']['prefix']);
|
||||
}
|
||||
|
||||
function is_ajax(): bool
|
||||
{
|
||||
return (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest');
|
||||
}
|
||||
|
||||
function sql_dbg_enabled()
|
||||
{
|
||||
return (SQL_DEBUG && DBG_USER && !empty($_COOKIE['sql_log']));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue