Esempio n. 1
0
                            if( $relatedObject->ClassIdentifier == 'article' )
                            {
                                $isVisible = ObjectVisibilityManager::isVisible($relatedObject->attribute('id'));

                                if( $isVisible )
                                {
                                    /* @type $articleDatamap eZContentObjectAttribute[] */
                                    $articleDatamap = $relatedObject->dataMap();

                                    if( isset($articleDatamap['online_date'])
                                        && $articleDatamap['online_date']->hasContent() )
                                    {
                                        /* @type $onlineDateContent eZDate */
                                        $onlineDateContent = $articleDatamap['online_date']->content();
                                        $onlineDate        = $onlineDateContent->timestamp();
                                        $dates             = SolrSafeOperatorHelper::getDatesPDFavailable($onlineDate,$expirationDuration);

                                        if( $dates['daysLeft'] > 0 )
                                        {
                                            $relatedArticles[] = $relatedObject;
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }

                    // could not find any valid related article => we serve a 403.
                    if( count($relatedArticles) == 0 )
                    {
    /**
     * @param eZTemplate $tpl
     * @param string $operatorName
     * @param array $operatorParameters
     * @param string $rootNamespace
     * @param string $currentNamespace
     * @param mixed $operatorValue
     * @param array $namedParameters
     */
    function modify($tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters)
    {
        switch ($operatorName)
        {
            /*******************************************************************************/
            /*                             Solr Safe Operators                             */
            /*******************************************************************************/

            case 'ezfind_raw_fetch':
                $operatorValue = SolrSafeOperatorHelper::ezfindRawFetch(
                    $namedParameters['params'],
                    $namedParameters['nodeIdsOnly']
                );
                break;
            case 'getUrlSolr':
                $operatorValue = SolrSafeOperatorHelper::getUrlSolr($namedParameters['solrdata']);
                break;
            case 'getDatesPDFavailable':
                $operatorValue = SolrSafeOperatorHelper::getDatesPDFavailable(
                    $namedParameters['onlineDate'],
                    $namedParameters['daysAvailable']
                );
                break;
            case 'getViewCounter':
                $operatorValue = SolrSafeOperatorHelper::getViewCounter(
                    $namedParameters['remoteId'],
                    $namedParameters['clusterIdentifier']
                );
                break;
            case 'getRatings':
                $operatorValue = SolrSafeOperatorHelper::getRatings(
                    $namedParameters['remoteId'],
                    $namedParameters['clusterIdentifier']
                );
                break;
            case 'getJavascriptFiles':
                $operatorValue = SolrSafeOperatorHelper::getJavascriptFiles(
                    $namedParameters['application_name'],
                    $namedParameters['type'],
                    $namedParameters['isConsult']
                );
                break;
            case 'getLessFiles':
                $operatorValue = SolrSafeOperatorHelper::getLessFiles(
                    $namedParameters['application_name'],
                    $namedParameters['application'],
                    $namedParameters['isConsult']
                );
                break;
            case 'getInfosApp':
                $operatorValue = SolrSafeOperatorHelper::getInfosApp($namedParameters['application_identifier']);
                break;
            case 'getHostNameFromURL':
                $operatorValue = SolrSafeOperatorHelper::getHostNameFromURL($namedParameters['url']);
                break;
            case 'context':
                $operatorValue = SolrSafeOperatorHelper::context($namedParameters['url']);
                break;
            case 'getMetas':
                $operatorValue = SolrSafeOperatorHelper::getMetas($namedParameters['applicationName']);
                break;
            case 'getSolrData':
                $operatorValue = SolrSafeOperatorHelper::getSolrData(
                    $namedParameters['remoteId'],
                    $namedParameters['clusterIdentifier'],
                    $namedParameters['extended_fields']
                );
                break;
            case 'getCustomParameter':
                $operatorValue = SolrSafeOperatorHelper::getCustomParameter(
                    $namedParameters['application'],
                    $namedParameters['parameter_name'],
                    $namedParameters['context']
                );
                break;
            case 'getAppIdentifierForIcon':
                $operatorValue = SolrSafeOperatorHelper::getAppIdentifierForIcon($namedParameters['application']);
                break;
            case 'getApplicationUrl':
                $operatorValue = SolrSafeOperatorHelper::getApplicationUrl($namedParameters['identifier']);
                break;
            case 'mappingNameSpe':
                $operatorValue = SolrSafeOperatorHelper::mappingNameSpe($namedParameters['specialtie']);
                break;
            case 'getMappingSpe':
                $operatorValue = SolrSafeOperatorHelper::getMappingSpe();
                break;
            case 'getCustomerTypes':
                $operatorValue = SolrSafeOperatorHelper::getCustomerTypes();
                break;
            case 'getMainSpecialities':
                $operatorValue = SolrSafeOperatorHelper::getMainSpecialities();
                break;
            case 'getUserSpecialities':
                $operatorValue = SolrSafeOperatorHelper::getUserSpecialities();
                break;
            case 'noSeoLink':
                $operatorValue = SolrSafeOperatorHelper::noSeoLink($operatorValue);
                break;
            case 'getTaxoTranslation':
                $operatorValue = SolrSafeOperatorHelper::getTaxoTranslation(
                    $namedParameters['identifier'],
                    $namedParameters['remote_id']
                );
                break;
            case 'cluster_ini':
                $operatorValue = SolrSafeOperatorHelper::clusterIni(
                    $namedParameters['section'],
                    $namedParameters['variable'],
                    $namedParameters['ini_file']
                );
                break;
            case 'truncateContentRelated':
                $operatorValue = SolrSafeOperatorHelper::truncateContentRelated($namedParameters['text']);
                break;
            case 'myCertificatesEnabled':
                $operatorValue = SolrSafeOperatorHelper::featureIsActive("MyCertificates");
                break;
            case 'appHasSpeciality':
                $operatorValue = SolrSafeOperatorHelper::appHasSpeciality();
                break;
            case 'setClusterIdentifier':
                // No $operatorValue modification is normal
                SolrSafeOperatorHelper::setClusterIdentifier($namedParameters['clusterIdentifier']);
                break;
            case 'featureIsActive':
                $operatorValue = SolrSafeOperatorHelper::featureIsActive($namedParameters['featureCode']);
                break;
            case 'feature':
                $operatorValue = SolrSafeOperatorHelper::feature(
                    $namedParameters['featureCode'],
                    $namedParameters['value']
                );
                break;
            case 'alphabet':
                $operatorValue = SolrSafeOperatorHelper::alphabet();
                break;
            case 'generateIso6391':
                $operatorValue = SolrSafeOperatorHelper::generateIso6391($namedParameters['regionalSettingsLocale']);
                break;
            case 'staticfile':
                $operatorValue = SolrSafeOperatorHelper::staticFile(
                    $operatorValue,
                    $namedParameters['quote'],
                    $namedParameters['skip_slash']
                );
                break;
            case 'showHelpDeskPhoneInHeader':
                $operatorValue = !(SolrSafeOperatorHelper::feature('HelpDeskSettings', 'HidePhoneNumberInHeader'));
                break;
            case 'showHelpDeskPhoneOnPage':
                $operatorValue = !(SolrSafeOperatorHelper::feature('HelpDeskSettings', 'HidePhoneNumberOnPage'));
                break;
            case 'getFooterHTML':
                $operatorValue = SolrSafeOperatorHelper::getFooterHTML($namedParameters['footerBlockIdentifier']);
                break;
            case 'getLocaleBySystemCode':
                $operatorValue = SolrSafeOperatorHelper::getLocaleBySystemCode($namedParameters['systemCode']);
                break;
            case 'buildExitUrl':
                $operatorValue = SolrSafeOperatorHelper::buildExitUrl($namedParameters['url']);
                break;
            case 'getUserToken':
                $operatorValue = SolrSafeOperatorHelper::getUserToken();
                break;
            case 'clusterHasFeaturedChannel':
                $operatorValue = SolrSafeOperatorHelper::clusterHasFeaturedChannel();
                break;
            case 'aliasDimensions':
                $operatorValue = SolrSafeOperatorHelper::aliasDimensions($namedParameters['alias']);
                break;
            case 'hasImageArticleFromSolr':
                $operatorValue = SolrSafeOperatorHelper::hasImageArticleFromSolr(
                    $namedParameters['solrdata'],
                    $namedParameters['media_case']
                );
                break;
            case 'getImageArticleUrl':
                $operatorValue = SolrSafeOperatorHelper::getImageArticleUrl(
                    $namedParameters['media_case'],
                    $namedParameters['object_id'],
                    $namedParameters['language'],
                    $namedParameters['alias']
                );
                break;
            case 'getImageArticleUrlFromSolr':
                $operatorValue = SolrSafeOperatorHelper::getImageArticleUrl(
                    $namedParameters['media_case'],
                    $namedParameters['solrdata']['object_id'],
                    $namedParameters['solrdata']['language'],
                    $namedParameters['alias']
                );
                break;
            case 'isHidden':
                $operatorValue = SolrSafeOperatorHelper::isHidden($namedParameters['contentobject_id']);
                break;
            case 'isObjectGloballyVisible':
                $operatorValue = SolrSafeOperatorHelper::isObjectGloballyVisible($namedParameters['contentobject_id']);
                break;
            case 'getClusterVisibilities':
                $operatorValue = SolrSafeOperatorHelper::getClusterVisibilities($namedParameters['contentobject_id']);
                break;
            case 'parseTranslationTagParams':
                $operatorValue = SolrSafeOperatorHelper::parseTranslationTagParams($namedParameters['params']);
                break;
            case 'isSendToColleagueDisabled':
                $operatorValue = SolrSafeOperatorHelper::featureIsActive('DisableSendToColleague')
                    ? SolrSafeOperatorHelper::feature('DisableSendToColleague', 'IsDisabled')
                    : false;
                break;
            case 'getListOfValueOptions':
                $operatorValue = SolrSafeOperatorHelper::getListOfValueOptions( $namedParameters['business_name'], $namedParameters['filter'] );
                break;
            case 'getListOfValues':
                $operatorValue = SolrSafeOperatorHelper::getListOfValues( $namedParameters['business_name'], $namedParameters['filter'] );
                break;
            case 'solrDateToStamp':
                $operatorValue = strtotime($namedParameters['date']) > 3600*24*2 ? SolrTool::getTimestampFromSolr($namedParameters['date']) : 0;
                break;
            case 'getSeoParam':
                $operatorValue = SolrSafeOperatorHelper::getSeoParam($namedParameters['applicationLocalized'], $namedParameters['name'], $namedParameters['params']);
                break;
            case 'applicationHasSeoSpeciality':
                $operatorValue = SolrSafeOperatorHelper::applicationHasSeoSpeciality($namedParameters['applicationIdentifier']);
                break;
            case 'seoIsEnabled':
                $operatorValue = SolrSafeOperatorHelper::seoIsEnabled($namedParameters['applicationIdentifier']);
                break;
            case 'includeEsi':
                $operatorValue = SolrSafeOperatorHelper::includeEsi( $namedParameters['src'], $namedParameters['debug'] );
                break;
            case 'imageDecHash':
                $operatorValue = SolrSafeOperatorHelper::imageDecHash( $operatorValue );
                break;
            case 'bannerDecHash':
                $operatorValue = SolrSafeOperatorHelper::bannerDecHash( $operatorValue );
                break;
            case 'getAndStoreGPNotebookHS':
                $operatorValue = self::getAndStoreGPNotebookHS( );
                break;
            case 'isPromoTaxonomyVisible':
                $operatorValue = SolrSafeOperatorHelper::isPromoTaxonomyVisible( $namedParameters['values'] );
                break;
            case 'translateTaxonomy':
                $operatorValue = SolrSafeOperatorHelper::translateTaxonomy( $namedParameters['code'] );
                break;
            case 'getPublisherArticleUrl':
                $operatorValue = SolrSafeOperatorHelper::getPublisherArticleUrl( $namedParameters['publisher'], $namedParameters['articleId'] );
                break;
        }
    }