Exemplo n.º 1
0
 public static function singleton()
 {
     if (!isset(self::$instance)) {
         $c = __CLASS__;
         self::$instance = new $c();
     }
     return self::$instance;
 }
 public function testStaticItem()
 {
     $this->client->shouldReceive('baseUrl')->once();
     $this->client->shouldReceive('request')->with('na/v1.2/item', ['api_key' => 'key', 'locale' => 'ko_KR'])->once()->andReturn(file_get_contents('tests/Json/Static/items.kr.json'));
     Api::setKey('key', $this->client);
     $items = StaticData::setLocale('ko_KR')->getItems();
     $item = $items->getItem(1042);
     $this->assertEquals('단검', $item->name);
 }
    /**
     * @param string $clusterIdentifier
     * @param string $imageType
     * @return string
     */
    public static function getStaticPath( $clusterIdentifier, $imageType )
    {
        if ( !isset( self::$imagePathMapping[$imageType]['staticPath'] ) )
        {
            return null;
        }
        $staticDir = StaticData::directory();

        return $staticDir.'/'.str_replace( '%clusterIdentifier%', $clusterIdentifier, self::$imagePathMapping[$imageType]['staticPath'] );
    }
Exemplo n.º 4
0
    /**
     * @param string $cluster
     * @param string $path
     * @param bool $clusterizedPath
     * @return bool|string
     */
    public static function clusterFilePath($cluster, $path, $clusterizedPath = true)
    {
        if (!$cluster)
        {
            $cluster = 'default';
        }

        $staticPath = eZDir::path(array(StaticData::directory(), $cluster, $path));
        $fullPath   = self::fileExists($staticPath);

        if ($fullPath)
        {
            return $clusterizedPath ? $fullPath : $staticPath;
        }

        if ($cluster != 'default')
        {
            return self::clusterFilePath('default', $path);
        }

        return false;
    }
Exemplo n.º 5
0
    /**
     * @return string
     */
    private function setToken()
    {
        $token = array();
        $staticDir = StaticData::directory();
        $outputFile = $staticDir.'/'.$this->tokenFileName;

        if( file_exists( $outputFile ) )
        {
            $token = json_decode( file_get_contents($outputFile), true );
        }
        
        if( !file_exists( $outputFile ) || !isset($token['expiresIn']) || !isset($token['accessToken']) || ($token['expiresIn'] < time()) )
        {
            if( file_exists( $outputFile ) )
            {
                unlink($outputFile);
            }
            $requestData = array(
                "clientId" => $this->clientId,
                "clientSecret" => $this->clientSecret
            );
            
            $query = http_build_query( $requestData );
            $smsApiUrl = "{$this->tokenRequestUrl}?{$query}";
            eZLog::write( "Sending request to: {$smsApiUrl}", 'sms.log' );
            
            $curl = curl_init($this->tokenRequestUrl);                                                                      
            
            curl_setopt_array($curl, array(
                CURLOPT_POST   => true,                                                                   
                CURLOPT_POSTFIELDS => $requestData,                                                                  
                CURLOPT_RETURNTRANSFER => true,
                )
            );
            
            $token = curl_exec( $curl );
            if( $token && isset($token['accessToken']) )
            {
                $logMessage = 'Recieved SMS Service responses: ' . var_export($token, true);
                eZLog::write( $logMessage, 'sms.log' );

                $token = json_decode($token, TRUE);
                $token['expiresIn'] += time() + 300; 
                curl_close( $curl );

                file_put_contents($outputFile, json_encode($token));
                $this->smsToken = $token['accessToken'];
                return true;
            }
            else
            {
                $logMessage = 'Error - Problem with recieved SMS Service responses: ' . var_export($token, true);
                eZLog::write( $logMessage, 'sms.log' );
                return false;
            }
        }
        $this->smsToken = $token['accessToken'];
        return true;
    }
