コード例 #1
0
 /**
  * Initialize all required repository and factory objects.
  *
  * @throws \RuntimeException
  */
 protected function init()
 {
     $fileadminDirectory = rtrim($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], '/') . '/';
     /** @var $storageRepository \TYPO3\CMS\Core\Resource\StorageRepository */
     $storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\StorageRepository');
     $storages = $storageRepository->findAll();
     foreach ($storages as $storage) {
         $storageRecord = $storage->getStorageRecord();
         $configuration = $storage->getConfiguration();
         $isLocalDriver = $storageRecord['driver'] === 'Local';
         $isOnFileadmin = !empty($configuration['basePath']) && \TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr($configuration['basePath'], $fileadminDirectory);
         if ($isLocalDriver && $isOnFileadmin) {
             $this->storage = $storage;
             break;
         }
     }
     if (!isset($this->storage)) {
         throw new \RuntimeException('Local default storage could not be initialized - might be due to missing sys_file* tables.');
     }
     $this->fileFactory = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\ResourceFactory');
     //TYPO3 >= 6.2.0
     if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 6002000) {
         $this->fileIndexRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\Index\\FileIndexRepository');
     } else {
         //TYPO3 = 6.1
         $this->fileRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\FileRepository');
     }
     $this->targetDirectory = PATH_site . $fileadminDirectory . self::FOLDER_ContentUploads . '/';
 }
コード例 #2
0
 /**
  * Converts string dependencies to an object storage of dependencies
  *
  * @param string $dependencies
  * @return \SplObjectStorage
  */
 public function convertDependenciesToObjects($dependencies)
 {
     $dependenciesObject = new \SplObjectStorage();
     $unserializedDependencies = unserialize($dependencies);
     if (!is_array($unserializedDependencies)) {
         return $dependenciesObject;
     }
     foreach ($unserializedDependencies as $dependencyType => $dependencyValues) {
         // Dependencies might be given as empty string, e.g. conflicts => ''
         if (!is_array($dependencyValues)) {
             continue;
         }
         foreach ($dependencyValues as $dependency => $versions) {
             if ($dependencyType && $dependency) {
                 $versionNumbers = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionsStringToVersionNumbers($versions);
                 $lowest = $versionNumbers[0];
                 if (count($versionNumbers) === 2) {
                     $highest = $versionNumbers[1];
                 } else {
                     $highest = '';
                 }
                 /** @var $dependencyObject \TYPO3\CMS\Extensionmanager\Domain\Model\Dependency */
                 $dependencyObject = $this->objectManager->get(\TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::class);
                 $dependencyObject->setType($dependencyType);
                 $dependencyObject->setIdentifier($dependency);
                 $dependencyObject->setLowestVersion($lowest);
                 $dependencyObject->setHighestVersion($highest);
                 $dependenciesObject->attach($dependencyObject);
                 unset($dependencyObject);
             }
         }
     }
     return $dependenciesObject;
 }
コード例 #3
0
    /**
     * Processes the actual transformation from CSV to sys_file_references
     *
     * @param array $record
     * @return void
     */
    protected function migrateRecord(array $record)
    {
        $collections = array();
        $files = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $record['image'], TRUE);
        $descriptions = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('
', $record['imagecaption']);
        $titleText = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('
', $record['imagetitletext']);
        $i = 0;
        foreach ($files as $file) {
            if (file_exists(PATH_site . 'uploads/tx_cal/pics/' . $file)) {
                \TYPO3\CMS\Core\Utility\GeneralUtility::upload_copy_move(PATH_site . 'uploads/tx_cal/pics/' . $file, $this->targetDirectory . $file);
                $fileObject = $this->storage->getFile(self::FOLDER_ContentUploads . '/' . $file);
                //TYPO3 >= 6.2.0
                if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 6002000) {
                    $this->fileIndexRepository->add($fileObject);
                } else {
                    //TYPO3 6.1.0
                    $this->fileRepository->addToIndex($fileObject);
                }
                $dataArray = array('uid_local' => $fileObject->getUid(), 'tablenames' => $this->getRecordTableName(), 'uid_foreign' => $record['uid'], 'pid' => $record['pid'], 'fieldname' => 'image', 'sorting_foreign' => $i);
                if (isset($descriptions[$i])) {
                    $dataArray['description'] = $descriptions[$i];
                }
                if (isset($titleText[$i])) {
                    $dataArray['alternative'] = $titleText[$i];
                }
                $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_file_reference', $dataArray);
                unlink(PATH_site . 'uploads/tx_cal/pics/' . $file);
            }
            $i++;
        }
        $this->cleanRecord($record, $i, $collections);
    }
