/**
  * Constructs this Dispatcher and registers the autoloader
  */
 public function __construct()
 {
     t3lib_cache::initializeCachingFramework();
     $this->initializeClassLoader();
     $this->initializeCache();
     $this->initializeReflection();
 }
示例#2
0
 /**
  * Collects the needed data recursively cached. This function detects recursion loops.
  *
  * @param string $function The function to call and collect the result of.
  * @param string $childrenFunction The function to get the children from (must return an iterable object or an array).
  * @param callable $processData An optional closure to process the data from the function, must return an array.
  * @return array The resulting collection.
  */
 public function collectRecursiveDataCached($function, $childrenFunction, $processData = null, $keyFunction = null, &$recursionIndex = array())
 {
     if (isset($recursionIndex[$this->getUid()])) {
         return array();
     }
     $recursionIndex[$this->getUid()] = true;
     $identifier = 'tx_contentstage_' . get_class($this) . '_' . $function . '_' . $childrenFunction . '_' . $this->getUid();
     if (TX_CONTENTSTAGE_USECACHE) {
         if (self::$cache === null) {
             t3lib_cache::initializeCachingFramework();
             if (method_exists('t3lib_cache', 'initContentHashCache')) {
                 // not needed in 6.2 anymore
                 t3lib_cache::initContentHashCache();
             }
             self::$cache = $GLOBALS['typo3CacheManager']->getCache('cache_hash');
         }
         if (TX_CONTENTSTAGE_USECACHE && self::$cache->has($identifier)) {
             return self::$cache->get($identifier);
         }
     }
     $data = array();
     $tData = array();
     if (is_callable(array($this, $function))) {
         $tData = $this->{$function}();
         if ($processData !== null && is_callable($processData)) {
             $tData = $processData($tData);
         }
     }
     $tData = is_array($tData) ? $tData : array();
     $useKeyFunction = false;
     if ($keyFunction !== null && is_callable($keyFunction)) {
         $useKeyFunction = true;
         foreach ($tData as $item) {
             $key = $keyFunction($item);
             if ($key !== null) {
                 $data[$key] = $item;
             } else {
                 $data[] = $item;
             }
         }
     } else {
         $data = $tData;
     }
     if (is_callable(array($this, $childrenFunction))) {
         foreach ($this->{$childrenFunction}() as $child) {
             foreach ($child->collectRecursiveDataCached($function, $childrenFunction, $processData, $keyFunction, $recursionIndex) as $item) {
                 if ($useKeyFunction && ($key = $keyFunction($item)) !== null) {
                     $data[$key] = $item;
                 } else {
                     $data[] = $item;
                 }
             }
         }
     }
     if (TX_CONTENTSTAGE_USECACHE) {
         self::$cache->set($identifier, $data, array(), TX_CONTENTSTAGE_CACHETIME);
     }
     return $data;
 }
 /**
  * Initializes the cache for this command.
  *
  * @return void
  */
 protected function initializeCache()
 {
     t3lib_cache::initializeCachingFramework();
     try {
         $this->cacheInstance = $GLOBALS['typo3CacheManager']->getCache('tx_solr');
     } catch (t3lib_cache_exception_NoSuchCache $e) {
         $this->cacheInstance = $GLOBALS['typo3CacheFactory']->create('tx_solr', $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_solr']['frontend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_solr']['backend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_solr']['options']);
     }
 }
 /**
  * Execute garbage collection, called by scheduler.
  *
  * @return void
  */
 public function execute()
 {
     // Don't do anything if caching framework is not used at all
     if (t3lib_cache::isCachingFrameworkInitialized()) {
         // Global subarray with all configured caches
         $cacheConfigurations = $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'];
         if (is_array($cacheConfigurations)) {
             // Iterate through configured caches and call garbage collection if
             // backend is within selected backends in additonal field of task
             foreach ($cacheConfigurations as $cacheName => $cacheConfiguration) {
                 // The cache backend used for this cache
                 $usedCacheBackend = $cacheConfiguration['backend'];
                 if (in_array($usedCacheBackend, $this->selectedBackends)) {
                     $this->callGarbageCollectionOfCache($cacheName, $cacheConfiguration);
                 }
             }
         }
     }
     return TRUE;
 }
示例#5
0
 /**
  * Imports the data from the stddb tables.sql file.
  *
  * Example/intended usage:
  *
  * <pre>
  * public function setUp() {
  *   $this->createDatabase();
  *   $db = $this->useTestDatabase();
  *   $this->importStdDB();
  *   $this->importExtensions(array('cms', 'static_info_tables', 'templavoila'));
  * }
  * </pre>
  *
  * @return void
  */
 protected function importStdDb()
 {
     $sqlFilename = t3lib_div::getFileAbsFileName(PATH_t3lib . 'stddb/tables.sql');
     $fileContent = t3lib_div::getUrl($sqlFilename);
     $this->importDatabaseDefinitions($fileContent);
     if (t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version) >= 4006000) {
         // make sure missing caching framework tables do not get into the way
         $cacheTables = t3lib_cache::getDatabaseTableDefinitions();
         $this->importDatabaseDefinitions($cacheTables);
     }
 }
 /**
  * Initialize the controller.
  *
  * @return void
  */
 public function initializeAction()
 {
     $this->extensionName = 'Contentstage';
     $this->activeBackendUser = $this->backendUserRepository->findByUid($GLOBALS['BE_USER']->user['uid']);
     if ($this->activeBackendUser === null) {
         // should never happen
         die($this->translate('error.noBackendUser'));
     }
     t3lib_cache::initializeCachingFramework();
     if (method_exists('t3lib_cache', 'initContentHashCache')) {
         // not needed in 6.2 anymore
         t3lib_cache::initContentHashCache();
     }
     $this->cache = $GLOBALS['typo3CacheManager']->getCache('cache_hash');
     $this->extensionConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['contentstage']);
     define('TX_CONTENTSTAGE_USECACHE', !empty($this->extensionConfiguration['useCache']));
     define('TX_CONTENTSTAGE_CACHETIME', intval($this->extensionConfiguration['cacheTime']));
     $this->settings['publishRecords'] = $this->extensionConfiguration['global.']['disablePublishRecord'] ? '' : 'Extended';
     $this->localDB = $GLOBALS['TYPO3_DB'];
     $this->initializePage();
     $info = $this->extensionConfiguration['remote.']['db.'];
     $noPconnect = $GLOBALS['TYPO3_CONF_VARS']['SYS']['no_pconnect'];
     $GLOBALS['TYPO3_CONF_VARS']['SYS']['no_pconnect'] = true;
     $this->remoteDB = t3lib_div::makeInstance('t3lib_db');
     $this->remoteDB->connectDB($info['host'], $info['user'], $info['password'], $info['database']);
     $GLOBALS['TYPO3_CONF_VARS']['SYS']['no_pconnect'] = $noPconnect;
     $this->initializeLog();
     $this->localRepository = $this->objectManager->create('Tx_Contentstage_Domain_Repository_ContentRepository', $this->localDB, $this->log, $this->cache, 'localRepository');
     $this->localRepository->setFolder(PATH_site);
     $this->localRepository->setCurrentPage($this->page);
     $this->localRepository->setParent($this);
     $this->remoteRepository = $this->objectManager->create('Tx_Contentstage_Domain_Repository_ContentRepository', $this->remoteDB, $this->log, $this->cache, 'remoteRepository');
     $this->remoteRepository->setFolder($this->extensionConfiguration['remote.']['folder']);
     $this->remoteRepository->setCurrentPage($this->page);
     $this->remoteRepository->setParent($this);
     $pageTS = $this->getPageTS();
     $this->localRepository->setUseHttps($pageTS['useHttpsLocal']);
     $this->localRepository->setOverrideDomain($pageTS['overrideDomainLocal']);
     $this->remoteRepository->setUseHttps($pageTS['useHttpsRemote']);
     $this->remoteRepository->setOverrideDomain($pageTS['overrideDomainRemote']);
     $this->initializeDepth();
     $this->initializeIgnoreTables();
     $this->initializeReview();
     $hookFilename = 'contentstage/Classes/Controller/' . $this->request->getControllerName() . 'Controller.php';
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$hookFilename][$this->request->getControllerActionName()])) {
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][$hookFilename][$this->request->getControllerActionName()] as $classRef) {
             $this->hookObjectsArray[] =& t3lib_div::getUserObj($classRef);
         }
     }
 }
 /**
  * Initializes the caching system.
  *
  * @return	void
  */
 protected function initCaches()
 {
     if (TYPO3_UseCachingFramework) {
         $GLOBALS['TT']->push('Initializing the Caching System', '');
         $GLOBALS['typo3CacheManager'] = t3lib_div::makeInstance('t3lib_cache_Manager');
         $GLOBALS['typo3CacheFactory'] = t3lib_div::makeInstance('t3lib_cache_Factory');
         $GLOBALS['typo3CacheFactory']->setCacheManager($GLOBALS['typo3CacheManager']);
         try {
             $this->pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages');
         } catch (t3lib_cache_exception_NoSuchCache $e) {
             t3lib_cache::initPageCache();
             $this->pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages');
         }
         t3lib_cache::initPageSectionCache();
         t3lib_cache::initContentHashCache();
         $GLOBALS['TT']->pull();
     }
 }
 /**
  * Initializes the cache instance
  *
  * @return void
  */
 protected function initCache()
 {
     t3lib_cache::initializeCachingFramework();
     try {
         $this->cache = $GLOBALS['typo3CacheManager']->getCache('cache_nrsemantictemplates_html');
     } catch (Exception $e) {
         $conf = $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_nrsemantictemplates_html'];
         $this->cache = $GLOBALS['typo3CacheFactory']->create('cache_nrsemantictemplates_html', $conf['frontend'], $conf['backend'], $conf['options']);
     }
 }
