示例#1
0
}
/** @var TYPO3_DB t3lib_db */
$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]));
 /**
  * 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();
     }
 }
示例#3
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) . ')');
     }
 }