public function beforeAction($action)
	{
		try {
			@Yii::app()->newRelic->setTransactionName($this->id, $action->id);
		} catch (Exception $e) {} // Ignore errors if NewRelic isn't installed/configured properly

		// Force SSL for secure areas if enabled from the dashboard
		if (!Yii::app()->getRequest()->isSecureConnection && Cii::getConfig('forceSecureSSL', false))
			$this->redirect('https://' . Yii::app()->getRequest()->serverName . Yii::app()->getRequest()->requestUri);

		// If content was sent as application/x-www-form-urlencoded, use it. Otherwise, assume raw JSON was sent and convert it into
		// the $_POST variable for ease of use
		if (Yii::app()->request->rawBody != "" && empty($_POST))
		{
			// IF the rawBody is malformed, throw an HTTP 500 error. Use json_encode so that we can get json_last_error
			$_POST = json_decode(Yii::app()->request->rawBody);
			if (json_last_error() != JSON_ERROR_NONE)
			{
				header('HTTP/1.1 400 Bad Request');
				$this->status = 400;
				$this->message = Yii::t('Api.main', 'Request payload not properly formed JSON.');
				return null;
			}

			$_POST = CJSON::decode(Yii::app()->request->rawBody);
		}

		return true;
	}
public function beforeAction($action)
	{
		try {
			@Yii::app()->newRelic->setTransactionName($this->id, $action->id);
		} catch (Exception $e) {} // Ignore errors if NewRelic isn't installed/configured properly

		// Force SSL for secure areas if enabled from the dashboard
		if (!Yii::app()->getRequest()->isSecureConnection && Cii::getConfig('forceSecureSSL', false))
			$this->redirect('https://' . Yii::app()->getRequest()->serverName . Yii::app()->getRequest()->requestUri);

		// If content was sent as application/x-www-form-urlencoded, use it. Otherwise, assume raw JSON was sent and convert it into
		// the $_POST variable for ease of use
		if (Yii::app()->request->rawBody != "" && empty($_POST))
		{
			// IF the rawBody is malformed, throw an HTTP 500 error. Use json_encode so that we can get json_last_error
			$_POST = json_decode(Yii::app()->request->rawBody);
			if (json_last_error() != JSON_ERROR_NONE)
			{
				header('HTTP/1.1 400 Bad Request');
				$this->status = 400;
				$this->message = Yii::t('Api.main', 'Request payload not properly formed JSON.');
				return null;
			}

			$_POST = CJSON::decode(Yii::app()->request->rawBody);
		}

		return true;
	}
public function beforeAction ( $ action ) { try { @ Yii :: app ( ) -> newRelic -> setTransactionName ( $ this -> id , $ action -> id ) ; } catch ( Exception $ e ) { } // Ignore errors if NewRelic isn't installed/configured properly
 // Force SSL for secure areas if enabled from the dashboard
 if ( ! Yii :: app ( ) -> getRequest ( ) -> isSecureConnection && Cii :: getConfig ( 'forceSecureSSL' , false ) ) $ this -> redirect ( 'https://' . Yii :: app ( ) -> getRequest ( ) -> serverName . Yii :: app ( ) -> getRequest ( ) -> requestUri ) ; // If content was sent as application/x-www-form-urlencoded, use it. Otherwise, assume raw JSON was sent and convert it into
 // the $_POST variable for ease of use
 if ( Yii :: app ( ) -> request -> rawBody != "" && empty ( $ _POST ) ) { // IF the rawBody is malformed, throw an HTTP 500 error. Use json_encode so that we can get json_last_error
 $ _POST = json_decode ( Yii :: app ( ) -> request -> rawBody ) ; if ( json_last_error ( ) != JSON_ERROR_NONE ) { header ( 'HTTP/1.1 400 Bad Request' ) ; $ this -> status = 400 ; $ this -> message = Yii :: t ( 'Api.main' , 'Request payload not properly formed JSON.' ) ; return null ; } $ _POST = CJSON :: decode ( Yii :: app ( ) -> request -> rawBody ) ; } return true ; }
BeforeAction, validates that there is a valid response body
@param  CAction $action    The action we want to run
BeforeAction validates that there is a valid response body