<?php

if (!defined('TYPO3_MODE')) {
    die('Access denied.');
}
if (TYPO3_MODE == 'BE') {
    // register the cache in BE so it will be cleared with "clear all caches"
    try {
        t3lib_cache::initializeCachingFramework();
        $GLOBALS['typo3CacheFactory']->create('tx_extbase_cache_reflection', $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['frontend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['backend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_reflection']['options']);
    } catch (t3lib_cache_exception_NoSuchCache $exception) {
    }
    $TBE_MODULES['_dispatcher'][] = 'Tx_Extbase_Dispatcher';
}
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['tx_reports']['status']['providers']['extbase'][] = 'tx_extbase_utility_extbaserequirementscheck';
t3lib_div::loadTCA('fe_users');
if (!isset($TCA['fe_groups']['ctrl']['type'])) {
    $tempColumns = array('tx_extbase_type' => array('exclude' => 1, 'label' => 'LLL:EXT:extbase/Resources/Private/Language/locallang_db.xml:fe_users.tx_extbase_type', 'config' => array('type' => 'select', 'items' => array(array('LLL:EXT:extbase/Resources/Private/Language/locallang_db.xml:fe_users.tx_extbase_type.0', '0'), array('LLL:EXT:extbase/Resources/Private/Language/locallang_db.xml:fe_users.tx_extbase_type.Tx_Extbase_Domain_Model_FrontendUser', 'Tx_Extbase_Domain_Model_FrontendUser')), 'size' => 1, 'maxitems' => 1, 'default' => '0')));
    t3lib_extMgm::addTCAcolumns('fe_users', $tempColumns, 1);
    t3lib_extMgm::addToAllTCAtypes('fe_users', 'tx_extbase_type');
    $TCA['fe_users']['ctrl']['type'] = 'tx_extbase_type';
}
$TCA['fe_users']['types']['Tx_Extbase_Domain_Model_FrontendUser'] = $TCA['fe_users']['types']['0'];
t3lib_div::loadTCA('fe_groups');
if (!isset($TCA['fe_groups']['ctrl']['type'])) {
    $tempColumns = array('tx_extbase_type' => array('exclude' => 1, 'label' => 'LLL:EXT:extbase/Resources/Private/Language/locallang_db.xml:fe_groups.tx_extbase_type', 'config' => array('type' => 'select', 'items' => array(array('LLL:EXT:extbase/Resources/Private/Language/locallang_db.xml:fe_groups.tx_extbase_type.0', '0'), array('LLL:EXT:extbase/Resources/Private/Language/locallang_db.xml:fe_groups.tx_extbase_type.Tx_Extbase_Domain_Model_FrontendUserGroup', 'Tx_Extbase_Domain_Model_FrontendUserGroup')), 'size' => 1, 'maxitems' => 1, 'default' => '0')));
    t3lib_extMgm::addTCAcolumns('fe_groups', $tempColumns, 1);
    t3lib_extMgm::addToAllTCAtypes('fe_groups', 'tx_extbase_type');
    $TCA['fe_groups']['ctrl']['type'] = 'tx_extbase_type';
}
$TCA['fe_groups']['types']['Tx_Extbase_Domain_Model_FrontendUserGroup'] = $TCA['fe_groups']['types']['0'];
 /**
  * Gets the defined field definitions from the ext_tables.sql files.
  *
  * @return array The accordant definitions
  */
 protected function getDefinedFieldDefinitions()
 {
     $content = '';
     $rawStructureDefinitions = $this->getAllRawStructureDefinitions();
     if (t3lib_div::compat_version('4.6')) {
         // Add caching framework tables if applicable
         $rawStructureDefinitions = array_merge($rawStructureDefinitions, $this->install->getStatementArray(t3lib_cache::getDatabaseTableDefinitions(), 1, '^CREATE TABLE '));
     }
     $rawStructureString = implode(chr(10), $rawStructureDefinitions);
     if (method_exists($this->install, 'getFieldDefinitions_fileContent')) {
         $content = $this->install->getFieldDefinitions_fileContent($rawStructureString);
     } else {
         $content = $this->install->getFieldDefinitions_sqlContent($rawStructureString);
     }
     //echo $content;
     return $content;
 }
示例#11
0
 /**
  * Initialize the cache.
  *
  * @return void
  */
 protected function initializeCache()
 {
     t3lib_cache::initializeCachingFramework();
     if (method_exists('t3lib_cache', 'initContentHashCache')) {
         // not needed in 6.2 anymore
         t3lib_cache::initContentHashCache();
     }
     $this->cache = $GLOBALS['typo3CacheManager']->getCache('cache_hash');
 }
 /**
  * Determines whether the caching framework is initialized.
  * The caching framework could be disabled for the core but used by an extension.
  *
  * @return	boolean
  */
 public function isCachingFrameworkInitialized()
 {
     if (!self::$isCachingFrameworkInitialized && isset($GLOBALS['typo3CacheManager']) && $GLOBALS['typo3CacheManager'] instanceof t3lib_cache_Manager && isset($GLOBALS['typo3CacheFactory']) && $GLOBALS['typo3CacheFactory'] instanceof t3lib_cache_Factory) {
         self::$isCachingFrameworkInitialized = TRUE;
     }
     return self::$isCachingFrameworkInitialized;
 }
示例#13
0
 /**
  * Initialize the TYPO3 second level cache
  */
 private function initializeLevel2Cache()
 {
     t3lib_cache::initializeCachingFramework();
     try {
         $this->level2Cache = $GLOBALS['typo3CacheManager']->getCache('cache_extbase_object');
     } catch (t3lib_cache_exception_NoSuchCache $exception) {
         $this->level2Cache = $GLOBALS['typo3CacheFactory']->create('cache_extbase_object', $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_object']['frontend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_object']['backend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['cache_extbase_object']['options']);
     }
 }
 /**
  * Clears the cache based on the command $cacheCmd.
  *
  * $cacheCmd='pages':	Clears cache for all pages. Requires admin-flag to
  * be set for BE_USER.
  *
  * $cacheCmd='all':		Clears all cache_tables. This is necessary if
  * templates are updated. Requires admin-flag to be set for BE_USER.
  *
  * $cacheCmd=[integer]:	Clears cache for the page pointed to by $cacheCmd
  * (an integer).
  *
  * Can call a list of post processing functions as defined in
  * $TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc']
  * (numeric array with values being the function references, called by
  * t3lib_div::callUserFunction()).
  *
  * Note: The following cache_* are intentionally not cleared by
  * $cacheCmd='all':
  *
  * - cache_md5params:	Clearing this table would destroy all simulateStatic
  *						 URLs, simulates file name and RDCT redirects.
  * - cache_imagesizes:	Clearing this table would cause a lot of unneeded
  *						 Imagemagick calls because the size informations have
  *						 to be fetched again after clearing.
  * - cache_extensions:	Clearing this table would make the extension manager
  *						 unusable until a new extension list is fetched from
  *						 the TER.
  *
  * @param	string		the cache command, see above description
  * @return	void
  */
 public function clear_cacheCmd($cacheCmd)
 {
     global $TYPO3_CONF_VARS;
     $this->BE_USER->writelog(3, 1, 0, 0, 'User %s has cleared the cache (cacheCmd=%s)', array($this->BE_USER->user['username'], $cacheCmd));
     // Clear cache for either ALL pages or ALL tables!
     switch ($cacheCmd) {
         case 'pages':
             if ($this->admin || $this->BE_USER->getTSConfigVal('options.clearCache.pages')) {
                 $this->internal_clearPageCache();
             }
             break;
         case 'all':
             if ($this->admin || $this->BE_USER->getTSConfigVal('options.clearCache.all')) {
                 // Clear all caching framework caches if it is initialized:
                 // (it could be disabled by initialized by an extension)
                 if (t3lib_cache::isCachingFrameworkInitialized()) {
                     $GLOBALS['typo3CacheManager']->flushCaches();
                 }
                 if (TYPO3_UseCachingFramework) {
                     if (t3lib_extMgm::isLoaded('cms')) {
                         $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('cache_treelist');
                     }
                 } else {
                     if (t3lib_extMgm::isLoaded('cms')) {
                         $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('cache_treelist');
                         $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('cache_pagesection');
                     }
                     $this->internal_clearPageCache();
                     $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery('cache_hash');
                 }
                 // Clearing additional cache tables:
                 if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearAllCache_additionalTables'])) {
                     foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearAllCache_additionalTables'] as $tableName) {
                         if (!preg_match('/[^[:alnum:]_]/', $tableName) && substr($tableName, -5) == 'cache') {
                             $GLOBALS['TYPO3_DB']->exec_TRUNCATEquery($tableName);
                         } else {
                             throw new RuntimeException('TYPO3 Fatal Error: Trying to flush table "' . $tableName . '" with "Clear All Cache"', 1270853922);
                         }
                     }
                 }
             }
             if ($this->admin && $TYPO3_CONF_VARS['EXT']['extCache']) {
                 $this->removeCacheFiles();
             }
             break;
         case 'temp_CACHED':
             if ($this->admin && $TYPO3_CONF_VARS['EXT']['extCache']) {
                 $this->removeCacheFiles();
             }
             break;
     }
     // Clear cache for a page ID!
     if (t3lib_div::testInt($cacheCmd)) {
         if (t3lib_extMgm::isLoaded('cms')) {
             $list_cache = array($cacheCmd);
             // Call pre-processing function for clearing of cache for page ids:
             if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearPageCacheEval'])) {
                 foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearPageCacheEval'] as $funcName) {
                     $_params = array('pageIdArray' => &$list_cache, 'cacheCmd' => $cacheCmd, 'functionID' => 'clear_cacheCmd()');
                     // Returns the array of ids to clear, false if nothing should be cleared! Never an empty array!
                     t3lib_div::callUserFunction($funcName, $_params, $this);
                 }
             }
             // Delete cache for selected pages:
             if (is_array($list_cache)) {
                 if (TYPO3_UseCachingFramework) {
                     $pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages');
                     $pageSectionCache = $GLOBALS['typo3CacheManager']->getCache('cache_pagesection');
                     foreach ($list_cache as $pageId) {
                         $pageCache->flushByTag('pageId_' . (int) $pageId);
                         $pageSectionCache->flushByTag('pageId_' . (int) $pageId);
                     }
                 } else {
                     $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages', 'page_id IN (' . implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($list_cache)) . ')');
                     $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pagesection', 'page_id IN (' . implode(',', $GLOBALS['TYPO3_DB']->cleanIntArray($list_cache)) . ')');
                     // Originally, cache_pagesection was not cleared with cache_pages!
                 }
             }
         }
     }
     // Call post processing function for clear-cache:
     if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc'])) {
         $_params = array('cacheCmd' => $cacheCmd);
         foreach ($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc'] as $_funcRef) {
             t3lib_div::callUserFunction($_funcRef, $_params, $this);
         }
     }
 }
 /**
  * Initializes the caching framework by loading the cache manager and factory
  * into the global context.
  *
  * @return	void
  */
 public static function initializeCachingFramework()
 {
     t3lib_cache::initializeCachingFramework();
 }
