/** * Makes expiration timestamp for SQL queries * * @param int $offsetFromNow Offset to expiration * @return int Expiration time stamp */ protected function makeExpirationTime($offsetFromNow = 0) { if (!$this->apiWrapper->isExtLoaded('adodb') && (TYPO3_db_host == '127.0.0.1' || TYPO3_db_host == 'localhost')) { // Same host, same time, optimize return $offsetFromNow ? '(UNIX_TIMESTAMP()+(' . $offsetFromNow . '))' : 'UNIX_TIMESTAMP()'; } // External database or non-mysql -> round to next day $date = getdate(time() + $offsetFromNow); return mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']); }
/** * Creates an instance of this class */ public function __construct() { $this->apiWrapper = tx_realurl_apiwrapper::getInstance(); if (!$this->apiWrapper->isExtLoaded('dbal')) { // allow to use the MySQL features of 5.x with mysqli $this->useMySQLExtendedSyntax = TRUE; } $sysconf = (array) unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['realurl']); $this->enableStrictMode = (bool) $sysconf['enableStrictMode']; $this->enableChashUrlDebug = (bool) $sysconf['enableChashUrlDebug']; $this->initDevLog($sysconf); }
/** * Creates common configuration template. * * @return array Template */ protected function getTemplate() { $confTemplate = array('init' => array('enableCHashCache' => true, 'appendMissingSlash' => 'ifNotFile,redirect', 'adminJumpToBackend' => true, 'enableUrlDecodeCache' => true, 'enableUrlEncodeCache' => true, 'emptyUrlReturnValue' => $this->apiWrapper->getIndpEnv('TYPO3_SITE_PATH')), 'pagePath' => array('type' => 'user', 'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main', 'spaceCharacter' => '-', 'languageGetVar' => 'L'), 'fileName' => array('defaultToHTMLsuffixOnPrev' => 0, 'acceptHTMLsuffix' => 1)); // Add print feature if TemplaVoila is not loaded if (!$this->apiWrapper->isExtLoaded('templavoila')) { $confTemplate['fileName']['index']['print'] = array('keyValues' => array('type' => 98)); } // Add respectSimulateStaticURLs if SimulateStatic is loaded if ($this->apiWrapper->isExtLoaded('simulatestatic')) { $confTemplate['init']['respectSimulateStaticURLs'] = true; } $this->addLanguages($confTemplate); // Add from extensions if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/realurl/class.tx_realurl_autoconfgen.php']['extensionConfiguration'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/realurl/class.tx_realurl_autoconfgen.php']['extensionConfiguration'] as $extKey => $userFunc) { $params = array('config' => $confTemplate, 'extKey' => $extKey); $var = $this->apiWrapper->callUserFunction($userFunc, $params, $this); if ($var) { $confTemplate = $var; } } } return $confTemplate; }