Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
SCBaseController.php
1 <?php
2 /**
3  * Gentics Portal.Node PHP
4  * Author & Copyright (c) by Gentics Software GmbH
5  * sales@gentics.com
6  * http://www.gentics.com
7  * Licenses can be found in the LICENSE.txt file in the root-folder of this installation
8  * You must not use this software without a valid license agreement.
9  *
10  * SCBaseController controller class file.
11  */
13 
14  public $breadcrumbs = array();
15 
16  /**
17  * Function checks matches the csrf tokens
18  *
19  * @return boolean returns true if the tokens are matched
20  */
21 
22  public function csrfProtect(){
23  if(Yii::app()->request->isPostRequest && Yii::app()->request->enableCsrfValidation){
24  if(strcmp($_POST['YII_CSRF_TOKEN'], Yii::app()->request->getCsrfToken()) !== 0 ){
25  throw new CHttpException(403);
26  return false;
27  }
28  }
29  return true;
30  }
31 }