/** * Saves the edited stop word list to Solr * * @return void */ public function saveStopWordsAction() { $solrConnection = $this->getSelectedCoreSolrConnection(); $postParameters = GeneralUtility::_POST('tx_solr_tools_solradministration'); // lowercase stopword before saving because terms get lowercased before stopword filtering $newStopWords = $this->stringUtility->toLower($postParameters['stopWords']); $newStopWords = GeneralUtility::trimExplode("\n", $newStopWords, true); $oldStopWords = $solrConnection->getStopWords(); $wordsRemoved = true; $removedStopWords = array_diff($oldStopWords, $newStopWords); foreach ($removedStopWords as $word) { $response = $solrConnection->deleteStopWord($word); if ($response->getHttpStatus() != 200) { $wordsRemoved = false; $this->addFlashMessage('Failed to remove stop word "' . $word . '".', 'An error occurred', FlashMessage::ERROR); break; } } $wordsAdded = true; $addedStopWords = array_diff($newStopWords, $oldStopWords); if (!empty($addedStopWords)) { $wordsAddedResponse = $solrConnection->addStopWords($addedStopWords); $wordsAdded = $wordsAddedResponse->getHttpStatus() == 200; } $reloadResponse = $solrConnection->reloadCore(); if ($wordsRemoved && $wordsAdded && $reloadResponse->getHttpStatus() == 200) { $this->addFlashMessage('Stop Words Updated.'); } $this->forwardToIndex(); }
/** * Initializes the Index Queue for selected indexing configurations * * @return void */ public function initializeIndexQueueAction() { $initializedIndexingConfigurations = array(); $itemIndexQueue = GeneralUtility::makeInstance('Tx_Solr_IndexQueue_Queue'); $indexingConfigurationsToInitialize = GeneralUtility::_POST('tx_solr-index-queue-initialization'); if (!empty($indexingConfigurationsToInitialize)) { // initialize selected indexing configuration foreach ($indexingConfigurationsToInitialize as $indexingConfigurationName) { $initializedIndexingConfiguration = $itemIndexQueue->initialize($this->site, $indexingConfigurationName); // track initialized indexing configurations for the flash message $initializedIndexingConfigurations = array_merge($initializedIndexingConfigurations, $initializedIndexingConfiguration); } } else { $this->addFlashMessage('No indexing configurations selected.', 'Index Queue not initialized', FlashMessage::WARNING); } $messagesForConfigurations = array(); foreach (array_keys($initializedIndexingConfigurations) as $indexingConfigurationName) { $itemCount = $itemIndexQueue->getItemsCountBySite($this->site, $indexingConfigurationName); if (!is_int($itemCount)) { $itemCount = 0; } $messagesForConfigurations[] = $indexingConfigurationName . ' (' . $itemCount . ' records)'; } if (!empty($initializedIndexingConfigurations)) { $this->addFlashMessage('Initialized indexing configurations: ' . implode(', ', $messagesForConfigurations), 'Index Queue initialized', FlashMessage::OK); } $this->forward('index'); }
/** * Create a tag * * @param array $params * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj * @return void * @throws \Exception */ public function createTag(array $params, \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj) { $request = GeneralUtility::_POST(); try { // Check if a tag is submitted if (!isset($request['item']) || empty($request['item'])) { throw new \Exception('error_no-tag'); } $itemUid = $request['uid']; if ((int) $itemUid === 0 && (strlen($itemUid) == 16 && !GeneralUtility::isFirstPartOfStr($itemUid, 'NEW'))) { throw new \Exception('error_no-uid'); } $table = $request['table']; if (empty($table)) { throw new \Exception('error_no-table'); } // Get tag uid $newTagId = $this->getTagUid($request); $ajaxObj->setContentFormat('javascript'); $ajaxObj->setContent(''); $response = array($newTagId, $request['item'], self::TAG, $table, 'tags', 'data[' . htmlspecialchars($table) . '][' . $itemUid . '][tags]', $itemUid); $ajaxObj->setJavascriptCallbackWrap(implode('-', $response)); } catch (\Exception $e) { $errorMsg = $GLOBALS['LANG']->sL(self::LLPATH . $e->getMessage()); $ajaxObj->setError($errorMsg); } }
/** * Administrative links for a table / record. * * @param string $table Table name * @param array $row Record for which administrative links are generated. * * @return string HTML link tags. */ public function adminLinks($table, array $row) { if ($table !== 'tx_commerce_products') { return parent::adminLinks($table, $row); } else { $language = $this->getLanguageService(); // Edit link: $adminLink = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick('&edit[' . $table . '][' . $row['uid'] . ']=edit', $this->getBackPath())) . '">' . IconUtility::getSpriteIcon('actions-document-open', array('title' => $language->sL('LLL:EXT:lang/locallang_core.xml:cm.edit', true))) . '</a>'; // Delete link: $adminLink .= '<a href="' . htmlspecialchars($this->doc->issueCommand('&cmd[' . $table . '][' . $row['uid'] . '][delete]=1')) . '">' . IconUtility::getSpriteIcon('actions-edit-delete', array('title' => $language->sL('LLL:EXT:lang/locallang_core.php:cm.delete', true))) . '</a>'; if ($row['pid'] == -1) { // get page TSconfig $pagesTyposcriptConfig = BackendUtility::getPagesTSconfig(GeneralUtility::_POST('popViewId')); if ($pagesTyposcriptConfig['tx_commerce.']['singlePid']) { $previewPageId = $pagesTyposcriptConfig['tx_commerce.']['singlePid']; } else { $previewPageId = SettingsFactory::getInstance()->getExtConf('previewPageID'); } $sysLanguageUid = (int) $row['sys_language_uid']; /** * Product. * * @var \CommerceTeam\Commerce\Domain\Model\Product $product */ $product = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Domain\\Model\\Product', $row['t3ver_oid'], $sysLanguageUid); $product->loadData(); $getVars = ($sysLanguageUid > 0 ? '&L=' . $sysLanguageUid : '') . '&ADMCMD_vPrev[' . rawurlencode($table . ':' . $row['t3ver_oid']) . ']=' . $row['uid'] . '&no_cache=1&tx_commerce_pi1[showUid]=' . $product->getUid() . '&tx_commerce_pi1[catUid]=' . current($product->getMasterparentCategory()); $adminLink .= '<a href="#" onclick="' . htmlspecialchars(BackendUtility::viewOnClick($previewPageId, $this->getBackPath(), BackendUtility::BEgetRootLine($row['_REAL_PID']), '', '', $getVars)) . '">' . IconUtility::getSpriteIcon('actions-document-view') . '</a>'; } return $adminLink; } }
/** * Run the wizard and output HTML. * * @return void */ public function main() { $p = GeneralUtility::_GP('P'); if (isset($p['itemName'])) { $this->parentFormItemName = $p['itemName']; } if (isset($p['fieldChangeFunc']['TBE_EDITOR_fieldChanged'])) { $this->parentFormFieldChangeFunc = $p['fieldChangeFunc']['TBE_EDITOR_fieldChanged']; } if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('tx_openid_mode') === 'finish' && $this->openIDResponse === NULL) { $this->includePHPOpenIDLibrary(); $openIdConsumer = $this->getOpenIDConsumer(); $this->openIDResponse = $openIdConsumer->complete($this->getReturnUrl()); $this->handleResponse(); $this->renderHtml(); return; } elseif (GeneralUtility::_POST('openid_url') != '') { $openIDIdentifier = GeneralUtility::_POST('openid_url'); $this->sendOpenIDRequest($openIDIdentifier); // When sendOpenIDRequest() returns, there was an error $flashMessageService = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService'); $flashMessage = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessage', sprintf($GLOBALS['LANG']->sL('LLL:EXT:openid/Resources/Private/Language/Wizard.xlf:error.setup'), htmlspecialchars($openIDIdentifier)), $GLOBALS['LANG']->sL('LLL:EXT:openid/Resources/Private/Language/Wizard.xlf:title.error'), \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR); $flashMessageService->getMessageQueueByIdentifier()->enqueue($flashMessage); } $this->renderHtml(); }
/** * Initializes the Index Queue for selected indexing configurations * * @return void */ public function initializeIndexQueueAction() { $initializedIndexingConfigurations = array(); $itemIndexQueue = GeneralUtility::makeInstance('Tx_Solr_IndexQueue_Queue'); $indexingConfigurationsToInitialize = GeneralUtility::_POST('tx_solr-index-queue-initialization'); if (!empty($indexingConfigurationsToInitialize)) { // initialize selected indexing configuration foreach ($indexingConfigurationsToInitialize as $indexingConfigurationName) { $initializedIndexingConfiguration = $itemIndexQueue->initialize($this->site, $indexingConfigurationName); // track initialized indexing configurations for the flash message $initializedIndexingConfigurations = array_merge($initializedIndexingConfigurations, $initializedIndexingConfiguration); } } else { $messageLabel = 'solr.backend.index_queue_module.flashmessage.initialize.no_selection'; $titleLabel = 'solr.backend.index_queue_module.flashmessage.not_initialized.title'; $this->addFlashMessage(LocalizationUtility::translate($messageLabel, 'Solr'), LocalizationUtility::translate($titleLabel, 'Solr'), FlashMessage::WARNING); } $messagesForConfigurations = array(); foreach (array_keys($initializedIndexingConfigurations) as $indexingConfigurationName) { $itemCount = $itemIndexQueue->getItemsCountBySite($this->site, $indexingConfigurationName); if (!is_int($itemCount)) { $itemCount = 0; } $messagesForConfigurations[] = $indexingConfigurationName . ' (' . $itemCount . ' records)'; } if (!empty($initializedIndexingConfigurations)) { $messageLabel = 'solr.backend.index_queue_module.flashmessage.initialize.success'; $titleLabel = 'solr.backend.index_queue_module.flashmessage.initialize.title'; $this->addFlashMessage(LocalizationUtility::translate($messageLabel, 'Solr', array(implode(', ', $messagesForConfigurations))), LocalizationUtility::translate($titleLabel, 'Solr'), FlashMessage::OK); } $this->forward('index'); }
/** * Single entry point for all MShop admin requests. * * @return JSON 2.0 RPC message response */ public function doAction() { $param = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST(); if (($content = file_get_contents('php://input')) === false) { throw new \RuntimeException('Unable to get request content'); } $this->view->assign('response', $this->getController()->process($param, $content)); }
/** * return true if the button is clicked * @return bool */ public function isClicked() { if ($this->form->isSubmitted()) { $post = GeneralUtility::_POST($this->form->getIdentifier()); return isset($post[$this->getName()]); } return false; }
/** * Rewrite Arguments to receive a clean mail object in createAction * * @return void */ public function initializeCreateAction() { $this->reformatParamsForAction(); $this->forwardIfFormParamsDoNotMatch(); if ($this->settings['debug']['variables']) { GeneralUtility::devLog('Variables', $this->extensionName, 0, GeneralUtility::_POST()); } }
/** * action showtext * * @param * @return string $response */ public function showtextAction() { $arg1 = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('a1'); $arg2 = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('a2'); $returnStr = ''; $returnStr = '"' . $arg1 . ' ' . $arg2 . '" ' . 'from Server as a Response!'; return $returnStr; }
/** * Get the file with its absolute path. * * @return string */ public function getFileWithAbsolutePath() { $fileIdentifier = GeneralUtility::_POST('qquuid'); if (!empty($fileIdentifier)) { $fileIdentifier .= '-'; } return $this->uploadFolder . DIRECTORY_SEPARATOR . $fileIdentifier . $this->name; }
/** * Saves the sorting order of tasks in the backend user's uc * * @param array $params Array of parameters from the AJAX interface, currently unused * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj Object of type TYPO3AJAX * @return void */ public function saveSortingState(array $params, \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj) { $sort = array(); $items = explode('&', \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('data')); foreach ($items as $item) { $sort[] = substr($item, 12); } $GLOBALS['BE_USER']->uc['taskcenter']['sorting'] = serialize($sort); $GLOBALS['BE_USER']->writeUC(); }
/** * Saves the sorting order of tasks in the backend user's uc * * @param array $params Array of parameters from the AJAX interface, currently unused * @param AjaxRequestHandler $ajaxObj Object of type AjaxRequestHandler * @return void */ public function saveSortingState(array $params, AjaxRequestHandler $ajaxObj) { $sort = array(); $items = explode('&', GeneralUtility::_POST('data')); foreach ($items as $item) { $sort[] = substr($item, 12); } $this->getBackendUserAuthentication()->uc['taskcenter']['sorting'] = serialize($sort); $this->getBackendUserAuthentication()->writeUC(); }
/** * Updates nested sets * * @return string HTML output */ public function main() { if (\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('nssubmit') != '') { $this->updateOverridePaths(); $content = 'Update finished successfully.'; } else { $content = $this->prompt(); } return $content; }
/** * action showtext * * @param * @return string $response */ public function showtextAction() { $ajaxParams = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('request'); $argsArray = $ajaxParams['arguments']; $arg1 = $argsArray['a1']; $arg2 = $argsArray['a2']; $returnStr = ''; $returnStr = $arg1 . ' ' . $arg2 . ' ' . 'from Server as a Response!'; return $returnStr; }
/** * Loads the GET/POST parameterss into the internal storage $this->gp * * @return array The loaded parameters */ protected function loadGP() { $gp = array_merge(\TYPO3\CMS\Core\Utility\GeneralUtility::_GET(), \TYPO3\CMS\Core\Utility\GeneralUtility::_POST()); $formValuesPrefix = $this->globals->getFormValuesPrefix(); if ($formValuesPrefix) { $gp = $gp[$formValuesPrefix]; } if (!is_array($gp)) { $gp = array(); } return $gp; }
/** * Used to broker incoming requests to other calls. * Called by typo3/ajax.php * * @param array $unused additional parameters (not used) * @param AjaxRequestHandler $ajax the AJAX object for this request * * @return void */ public function ajaxBroker(array $unused, AjaxRequestHandler $ajax) { $state = (bool) GeneralUtility::_POST('state'); $checkbox = GeneralUtility::_POST('checkbox'); if (in_array($checkbox, $this->validCheckboxKeys, true)) { $ajax->setContentFormat('json'); $this->userSettingsService->set($checkbox, $state); $ajax->addContent('success', true); } else { $ajax->setContentFormat('plain'); $ajax->setError('Illegal input parameters.'); } }
public function getMergedGP() { $gp = array_merge(\TYPO3\CMS\Core\Utility\GeneralUtility::_GET(), \TYPO3\CMS\Core\Utility\GeneralUtility::_POST()); $prefix = $this->globals->getFormValuesPrefix(); if ($prefix) { $gp = $gp[$prefix]; } /* * Unset key "saveDB" to prevent conflicts with information set by Finisher_DB */ unset($gp['saveDB']); return $gp; }
/** * Add synonyms to selected core * * @return void */ public function addSynonymsAction() { $solrConnection = $this->getSelectedCoreSolrConnection(); $synonymMap = GeneralUtility::_POST('tx_solr_tools_solradministration'); if (empty($synonymMap['baseWord']) || empty($synonymMap['synonyms'])) { $this->addFlashMessage('Please provide a base word and synonyms.', 'Missing parameter', FlashMessage::ERROR); } else { $baseWord = $synonymMap['baseWord']; $synonyms = $synonymMap['synonyms']; $solrConnection->addSynonym($baseWord, GeneralUtility::trimExplode(',', $synonyms, TRUE)); $this->addFlashMessage('"' . $synonyms . '" added as synonyms for base word "' . $baseWord . '"'); } $this->forward('index'); }
/** * Delete a file being just uploaded. * * @return string */ public function deleteAction() { $fileIdentifier = GeneralUtility::_POST('qquuid'); /** @var $uploadManager \TYPO3\CMS\Media\FileUpload\UploadManager */ $uploadManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Media\\FileUpload\\UploadManager'); $uploadFolderPath = $uploadManager->getUploadFolder(); $fileNameAndPath = sprintf('%s/%s', $uploadFolderPath, $fileIdentifier); $files = glob($fileNameAndPath . '*'); $fileWithIdentifier = current($files); if (file_exists($fileWithIdentifier)) { unlink($fileWithIdentifier); } $result = array('success' => TRUE); return json_encode($result); }
/** * @return \Fab\Media\FileUpload\Base64File */ public function __construct() { // Processes the encoded image data and returns the decoded image $encodedImage = GeneralUtility::_POST($this->inputName); if (preg_match('/^data:image\\/(jpg|jpeg|png)/i', $encodedImage, $matches)) { $this->extension = $matches[1]; } else { return FALSE; } // Remove the mime-type header $data = reset(array_reverse(explode('base64,', $encodedImage))); // Use strict mode to prevent characters from outside the base64 range $this->image = base64_decode($data, true); if (!$this->image) { return FALSE; } $this->setName(uniqid() . '.' . $this->extension); }
/** * @return SearchRequest */ private function buildSearchRequest() { $solrParameters = array(); $solrPostParameters = GeneralUtility::_POST('tx_solr'); $solrGetParameters = GeneralUtility::_GET('tx_solr'); // check for GET parameters, POST takes precedence if (isset($solrGetParameters) && is_array($solrGetParameters)) { $solrParameters = $solrGetParameters; } if (isset($solrPostParameters) && is_array($solrPostParameters)) { $solrParameters = $solrPostParameters; } /** @var $searchRequest \ApacheSolrForTypo3\Solr\Domain\Search\SearchRequest */ $searchRequest = GeneralUtility::makeInstance(\ApacheSolrForTypo3\Solr\Domain\Search\SearchRequest::class, array('tx_solr' => $solrParameters), $GLOBALS['TSFE']->id, $GLOBALS['TSFE']->sys_language_uid, $this->typoScriptConfiguration); $searchRequest->mergeArguments(array('tx_solr' => $this->piVars)); $searchRequest->mergeArguments(array('q' => $this->getRawUserQuery())); return $searchRequest; }
/** * The constructor of this class */ public function __construct() { $this->getLanguageService()->includeLLFile('EXT:lang/locallang_mod_web_perm.xlf'); // Configuration, variable assignment $this->conf['page'] = GeneralUtility::_POST('page'); $this->conf['who'] = GeneralUtility::_POST('who'); $this->conf['mode'] = GeneralUtility::_POST('mode'); $this->conf['bits'] = (int) GeneralUtility::_POST('bits'); $this->conf['permissions'] = (int) GeneralUtility::_POST('permissions'); $this->conf['action'] = GeneralUtility::_POST('action'); $this->conf['ownerUid'] = (int) GeneralUtility::_POST('ownerUid'); $this->conf['username'] = GeneralUtility::_POST('username'); $this->conf['groupUid'] = (int) GeneralUtility::_POST('groupUid'); $this->conf['groupname'] = GeneralUtility::_POST('groupname'); $this->conf['editLockState'] = (int) GeneralUtility::_POST('editLockState'); $this->conf['new_owner_uid'] = (int) GeneralUtility::_POST('newOwnerUid'); $this->conf['new_group_uid'] = (int) GeneralUtility::_POST('newGroupUid'); }
/** * Builds a widget request object from the raw HTTP information * * @return \TYPO3\CMS\Fluid\Core\Widget\WidgetRequest The widget request as an object */ public function build() { $request = $this->objectManager->get(\TYPO3\CMS\Fluid\Core\Widget\WidgetRequest::class); $request->setRequestUri(GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL')); $request->setBaseUri(GeneralUtility::getIndpEnv('TYPO3_SITE_URL')); $request->setMethod(isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : null); if (strtolower($_SERVER['REQUEST_METHOD']) === 'post') { $request->setArguments(GeneralUtility::_POST()); } else { $request->setArguments(GeneralUtility::_GET()); } $rawGetArguments = GeneralUtility::_GET(); if (isset($rawGetArguments['action'])) { $request->setControllerActionName($rawGetArguments['action']); } $widgetContext = $this->ajaxWidgetContextHolder->get($rawGetArguments['fluid-widget-id']); $request->setWidgetContext($widgetContext); return $request; }
public static function getMergedGP() { $gp = array_merge(\TYPO3\CMS\Core\Utility\GeneralUtility::_GET(), \TYPO3\CMS\Core\Utility\GeneralUtility::_POST()); $prefix = \Typoheads\Formhandler\Utility\Globals::getFormValuesPrefix(); if ($prefix) { if (is_array($gp[$prefix])) { $gp = $gp[$prefix]; } else { $gp = array(); } } /* * Unset key "saveDB" to prevent conflicts with information set by Finisher_DB */ if (is_array($gp) && array_key_exists('saveDB', $gp)) { unset($gp['saveDB']); } return $gp; }
/** * Processes update requests from payment service providers. */ public function updateAction() { try { $context = $this->getContext(); $templatePaths = Base::getAimeos()->getCustomPaths('client/html'); $client = \Aimeos\Client\Html\Checkout\Update\Factory::createClient($context, $templatePaths); $view = $context->getView(); $param = array_merge(\TYPO3\CMS\Core\Utility\GeneralUtility::_GET(), \TYPO3\CMS\Core\Utility\GeneralUtility::_POST()); $helper = new \Aimeos\MW\View\Helper\Parameter\Standard($view, $param); $view->addHelper('param', $helper); $client->setView($view); $client->process(); $this->response->addAdditionalHeaderData($client->getHeader()); return $client->getBody(); } catch (\Exception $e) { @header('HTTP/1.1 500 Internal server error', true, 500); return 'Error: ' . $e->getMessage(); } }
/** * Builds a widget request object from the raw HTTP information * * @return \TYPO3\Fluid\Core\Widget\WidgetRequest The widget request as an object */ public function build() { $request = $this->objectManager->create('TYPO3\\Fluid\\Core\\Widget\\WidgetRequest'); $request->setRequestURI(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL')); $request->setBaseURI(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL')); $request->setMethod(isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : NULL); if (strtolower($_SERVER['REQUEST_METHOD']) === 'post') { $request->setArguments(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST()); } else { $request->setArguments(\TYPO3\CMS\Core\Utility\GeneralUtility::_GET()); } $rawGetArguments = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET(); // TODO: rename to @action, to be consistent with normal naming? if (isset($rawGetArguments['action'])) { $request->setControllerActionName($rawGetArguments['action']); } $widgetContext = $this->ajaxWidgetContextHolder->get($rawGetArguments['fluid-widget-id']); $request->setWidgetContext($widgetContext); return $request; }
/** * Create a request from the original superglobal variables. * * @return ServerRequest * @throws \InvalidArgumentException when invalid file values given * @internal Note that this is not public API yet. */ public static function fromGlobals() { $serverParameters = $_SERVER; $headers = static::prepareHeaders($serverParameters); $method = isset($serverParameters['REQUEST_METHOD']) ? $serverParameters['REQUEST_METHOD'] : 'GET'; $uri = new Uri(GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL')); $request = new ServerRequest($uri, $method, 'php://input', $headers, $serverParameters, static::normalizeUploadedFiles($_FILES)); if (!empty($_COOKIE)) { $request = $request->withCookieParams($_COOKIE); } $queryParameters = GeneralUtility::_GET(); if (!empty($queryParameters)) { $request = $request->withQueryParams($queryParameters); } $parsedBody = GeneralUtility::_POST(); if (!empty($parsedBody)) { $request = $request->withParsedBody($parsedBody); } return $request; }
/** * @param $par * @throws Exception * @return void */ function emSaveConstants($par) { if ($par['extKey'] == 'piwikintegration' && \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('submit')) { $newconf = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST(); $newconf = $newconf['data']; //init piwik to get table prefix #$this->initPiwik(); if (!tx_piwikintegration_install::getInstaller()->checkInstallation()) { return 'Problem moving database, Piwik is not installed ...'; } $old_database = tx_piwikintegration_install::getInstaller()->getConfigObject()->getOption('database', 'dbname'); $new_database = $newconf['databaseTablePrefix']; $this->table_prefix = tx_piwikintegration_install::getInstaller()->getConfigObject()->getOption('database', 'table_prefix'); //walk through changes if ($old_database !== $new_database) { //create shortVars if ($new_database == '') { $new_database = TYPO3_db; } //get tablenames and rename tables $suffix = ''; if ($old_database != '') { $suffix = ' FROM `' . $old_database . '`'; } $erg = $GLOBALS['TYPO3_DB']->admin_query('SHOW TABLES' . $suffix); while (false !== ($row = $GLOBALS['TYPO3_DB']->sql_fetch_row($erg))) { if (substr($row[0], 0, 20) == 'tx_piwikintegration_') { $GLOBALS['TYPO3_DB']->admin_query('RENAME TABLE `' . $old_database . '`.`' . $row[0] . '` TO `' . $new_database . '`.`' . $row[0] . '`'); } } //change config $conf = tx_piwikintegration_install::getInstaller()->getConfigObject(); $conf->setOption('database', 'tables_prefix', 'tx_piwikintegration_'); $conf->setOption('database', 'dbname', $newconf['databaseTablePrefix']); $conf->setOption('database', 't3dbname', TYPO3_db); } } }
/** * Builds a widget request object from the raw HTTP information * * @return \TYPO3\CMS\Fluid\Core\Widget\WidgetRequest The widget request as an object */ public function build() { $request = $this->objectManager->get(\TYPO3\CMS\Fluid\Core\Widget\WidgetRequest::class); $request->setRequestURI(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL')); $request->setBaseURI(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL')); $request->setMethod(isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : null); if (strtolower($_SERVER['REQUEST_METHOD']) === 'post') { $files = $this->untangleFilesArray($_FILES); $parameters = array_merge(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST(), $files); $request->setArguments($parameters); } else { $request->setArguments(\TYPO3\CMS\Core\Utility\GeneralUtility::_GET()); } $rawGetArguments = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET(); // @todo rename to @action, to be consistent with normal naming? if (isset($rawGetArguments['action'])) { $request->setControllerActionName($rawGetArguments['action']); } $widgetContext = $this->ajaxWidgetContextHolder->get($rawGetArguments['fluid-widget-id']); $request->setWidgetContext($widgetContext); return $request; }