示例#16
0
 /**
  * Init function, setting the input vars in the global space.
  *
  * @return	void
  */
 function init()
 {
     // Loading internal vars with the GET/POST parameters from outside:
     $this->file = t3lib_div::_GP('file');
     $this->width = t3lib_div::_GP('width');
     $this->height = t3lib_div::_GP('height');
     $this->sample = t3lib_div::_GP('sample');
     $this->alternativeTempPath = t3lib_div::_GP('alternativeTempPath');
     $this->effects = t3lib_div::_GP('effects');
     $this->frame = t3lib_div::_GP('frame');
     $this->bodyTag = t3lib_div::_GP('bodyTag');
     $this->title = t3lib_div::_GP('title');
     $this->wrap = t3lib_div::_GP('wrap');
     $this->md5 = t3lib_div::_GP('md5');
     $this->contentHash = t3lib_div::_GP('contentHash');
     // ***********************
     // Check parameters
     // ***********************
     // If no file-param is given, we must exit
     if (!$this->file) {
         die('Parameter Error: No file given.');
     }
     // Chech md5-checksum: If this md5-value does not match the one submitted, then we fail... (this is a kind of security that somebody don't just hit the script with a lot of different parameters
     $md5_value = md5($this->file . '|' . $this->width . '|' . $this->height . '|' . $this->effects . '|' . $this->bodyTag . '|' . $this->title . '|' . $this->wrap . '|' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] . '|');
     if ($md5_value != $this->md5) {
         die('Parameter Error: Wrong parameters sent.');
     }
     // Need to connect to database, because this is used (typo3temp_db_tracking, cached image dimensions).
     $GLOBALS['TYPO3_DB']->sql_pconnect(TYPO3_db_host, TYPO3_db_username, TYPO3_db_password);
     $GLOBALS['TYPO3_DB']->sql_select_db(TYPO3_db);
     if (TYPO3_UseCachingFramework) {
         $GLOBALS['typo3CacheManager'] = t3lib_div::makeInstance('t3lib_cache_Manager');
         $GLOBALS['typo3CacheFactory'] = t3lib_div::makeInstance('t3lib_cache_Factory');
         $GLOBALS['typo3CacheFactory']->setCacheManager($GLOBALS['typo3CacheManager']);
         t3lib_cache::initPageCache();
         t3lib_cache::initPageSectionCache();
         t3lib_cache::initContentHashCache();
     }
     // Check for the new content cache hash
     if (strlen(t3lib_div::_GP('contentHash')) > 0) {
         $this->content = t3lib_pageSelect::getHash($this->contentHash);
         if (is_null($this->content)) {
             die('Parameter Error: Content not available.');
         }
     }
     // ***********************
     // Check the file. If must be in a directory beneath the dir of this script...
     // $this->file remains unchanged, because of the code in stdgraphic, but we do check if the file exists within the current path
     // ***********************
     $test_file = PATH_site . $this->file;
     if (!t3lib_div::validPathStr($test_file)) {
         die('Parameter Error: No valid filepath');
     }
     if (!@is_file($test_file)) {
         die('The given file was not found');
     }
 }
 public function loescheTypo3Seitencache($pidList)
 {
     if (TYPO3_UseCachingFramework) {
         $pageIds = t3lib_div::trimExplode(',', $pidList);
         $pageCache = t3lib_div::makeInstance('t3lib_cache_Manager');
         try {
             $pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages');
         } catch (t3lib_cache_exception_NoSuchCache $e) {
             t3lib_cache::initPageCache();
             $pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages');
         }
         foreach ($pageIds as $pageId) {
             $pageCache->flushByTag('pageId_' . (int) $pageId);
         }
         return true;
     } else {
         return $GLOBALS['TYPO3_DB']->exec_DELETEquery('cache_pages', 'page_id IN (' . $GLOBALS['TYPO3_DB']->cleanIntList($pidList) . ')');
     }
 }
