%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
| Server IP : 14.207.165.8 / Your IP : 216.73.216.26 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/water/vendor/yiisoft/yii2/filters/ |
Upload File : |
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\filters;
use Yii;
use yii\base\ActionFilter;
use yii\web\BadRequestHttpException;
use yii\web\Request;
/**
* AjaxFilter allow to limit access only for ajax requests.
*
* ```php
* public function behaviors()
* {
* return [
* [
* 'class' => 'yii\filters\AjaxFilter',
* 'only' => ['index']
* ],
* ];
* }
* ```
*
* @author Dmitry Dorogin <dmirogin@ya.ru>
* @since 2.0.13
*/
class AjaxFilter extends ActionFilter
{
/**
* @var string the message to be displayed when request isn't ajax
*/
public $errorMessage = 'Request must be XMLHttpRequest.';
/**
* @var Request the current request. If not set, the `request` application component will be used.
*/
public $request;
/**
* {@inheritdoc}
*/
public function init()
{
if ($this->request === null) {
$this->request = Yii::$app->getRequest();
}
}
/**
* {@inheritdoc}
*/
public function beforeAction($action)
{
if ($this->request->getIsAjax()) {
return true;
}
throw new BadRequestHttpException($this->errorMessage);
}
}