コード例 #4
0
 /**
  * Creates instance of an Update object
  *
  * @param string $className The class name
  * @param string $identifier The identifier of Update object - needed to fetch user input
  * @return AbstractUpdate Newly instantiated Update object
  */
 protected function getUpdateObjectInstance($className, $identifier)
 {
     //$userInput = $this->postValues['values'][$identifier];
     $userInput = NULL;
     $versionAsInt = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version);
     return \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($className, $identifier, $versionAsInt, $userInput, $this);
 }
コード例 #5
0
 /**
  * Check if current TYPO3 version is suitable for the extension
  *
  * @param string $lowestVersion
  * @param string $highestVersion
  * @return bool
  */
 protected static function isVersionSuitable($lowestVersion, $highestVersion)
 {
     $numericTypo3Version = VersionNumberUtility::convertVersionNumberToInteger(VersionNumberUtility::getNumericTypo3Version());
     $numericLowestVersion = VersionNumberUtility::convertVersionNumberToInteger($lowestVersion);
     $numericHighestVersion = VersionNumberUtility::convertVersionNumberToInteger($highestVersion);
     return MathUtility::isIntegerInRange($numericTypo3Version, $numericLowestVersion, $numericHighestVersion);
 }
コード例 #6
0
 /**
  * constructPostProcess
  *
  * @param array $config
  * @param \TYPO3\CMS\Backend\Controller\BackendController $backendReference
  */
 public function constructPostProcess($config, &$backendReference)
 {
     $lastPwChange = $GLOBALS['BE_USER']->user['tx_besecurepw_lastpwchange'];
     $lastLogin = $GLOBALS['BE_USER']->user['lastlogin'];
     // get configuration of a secure password
     $extConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['be_secure_pw']);
     $validUntilConfiguration = trim($extConf['validUntil']);
     $validUntil = 0;
     if ($validUntilConfiguration != '') {
         $validUntil = strtotime('- ' . $validUntilConfiguration);
     }
     if ($validUntilConfiguration != '' && ($lastPwChange == 0 || $lastPwChange < $validUntil) || $lastLogin == 0) {
         // let the popup pop up :)
         $generatedLabels = array('passwordReminderWindow_title' => $GLOBALS['LANG']->sL('LLL:EXT:be_secure_pw/Resources/Private/Language/locallang_reminder.xml:passwordReminderWindow_title'), 'passwordReminderWindow_message' => $GLOBALS['LANG']->sL('LLL:EXT:be_secure_pw/Resources/Private/Language/locallang_reminder.xml:passwordReminderWindow_message'), 'passwordReminderWindow_button_changePassword' => $GLOBALS['LANG']->sL('LLL:EXT:be_secure_pw/Resources/Private/Language/locallang_reminder.xml:passwordReminderWindow_button_changePassword'), 'passwordReminderWindow_button_postpone' => $GLOBALS['LANG']->sL('LLL:EXT:be_secure_pw/Resources/Private/Language/locallang_reminder.xml:passwordReminderWindow_button_postpone'));
         // Convert labels/settings back to UTF-8 since json_encode() only works with UTF-8:
         if ($GLOBALS['LANG']->charSet !== 'utf-8') {
             $GLOBALS['LANG']->csConvObj->convArray($generatedLabels, $GLOBALS['LANG']->charSet, 'utf-8');
         }
         $labelsForJS = 'TYPO3.LLL.beSecurePw = ' . json_encode($generatedLabels) . ';';
         $backendReference->addJavascript($labelsForJS);
         $version7 = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger('7.0.0');
         $currentVersion = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version);
         if ($currentVersion < $version7) {
             $javaScriptFile = 'passwordreminder.js';
         } else {
             $javaScriptFile = 'passwordreminder7.js';
         }
         $backendReference->addJavascriptFile($GLOBALS['BACK_PATH'] . '../' . ExtensionManagementUtility::siteRelPath('be_secure_pw') . 'Resources/Public/JavaScript/' . $javaScriptFile);
     }
 }