/**
 * Removes icons for given application
 * @param string $appIdentifier Identifier of app
 * @param string $clusterIdentifier Identifier of cluster
 */
function removeIcons()
{
    global $appIdentifier, $clusterIdentifier;
    
    $imageDirPath = eZDir::path( array( StaticData::directory(), $clusterIdentifier, 'apps', $appIdentifier ) );
    eZDir::recursiveDelete($imageDirPath);
}
Exemplo n.º 7
0
    /**
     * @param ChannelBlockConfiguration[] $configurations
     * @param ChannelBlock $block
     * @return array
     */
    public function getBlockHtml($configurations, ChannelBlock $block, $taxonomyFilters = array())
    {
        // list of all applications with application informations and all articles
        $articles = array();

        $variables = array(
            "title" => $block->attribute("title")
        );
        $variables["show_title"] = !$block->attribute("hide_title");

        if($block->attribute("illustration_image"))
        {
            $variables["illustration_image"] = StaticData::externalUrl(ClusterTool::clusterIdentifier(), $block->attribute("illustration_image"));
        }

        $mustacheEngine = MustacheTool::getEngine("__CHANNEL_", false, $this);

        $dynamicContent = $this->manageDynamicContent($block, $variables);

        if(!$configurations)
        {
            return $this->manageStaticContent($block, $mustacheEngine, $variables, $dynamicContent);
        }

        // Retrieve all articles for the block (all articles from all applications)
        $applicationLocalized = null;
        /** @var ChannelBlockConfiguration $configuration */
        foreach($configurations as $configuration)
        {
            $applicationLocalized = CacheApplicationTool::buildLocalizedApplicationByLocalizedId($configuration->attribute("application_localized_id"));

            if(is_null($applicationLocalized))
                continue;

            /** @var ContentListBase $app */
            $app = ApplicationFactory::fetchByUri( $applicationLocalized->applicationUrl() );

            // retrieve default filters
            $this->addParamsConfiguration($app, $configuration);

            $categoryFiltered = $configuration->attribute('category_filtered');
            // add taxonomy in fl

            if (!empty($taxonomyFilters) && $categoryFiltered) {
                $app->getResultHandler()->setExternalFilters($taxonomyFilters);
            }

            $app->getResultHandler()->additionnalTaxonomyFields = $this->addMappingTaxonomies();
            // isFull to true, for get all articles and not call additionalSolrFilters and limit on date -> see MMJamaNetworkListSolrQueryHandler
            $app->isFull = true;

            $solrResult = $app->getResultHandler()->contentResultMain(false, true);
            if($solrResult["response"]["numFound"])
            {
                $solrReturn = $app->getResultHandler()->articleResult($solrResult, array());
                if($solrReturn["article_informations"] && $solrReturn["article_informations"]["articles_solrdata"])
                {
                    $newArticles = $this->constructArticles($solrReturn["article_informations"]["articles_solrdata"], $app->getResultHandler()->additionnalTaxonomyFields, $configuration->getChannelBlock());
                    $articles = array_merge($articles, $newArticles);
                }
            }
        }

        // construct url for link "more" and reorder/limit if we have several application
        $more = null;
        if(count($configurations) == 1 && $solrResult["response"]["numFound"] == 0 && $block->getTemplate())
        {
            return false;
        }
        elseif(count($configurations) == 1 && ($solrResult["response"]["numFound"] > $this->getLimit($block)))
        {
            $variables["has_more"] = true;
            $more = $this->getLinkMore($configurations[0], $block);
        }
        else
        {
            if(count($articles) == 0)
                return false;

            // if we have several articles from several applications we have to reorder them no matter the application
            $this->reorderArticles($articles, $block->attribute("sorting_method"));
            $articles = $this->limitArticles($articles, $block);
        }

        $articlesColumns = $this->splitArticles($articles, $block);
        // if there is no columns, we fill articles variable instead of articles
        if(empty($articlesColumns))
            $variables["articles"] = $articles;
        else
            $variables["columns"] = $articlesColumns;

        $variables["nb_columns"] = $this->getColumns($block);

        return array(
            "more"      => $more,
            "content"   => $mustacheEngine->render($block->getTemplate(), $variables),
            'isStatic'  => false
        );
    }
