/** * Returns the full url Gems should forward to after survey completion. * * This fix allows multiple sites with multiple url's to share a single * installation. * * @return string */ protected function calculateReturnUrl() { $currentUri = $this->util->getCurrentURI(); /* // Referrer would be powerful when someone is usng multiple windows, but // the loop does not always provide a correct referrer. $referrer = $_SERVER["HTTP_REFERER"]; // If a referrer was specified and that referral is from the current site, then use it // as it is more dependable when the user has multiple windows open on the application. if ($referrer && (0 == strncasecmp($referrer, $currentUri, strlen($currentUri)))) { return $referrer; // \MUtil_Echo::track($referrer); } // */ // Use the survey return if available. $surveyReturn = $this->loader->getCurrentUser()->getSurveyReturn(); if ($surveyReturn) { // Do not show the base url as it is in $currentUri $surveyReturn['NoBase'] = true; // Add route reset to prevet the current parameters to be // added to the url. $surveyReturn['RouteReset'] = true; // \MUtil_Echo::track($currentUri, \MUtil_Html::urlString($surveyReturn)); return $currentUri . \MUtil_Html::urlString($surveyReturn); } // Ultimate backup solution for return return $currentUri . '/ask/forward/' . \MUtil_Model::REQUEST_ID . '/' . urlencode($this->getTokenId()); }