コード例 #7
0
ファイル: Utility.php プロジェクト: sirdiego/importr
 /**
  * Get TYPO3 Version
  *
  * @param  null $version
  * @return string
  */
 public static function getVersion($version = null)
 {
     if ($version === null) {
         $version = TYPO3_version;
     }
     return VersionNumberUtility::convertIntegerToVersionNumber($version);
 }
コード例 #8
0
ファイル: InstallService.php プロジェクト: dcngmbh/moox_core
 /**
  * Initializes the install service
  */
 public function __construct()
 {
     if (VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 7000000) {
         $this->messageQueueByIdentifier = 'extbase.flashmessages.tx_extensionmanager_tools_extensionmanagerextensionmanager';
     } else {
         $this->messageQueueByIdentifier = 'core.template.flashMessages';
     }
 }
コード例 #9
0
 /**
  * @param array $params
  * @return array
  */
 protected function addConfigToParams(array $params)
 {
     if (VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) < 7000000) {
         $params['config']['init']['emptyUrlReturnValue'] = GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
     }
     $params['config']['preVars'] = array('0' => array('GETvar' => 'no_cache', 'valueMap' => array('nc' => '1'), 'noMatch' => 'bypass'), '1' => array('GETvar' => 'L', 'valueMap' => array('de' => '1', 'da' => '2'), 'noMatch' => 'bypass'));
     $params['config']['postVarSets']['_DEFAULT']['page'] = array(0 => array('GETvar' => 'page'));
     return $params;
 }
コード例 #10
0
ファイル: CalWizIcon.php プロジェクト: ulrikkold/cal
 public function includeLocalLang()
 {
     $llFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('cal') . 'Resources/Private/Language/locallang_plugin.xml';
     if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 4006000) {
         $localizationParser = new \TYPO3\CMS\Core\Localization\Parser\LocallangXmlParser();
         $LOCAL_LANG = $localizationParser->getParsedData($llFile, $GLOBALS['LANG']->lang);
     } else {
         $LOCAL_LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile($llFile, $GLOBALS['LANG']->lang);
     }
     return $LOCAL_LANG;
 }
コード例 #11
0
 /**
  * Returns TRUE if the current TYPO3 version is compatible to the input version
  * Notice that this function compares branches, not versions
  * (4.0.1 would be > 4.0.0 although they use the same compat_version)
  *
  * @param string $verNumberStr Minimum branch number: format "4.0" NOT "4.0.0"
  * @return boolean Returns TRUE if compatible with the provided version number
  */
 public static function convertVersionNumberToInteger($verNumberStr)
 {
     $result = '';
     if (self::isEqualOrHigherSixZero()) {
         $result = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger($verNumberStr);
     } elseif (class_exists('t3lib_utility_VersionNumber')) {
         $result = t3lib_utility_VersionNumber::convertVersionNumberToInteger($verNumberStr);
     } else {
         $result = t3lib_div::int_from_ver($verNumberStr);
     }
     return $result;
 }
コード例 #12
0
 /**
  * Returns the current TYPO3 version number as an integer, eg. 4005000 for version 4.5
  *
  * @return int
  */
 public function getNumericTYPO3versionNumber()
 {
     if (class_exists(VersionNumberUtility)) {
         $numeric_typo3_version = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version);
     } else {
         if (class_exists('t3lib_utility_VersionNumber')) {
             $numeric_typo3_version = t3lib_utility_VersionNumber::convertVersionNumberToInteger(TYPO3_version);
         } else {
             $numeric_typo3_version = t3lib_div::int_from_ver(TYPO3_version);
         }
     }
     return $numeric_typo3_version;
 }
