本文整理汇总了PHP中CHttpRequest::normalizeRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP CHttpRequest::normalizeRequest方法的具体用法?PHP CHttpRequest::normalizeRequest怎么用?PHP CHttpRequest::normalizeRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHttpRequest
的用法示例。
在下文中一共展示了CHttpRequest::normalizeRequest方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: normalizeRequest
/**
* Normalizes the request data.
* This method strips off slashes in request data if get_magic_quotes_gpc() returns true.
* It also performs CSRF validation if {@link enableCsrfValidation} is true.
*/
protected function normalizeRequest()
{
parent::normalizeRequest();
if ($this->getIsPostRequest() && $this->enableCsrfValidation && $this->checkCurrentRoute()) {
Yii::app()->detachEventHandler('onbeginRequest', array($this, 'validateCsrfToken'));
}
}
示例2: normalizeRequest
/**
* @see CHttpRequest::normalizeRequest()
*/
protected function normalizeRequest()
{
$this->normalizeEOL($_POST);
$this->normalizeEOL($_GET);
$this->normalizeEOL($_REQUEST);
parent::normalizeRequest();
}
示例3: normalizeRequest
protected function normalizeRequest()
{
parent::normalizeRequest();
if ($this->enableCsrfValidation) {
$url = Yii::app()->getUrlManager()->parseUrl($this);
if (in_array($url, $this->noValidationRoutes)) {
Yii::app()->detachEventHandler('onBeginRequest', array($this, 'validateCsrfToken'));
}
}
}
示例4: normalizeRequest
protected function normalizeRequest()
{
//attach event handlers for CSRFin the parent
parent::normalizeRequest();
//remove the event handler CSRF if this is a route we want skipped
if (!Common::isCli() && $this->enableCsrfValidation) {
$url = Yii::app()->getUrlManager()->parseUrl($this);
foreach ($this->noCsrfValidationRoutes as $route) {
if (strpos($url, $route) === 0) {
Yii::app()->detachEventHandler('onBeginRequest', array($this, 'validateCsrfToken'));
}
}
}
}
示例5: normalizeRequest
protected function normalizeRequest()
{
//attach event handlers for CSRFin the parent
parent::normalizeRequest();
//remove the event handler CSRF if this is a route we want skipped
if ($this->enableCsrfValidation) {
$url = Yii::app()->getUrlManager()->parseUrl($this);
$t = strpos($url, "/");
if ($t !== FALSE) {
$url = substr($url, 0, $t);
if (in_array($url, $this->noCsrfValidationRoutes)) {
Yii::app()->detachEventHandler('onBeginRequest', array($this, 'validateCsrfToken'));
}
}
}
}
示例6: normalizeRequest
protected function normalizeRequest(){
parent::normalizeRequest();
if($_SERVER['REQUEST_METHOD'] != 'POST') return;
$route = Yii::app()->getUrlManager()->parseUrl($this);
if($this->enableCsrfValidation){
foreach($this->noCsrfValidationRoutes as $cr){
if(preg_match('#'.$cr.'#', $route)){
Yii::app()->detachEventHandler('onBeginRequest',
array($this,'validateCsrfToken'));
Yii::trace('Route "'.$route.' passed without CSRF validation');
break; // found first route and break
}
}
}
}
示例7: normalizeRequest
protected function normalizeRequest()
{
//attach event handlers for CSRFin the parent
parent::normalizeRequest();
//remove the event handler CSRF if this is a route we want skipped
if ($this->enableCsrfValidation) {
//$url=Yii::app()->getUrlManager()->parseUrl($this);
$route1 = Yii::app()->createController(Yii::app()->getUrlManager()->parseUrl(new CHttpRequest()));
$url = $route1 ? $route1[0]->id : "";
foreach ($this->noCsrfValidationRoutes as $route) {
$url = strtolower($url);
$route = strtolower($route);
if (strpos($url, $route) === 0) {
Yii::app()->detachEventHandler('onBeginRequest', array($this, 'validateCsrfToken'));
}
}
}
}
示例8: normalizeRequest
/**
*Extends CHttpRequest::normalizeRequest to support 'enableCsrfValidationRoutes' attribute
* The new attribute allows you to enable CSRF token validation on a list of routes
*/
protected function normalizeRequest()
{
//attach event handlers for CSRFin the parent
parent::normalizeRequest();
//remove the event handler CSRF if this is a route we want skipped
if ($this->enableCsrfValidation) {
$url = $_SERVER['REQUEST_URI'];
$enableValidation = false;
foreach ($this->enableCsrfValidationRoutes as $route) {
if (strpos($url, $route) === 0) {
$enableValidation = true;
break;
}
}
if (!$enableValidation) {
Yii::app()->detachEventHandler('onBeginRequest', array($this, 'validateCsrfToken'));
}
}
}
示例9: normalizeRequest
/**
* Normalize request.
* Disable CSRF for payment controller
*/
protected function normalizeRequest()
{
parent::normalizeRequest();
if ($this->enableCsrfValidation && $this->isCLI() === false) {
$url = $this->getRequestUri();
foreach ($this->noCsrfValidationRoutes as $route) {
if (substr($url, 0, strlen($route)) === $route) {
Yii::app()->detachEventHandler('onBeginRequest', array($this, 'validateCsrfToken'));
}
}
}
}