Exemplo n.º 8
0
                continue;
            }
            if ($data['uid']) {
                $suid = explode("_", $data['uid']);
                $suid = end($suid);
                list($player, $ret) = Player::instance($suid);
                if ($player) {
                    $player->to_bonus($bonus);
                    $player->save();
                }
            }
        }
    }
} else {
    //此处将是一个多维数组
    $bonus = StaticData::read('country_rank_bonus');
    $_data = $_country_handle->use_collection(NameMapper::get_country_uid_list_collection_name())->find(array('server_id' => $server_id), array('uid' => true, 'server_id' => true, 'rank' => true));
    if ($_data->count()) {
        foreach ($_data as $data) {
            if ($data['server_id'] != $server_id) {
                continue;
            }
            if ($data['uid']) {
                $suid = explode("_", $data['uid']);
                $suid = end($suid);
                list($player, $ret) = Player::instance($suid);
                $temp_player_tmp_backpack_handle = $player->get_player_class_handle('tmpbackpack');
                if ($player) {
                    $bonus_list = array();
                    if (isset($bonus[$data['rank']])) {
                        foreach ($bonus[$data['rank']]['bonus'] as $bval) {
Exemplo n.º 9
0
<?php

$parameters = $Module->OriginalParameters;

$cluster = array_shift($parameters);
if ($cluster == 'auto')
    $cluster = ClusterTool::clusterIdentifier();

$path = eZDir::path($parameters);

$filePath = StaticData::clusterFilePath($cluster, $path);
if ($filePath) {
    $fileName = basename( $filePath );
    $fileExtension = strtolower( substr( strrchr( $fileName, "." ), 1 ) );

    $contentType = "application/octet-stream";
    switch( $fileExtension )
    {
        case "gif":
            $contentType = "image/gif";
            break;
        case "png":
            $contentType = "image/png";
            break;
        case "jpg":
        case "jpeg":
            $contentType = "image/jpg";
        default:
            break;
    }
    /**
     * @param string $type
     * @return string
     */
    private function getBanner( $type )
    {
        // second type because new files are named with 'large' instead of big in name.
        if( $type == 'big' ) 
            $type = 'large';
        $appIdentifier = $this->applicationObject()->attribute('identifier');
        $extensionsFallbacks = array(
            'jpg',
            'jpeg',
            'png',
        );

        $outputFile = null;
        foreach ($extensionsFallbacks as $extension)
        {
            if (!$outputFile) {
                $outputFile = StaticData::clusterFilePath(ClusterTool::clusterIdentifier(), "apps/{$appIdentifier}/banner_{$type}.{$extension}");
            }
            else {
                break;
            }
        }
        if ($outputFile)
            return $outputFile;
        
        return null;
    }
    /**
     * @param ChannelConfiguration $channelConfiguration
     * @return string
     */
    public function getNewImage(ChannelConfiguration $channelConfiguration)
    {
        if($this->attribute("new"))
        {
            return StaticData::externalUrl(ClusterTool::clusterIdentifier(), $this->attribute("new"));
        }

        if(!$channelConfiguration->attribute("new"))
        {
            return null;
        }

        return StaticData::externalUrl(ClusterTool::clusterIdentifier(), $channelConfiguration->attribute("new"));
    }
<?php

/* @type $Params string[] */

$clusterIdentifier      = isset( $Params['ClusterIdentifier'] ) ? $Params['ClusterIdentifier'] : ClusterTool::clusterIdentifier();
$applicationIdentifier  = $Params['ApplicationIdentifier'];
$staticDir              = StaticData::directory();
$clusterShort           = substr( $clusterIdentifier, 8 );

$filesToCheck = array(
    StaticData::clusterFilePath( $clusterIdentifier, 'apps/' . $applicationIdentifier . '/appstore_cover.jpg' ),
    StaticData::clusterFilePath( $clusterIdentifier, 'apps/' . $applicationIdentifier . '/appstore_cover.png' ),
    'extension/ezoscar/design/oscar/images/' . $clusterShort . '/apps/' . $applicationIdentifier . '/appstore_cover.jpg',
    'extension/ezoscar/design/oscar/images/' . $clusterShort . '/apps/' . $applicationIdentifier . '/appstore_cover.png',
    'extension/ezoscar/design/oscar/images/common/apps/' . $applicationIdentifier . '/appstore_cover.jpg',
    'extension/ezoscar/design/oscar/images/common/apps/' . $applicationIdentifier . '/appstore_cover.png'
);

foreach ( $filesToCheck as $file )
{
    if ( file_exists( $file ) )
    {
        $image = file_get_contents( $file );
        $fileUtils = eZClusterFileHandler::instance( $file );
        $fileUtils->storeContents( $image );
        header( 'Content-Type: image/jpg' );
        header( 'Content-Length: ' . $fileUtils->size() );
        $fileUtils->passthrough();
        eZExecution::cleanExit();
    }
}
    /**
     * @param string $path
     * @param string $quote
     * @param bool $skipSlash
     * @return string
     */
    public static function staticFile($path, $quote, $skipSlash)
    {
        $ini = eZINI::instance();
        $imgDecHash = 0;
        if ( $ini->variable( 'DesignSettings', 'DynamicImageSuffix' ) == 'enabled' )
        {
            $cluster = ClusterTool::clusterIdentifier();
            $filePath = StaticData::clusterFilePath($cluster, $path);
            if ( ! empty( $filePath ) )
            {
                $imgHash = sha1_file( $filePath );
                $imgDecHash = hexdec( substr( $imgHash, 0, 7 ) );
            }
        }
        $path = StaticData::externalUrl(ClusterTool::clusterIdentifier(), $path);

        $path = (!$skipSlash ? '/' : '') . ltrim($path, '/');

        if ( ! empty( $imgDecHash ) )
        {
            $path =  preg_replace( '/^(.*)\.([^.]+)$/i', '$1.'.$imgDecHash.'.$2', $path );
        }

        if (! $skipSlash )
        {
            $serverURL = eZURI::serverShardingURL( $path );
            $path = $serverURL.$path;
        }

        if ($quote == 'double')
            $path = sprintf('"%s"', $path);
        elseif ($quote == "single")
            $path = sprintf("'%s'", $path);

        return $path;
    }
    'use-extensions' => true,
    'debug-output' => false,
) );

$script->startup();
$script->initialize();

$cli = eZCLI::instance();

$options = $script->getOptions('[remove]', '', array(
    'remove'              => 'Remove old files else copy. Use remove option in a second pass'
));

$remove = isset($options['remove']) && $options['remove'] == true;
$varDir = eZSys::varDirectory();
$newStaticDir = StaticData::directory();

$fileUtils = eZClusterFileHandler::instance( $path );
if( $fileUtils->requiresClusterizing() ) {
    $dfsBackend = new eZDFSFileHandlerDFSBackend();
    $mountPoint = $dfsBackend->getMountPoint();
    $varDir = eZDir::path(array($mountPoint, $varDir));
    $newStaticDir = eZDir::path(array($mountPoint, $newStaticDir));
}

$clusterList = ClusterTool::globCluster();
$oldStaticDir = eZDir::path(array($varDir, 'static-data'));

$applicationList = array();
$rows = ApplicationObject::fetchObjectList(ApplicationObject::definition(), array('identifier'), null, null, null, false);
foreach ($rows as $row) {
Exemplo n.º 15
0
<?php

/* @type $Params string[] */

$clusterIdentifier = isset( $Params['ClusterIdentifier'] ) ? $Params['ClusterIdentifier'] : ClusterTool::clusterIdentifier();

$filePath = StaticData::clusterFilePath( $clusterIdentifier, "logo_big.png" );

if ( !$filePath )
{
    eZDebug::writeError( 'Sprite image does not exists' );
    header( 'HTTP/1.0 404 Not Found' );
}

header( 'Content-Type: image/png' );
header( 'Content-Length: ' . filesize( $filePath ) );
readfile( $filePath );
eZExecution::cleanExit();
    handleError();
}

$publisherFolderTranslation = $publisherFolder->getTranslation();
if ($publisherFolderTranslation instanceof PublisherFolderTranslation === false)
{
    handleError();
}

if ($publisherFolderTranslation->attribute($logoType) == null)
{
    handleError();
}

//we do this only to copy the image into a proper path
$filePath = $publisherFolderTranslation->getFile($logoType);

$filePath = StaticData::clusterFilePath( $clusterIdentifier, "publisher_folders/{$publisherFolder->attribute('path')}/{$logoType}.png" );

header( 'Content-Type: image/png' );
header( 'Content-Length: ' . filesize( $filePath ) );
readfile( $filePath );

eZExecution::cleanExit();

function handleError()
{
    eZDebug::writeError( 'Sprite image does not exists' );
    header( 'HTTP/1.0 404 Not Found' );
    eZExecution::cleanExit();
}
    /**
     * Push to the view variable about channel : channel headline, channel full url, channel part url (i.e: (channel)/131) and the icon
     */
    public function pushChannelResult()
    {
        if ($this->channel instanceof ApplicationLocalized) {
            $channelConfiguration = $this->channel->getChannelConfiguration();
            
            if ($this->channel->attribute("headline")) {
                $this->pushResult("channel_headline", $this->channel->attribute("headline"));
                $this->pushResult("channel_url", $this->channel->applicationUrl());
            }

            $this->pushResult('channel_id', $this->channel->application_id);

            $this->pushResult("channel_icon", StaticData::externalUrl(ClusterTool::clusterIdentifier(), $channelConfiguration->attribute("icon")));
            $this->pushResult("channel_color", $channelConfiguration->attribute("color"));

            if($this->channelBlockId){
                $this->pushResult("channel_part_url", "/(channel)/" . $this->channelBlockId);
            }

            $this->pushResult("channel_identifier", $this->channel->applicationObject()->identifier);
        }
    }
Exemplo n.º 18
0
<?php

/* @type $Params string[] */

$appIdentifier = $Params['ApplicationIdentifier'];
$clusterIdentifier = isset( $Params['ClusterIdentifier'] ) ? $Params['ClusterIdentifier'] : ClusterTool::clusterIdentifier();

$varDir = eZINI::instance( 'site.ini' )->variable( 'FileSettings', 'VarDir' );
$outputFile =  "{$varDir}/images/common/apps/icon/{$appIdentifier}/{$clusterIdentifier}_ico.png";
$spriteImgPath = StaticData::clusterFilePath(false, "apps/{$appIdentifier}/ico_sprite.png");
$backgroundFilePath = './extension/ezoscar/design/oscar/images/common/appicon/background.png';

$fileUtils = eZClusterFileHandler::instance($outputFile);

ClusterTool::setCurrentCluster( $clusterIdentifier );
$app = CacheApplicationTool::buildLocalizedApplicationByIdentifier( $appIdentifier );
ClusterTool::resetCurrentCluster();

if ( !$app instanceof ApplicationLocalized )
{
    eZDebug::writeError( "Application not found: {$appIdentifier}" );
    header('HTTP/1.0 404 Not Found');
    eZExecution::cleanExit();
}



if ( $fileUtils->fileExists( $outputFile ) )
{
    $appIcon = $fileUtils->fetchContents();
}
Exemplo n.º 19
0
    /**
     * @param string$clusterIdentifier
     * @param bool $backupExisting
     * @param bool $includeTimestamp
     * @return array
     * @throws Exception
     */
    public function generateSpriteForCluster($clusterIdentifier, $backupExisting = true, $includeTimestamp = true)
    {
        $outputFile = $this->buildFilePath($this->outputPath, array($clusterIdentifier));
        $timestampOutputFile = $this->generateFileName($outputFile, $includeTimestamp);
        $generatedSpriteName = substr($timestampOutputFile, strrpos($timestampOutputFile, '/') + 1);

        ClusterTool::setCurrentCluster( $clusterIdentifier );

        $lessPath = "extension/{$clusterIdentifier}/design/oscar/stylesheets/";
        $icoSprite = "/ico_sprite.png";
        $offsetStep = 95;
        $crop = $offsetStep * 2;
        $mobileStep = 83;
        $spriteConvertOptions = " -crop x{$crop}+0+0 ";
        $globalConvertOptions = " -append -quality 80%";

        $applicationList = CacheApplicationTool::clusterApplications();
        $cssList = array();
        $icoList = array();
        foreach( $applicationList as $application )
        {
            $icoCss = 'ico_'.SolrSafeOperatorHelper::getAppIdentifierForIcon( $application->applicationObject->identifier );
            $icoFile = StaticData::clusterFilePath( $clusterIdentifier, 'apps/'.$application->applicationObject->identifier.$icoSprite, true, true );

            if ( ! file_exists( $icoFile ) )
            {
                $icoFile = StaticData::clusterFilePath( 'default', 'apps/'.$application->applicationObject->identifier.$icoSprite, true, true );
            }
            if ( file_exists( $icoFile ) && ! in_array( $icoCss, $cssList ) )
            {
                $cssList[] = $icoCss;
                $icoList[] = $icoFile;
            }
        }

        if (empty($icoList))
        {
            throw new \Exception("No icons found for cluster {$clusterIdentifier}", 0);
        }
        if ($backupExisting && file_exists($outputFile))
        {
            rename($outputFile, $outputFile . '.bak');
        }
        $convertBinPath = $this->convertBinPath;

        $cmd = 'export PATH=$PATH:' . $convertBinPath . '; convert ' . implode( $spriteConvertOptions, $icoList ) . "{$spriteConvertOptions} {$globalConvertOptions} {$outputFile}";
        $cmdStatus = 0;
        $cmdOutput = array();
        exec($cmd, $cmdOutput, $cmdStatus);
        if ($cmdStatus != 0)
        {
            return array(
                'errorCode' => $cmdStatus,
                'generateSpriteCommand' => $cmd,
                'error' => implode('\n', $cmdOutput),
            );
        }

        $css = "
#app-catalog a.app-bar-access-app-library .poster{
    background-image: none !important;
}
#app-catalog a .poster,
#hide-app a .poster,
.item-apps .batch .wrap > a .poster,
.item-related-app .batch .wrap > a .poster{
      background-image:url(/esibuild/static/{$clusterIdentifier}/{$generatedSpriteName});
      background-repeat: no-repeat;
}
";
        $cssMobile = "
#app-catalog a.app-bar-access-app-library .poster{
    background-image: none !important;
}
#app-catalog a .poster,
#hide-app a .poster,
.item-apps .batch .wrap > a .poster,
.item-related-app .batch .wrap > a .poster{
      background-image:url(/esibuild/static/{$clusterIdentifier}/{$generatedSpriteName});
      background-repeat: no-repeat;
      background-size: {$mobileStep}px auto !important;
}
";
        $offset = 0;
        $offsetMobile = 0;
        foreach( $cssList as $key => $cssStyle )
        {
            $css .= "
#app-catalog a .poster.$cssStyle,
#hide-app a .poster.$cssStyle,
.item-apps .batch .wrap > a .poster.$cssStyle,
.item-related-app .batch .wrap > a .poster.$cssStyle{
      background-position: 0 -{$offset}px !important;
}
";
            $cssMobile .= "
#app-catalog a .poster.$cssStyle,
#hide-app a .poster.$cssStyle,
.item-apps .batch .wrap > a .poster.$cssStyle{
      background-position: 0 -{$offsetMobile}px !important;
}
";
            $offset += $offsetStep;
            $offsetMobile += $mobileStep;
            $css .= "
#app-catalog a:hover .poster.$cssStyle,
#app-catalog a:active .poster.$cssStyle,
#app-catalog a.active .poster.$cssStyle,
#hide-app a:active .poster.$cssStyle,
#hide-app a.active .poster.$cssStyle,
.item-apps .batch:hover .wrap > a .poster.$cssStyle,
.item-related-app .batch:hover .wrap > a .poster.$cssStyle{
      background-position: 0 -{$offset}px !important;
}
";
            $cssMobile .= "
#app-catalog a:hover .poster.$cssStyle,
#app-catalog a:active .poster.$cssStyle,
#app-catalog a.active .poster.$cssStyle,
#hide-app a:active .poster.$cssStyle,
#hide-app a.active .poster.$cssStyle,
.item-apps .batch:hover .wrap > a .poster.$cssStyle,
.item-related-app .batch:hover .wrap > a .poster.$cssStyle{
      background-position: 0 -{$offsetMobile}px !important;
}
";
            $offset += $offsetStep;
            $offsetMobile += $mobileStep;
        }

        if ( ! file_exists( $lessPath ) )
        {
            mkdir( $lessPath, 0755 );
        }
        if ( is_dir( $lessPath ) )
        {
            $lessFile = $lessPath."mod.icosprite.less";
            file_put_contents( $lessFile, $css );
            $lessFileMobile = $lessPath."mod.icosprite.mobile.less";
            file_put_contents( $lessFileMobile, $cssMobile );
            eZCache::clearByID( array('ezjscore-packer'), 'template-block' );
        }

        return array(
            'errorCode' => 0,
            'generateSpriteCommand' => $cmd
        );
    }
Exemplo n.º 20
0
    /**
     * @return array
     */
    public static function applicationList()
    {
        # Hotfix #23450 note-8
        if ( !isset($_COOKIE['remember_me']) )
        {
            $cookieExpiration = time() + eZINI::instance('merck.ini')->variable('TIBCOCookieSettings', 'TIBCOCookieExpiration');
            $uuid = MMUsers::getCurrentUserId();
            setcookie('remember_me', MMUserLogin::encryptText(json_encode($uuid)), $cookieExpiration, '/', CookieTool::getCookieDomain());
        }

        $out = array('applicationList' => array());
        $host = 'http://' . self::host();

        if ( isset($_POST['application']) )
        {
            $applicationIdList = array((int) $_POST['application']);
        }
        else
        {
            $applicationIdList = AppBarControl::instance()->applicationIds();
        }

        foreach ( $applicationIdList as $applicationId )
        {
            if ( !is_numeric($applicationId) )
            {
                continue;
            }
            $applicationLocalized = CacheApplicationTool::buildLocalizedApplicationByApplication($applicationId);
            $application = ($applicationLocalized) ? $applicationLocalized->applicationObject() : null;

            if ( $applicationLocalized )
            {
                $application = $applicationLocalized->applicationObject();
            }

            if ( isset($application) )
            {
                $applicationType = $application->applicationType();

                $icons = array(
                    'icon' => array(
                        'path' => '',
                        'md5' => '',
                        'file' => 'ico.png',
                    ),
                    'icon_hd' => array(
                        'path' => '',
                        'md5' => '',
                        'file' => 'ico_notext_hd.png',
                    ),
                    'icon_active' => array(
                        'path' => '',
                        'md5' => '',
                        'file' => 'ico_notext_active.png',
                    ),
                    'icon_active_hd' => array(
                        'path' => '',
                        'md5' => '',
                        'file' => 'ico_notext_active_hd.png'
                    ),
                );

                foreach($icons as $key => $iconData)
                {
                    $path = sprintf('apps/%s/%s', $application->attribute('identifier'), $iconData['file']);
                    $fullPath = StaticData::clusterFilePath(ClusterTool::clusterIdentifier(), $path);
                    if ($fullPath)
                    {
                        $icons[$key]['path'] = StaticData::externalUrl(ClusterTool::clusterIdentifier(), $path);
                        $icons[$key]['md5'] = md5_file($fullPath);
                    }
                }

                $path = '/' . $applicationLocalized->attribute('url');
                $url = $host . $path;
                if ( $application->isPureExternal() )
                {
                    $url = $applicationLocalized->attribute("external_url");
                }

                $outApplicationListArray = array(
                    'id'         => $applicationId,
                    'identifier' => $application->attribute('identifier'),
                    'name'       => $applicationLocalized->attribute('name'),
                    'headline'   => $applicationLocalized->attribute('headline'),
                    'type'       => $applicationType->attribute('internal_type'),
                    'url'        => $url,
                    'path'       => $path,
                    'javascript' => self::getJavascript($application->attribute('identifier'), 'application'));

                foreach($icons as $key => $icon)
                {
                    $outApplicationListArray[$key] = array(
                        '100' => array('path' => $icon['path'], $icon['md5']),
                    );
                }
                $out['applicationList'][] = $outApplicationListArray;
            }
        }
        return $out;
    }
Exemplo n.º 21
0
<?php

define('ROOT', dirname(__DIR__));
include ROOT . '/include/common.php';
Logger::set_name("cron_start_country");
echo date("Y-m-d H:i:s") . "|cron_start_country start \n";
$server_id = ConfigData::get('app|server_id', 1, TRUE);
$static_country_list = StaticData::read('country_list');
if (!isset($static_country_list[$server_id])) {
    echo "This server_id is no longer war in the country  \n";
    exit;
}
$scountry = array();
foreach ($static_country_list as $ckey => $cval) {
    if ($cval != $static_country_list[$server_id]) {
        continue;
    }
    $scountry[] = $ckey;
}
sort($scountry);
reset($scountry);
/*if(current($scountry) != $server_id){
    echo "This crontab  Return to normal\n";
    exit;
}*/
$uid = 'de721bcef5cba1fc182d186d98afe072';
list($player, $ret) = Player::instance($uid);
$player_country_handle = $player->get_player_class_handle('country');
$player_country_handle->removeprev();
$player_country_handle->initinfo();
echo date("Y-m-d H:i:s") . "|cron_start_country end \n";
Exemplo n.º 22
0
    } else {
        require_once '../../models/DAO/DAO.class.php';
        require_once_model('Term');
        require_once_model('Unit');
        require_once_model('Building');
        require_once_model('Technology');
        require_once_model('Sector');
        require_once_model('Player');
        require_once_model('Resource');
        require_once_model('StaticData');
        require_once_model('ProductionMod');
        require_once_model('BattleMod');
    }
}
//session_start();
$staticData = StaticData::singleton();
$termConn = new TermDAO();
$unitConn = new UnitDAO();
$buildingConn = new BuildingDAO();
$technologyConn = new TechnologyDAO();
$playerConn = new PlayerDAO();
$resourceConn = new ResourceDAO();
$productionModConn = new ProductionModDAO();
$battleModConn = new BattleModDAO();
Term::setLang($_SESSION['language']);
$termsArr = $termConn->getAllTerms($_SESSION['language']);
foreach ($termsArr as $termArr) {
    $term = new Term($termArr[0], $termArr[1]);
    $terms[$termArr[0]] = $term;
}
$battleModsArr = $battleModConn->getAllBattleMods();