コード例 #13
0
 /**
  * Reads the [extDir]/locallang.xml and returns the $LOCAL_LANG array found in that file.
  *
  * @return array The array with language labels
  */
 protected function includeLocalLang()
 {
     $llFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('listfeusers') . 'locallang.xml';
     $version = class_exists('\\TYPO3\\CMS\\Core\\Utility\\VersionNumberUtility') ? \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) : t3lib_div::int_from_ver(TYPO3_version);
     if ($version < 4006000) {
         $LOCAL_LANG = t3lib_div::readLLXMLfile($llFile, $GLOBALS['LANG']->lang);
     } else {
         /** @var $llxmlParser t3lib_l10n_parser_Llxml */
         $llxmlParser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\Parser\\LocallangXmlParser');
         $LOCAL_LANG = $llxmlParser->getParsedData($llFile, $GLOBALS['LANG']->lang);
     }
     return $LOCAL_LANG;
 }
コード例 #14
0
 /**
  * Reads the [extDir]/locallang.xml and returns the $LOCAL_LANG array found in that file.
  *
  * @return	The array with language labels
  */
 public function includeLocalLang()
 {
     $llFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('jfmulticontent') . 'locallang.xml';
     $version = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version);
     if ($version < 4006000) {
         $LOCAL_LANG = \TYPO3\CMS\Core\Utility\GeneralUtility::readLLXMLfile($llFile, $GLOBALS['LANG']->lang);
     } else {
         /** @var $llxmlParser t3lib_l10n_parser_Llxml */
         $llxmlParser = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Localization\\Parser\\LocallangXmlParser');
         $LOCAL_LANG = $llxmlParser->getParsedData($llFile, $GLOBALS['LANG']->lang);
     }
     return $LOCAL_LANG;
 }
コード例 #15
0
ファイル: Functions.php プロジェクト: ulrikkold/cal
 public static function clearCache()
 {
     if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 7005000) {
         $pageCache = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager')->getCache('cache_pages');
         $pageCache->flushByTag('cal');
     } else {
         // only use cachingFramework if initialized and configured in TYPO3
         if (\TYPO3\CMS\Core\Cache\Cache::isCachingFrameworkInitialized() && TYPO3_UseCachingFramework && is_object($GLOBALS['typo3CacheManager'])) {
             $pageCache = $GLOBALS['typo3CacheManager']->getCache('cache_pages');
             $pageCache->flushByTag('cal');
         }
     }
 }
コード例 #16
0
 /**
  * @param string $identifier
  * @param string $size
  * @param null $overlay
  * @param string $state
  * @param string $alternativeMarkupIdentifier
  * @return string
  */
 public function render($identifier, $size = 'small', $overlay = null, $state = 'default', $alternativeMarkupIdentifier = null)
 {
     if (VersionNumberUtility::convertVersionNumberToInteger(VersionNumberUtility::getNumericTypo3Version()) < 7000000) {
         /** @var \TYPO3\CMS\Fluid\ViewHelpers\Be\Buttons\IconViewHelper $iconViewHelper */
         $iconViewHelper = $this->objectManager->get('TYPO3\\CMS\\Fluid\\ViewHelpers\\Be\\Buttons\\IconViewHelper');
         $iconViewHelper->setRenderingContext($this->renderingContext);
         return $iconViewHelper->render('', $identifier);
     } else {
         /** @var \TYPO3\CMS\Core\ViewHelpers\IconViewHelper $iconViewHelper */
         $iconViewHelper = $this->objectManager->get('TYPO3\\CMS\\Core\\ViewHelpers\\IconViewHelper');
         $iconViewHelper->setRenderingContext($this->renderingContext);
         return $iconViewHelper->render($identifier, $size, $overlay, $state, $alternativeMarkupIdentifier);
     }
 }
コード例 #17
0
 /**
  * MAIN function for cache information
  *
  * @return	string		Output HTML for the module.
  */
 public function main()
 {
     $typo3VersionArray = VersionNumberUtility::convertVersionStringToArray(VersionNumberUtility::getCurrentTypo3Version());
     $this->typo3VersionMain = $typo3VersionArray['version_main'];
     if ($this->typo3VersionMain > 6) {
         $this->iconFactory = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Imaging\\IconFactory');
     }
     if ($this->pObj->id) {
         $result = $this->createModuleContentForPage();
     } else {
         $result = '<p>' . $GLOBALS['LANG']->getLL('no_page_id') . '</p>';
     }
     return $result;
 }