示例#18
0
$TYPO3_DB = t3lib_div::makeInstance('t3lib_DB');
$TYPO3_DB->debugOutput = $TYPO3_CONF_VARS['SYS']['sqlDebug'];
$CLIENT = t3lib_div::clientInfo();
// $CLIENT includes information about the browser/user-agent
$PARSETIME_START = t3lib_div::milliseconds();
// Is set to the system time in milliseconds. This could be used to output script parsetime in the end of the script
// ***********************************
// Initializing the Caching System
// ***********************************
if (TYPO3_UseCachingFramework) {
    $typo3CacheManager = t3lib_div::makeInstance('t3lib_cache_Manager');
    $typo3CacheFactory = t3lib_div::makeInstance('t3lib_cache_Factory');
    $typo3CacheFactory->setCacheManager($typo3CacheManager);
    t3lib_cache::initPageCache();
    t3lib_cache::initPageSectionCache();
    t3lib_cache::initContentHashCache();
}
// *************************
// CLI dispatch processing
// *************************
if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI && basename(PATH_thisScript) == 'cli_dispatch.phpsh') {
    // First, take out the first argument (cli-key)
    $temp_cliScriptPath = array_shift($_SERVER['argv']);
    $temp_cliKey = array_shift($_SERVER['argv']);
    array_unshift($_SERVER['argv'], $temp_cliScriptPath);
    // If cli_key was found in configuration, then set up the cliInclude path and module name:
    if ($temp_cliKey) {
        if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['GLOBAL']['cliKeys'][$temp_cliKey])) {
            define('TYPO3_cliInclude', t3lib_div::getFileAbsFileName($TYPO3_CONF_VARS['SC_OPTIONS']['GLOBAL']['cliKeys'][$temp_cliKey][0]));
            $MCONF['name'] = $TYPO3_CONF_VARS['SC_OPTIONS']['GLOBAL']['cliKeys'][$temp_cliKey][1];
        } else {
示例#19
0
 /**
  * initializes the cache for the DB requests
  *
  * @return Cache Object
  */
 protected function initializeCache()
 {
     // Create the cache (only needed for 4.5 and lower)
     if (\t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version) < '4006000') {
         \t3lib_cache::initializeCachingFramework();
         try {
             $cacheInstance = $GLOBALS['typo3CacheManager']->getCache('tx_geocoding');
         } catch (\t3lib_cache_exception_NoSuchCache $e) {
             $cacheInstance = $GLOBALS['typo3CacheFactory']->create('tx_geocoding', $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_geocoding']['frontend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_geocoding']['backend'], $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['tx_geocoding']['options']);
         }
     } else {
         // Initialize the cache
         try {
             if (isset($GLOBALS['typo3CacheManager'])) {
                 $cacheInstance = $GLOBALS['typo3CacheManager']->getCache('tx_geocoding');
             } else {
                 $cacheInstance = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager')->getCache('tx_geocoding');
             }
         } catch (\t3lib_cache_exception_NoSuchCache $e) {
             throw new Exception('Unable to load Cache! 1299944198');
         }
     }
     return $cacheInstance;
 }