public static function exportConfig($clusterIdentifier) { $db = MMDB::instance(); $cli = eZCLI::instance(); $config = array(); $cli->output($clusterIdentifier); // GENERAL ABOUT CLUSTER $localized["view"] = ezpI18n::tr("merck", "NO VIEW"); $localized["views"] = ezpI18n::tr("merck", "VIEWS"); $localized["rating"] = ezpI18n::tr("merck", "NO RATING"); $localized["ratings"] = ezpI18n::tr("merck", "RATING"); $localized["dateForm"] = str_replace('%', '', eZINI::instance("date.ini")->variable($clusterIdentifier, 'DateFormat')); $localized["altDescription"] = ezpI18n::tr("seo", "ACTUALITIES"); $config["localized"] = $localized; ClusterTool::setCurrentCluster($clusterIdentifier); // About application foreach($db->arrayQuery(sprintf("SELECT DISTINCT(application_identifier) FROM mm_seo WHERE cluster_identifier = '%s'", $clusterIdentifier)) as $row) { $applicationIdentifier = $row["application_identifier"]; $filters = array(); $config[$applicationIdentifier] = array(); $appLocalized = ApplicationLocalized::getLocalizedApplicationByIdentifier($applicationIdentifier, $clusterIdentifier); $appUrl = $appLocalized->attribute('url'); /** @var ContentListBase $app */ $app = ApplicationFactory::fetchByUri( '/'.$appUrl ); $isContentApplication = ( $app instanceof ContentListBase); if ( !$isContentApplication ) { continue; } // CREATE FILTER $solrFilter = $app->getResultHandler()->solrFilter(); $solrFacetsFiler = $app->getResultHandler()->solrFacetsFilter(); if( $solrFilter ) $filters[] = $solrFilter; if( $solrFacetsFiler ) $filters[] = $solrFacetsFiler; $filters = implode(' AND ', $filters); $config[$applicationIdentifier]["filters"] = $filters; // CREATE MAPPING PUBLISHERS $publishers = array(); foreach($app->applicationLocalized()->publisherFolders as $publisherFolder) { $publishers[$publisherFolder->attribute("path")] = $publisherFolder->getTranslation()->attribute("name"); } $config[$applicationIdentifier]["publishers"] = $publishers; // CREATE CONFIGURATION TAGLINE $features = $app->resultHandler->features; $config[$applicationIdentifier]["tagline"] = $features["line"]; } return $config; }
$function = $Params['function']; $position = $Params['position']; // INITIAL CHECKS if ($function != 'install') { echo "Unsuported operation detected. Only install is allowed, '{$operation}' given"; eZExecution::cleanExit(); } if ($position < 0) { echo "Position must be > 1"; eZExecution::cleanExit(); } $application = ApplicationLocalized::getLocalizedApplicationByIdentifier($applicationIdentifier); if ($application == null || $application instanceof ApplicationLocalized === false) { header('Location: /error_40x'); eZExecution::cleanExit(); } $user = MMUsers::getCurrentUserObject(); if ($user === false) { $siteIni = eZINI::instance( 'site.ini' ); $loginUrl = preg_replace('#^https?//[^/]+#', '', $siteIni->variable('SiteSettings', 'LoginPage')); $redirectUrl = $loginUrl . '?context='. urlencode("/service/app/{$applicationIdentifier}/{$function}/{$position}"); header('Location: ' . $redirectUrl);
/** * Allow to set channel and channelBlockId from view parameters in url : (channel)/131 */ protected function initChannelInformations() { $parameters = $this->_params['UserParameters']; if($parameters && $parameters["channel"]) { $block = ChannelBlock::fetchById($parameters["channel"]); if($block instanceof ChannelBlock) { $this->channel = $block->getChannelApplicationLocalized(); $this->channelBlockId = $parameters["channel"]; } } else if ($this->getCustomParameter('ParentChannel') !== false) { $channelIdentifier = $this->getCustomParameter('ParentChannel'); $channel = ApplicationLocalized::getLocalizedApplicationByIdentifier($channelIdentifier); if ($channel != null && $channel instanceof ApplicationLocalized) { $this->channel = $channel; } } }
$bigFilename = eZDir::path(array($newBannerDir, 'banner_large.png')); $smallFilename = eZDir::path(array($newBannerDir, 'banner_small.png')); // Move banners $oldLargeBanner = eZDir::path(array($oldBannersDir, 'large.png')); if (file_exists($oldLargeBanner)) { moveIfNeeded($oldLargeBanner, $bigFilename); } $oldSmallBanner = eZDir::path(array($oldBannersDir, 'small.png')); if (file_exists($oldSmallBanner)) { moveIfNeeded($oldSmallBanner, $smallFilename); } // Fallback on image set in database and located in ezoscar extension $localApplication = ApplicationLocalized::getLocalizedApplicationByIdentifier($appIdentifier, $clusterIdentifier); if (!$localApplication instanceof ApplicationLocalized) { continue; } $db = eZDb::instance(); $sql = 'SELECT banner_small_filename, banner_big_filename FROM mm_application_banner WHERE application_localized_id = %s;'; $banners = $db->arrayQuery(sprintf($sql, $localApplication->attribute('id'))); foreach($banners as $banner) { $oldLargeBanner = ltrim($banner, '/'); $oldSmallBanner = ltrim($banner, '/'); if ($oldLargeBanner) { moveIfNeeded($oldLargeBanner, $bigFilename); }
/** * @param string $applicationIdentifier * @return ApplicationLocalized */ public static function buildLocalizedApplicationByIdentifier($applicationIdentifier) { $applicationName = CacheApplicationTool::getValue('applicationNameByIdentifier', $applicationIdentifier); if ( is_null($applicationName) ) { $localizedApplication = ApplicationLocalized::getLocalizedApplicationByIdentifier($applicationIdentifier); if ( $localizedApplication instanceof ApplicationLocalized ) { self::buildCache($localizedApplication); return $localizedApplication; } else { return null; } } else { return self::buildLocalizedApplication($applicationName); } }