コード例 #18
0
ファイル: T3VersionViewHelper.php プロジェクト: advOpk/pwm
 /**
  * Check if TYPO3 Version is correct
  *
  * @return bool
  */
 public function render()
 {
     // settings
     $_EXTKEY = 'powermail';
     require_once \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('powermail') . 'ext_emconf.php';
     $versionString = $EM_CONF['powermail']['constraints']['depends']['typo3'];
     $versions = explode('-', $versionString);
     $powermailVersion = VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version);
     $isAboveMinVersion = $powermailVersion > VersionNumberUtility::convertVersionNumberToInteger($versions[0]);
     $isBelowMaxVersion = $powermailVersion < VersionNumberUtility::convertVersionNumberToInteger($versions[1]);
     if ($isAboveMinVersion && $isBelowMaxVersion) {
         return TRUE;
     }
     return FALSE;
 }
コード例 #19
0
 /**
  * @param string $operator
  * @param integer $value
  * @return bool
  */
 public function match($operator = null, $value = null)
 {
     $result = false;
     $value = intval($value);
     $version = VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version);
     if ($value) {
         if ($operator === "equals" && $version === $value) {
             $result = true;
         } elseif ($operator === "lessThan" && $version < $value) {
             $result = true;
         } elseif ($operator === "greaterThan" && $version > $value) {
             $result = true;
         }
     }
     return $result;
 }
コード例 #20
0
 /**
  * Migrate date and datetime db field values to timestamp
  *
  * @param array $result
  * @return array
  */
 public function addData(array $result)
 {
     if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 7006000) {
         $processedTcaColumns = $result['processedTca']['columns'];
     } else {
         $processedTcaColumns = $result['vanillaTableTca']['columns'];
     }
     foreach ($processedTcaColumns as $column => $columnConfig) {
         if (isset($columnConfig['config']['tx_cal_event'])) {
             $mainFields = new \TYPO3\CMS\Cal\Hooks\TceFormsGetmainfields();
             $mainFields->getMainFields_preProcess($result['tableName'], $result['databaseRow'], NULL);
             return $result;
         }
     }
     return $result;
 }
コード例 #21
0
ファイル: InstallService.php プロジェクト: mrmoree/vkmh_typo3
 /**
  * @param string $extension
  */
 public function generateConfigFiles($extension = NULL)
 {
     if ($extension == $this->extKey) {
         // create object manager and msg queue
         $this->objManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
         /** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMsgService  */
         $flashMsgService = $this->objManager->get('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService');
         if (VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) >= 7000000) {
             $this->flashMsgQueue = $flashMsgService->getMessageQueueByIdentifier('extbase.flashmessages.tx_extensionmanager_tools_extensionmanagerextensionmanager');
         } else {
             $this->flashMsgQueue = $flashMsgService->getMessageQueueByIdentifier('core.template.flashMessages');
         }
         // create file(s)
         $this->createHtaccessFile();
     }
 }
