/** * Override parent method to add url validation. Present warning to user on flow save if * specified url points to same server as the one X2Engine is hosted on. */ public function validateOptions(&$paramRules, $params = null, $staticValidation = false) { list($success, $message) = parent::validateOptions($paramRules, $params, $staticValidation); if (!$success) { return array($success, $message); } $url = $this->config['options']['url']['value']; $hostInfo = preg_replace('/^https?:\\/\\//', '', Yii::app()->getAbsoluteBaseUrl()); $url = preg_replace('/^https?:\\/\\//', '', $url); if ($staticValidation && gethostbyname($url) === gethostbyname($hostInfo)) { return array(self::VALIDATION_WARNING, Yii::t('studio', 'Warning: The url specified in your Remote API Call flow action points to the ' . 'same server that X2Engine is hosted on. This could mean that this flow makes ' . 'a request to X2Engine\'s API. Calling X2Engine\'s API from X2Flow is not ' . 'advised since it could potentially trigger this flow, resulting in an ' . 'infinite loop.')); } else { return array(true, $message); } }