public function contentBuildResult() { $oldSkipPage = SolrSafeOperatorHelper::getCustomParameter($this->applicationObject->identifier, 'SkipExitPage', 'application'); $skipPage = $oldSkipPage || !$this->exitStrategy(); $this->pushResult('user' , self::user()); $this->pushResult('country', LocaleTool::countryISO3166Code()); if ( $skipPage ) { $_REQUEST['proceed'] = 'proceed'; $_COOKIE[$this->cookieKey()] = '1'; if ( ContextTool::instance()->isMobile() ) $_REQUEST['r'] = 1; } if( isset($_REQUEST['proceed']) && isset($_COOKIE[$this->cookieKey()]) && filter_var($_COOKIE[$this->cookieKey()], FILTER_VALIDATE_INT)) { // proceed to iframe view $this->iframeBuildResult( ); } elseif( isset($_REQUEST['proceed']) ) { // proceed requested but no cookie, we ask again and force redirect to make sure we the proper layout header('Location: '.ContextTool::instance()->domain().$this->applicationLocalized()->applicationUrl()); eZExecution::cleanExit(); } else { // normal exit page vie $isMobile = ContextTool::instance()->isMobile(); $urlToRedirect = isset($_REQUEST['r']) ? trim($_REQUEST['r']) : null; if ($this->isExitApplication() && $this->displayIframe()) { $serverUrl = ContextTool::instance()->domain(); $params = array( 'r' => urlencode($urlToRedirect), 'exit_strategy' => 0, 'display_iframe' => $this->displayIframe(), 'new_window' => $this->newWindow() ); $urlToRedirect = $serverUrl . '/external/exit/?' . http_build_query($params); $this->pushResult('decode_url', false); $this->pushResult('server_url', $serverUrl); } if($isMobile){ if($this->applicationObject()->externalLinkHandler()) { $externalUrl = $this->applicationObject()->externalLinkHandler()->getNodeUrl( $this->node ); $urlToRedirect = isset($externalUrl) ? $externalUrl : $urlToRedirect ; if(SolrSafeOperatorHelper::getCustomParameter($this->applicationObject->identifier, 'usePostMethod', 'application' )){ $url = $this->applicationObject()->externalLinkHandler()->getNodeUrl( $this->node ); $url = $this->getDeeplink( $url ); if ($url == null && isset($_REQUEST['r'])) { $url = urldecode($_REQUEST['r']); } $url = in_array('arg', array_keys($this->_params['UserParameters'])) ? $url . $this->_params['UserParameters']['arg'] : $url; $this->pushResult('postParams', $url); } } else { $urlToRedirect = '/bad_config'; } } $this->pushResult('back_url', ContextTool::instance()->backUrl()); $this->pushResult('url', $urlToRedirect); $this->pushResult('deeplink', urlencode( $this->getDeeplink() )); // Because we are passing boolean parameters to final URL, we need to make isset check. if ( $this->isDeeplinkApplication() || $this->isExitApplication() ) { if ( isset( $_GET['display_iframe'] ) ) { $this->pushResult('display_iframe', $this->displayIframe()); } if ( isset( $_GET['new_window'] ) ) { $this->pushResult('new_window', $this->newWindow()); } if ( isset( $_GET['exit_strategy'] ) ) { $this->pushResult('exit_strategy', $this->exitStrategy()); } } } if($this->node && $this->node->attribute('url_alias') != "") { $this->pushResult('article_url', end(explode("/", $this->node->attribute('url_alias')))); /* @type $pfDM eZContentObjectAttribute[] */ $pf = NodeTool::getPublisherNodeFromNode( $this->node ); $pfDM = $pf->DataMap(); $pfID = PublisherFolderTool::getPathToIDMapping( $pfDM['path']->content() ); $this->pushResult( 'pfid', $pfID['pfid'] . '/' ); } $oldOpenInNewWindow = SolrSafeOperatorHelper::getCustomParameter($this->applicationObject()->identifier, 'openInNewWindow', 'application'); $openInNewWindow = $this->newWindow() || $oldOpenInNewWindow; $this->pushResult('application', $this->applicationObject); $this->pushResult('open_in_new_window', $openInNewWindow); $this->pushResult('cookie_key', $this->cookieKey()); $this->pushResult('node', $this->node); if( SolrSafeOperatorHelper::featureIsActive( 'GoogleAnalytics' ) ) { $this->pushResult( 'gtm_variables', $this->getGTMTags( $this->node ) ); if( $this->node ) { $publisherNodeId = PublisherFolderTool::getPublisherNodeIdFromArticleNode($this->node); if ($publisherNodeId) { $publisherInfos = PublisherFolderTool::getNodeIdToPathMapping( $publisherNodeId ); $publisherPath = $publisherInfos['path']; $this->pushResult( 'publisher', $this->applicationLocalized()->getPublisherFolderFromPath( $publisherPath ) ); } } } }
protected function response( $uri ) { switch( self::redirectMode() ) { case self::LOGIN_REDIRECT_MODE_HTTP: header( "Location: $uri" ); break; case self::LOGIN_REDIRECT_MODE_JS: header( "Content-type: application/json"); if ( SolrSafeOperatorHelper::featureIsActive( 'UUMP' ) ) { header( "Accept: application/json"); } echo json_encode( $uri ); break; case self::LOGIN_REDIRECT_MODE_JSON: header('Content-type: application/json'); $result = array(); $result['status'] = $this->_isLoginSuccessful ? 0 : 1; $result['LoginRedirect'] = $this->_isLoginSuccessful ? $this->_destUrl : $uri; $mmUser = MMUsers::getCurrentUserObject(); if ( $this->_isLoginSuccessful ) { $result['User'] = $this->_esbResult->toArray(); $result['User']['mmSettings'] = $mmUser->getMMSettings(); $result['User']['unorderedAppList'] = $mmUser->getApplicationList(); $result['User']['alterboxMsgReset'] = $mmUser->hasPreference('alterboxMsgReset') ? $mmUser->getPreferences('alterboxMsgReset') : true; $result['cookies'] = CookieTool::setCookies(); $salutations = SolrSafeOperatorHelper::clusterIni('Salutations', 'Salutation', 'merck.ini' ); $localeMap = SolrSafeOperatorHelper::clusterIni('ESBSettings', 'ESBLocaleMap', 'merck.ini' ); $locale = $this->_esbResult->language; if ( isset($localeMap[$locale]) ) $locale = $localeMap[$locale]; $result['commonauth'] = array( 'user_id' => $this->_esbResult->userName, 'MSDID' => ( isset( $this->_esbResult->othersParams['crmMemberId'] ) && !empty($this->_esbResult->othersParams['crmMemberId']) ) ? $this->_esbResult->othersParams['crmMemberId'] : $this->_esbResult->countryOfRegistration.'000000X', 'userId' => $this->_esbResult->userId, 'UUMPID' => $this->_esbResult->userId, 'UVDSPam' => null, 'ValidationStatus' => $this->_esbResult->getValidationStatus(), 'ODMNum' => null, 'ValidationDate' => ($this->_esbResult->registrationDate) ? date('d-M-y', strtotime($this->_esbResult->registrationDate)) : null, 'TVFCode' => 'MSD', 'Email' => $this->_esbResult->emailAddress, 'cc' => $this->_esbResult->countryOfRegistration, 'PhoneNum' => isset($this->_esbResult->othersParams['phoneNumber']) ? $this->_esbResult->othersParams['phoneNumber'] : null, 'ZipCode' => $this->_esbResult->postalCode, 'zipCode' => $this->_esbResult->postalCode, 'Salutation' => isset($salutations[$this->_esbResult->othersParams['salutation']]) ? $salutations[$this->_esbResult->othersParams['salutation']] : null, 'City' => $this->_esbResult->city, 'Street' => isset($this->_esbResult->othersParams['addressLine2']) ? $this->_esbResult->othersParams['addressLine2'] : null, 'Address' => isset($this->_esbResult->othersParams['addressLine1']) ? $this->_esbResult->othersParams['addressLine1'] : null, 'Country' => $this->_esbResult->countryOfRegistration, 'CustomerType' => $this->_esbResult->customerType, 'SiteCRMStatus' => null, 'LastName' => $this->_esbResult->lastName, 'FirstName' => $this->_esbResult->firstName, 'specialty' => $this->_esbResult->userSpecialty, 'lng' => LocaleTool::languageISO639Code($locale).'_'.LocaleTool::countryISO3166Code($locale), 'hostName' => preg_replace('#^https?://#', '', ContextTool::instance()->domain()), 'LicenseNumber' => isset($this->_esbResult->othersParams['licenseNumber']) ? $this->_esbResult->othersParams['licenseNumber'] : null, ); } echo json_encode($result); break; } eZExecution::cleanExit(); }