コード例 #22
0
ファイル: PageRenderer.php プロジェクト: sonority/lib_jquery
 /**
  * Insert javascript-tags for jQuery
  *
  * @param array $params
  * @param \TYPO3\CMS\Core\Page\PageRenderer $pObj
  * @return void
  */
 public function renderPreProcess($params, $pObj)
 {
     // Get plugin-configuration
     $conf = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_libjquery.']['settings.'];
     // Generate script-tag for jquery if CDN is set
     if (!empty($conf['cdn']) && array_key_exists($conf['cdn'], $this->jQueryCdnUrls)) {
         // Set version-number for CDN
         if (!(int) $conf['version'] || $conf['version'] === 'latest') {
             $versionCdn = end($this->availableLocalJqueryVersions);
         } else {
             $versionCdn = VersionNumberUtility::convertVersionNumberToInteger($conf['version']);
         }
         // Set correct version-number for local version
         if (!in_array($versionCdn, $this->availableLocalJqueryVersions)) {
             $versionLocal = $this->getNearestVersion($versionCdn);
         } else {
             $versionLocal = $versionCdn;
         }
         $fallbackTag = '';
         // Choose minified version if debug is disabled
         $minPart = (int) $conf['debug'] ? '' : '.min';
         // Deliver gzipped-version if compression is activated and client supports gzip (compression done with "gzip --best -k -S .gzip")
         $gzipPart = (int) $GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['compressionLevel'] ? '.gzip' : '';
         // Set path and placeholders for local file
         $this->jQueryCdnUrls['local'] = $conf['localPath'] . 'jquery-%1$s%2$s.js';
         // Generate tags for local or CDN (and fallback)
         if ($conf['cdn'] === 'local') {
             // Get local version and replace placeholders
             $file = sprintf($this->jQueryCdnUrls['local'], VersionNumberUtility::convertIntegerToVersionNumber($versionLocal), $minPart) . $gzipPart;
             $file = str_replace(PATH_site, '', GeneralUtility::getFileAbsFileName($file));
         } else {
             // Get CDN and replace placeholders
             $file = sprintf($this->jQueryCdnUrls[$conf['cdn']], VersionNumberUtility::convertIntegerToVersionNumber($versionCdn), $minPart);
             // Generate fallback if required
             if ((int) $conf['localFallback']) {
                 // Get local fallback version and replace placeholders
                 $fileFallback = sprintf($this->jQueryCdnUrls['local'], VersionNumberUtility::convertIntegerToVersionNumber($versionLocal), $minPart) . $gzipPart;
                 // Get absolute path to the fallback-file
                 $fileFallback = str_replace(PATH_site, '', GeneralUtility::getFileAbsFileName($fileFallback));
                 // Wrap it in some javascript code which will enable the fallback
                 $fallbackTag = '<script>window.jQuery || document.write(\'<script src="' . htmlspecialchars($fileFallback) . '" type="text/javascript"><\\/script>\')</script>' . LF;
             }
         }
         $pObj->addJsLibrary('lib_jquery', $file, 'text/javascript', FALSE, TRUE, '|' . LF . $fallbackTag . '', TRUE);
     }
 }
コード例 #23
0
 /**
  * @param string $operator
  * @param integer $value
  * @return bool
  */
 public function match($operator = NULL, $value = NULL)
 {
     $result = FALSE;
     $value = intval($value);
     $version = VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version);
     if ($value) {
         if ($operator === "equals" && $version === $value) {
             $result = TRUE;
         } else {
             if ($operator === "lessThan" && $version < $value) {
                 $result = TRUE;
             } else {
                 if ($operator === "greaterThan" && $version > $value) {
                     $result = TRUE;
                 }
             }
         }
     }
     return $result;
 }
コード例 #24
0
    /**
     * Shows the update Message
     *
     * @return string
     */
    public function displayMessage(&$params, &$tsObj)
    {
        $out = '';
        if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) < 4003000) {
            // 4.3.0 comes with flashmessages styles. For older versions we include the needed styles here
            $cssPath = $GLOBALS['BACK_PATH'] . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('jfmulticontent');
            $out .= '<link rel="stylesheet" type="text/css" href="' . $cssPath . 'compat/flashmessages.css" media="screen" />';
        }
        $checkConfig = null;
        if ($this->checkConfig() === false) {
            $checkConfig = '
	<div class="typo3-message message-warning">
		<div class="message-header">' . $GLOBALS['LANG']->sL('LLL:EXT:jfmulticontent/locallang.xml:extmng.classInnerHeader') . '</div>
		<div class="message-body">
			' . $GLOBALS['LANG']->sL('LLL:EXT:jfmulticontent/locallang.xml:extmng.classInner') . '
		</div>
	</div>';
        }
        if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger(TYPO3_version) < 4005000) {
            $url = 'index.php?&amp;id=0&amp;CMD[showExt]=jfmulticontent&amp;SET[singleDetails]=updateModule';
        } else {
            $url = 'mod.php?&id=0&M=tools_em&CMD[showExt]=jfmulticontent&SET[singleDetails]=updateModule';
        }
        $out .= '
