本文整理汇总了PHP中TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP GeneralUtility::locationHeaderUrl方法的具体用法?PHP GeneralUtility::locationHeaderUrl怎么用?PHP GeneralUtility::locationHeaderUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Utility\GeneralUtility
的用法示例。
在下文中一共展示了GeneralUtility::locationHeaderUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mainAction
/**
* Process add media request
*
* @param ServerRequestInterface $request
* @param ResponseInterface $response
* @return ResponseInterface
*/
public function mainAction(ServerRequestInterface $request, ResponseInterface $response)
{
$files = $request->getParsedBody()['file'];
$newMedia = [];
if (isset($files['newMedia'])) {
$newMedia = (array) $files['newMedia'];
}
foreach ($newMedia as $media) {
if (!empty($media['url']) && !empty($media['target'])) {
$allowed = !empty($media['allowed']) ? GeneralUtility::trimExplode(',', $media['allowed']) : [];
$file = $this->addMediaFromUrl($media['url'], $media['target'], $allowed);
if ($file !== null) {
$flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $file->getName(), $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:online_media.new_media.added'), FlashMessage::OK, true);
} else {
$flashMessage = GeneralUtility::makeInstance(FlashMessage::class, $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:online_media.error.invalid_url'), $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:online_media.error.new_media.failed'), FlashMessage::ERROR, true);
}
$this->addFlashMessage($flashMessage);
}
}
$redirect = isset($request->getParsedBody()['redirect']) ? $request->getParsedBody()['redirect'] : $request->getQueryParams()['redirect'];
$redirect = GeneralUtility::sanitizeLocalUrl($redirect);
if ($redirect) {
$response = $response->withHeader('Location', GeneralUtility::locationHeaderUrl($redirect))->withStatus(303);
}
return $response;
}
示例2: createPublicTempFile
public static function createPublicTempFile($prefix, $suffix)
{
$fullname = GeneralUtility::tempnam($prefix, $suffix);
$urlname = preg_replace('/.*(?=\\/typo3temp)/', '', $fullname);
$url = GeneralUtility::locationHeaderUrl($urlname);
return ['name' => $fullname, 'url' => $url];
}
示例3: logoutAction
/**
* Injects the request object for the current request or subrequest
* As this controller goes only through the main() method, it is rather simple for now
* This will be split up in an abstract controller once proper routing/dispatcher is in place.
*
* @param ServerRequestInterface $request the current request
* @param ResponseInterface $response
* @return ResponseInterface the response with the content
*/
public function logoutAction(ServerRequestInterface $request, ResponseInterface $response)
{
$this->logout();
$redirectUrl = isset($request->getParsedBody()['redirect']) ? $request->getParsedBody()['redirect'] : $request->getQueryParams()['redirect'];
$redirectUrl = GeneralUtility::sanitizeLocalUrl($redirectUrl);
if (empty($redirectUrl)) {
/** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */
$uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
$redirectUrl = (string) $uriBuilder->buildUriFromRoute('login', array(), $uriBuilder::ABSOLUTE_URL);
}
return $response->withStatus(303)->withHeader('Location', GeneralUtility::locationHeaderUrl($redirectUrl));
}
示例4: getExistingFiles
/**
* Handles the existing files of a Fine Uploader form.
* The values are stored in the GET/POST var at the index "fieldValue".
*
* @return string
*/
public function getExistingFiles()
{
$files = array();
$fieldValue = GeneralUtility::_GP('fieldValue');
if ($fieldValue != '') {
$imagePath = GeneralUtility::getFileAbsFileName($fieldValue);
$imageName = PathUtility::basename($imagePath);
$imageDirectoryPath = PathUtility::dirname($imagePath);
$imageDirectoryPath = PathUtility::getRelativePath(PATH_site, $imageDirectoryPath);
$imageUrl = GeneralUtility::locationHeaderUrl('/' . $imageDirectoryPath . $imageName);
if (file_exists($imagePath)) {
$files[] = array('name' => $imageName, 'uuid' => $imageUrl, 'thumbnailUrl' => $imageUrl);
}
}
return json_encode($files);
}
示例5: getAdditionalFields
/**
* Gets additional fields to render in the form to add/edit a task
*
* @param array $taskInfo Values of the fields from the add/edit task form
* @param \TYPO3\CMS\Scheduler\Task\AbstractTask $task The task object being edited. Null when adding a task!
* @param \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule Reference to the scheduler backend module
* @return array A two dimensional array, array('Identifier' => array('fieldId' => array('code' => '', 'label' => '', 'cshKey' => '', 'cshLabel' => ''))
*/
public function getAdditionalFields(array &$taskInfo, $task, \TYPO3\CMS\Scheduler\Controller\SchedulerModuleController $schedulerModule)
{
/** @var \DmitryDulepov\DdGooglesitemap\Scheduler\Task $task */
$additionalFields = array();
if (!$task) {
$url = GeneralUtility::locationHeaderUrl('/index.php?eID=dd_googlesitemap');
$task = GeneralUtility::makeInstance('DmitryDulepov\\DdGooglesitemap\\Scheduler\\Task');
} else {
$url = $task->getEIdScriptUrl();
}
$indexFilePath = $task->getIndexFilePath();
$maxUrlsPerSitemap = $task->getMaxUrlsPerSitemap();
$additionalFields['eIdUrl'] = array('code' => '<textarea style="width:350px;height:200px" name="tx_scheduler[eIdUrl]" wrap="off">' . htmlspecialchars($url) . '</textarea>', 'label' => 'LLL:EXT:dd_googlesitemap/locallang.xml:scheduler.eIDFieldLabel', 'cshKey' => '', 'cshLabel' => '');
$additionalFields['indexFilePath'] = array('code' => '<input class="wide" type="text" name="tx_scheduler[indexFilePath]" value="' . htmlspecialchars($indexFilePath) . '" />', 'label' => 'LLL:EXT:dd_googlesitemap/locallang.xml:scheduler.indexFieldLabel', 'cshKey' => '', 'cshLabel' => '');
$additionalFields['maxUrlsPerSitemap'] = array('code' => '<input type="text" name="tx_scheduler[maxUrlsPerSitemap]" value="' . $maxUrlsPerSitemap . '" />', 'label' => 'LLL:EXT:dd_googlesitemap/locallang.xml:scheduler.maxUrlsPerSitemapLabel', 'cshKey' => '', 'cshLabel' => '');
return $additionalFields;
}
示例6: getExistingFiles
/**
* Handles the existing files of a Fine Uploader form.
* The values are stored in the GET/POST var at the index "fieldValue".
*
* @return string
*/
public function getExistingFiles()
{
$files = [];
$fieldValue = GeneralUtility::_GP('fieldValue');
if ($fieldValue != '') {
// $imagePath = GeneralUtility::getFileAbsFileName($fieldValue);
$imagePath = str_replace('new:', '', $fieldValue);
$imageName = PathUtility::basename($imagePath);
$imageDirectoryPath = PathUtility::dirname($imagePath);
$imageDirectoryPath = PathUtility::getRelativePath(PATH_site, $imageDirectoryPath);
$imageUrl = GeneralUtility::locationHeaderUrl('/' . $imageDirectoryPath . $imageName);
if (file_exists($imagePath)) {
$files[] = ['name' => $imageName, 'uuid' => $imageUrl, 'thumbnailUrl' => $imageUrl];
}
}
return $files;
}
示例7: generateAndSendHash
/**
* Generates a hashed link and send it with email
*
* @param array $user Contains user data
* @return string Empty string with success, error message with no success
*/
protected function generateAndSendHash($user)
{
$hours = (int) $this->conf['forgotLinkHashValidTime'] > 0 ? (int) $this->conf['forgotLinkHashValidTime'] : 24;
$validEnd = time() + 3600 * $hours;
$validEndString = date($this->conf['dateFormat'], $validEnd);
$hash = md5(GeneralUtility::generateRandomBytes(64));
$randHash = $validEnd . '|' . $hash;
$randHashDB = $validEnd . '|' . md5($hash);
// Write hash to DB
$res = $this->databaseConnection->exec_UPDATEquery('fe_users', 'uid=' . $user['uid'], array('felogin_forgotHash' => $randHashDB));
// Send hashlink to user
$this->conf['linkPrefix'] = -1;
$isAbsRefPrefix = !empty($this->frontendController->absRefPrefix);
$isBaseURL = !empty($this->frontendController->baseUrl);
$isFeloginBaseURL = !empty($this->conf['feloginBaseURL']);
$link = $this->pi_getPageLink($this->conf['restorePasswordPageUid'], '', array(rawurlencode('tx_femanager_pi1[forgothash]') => $randHash, 'L' => GeneralUtility::_GET('L')));
// Prefix link if necessary
if ($isFeloginBaseURL) {
// First priority, use specific base URL
// "absRefPrefix" must be removed first, otherwise URL will be prepended twice
if ($isAbsRefPrefix) {
$link = substr($link, strlen($this->frontendController->absRefPrefix));
}
$link = $this->conf['feloginBaseURL'] . $link;
} elseif ($isAbsRefPrefix) {
// Second priority
// absRefPrefix must not necessarily contain a hostname and URL scheme, so add it if needed
$link = GeneralUtility::locationHeaderUrl($link);
} elseif ($isBaseURL) {
// Third priority
// Add the global base URL to the link
$link = $this->frontendController->baseUrlWrap($link);
} else {
// No prefix is set, return the error
return $this->pi_getLL('ll_change_password_nolinkprefix_message');
}
// \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($user);
$this->sendTemplateEmail([$user['email']], ['sashaost@mail.ru'], 'Test subject', 'emailtemplate', ['name' => 'Mila', 'link' => $link]);
return '';
}
示例8: renderMainJavaScriptLibraries
/**
* Helper function for render the main JavaScript libraries,
* currently: RequireJS, jQuery, ExtJS
*
* @return string Content with JavaScript libraries
*/
protected function renderMainJavaScriptLibraries()
{
$out = '';
// Include RequireJS
if ($this->addRequireJs) {
// load the paths of the requireJS configuration
$out .= GeneralUtility::wrapJS('var require = ' . json_encode($this->requireJsConfig)) . LF;
// directly after that, include the require.js file
$out .= '<script src="' . $this->processJsFile($this->backPath . $this->requireJsPath . 'require.js') . '" type="text/javascript"></script>' . LF;
}
// Include jQuery Core for each namespace, depending on the version and source
if (!empty($this->jQueryVersions)) {
foreach ($this->jQueryVersions as $namespace => $jQueryVersion) {
$out .= $this->renderJqueryScriptTag($jQueryVersion['version'], $jQueryVersion['source'], $namespace);
}
}
// Include extJS
if ($this->addExtJS) {
// Use the base adapter all the time
$out .= '<script src="' . $this->processJsFile($this->backPath . $this->extJsPath . 'adapter/ext-base' . ($this->enableExtJsDebug ? '-debug' : '') . '.js') . '" type="text/javascript"></script>' . LF;
$out .= '<script src="' . $this->processJsFile($this->backPath . $this->extJsPath . 'ext-all' . ($this->enableExtJsDebug ? '-debug' : '') . '.js') . '" type="text/javascript"></script>' . LF;
// Add extJS localization
// Load standard ISO mapping and modify for use with ExtJS
$localeMap = $this->locales->getIsoMapping();
$localeMap[''] = 'en';
$localeMap['default'] = 'en';
// Greek
$localeMap['gr'] = 'el_GR';
// Norwegian Bokmaal
$localeMap['no'] = 'no_BO';
// Swedish
$localeMap['se'] = 'se_SV';
$extJsLang = isset($localeMap[$this->lang]) ? $localeMap[$this->lang] : $this->lang;
// @todo autoconvert file from UTF8 to current BE charset if necessary!!!!
$extJsLocaleFile = $this->extJsPath . 'locale/ext-lang-' . $extJsLang . '.js';
if (file_exists(PATH_typo3 . $extJsLocaleFile)) {
$out .= '<script src="' . $this->processJsFile($this->backPath . $extJsLocaleFile) . '" type="text/javascript" charset="utf-8"></script>' . LF;
}
// Remove extjs from JScodeLibArray
unset($this->jsFiles[$this->backPath . $this->extJsPath . 'ext-all.js'], $this->jsFiles[$this->backPath . $this->extJsPath . 'ext-all-debug.js']);
}
$this->loadJavaScriptLanguageStrings();
if (TYPO3_MODE === 'BE') {
$this->addAjaxUrlsToInlineSettings();
}
$inlineSettings = $this->inlineLanguageLabels ? 'TYPO3.lang = ' . json_encode($this->inlineLanguageLabels) . ';' : '';
$inlineSettings .= $this->inlineSettings ? 'TYPO3.settings = ' . json_encode($this->inlineSettings) . ';' : '';
if ($this->addExtJS) {
// Set clear.gif, move it on top, add handler code
$code = '';
if (!empty($this->extOnReadyCode)) {
foreach ($this->extOnReadyCode as $block) {
$code .= $block;
}
}
$out .= $this->inlineJavascriptWrap[0] . '
Ext.ns("TYPO3");
Ext.BLANK_IMAGE_URL = "' . htmlspecialchars(GeneralUtility::locationHeaderUrl($this->backPath . 'sysext/t3skin/icons/gfx/clear.gif')) . '";
Ext.SSL_SECURE_URL = "' . htmlspecialchars(GeneralUtility::locationHeaderUrl($this->backPath . 'sysext/t3skin/icons/gfx/clear.gif')) . '";' . LF . $inlineSettings . 'Ext.onReady(function() {' . $code . ' });' . $this->inlineJavascriptWrap[1];
$this->extOnReadyCode = array();
// Include TYPO3.l10n object
if (TYPO3_MODE === 'BE') {
$out .= '<script src="' . $this->processJsFile($this->backPath . 'sysext/lang/Resources/Public/JavaScript/Typo3Lang.js') . '" type="text/javascript" charset="utf-8"></script>' . LF;
}
if ($this->extJScss) {
if (isset($GLOBALS['TBE_STYLES']['extJS']['all'])) {
$this->addCssLibrary($this->backPath . $GLOBALS['TBE_STYLES']['extJS']['all'], 'stylesheet', 'all', '', true);
} else {
$this->addCssLibrary($this->backPath . $this->extJsPath . 'resources/css/ext-all-notheme.css', 'stylesheet', 'all', '', true);
}
}
if ($this->extJStheme) {
if (isset($GLOBALS['TBE_STYLES']['extJS']['theme'])) {
$this->addCssLibrary($this->backPath . $GLOBALS['TBE_STYLES']['extJS']['theme'], 'stylesheet', 'all', '', true);
} else {
$this->addCssLibrary($this->backPath . $this->extJsPath . 'resources/css/xtheme-blue.css', 'stylesheet', 'all', '', true);
}
}
} else {
// no extJS loaded, but still inline settings
if ($inlineSettings !== '') {
// make sure the global TYPO3 is available
$inlineSettings = 'var TYPO3 = TYPO3 || {};' . CRLF . $inlineSettings;
$out .= $this->inlineJavascriptWrap[0] . $inlineSettings . $this->inlineJavascriptWrap[1];
// Add language module only if also jquery is guaranteed to be there
if (TYPO3_MODE === 'BE' && !empty($this->jQueryVersions)) {
$this->loadRequireJsModule('TYPO3/CMS/Lang/Lang');
}
}
}
return $out;
}
示例9: addJS
//.........这里部分代码省略.........
* @return void
*/
protected function addJS($parameters, &$pageRenderer)
{
$formprotection = FormProtectionFactory::get();
if (count($parameters['jsFiles'])) {
if (method_exists($GLOBALS['SOBE']->doc, 'issueCommand')) {
/** @var \TYPO3\CMS\Backend\Clipboard\Clipboard $clipObj */
$clipObj = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Clipboard\\Clipboard');
// Start clipboard
$clipObj->initializeClipboard();
$clipBoardHasContent = FALSE;
if (isset($clipObj->clipData['normal']['el']) && strpos(key($clipObj->clipData['normal']['el']), 'tt_content') !== FALSE) {
$pasteURL = str_replace('&', '&', $clipObj->pasteUrl('tt_content', 'DD_PASTE_UID', 0));
if (isset($clipObj->clipData['normal']['mode'])) {
$clipBoardHasContent = 'copy';
} else {
$clipBoardHasContent = 'move';
}
}
$moveParams = '&cmd[tt_content][DD_DRAG_UID][move]=DD_DROP_UID';
$moveURL = str_replace('&', '&', htmlspecialchars($GLOBALS['SOBE']->doc->issueCommand($moveParams, 1)));
$copyParams = '&cmd[tt_content][DD_DRAG_UID][copy]=DD_DROP_UID&DDcopy=1';
$copyURL = str_replace('&', '&', htmlspecialchars($GLOBALS['SOBE']->doc->issueCommand($copyParams, 1)));
// add JavaScript library
$pageRenderer->addJsFile($GLOBALS['BACK_PATH'] . ExtensionManagementUtility::extRelPath('gridelements') . 'Resources/Public/Backend/JavaScript/dbNewContentElWizardFixDTM.js', $type = 'text/javascript', $compress = TRUE, $forceOnTop = FALSE, $allWrap = '');
// add JavaScript library
$pageRenderer->addJsFile($GLOBALS['BACK_PATH'] . ExtensionManagementUtility::extRelPath('gridelements') . 'Resources/Public/Backend/JavaScript/GridElementsDD.js', $type = 'text/javascript', $compress = TRUE, $forceOnTop = FALSE, $allWrap = '');
// add JavaScript library
$pageRenderer->addJsFile($GLOBALS['BACK_PATH'] . ExtensionManagementUtility::extRelPath('gridelements') . 'Resources/Public/Backend/JavaScript/GridElementsListView.js', $type = 'text/javascript', $compress = TRUE, $forceOnTop = FALSE, $allWrap = '');
if (!$pageRenderer->getCharSet()) {
$pageRenderer->setCharSet($GLOBALS['LANG']->charSet ? $GLOBALS['LANG']->charSet : 'utf-8');
}
if (is_array($clipObj->clipData['normal']['el'])) {
$arrCBKeys = array_keys($clipObj->clipData['normal']['el']);
$intFirstCBEl = str_replace('tt_content|', '', $arrCBKeys[0]);
}
// pull locallang_db.xml to JS side - only the tx_gridelements_js-prefixed keys
$pageRenderer->addInlineLanguageLabelFile('EXT:gridelements/Resources/Private/Language/locallang_db.xml', 'tx_gridelements_js');
$pRaddExtOnReadyCode = '
TYPO3.l10n = {
localize: function(langKey){
return TYPO3.lang[langKey];
}
}
';
$allowedCTypesAndGridTypesClassesByColPos = array();
$layoutSetup = GeneralUtility::callUserFunction('TYPO3\\CMS\\Backend\\View\\BackendLayoutView->getSelectedBackendLayout', intval(GeneralUtility::_GP('id')), $this);
if (is_array($layoutSetup) && !empty($layoutSetup['__config']['backend_layout.']['rows.'])) {
foreach ($layoutSetup['__config']['backend_layout.']['rows.'] as $rows) {
foreach ($rows as $row) {
if (!empty($layoutSetup['__config']['backend_layout.']['rows.'])) {
foreach ($row as $col) {
$classes = '';
if ($col['allowed']) {
$allowed = explode(',', $col['allowed']);
foreach ($allowed as $ctypes) {
$ctypes = trim($ctypes);
if ($ctypes === '*') {
$classes = 't3-allow-all';
break;
} else {
$ctypes = explode(',', $ctypes);
foreach ($ctypes as $ctype) {
$classes .= 't3-allow-' . $ctype . ' ';
}
}
}
} else {
$classes = 't3-allow-all';
}
if ($col['allowedGridTypes']) {
$allowedGridTypes = explode(',', $col['allowedGridTypes']);
$classes .= 't3-allow-gridelements_pi1 ';
foreach ($allowedGridTypes as $gridTypes) {
$gridTypes = trim($gridTypes);
if ($gridTypes !== '*') {
$gridTypes = explode(',', $gridTypes);
foreach ($gridTypes as $gridType) {
$classes .= 't3-allow-gridtype-' . $gridType . ' ';
}
}
}
} else {
if ($classes !== 't3-allow-all') {
$classes .= 't3-allow-gridelements_pi1 ';
}
}
$allowedCTypesAndGridTypesClassesByColPos[] = $col['colPos'] . ':' . trim($classes);
}
}
}
}
}
// add Ext.onReady() code from file
$modTSconfig = BackendUtility::getModTSconfig((int) GeneralUtility::_GP('id'), 'mod.web_layout');
$pageRenderer->addExtOnReadyCode($pRaddExtOnReadyCode . "\n\t\t\t\t\t\ttop.pageColumnsAllowedCTypes = '" . join('|', $allowedCTypesAndGridTypesClassesByColPos) . "';\n\t\t\t\t\t\ttop.pasteURL = '" . $pasteURL . "';\n\t\t\t\t\t\ttop.moveURL = '" . $moveURL . "';\n\t\t\t\t\t\ttop.copyURL = '" . $copyURL . "';\n\t\t\t\t\t\ttop.pasteTpl = '" . str_replace('&redirect=1', '', str_replace('DDcopy=1', 'DDcopy=1&reference=DD_REFYN', $copyURL)) . "';\n\t\t\t\t\t\ttop.DDtceActionToken = '" . $formprotection->generateToken('tceAction') . "';\n\t\t\t\t\t\ttop.DDtoken = '" . $formprotection->generateToken('editRecord') . "';\n\t\t\t\t\t\ttop.DDpid = '" . (int) GeneralUtility::_GP('id') . "';\n\t\t\t\t\t\ttop.DDclipboardfilled = '" . ($clipBoardHasContent ? $clipBoardHasContent : 'false') . "';\n\t\t\t\t\t\ttop.pasteReferenceAllowed = '" . ($GLOBALS['BE_USER']->checkAuthMode('tt_content', 'CType', 11, 'explicitAllow') ? 'true' : 'false') . "';\n\t\t\t\t\t\ttop.newElementWizard = '" . ($modTSconfig['properties']['disableNewContentElementWizard'] ? 'false' : 'true') . "';\n\t\t\t\t\t\ttop.DDclipboardElId = '" . $intFirstCBEl . "';\n\t\t\t\t\t" . str_replace(array('top.skipDraggableDetails = 0;', 'insert_ext_baseurl_here', 'insert_server_time_here', 'top.geSprites = {};', "top.backPath = '';"), array($GLOBALS['BE_USER']->uc['dragAndDropHideNewElementWizardInfoOverlay'] ? 'top.skipDraggableDetails = true;' : 'top.skipDraggableDetails = false;', GeneralUtility::locationHeaderUrl('/' . ExtensionManagementUtility::siteRelPath('gridelements')), time() . '000', "top.geSprites = {\n\t\t\t\t\t\t\tcopyfrompage: '" . IconUtility::getSpriteIconClasses('extensions-gridelements-copyfrompage') . "',\n\t\t\t\t\t\t\t\tpastecopy: '" . IconUtility::getSpriteIconClasses('extensions-gridelements-pastecopy') . "',\n\t\t\t\t\t\t\t\tpasteref: '" . IconUtility::getSpriteIconClasses('extensions-gridelements-pasteref') . "'\n\t\t\t\t\t\t\t};", "top.backPath = '" . $GLOBALS['BACK_PATH'] . "';"), file_get_contents(ExtensionManagementUtility::extPath('gridelements') . 'Resources/Public/Backend/JavaScript/GridElementsDD_onReady.js')), TRUE);
}
}
}
示例10:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'][] = '&ApacheSolrForTypo3\\Solr\\GarbageCollector';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = '&ApacheSolrForTypo3\\Solr\\GarbageCollector';
// hooking into TCE Main to monitor record updates that may require reindexing by the index queue
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processCmdmapClass'][] = 'ApacheSolrForTypo3\\Solr\\IndexQueue\\RecordMonitor';
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = 'ApacheSolrForTypo3\\Solr\\IndexQueue\\RecordMonitor';
}
# ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #
// register click menu item to initialize the Solr connections for a single site
// visible for admin users only
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig('
[adminUser = 1]
options.contextMenu.table.pages.items.850 = ITEM
options.contextMenu.table.pages.items.850 {
name = Tx_Solr_initializeSolrConnections
label = Initialize Solr Connections
icon = ' . \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($iconPath . 'InitSolrConnections.png') . '
displayCondition = getRecord|is_siteroot = 1
callbackAction = initializeSolrConnections
}
options.contextMenu.table.pages.items.851 = DIVIDER
[global]
');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerExtDirectComponent('TYPO3.Solr.ContextMenuActionController', 'ApacheSolrForTypo3\\Solr\\ContextMenuActionController', 'web', 'admin');
// include JS in backend
$GLOBALS['TYPO3_CONF_VARS']['typo3/backend.php']['additionalBackendItems']['Solr.ContextMenuInitializeSolrConnectionsAction'] = $GLOBALS['PATH_solr'] . 'Classes/BackendItem/ContextMenuActionJavascriptRegistration.php';
# ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- # ----- #
// replace the built-in search content element
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue('*', 'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/Results.xml', 'search');
$TCA['tt_content']['types']['search']['showitem'] = '--palette--;LLL:EXT:cms/locallang_ttc.xml:palette.general;general,
--palette--;LLL:EXT:cms/locallang_ttc.xml:palette.header;header,
示例11: handleNonExistingPostVarSet
/**
* Handles non-existing postVarSet according to configuration.
*
* @param int $pageId
* @param string $postVarSetKey
* @param array $pathSegments
*/
protected function handleNonExistingPostVarSet($pageId, $postVarSetKey, array &$pathSegments)
{
$failureMode = $this->configuration->get('init/postVarSet_failureMode');
if ($failureMode == 'redirect_goodUpperDir') {
$nonProcessedArray = array($postVarSetKey) + $pathSegments;
$badPathPart = implode('/', $nonProcessedArray);
$badPathPartPos = strpos($this->originalPath, $badPathPart);
$badPathPartLength = strlen($badPathPart);
if ($badPathPartPos > 0) {
// We also want to get rid of one slash
$badPathPartPos--;
$badPathPartLength++;
}
$goodPath = substr($this->originalPath, 0, $badPathPartPos) . substr($this->originalPath, $badPathPartPos + $badPathPartLength);
@ob_end_clean();
header(self::REDIRECT_STATUS_HEADER);
header(self::REDIRECT_INFO_HEADER . ': postVarSet_failureMode redirect for ' . $postVarSetKey);
header('Location: ' . GeneralUtility::locationHeaderUrl($goodPath));
exit;
} elseif ($failureMode == 'ignore') {
$pathSegments = array();
} else {
$this->throw404('Segment "' . $postVarSetKey . '" was not a keyword for a postVarSet as expected on page with id=' . $pageId . '.');
}
}
示例12: fix_links_callback
function fix_links_callback($matches)
{
return $matches[1] . \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl($matches[2]) . $matches[3];
}
示例13: getUrl
/**
* Returns the URL, depending on the type of redirect
*
* @return null|string
*/
public function getUrl()
{
$url = null;
switch ($this->type) {
// Internal page
case 0:
$url = $this->constructUrlForInternalPage();
break;
// External URL
// External URL
case 1:
$url = $this->constructUrlForExternal();
break;
// Internal file
// Internal file
case 2:
$url = GeneralUtility::locationHeaderUrl($this->internalFile);
break;
}
return $url;
}
示例14: generateAndSendHash
/**
* Generates a hashed link and send it with email
*
* @param array $user Contains user data
* @return string Empty string with success, error message with no success
*/
protected function generateAndSendHash($user)
{
$hours = (int) $this->conf['forgotLinkHashValidTime'] > 0 ? (int) $this->conf['forgotLinkHashValidTime'] : 24;
$validEnd = time() + 3600 * $hours;
$validEndString = date($this->conf['dateFormat'], $validEnd);
$hash = md5(GeneralUtility::generateRandomBytes(64));
$randHash = $validEnd . '|' . $hash;
$randHashDB = $validEnd . '|' . md5($hash);
// Write hash to DB
$res = $this->databaseConnection->exec_UPDATEquery('fe_users', 'uid=' . $user['uid'], array('felogin_forgotHash' => $randHashDB));
// Send hashlink to user
$this->conf['linkPrefix'] = -1;
$isAbsRelPrefix = !empty($this->frontendController->absRefPrefix);
$isBaseURL = !empty($this->frontendController->baseUrl);
$isFeloginBaseURL = !empty($this->conf['feloginBaseURL']);
$link = $this->pi_getPageLink($this->frontendController->id, '', array(rawurlencode($this->prefixId . '[user]') => $user['uid'], rawurlencode($this->prefixId . '[forgothash]') => $randHash));
// Prefix link if necessary
if ($isFeloginBaseURL) {
// First priority, use specific base URL
// "absRefPrefix" must be removed first, otherwise URL will be prepended twice
if (!empty($this->frontendController->absRefPrefix)) {
$link = substr($link, strlen($this->frontendController->absRefPrefix));
}
$link = $this->conf['feloginBaseURL'] . $link;
} elseif ($isAbsRelPrefix) {
// Second priority
// absRefPrefix must not necessarily contain a hostname and URL scheme, so add it if needed
$link = GeneralUtility::locationHeaderUrl($link);
} elseif ($isBaseURL) {
// Third priority
// Add the global base URL to the link
$link = $this->frontendController->baseUrlWrap($link);
} else {
// No prefix is set, return the error
return $this->pi_getLL('ll_change_password_nolinkprefix_message');
}
$msg = sprintf($this->pi_getLL('ll_forgot_validate_reset_password'), $user['username'], $link, $validEndString);
// Add hook for extra processing of mail message
if (isset($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['forgotPasswordMail']) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['forgotPasswordMail'])) {
$params = array('message' => &$msg, 'user' => &$user);
foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['forgotPasswordMail'] as $reference) {
if ($reference) {
GeneralUtility::callUserFunction($reference, $params, $this);
}
}
}
if ($user['email']) {
$this->cObj->sendNotifyEmail($msg, $user['email'], '', $this->conf['email_from'], $this->conf['email_fromName'], $this->conf['replyTo']);
}
return '';
}
示例15: getPageLink
/**
* Creates a link to a single page
*
* @param array $pageId Page ID
* @return string Full URL of the page including host name (escaped)
*/
protected function getPageLink($pageId)
{
$conf = array('parameter' => $pageId, 'returnLast' => 'url');
$link = htmlspecialchars($this->cObj->typoLink('', $conf));
return GeneralUtility::locationHeaderUrl($link);
}