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 ) ); } } } }
/** * @param ApplicationDefault $contentApp * @return array */ private function oldPromoPage( $contentApp ) { $promoLoginUri = eZINI::instance()->variable('SiteSettings', 'PromoLoginPage'); $promoLoginPath = preg_replace('#^https?://[^/]+/#', '/', $promoLoginUri); if( (bool)self::user() && !self::user()->toUValidated() && $this->iniMerck()->hasVariable( 'LoginSettings', 'ToUCheck' ) && $this->iniMerck()->variable( 'LoginSettings', 'ToUCheck') != 'disabled' ){ $promoLoginUri = eZINI::instance()->variable('SiteSettings', 'ToUAgreementPage'); $promoLoginPath = preg_replace('#^https?://[^/]+/#', '/', $promoLoginUri); } $patterns = array( '#^(?:https?://[^/]+)?/esibuild/main_view/app_content#', '#\?key=[^&]+#' ); $context = ContextTool::instance()->domain().preg_replace($patterns, array( '', '' ), $_SERVER['REQUEST_URI'] ); // for externals, we need to redirect to the promologin page if( !isset($_GET['key'] ) && $this->applicationObject()->hasExternalLinkHandler() ) { $context = preg_replace( '#^(https?://[^/]+/)#', '\1external/', $context ); header( 'Location: '.ContextTool::instance()->domain().$promoLoginUri.'?context='.urlencode($context) ); eZExecution::cleanExit(); } if(strpos($promoLoginPath, '/page') !== 0) $promoLoginPath = '/page'.$promoLoginPath; $app = ApplicationFactory::fetchByUri( $promoLoginPath ); if( empty( $app->node ) ) { if( in_array( ContextTool::instance()->environment(), array(ContextTool::ENVIRONMENT_PROD, ContextTool::ENVIRONMENT_STAGING) ) ) { openlog( 'Missing Promo page', LOG_PID, LOG_LOCAL6 ); syslog( LOG_CRIT, 'Error message' ); closelog(); } else { $out = 'Promo page can not be loaded for the cluster: '.ClusterTool::clusterIdentifier(); eZDebug::writeError( $out, 'Missing Promo page' ); } } $app->buildResult(); $app->pushResult('context', urlencode( $context )); $this->tpl()->setVariable('staticnode', $contentApp->node); if( SolrSafeOperatorHelper::featureIsActive( 'GoogleAnalytics' ) ) { $this->tpl()->setVariable( 'gtm_variables', $this->getGTMTags( $contentApp->node ) ); if( $contentApp->node ) { $publisherNode = NodeTool::getPublisherNodeFromNode($contentApp->node); if ($publisherNode) { /* @type eZContentObjectAttribute[] $publisherDM */ $publisherDM = $publisherNode->dataMap(); $publisherPath = $publisherDM['path']->content(); $this->tpl()->setVariable( 'publisher', $this->applicationLocalized()->getPublisherFolderFromPath( $publisherPath ) ); } } } return $app->getHtmlResult(); }