<div style="position:absolute;top:10px;right:10px; width:300px;">
	<div class="typo3-message message-information">
		<div class="message-header">' . $GLOBALS['LANG']->sL('LLL:EXT:jfmulticontent/locallang.xml:extmng.updatermsgHeader') . '</div>
		<div class="message-body">
			' . $GLOBALS['LANG']->sL('LLL:EXT:jfmulticontent/locallang.xml:extmng.updatermsg') . '<br />
			<a style="text-decoration:underline;" href="' . $url . '">
			' . $GLOBALS['LANG']->sL('LLL:EXT:jfmulticontent/locallang.xml:extmng.updatermsgLink') . '</a>
		</div>
	</div>
	' . $checkConfig . '
</div>';
        return $out;
    }
コード例 #25
0
ファイル: IconViewHelper.php プロジェクト: jmverges/mask
 /**
  * Prints icon html for $identifier key
  *
  * @param string $identifier
  * @param string $size
  * @param string $overlay
  * @param string $altSrc
  * @param string $altText
  * @author Benjamin Butschell <*****@*****.**>
  * @return string
  */
 public function render($identifier, $size = NULL, $overlay = NULL, $altSrc = "", $altText = "")
 {
     // backwards compatibility for typo3 6.2
     $version = \TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version();
     $versionNumber = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger($version);
     // Since TYPO3 7.5 use IconViewHelper from core
     if ($versionNumber >= 7005000) {
         $iconViewHelper = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance("TYPO3\\CMS\\Core\\ViewHelpers\\IconViewHelper");
         if ($size == NULL) {
             $size = \TYPO3\CMS\Core\Imaging\Icon::SIZE_SMALL;
         }
         $iconViewHelper->setRenderingContext($this->renderingContext);
         return $iconViewHelper->render($identifier, $size, $overlay);
     } else {
         // For everything else use altSrc and altText attributes
         if ($altSrc) {
             return '<img src="' . $altSrc . '" alt="' . $altText . '" />';
         } else {
             if ($altText) {
                 return '$altText';
             }
         }
     }
 }
コード例 #26
0
ファイル: Base.php プロジェクト: nos3/aimeos-typo3
 /**
  * Creates the view object for the HTML client.
  *
  * @param \MW_Config_Interface $config Configuration object
  * @param \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder $uriBuilder URL builder object
  * @param array $templatePaths List of base path names with relative template paths as key/value pairs
  * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface|null $request Request object
  * @param string|null $locale Code of the current language or null for no translation
  * @return MW_View_Interface View object
  */
 public static function getView(\MW_Config_Interface $config, \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder $uriBuilder, array $templatePaths, \TYPO3\CMS\Extbase\Mvc\RequestInterface $request = null, $locale = null)
 {
     $params = $fixed = array();
     if ($request !== null && $locale !== null) {
         $fixed = self::getFixedParams($config, $request);
         // required for reloading to the current page
         $params = $request->getArguments();
         $params['target'] = $GLOBALS["TSFE"]->id;
         $i18n = Base::getI18n(array($locale), $config->get('i18n', array()));
         $translation = $i18n[$locale];
     } else {
         $translation = new \MW_Translation_None('en');
     }
     $view = new \MW_View_Default();
     // workaround for TYPO3 6.2 bug (UriBuilder is incomplete)
     if ($request !== null || \TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version() >= '7.0.0') {
         $helper = new \MW_View_Helper_Url_Typo3($view, $uriBuilder, $fixed);
     } else {
         $helper = new \MW_View_Helper_Url_None($view);
     }
     $view->addHelper('url', $helper);
     $helper = new \MW_View_Helper_Translate_Default($view, $translation);
     $view->addHelper('translate', $helper);
     $helper = new \MW_View_Helper_Partial_Default($view, $config, $templatePaths);
     $view->addHelper('partial', $helper);
     $helper = new \MW_View_Helper_Parameter_Default($view, $params);
     $view->addHelper('param', $helper);
     $helper = new \MW_View_Helper_Config_Default($view, $config);
     $view->addHelper('config', $helper);
     $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.');
     $sep1000 = $config->get('client/html/common/format/seperator1000', ' ');
     $helper = new \MW_View_Helper_Number_Default($view, $sepDec, $sep1000);
     $view->addHelper('number', $helper);
     $helper = new \MW_View_Helper_FormParam_Default($view, array($uriBuilder->getArgumentPrefix()));
     $view->addHelper('formparam', $helper);
     $helper = new \MW_View_Helper_Encoder_Default($view);
     $view->addHelper('encoder', $helper);
     $helper = new \MW_View_Helper_Csrf_Default($view);
     $view->addHelper('csrf', $helper);
     $body = @file_get_contents('php://input');
     $helper = new \MW_View_Helper_Request_Default($view, $body, $_SERVER['REMOTE_ADDR']);
     $view->addHelper('request', $helper);
     return $view;
 }
コード例 #27
0
ファイル: ImportExport.php プロジェクト: franzholz/TYPO3.CMS
 /**
  * Setting up the object based on the recently loaded ->dat array
  *
  * @return void
  */
 public function loadInit()
 {
     $this->relStaticTables = (array) $this->dat['header']['relStaticTables'];
     $this->excludeMap = (array) $this->dat['header']['excludeMap'];
     $this->softrefCfg = (array) $this->dat['header']['softrefCfg'];
     $this->extensionDependencies = (array) $this->dat['header']['extensionDependencies'];
     $this->fixCharsets();
     if (isset($this->dat['header']['meta']['TYPO3_version']) && VersionNumberUtility::convertVersionNumberToInteger($this->dat['header']['meta']['TYPO3_version']) < 6000000) {
         $this->legacyImport = true;
         $this->initializeLegacyImportFolder();
     }
 }
コード例 #28
0
ファイル: MaskUtility.php プロジェクト: jmverges/mask
 /**
  * Generates and sets the tca for all the extended pages
  *
  * @param array $tca
  * @author Benjamin Butschell <*****@*****.**>
  */
 public function setPageTca($tca, &$confVarsFe)
 {
     // backwards compatibility for typo3 6.2
     $version = \TYPO3\CMS\Core\Utility\VersionNumberUtility::getNumericTypo3Version();
     $versionNumber = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger($version);
     // Load all Page-Fields for new Tab in Backend
     $pageFields = array();
     if ($tca) {
         foreach ($tca as $fieldKey => $value) {
             if ($versionNumber >= 7000000) {
                 $fieldKeyTca = $fieldKey;
             } else {
                 $element = array_pop($this->getElementsWhichUseField($fieldKey, "pages"));
                 $type = $this->getFormType($fieldKey, $element["key"], "pages");
                 $fieldKeyTca = $fieldKey;
                 if ($type == "Richtext") {
                     $fieldKeyTca .= ";;;richtext[]:rte_transform[mode=ts]";
                 }
             }
             $pageFields[] = $fieldKeyTca;
             // Add addRootLineFields and pageOverlayFields for all pagefields
             $confVarsFe["addRootLineFields"] .= "," . $fieldKey;
             $confVarsFe["pageOverlayFields"] .= "," . $fieldKey;
         }
     }
     $pageFieldString = "--div--;Content-Fields," . implode(",", $pageFields);
     \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('pages', $pageFieldString);
     \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('pages_language_overlay', $pageFieldString);
 }
コード例 #29
0
 /**
  * Returns TRUE if the current TYPO3 version (or compatibility version) is compatible to the input version
  * Notice that this function compares branches, not versions (4.0.1 would be > 4.0.0 although they use the same compat_version)
  *
  * @param string $verNumberStr Minimum branch number required (format x.y / e.g. "4.0" NOT "4.0.0"!)
  * @return boolean Returns TRUE if this setup is compatible with the provided version number
  * @todo Still needs a function to convert versions to branches
  */
 public static function compat_version($verNumberStr)
 {
     $currVersionStr = $GLOBALS['TYPO3_CONF_VARS']['SYS']['compat_version'] ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['compat_version'] : TYPO3_branch;
     if (\TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger($currVersionStr) < \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger($verNumberStr)) {
         return FALSE;
     } else {
         return TRUE;
     }
 }
コード例 #30
0
ファイル: Extension.php プロジェクト: noxludo/TYPO3v4-Core
 /**
  * Setter for the version from string
  *
  * @param string $version Needs to have a format like '1.3.7' and converts it into an integer like 1003007 before setting the version
  * @see \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger
  * @return void
  */
 public function setVersionFromString($version)
 {
     $this->version = \TYPO3\CMS\Core\Utility\VersionNumberUtility::convertVersionNumberToInteger($version);
 }