Esempio n. 1
0
 /**
  * @param array $ajaxParams
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObject
  * @return string
  */
 public function updateConfigurationFile($ajaxParams, $ajaxObject)
 {
     $extensionKey = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('extensionKey');
     if (!empty($extensionKey)) {
         $packageManager = \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->getEarlyInstance('TYPO3\\Flow\\Package\\PackageManager');
         $extensionConfigurationPath = $packageManager->getPackage($extensionKey)->getPackagePath() . 'ext_emconf.php';
         $_EXTKEY = $extensionKey;
         $EM_CONF = NULL;
         $extension = NULL;
         if (file_exists($extensionConfigurationPath)) {
             include $extensionConfigurationPath;
             if (is_array($EM_CONF[$_EXTKEY])) {
                 $extension = $EM_CONF[$_EXTKEY];
             }
         }
         if ($EM_CONF !== NULL) {
             $currentMd5HashArray = \IchHabRecht\Devtools\Utility\ExtensionUtility::getMd5HashArrayForExtension($extensionKey);
             $EM_CONF[$extensionKey]['_md5_values_when_last_written'] = serialize($currentMd5HashArray);
             /** @var \TYPO3\CMS\Extensionmanager\Utility\EmConfUtility $emConfUtility */
             $emConfUtility = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('\\TYPO3\\CMS\\Extensionmanager\\Utility\\EmConfUtility');
             $extensionData = array('extKey' => $extensionKey, 'EM_CONF' => $EM_CONF[$extensionKey]);
             $emConfContent = $emConfUtility->constructEmConf($extensionData);
             \TYPO3\CMS\Core\Utility\GeneralUtility::writeFile($extensionConfigurationPath, $emConfContent);
         }
         $ajaxObject->setContentFormat('json');
         $ajaxObject->addContent('title', $this->translate('title'));
         $ajaxObject->addContent('message', sprintf($this->translate('message'), $extensionKey));
     }
 }
 /**
  * The main dispatcher function. Collect data and prepare HTML output.
  *
  * @param array $params array of parameters, currently unused
  * @param AjaxRequestHandler $ajaxObj object of type AjaxRequestHandler
  * @return void
  */
 public function dispatch($params = array(), AjaxRequestHandler $ajaxObj = NULL)
 {
     $params = GeneralUtility::_GP('params');
     if ($params['action'] === 'getContextHelp') {
         $result = $this->getContextHelp($params['table'], $params['field']);
         $ajaxObj->addContent('title', $result['title']);
         $ajaxObj->addContent('content', $result['description']);
         $ajaxObj->addContent('link', $result['moreInfo']);
         $ajaxObj->setContentFormat('json');
     }
 }
Esempio n. 3
0
 /**
  * Gets RSA Public Key.
  *
  * @param array $parameters Parameters (not used)
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $parent The calling parent AJAX object
  * @return void
  */
 public function getRsaPublicKey(array $parameters, \TYPO3\CMS\Core\Http\AjaxRequestHandler $parent)
 {
     $backend = BackendFactory::getBackend();
     if ($backend !== NULL) {
         $keyPair = $backend->createNewKeyPair();
         $storage = \TYPO3\CMS\Rsaauth\Storage\StorageFactory::getStorage();
         $storage->put($keyPair->getPrivateKey());
         session_commit();
         $parent->addContent('publicKeyModulus', $keyPair->getPublicKeyModulus());
         $parent->addContent('exponent', sprintf('%x', $keyPair->getExponent()));
         $parent->setContentFormat('json');
     } else {
         $parent->setError('No OpenSSL backend could be obtained for rsaauth.');
     }
 }
Esempio n. 4
0
 /**
  * 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.');
     }
 }
 /**
  * General processor for AJAX requests.
  * (called by typo3/ajax.php)
  *
  * @param array $params Additional parameters (not used here)
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj The AjaxRequestHandler object of this request
  * @return void
  * @author Oliver Hader <*****@*****.**>
  */
 public function processAjaxRequest($params, \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj)
 {
     $this->ajaxObj = $ajaxObj;
     // Load the TSref XML information:
     $this->loadFile(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('t3editor') . 'res/tsref/tsref.xml');
     $ajaxIdParts = explode('::', $ajaxObj->getAjaxID(), 2);
     $ajaxMethod = $ajaxIdParts[1];
     $response = array();
     // Process the AJAX requests:
     if ($ajaxMethod == 'getTypes') {
         $ajaxObj->setContent($this->getTypes());
         $ajaxObj->setContentFormat('jsonbody');
     } elseif ($ajaxMethod == 'getDescription') {
         $ajaxObj->addContent('', $this->getDescription(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('typeId'), \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('parameterName')));
         $ajaxObj->setContentFormat('plain');
     }
 }
Esempio n. 6
0
	/**
	 * Returns the html for the AJAX API
	 *
	 * @param array $params
	 * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxRequestHandler
	 * @return void
	 */
	public function getHtmlForImageManipulationWizard($params, $ajaxRequestHandler) {
		if (!$this->checkHmacToken()) {
			HttpUtility::setResponseCodeAndExit(HttpUtility::HTTP_STATUS_403);
		}

		$fileUid = GeneralUtility::_GET('file');
		$image = NULL;
		if (MathUtility::canBeInterpretedAsInteger($fileUid)) {
			try {
				$image = ResourceFactory::getInstance()->getFileObject($fileUid);
			} catch (FileDoesNotExistException $e) {}
		}

		$view = $this->getFluidTemplateObject($this->templatePath . 'Wizards/ImageManipulationWizard.html');
		$view->assign('image', $image);
		$view->assign('zoom', (bool)GeneralUtility::_GET('zoom'));
		$view->assign('ratios', $this->getRatiosArray());
		$content = $view->render();

		$ajaxRequestHandler->addContent('content', $content);
		$ajaxRequestHandler->setContentFormat('html');
	}
Esempio n. 7
0
 /**
  * Makes the AJAX call to expand or collapse the categorytree.
  * Called by typo3/ajax.php
  *
  * @param array $params Additional parameters (not used here)
  * @param AjaxRequestHandler $ajaxObj Ajax object
  *
  * @return void
  */
 public function ajaxExpandCollapseWithoutProduct(array $params, AjaxRequestHandler &$ajaxObj)
 {
     $parameter = $this->getParameter();
     // Get the category tree without the products and the articles
     $this->init(TRUE);
     $tree = $this->categoryTree->getBrowseableAjaxTree($parameter);
     $ajaxObj->addContent('tree', $tree);
 }
Esempio n. 8
0
 /**
  * Renders the FlashMessages from queue and returns them as AJAX.
  *
  * @param array $params Always empty.
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj The AjaxRequestHandler object used to return content and set content types
  * @return void
  */
 public function renderFlashMessages(array $params, \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj)
 {
     $ajaxObj->addContent('result', $this->getFlashMessages());
     $ajaxObj->setContentFormat('html');
 }
Esempio n. 9
0
 /**
  * Renders the menu so that it can be returned as response to an AJAX call
  *
  * @param array $params Array of parameters from the AJAX interface, currently unused
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj Object of type AjaxRequestHandler
  * @return void
  */
 public function renderAjax($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj = NULL)
 {
     $ajaxObj->addContent('opendocsMenu', $this->getDropDown());
 }
Esempio n. 10
0
 /**
  * Handles the actual process from within the ajaxExec function
  * therefore, it does exactly the same as the real typo3/tce_file.php
  * but without calling the "finish" method, thus makes it simpler to deal with the
  * actual return value
  *
  * @param array $params Always empty.
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj The AjaxRequestHandler object used to return content and set content types
  * @return void
  */
 public function processAjaxRequest(array $params, \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj)
 {
     $this->init();
     $this->main();
     $errors = $this->fileProcessor->getErrorMessages();
     if (!empty($errors)) {
         $ajaxObj->setError(implode(',', $errors));
     } else {
         $flatResult = array();
         foreach ($this->fileData as $action => $results) {
             foreach ($results as $result) {
                 if (is_array($result)) {
                     foreach ($result as $subResult) {
                         $flatResult[$action][] = $this->flattenResultDataValue($subResult);
                     }
                 } else {
                     $flatResult[$action][] = $this->flattenResultDataValue($result);
                 }
             }
         }
         $ajaxObj->addContent('result', $flatResult);
         if ($this->redirect) {
             $ajaxObj->addContent('redirect', $this->redirect);
         }
         $ajaxObj->setContentFormat('json');
     }
 }
 /**
  * The main dispatcher function. Collect data and prepare HTML output.
  *
  * @param array $params array of parameters from the AJAX interface, currently unused
  * @param AjaxRequestHandler $ajaxObj object of type AjaxRequestHandler
  * @return void
  */
 public function dispatch($params = array(), AjaxRequestHandler $ajaxObj = NULL)
 {
     $extPath = ExtensionManagementUtility::extPath('beuser');
     $view = GeneralUtility::makeInstance(StandaloneView::class);
     $view->setPartialRootPaths(array('default' => ExtensionManagementUtility::extPath('beuser') . 'Resources/Private/Partials'));
     $view->assign('pageId', $this->conf['page']);
     $content = '';
     // Basic test for required value
     if ($this->conf['page'] > 0) {
         // Init TCE for execution of update
         /** @var $tce DataHandler */
         $tce = GeneralUtility::makeInstance(DataHandler::class);
         $tce->stripslashes_values = FALSE;
         // Determine the scripts to execute
         switch ($this->conf['action']) {
             case 'show_change_owner_selector':
                 $content = $this->renderUserSelector($this->conf['page'], $this->conf['ownerUid'], $this->conf['username']);
                 break;
             case 'change_owner':
                 $userId = $this->conf['new_owner_uid'];
                 if (is_int($userId)) {
                     // Prepare data to change
                     $data = array();
                     $data['pages'][$this->conf['page']]['perms_userid'] = $userId;
                     // Execute TCE Update
                     $tce->start($data, array());
                     $tce->process_datamap();
                     $view->setTemplatePathAndFilename($extPath . 'Resources/Private/Templates/PermissionAjax/ChangeOwner.html');
                     $view->assign('userId', $userId);
                     $usernameArray = BackendUtility::getUserNames('username', ' AND uid = ' . $userId);
                     $view->assign('username', $usernameArray[$userId]['username']);
                     $content = $view->render();
                 } else {
                     $ajaxObj->setError('An error occurred: No page owner uid specified.');
                 }
                 break;
             case 'show_change_group_selector':
                 $content = $this->renderGroupSelector($this->conf['page'], $this->conf['groupUid'], $this->conf['groupname']);
                 break;
             case 'change_group':
                 $groupId = $this->conf['new_group_uid'];
                 if (is_int($groupId)) {
                     // Prepare data to change
                     $data = array();
                     $data['pages'][$this->conf['page']]['perms_groupid'] = $groupId;
                     // Execute TCE Update
                     $tce->start($data, array());
                     $tce->process_datamap();
                     $view->setTemplatePathAndFilename($extPath . 'Resources/Private/Templates/PermissionAjax/ChangeGroup.html');
                     $view->assign('groupId', $groupId);
                     $groupnameArray = BackendUtility::getGroupNames('title', ' AND uid = ' . $groupId);
                     $view->assign('groupname', $groupnameArray[$groupId]['title']);
                     $content = $view->render();
                 } else {
                     $ajaxObj->setError('An error occurred: No page group uid specified.');
                 }
                 break;
             case 'toggle_edit_lock':
                 // Prepare data to change
                 $data = array();
                 $data['pages'][$this->conf['page']]['editlock'] = $this->conf['editLockState'] === 1 ? 0 : 1;
                 // Execute TCE Update
                 $tce->start($data, array());
                 $tce->process_datamap();
                 $content = $this->renderToggleEditLock($this->conf['page'], $data['pages'][$this->conf['page']]['editlock']);
                 break;
             default:
                 if ($this->conf['mode'] === 'delete') {
                     $this->conf['permissions'] = (int) ($this->conf['permissions'] - $this->conf['bits']);
                 } else {
                     $this->conf['permissions'] = (int) ($this->conf['permissions'] + $this->conf['bits']);
                 }
                 // Prepare data to change
                 $data = array();
                 $data['pages'][$this->conf['page']]['perms_' . $this->conf['who']] = $this->conf['permissions'];
                 // Execute TCE Update
                 $tce->start($data, array());
                 $tce->process_datamap();
                 $view->setTemplatePathAndFilename($extPath . 'Resources/Private/Templates/PermissionAjax/ChangePermission.html');
                 $view->assign('permission', $this->conf['permissions']);
                 $view->assign('scope', $this->conf['who']);
                 $content = $view->render();
         }
     } else {
         $ajaxObj->setError('This script cannot be called directly.');
     }
     $ajaxObj->addContent($this->conf['page'] . '_' . $this->conf['who'], $content);
 }
Esempio n. 12
0
 /**
  * Gets called when a shortcut is changed, checks whether the user has
  * permissions to do so and saves the changes if everything is ok
  *
  * @param array $params Array of parameters from the AJAX interface, currently unused
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj Object of type AjaxRequestHandler
  * @return void
  */
 public function setAjaxShortcut($params = array(), AjaxRequestHandler $ajaxObj = NULL)
 {
     $databaseConnection = $this->getDatabaseConnection();
     $backendUser = $this->getBackendUser();
     $shortcutId = (int) GeneralUtility::_POST('shortcutId');
     $shortcutName = strip_tags(GeneralUtility::_POST('shortcutTitle'));
     $shortcutGroupId = (int) GeneralUtility::_POST('shortcutGroup');
     if ($shortcutGroupId > 0 || $backendUser->isAdmin()) {
         // Users can delete only their own shortcuts (except admins)
         $addUserWhere = !$backendUser->isAdmin() ? ' AND userid=' . (int) $backendUser->user['uid'] : '';
         $fieldValues = array('description' => $shortcutName, 'sc_group' => $shortcutGroupId);
         if ($fieldValues['sc_group'] < 0 && !$backendUser->isAdmin()) {
             $fieldValues['sc_group'] = 0;
         }
         $databaseConnection->exec_UPDATEquery('sys_be_shortcuts', 'uid=' . $shortcutId . $addUserWhere, $fieldValues);
         $affectedRows = $databaseConnection->sql_affected_rows();
         if ($affectedRows == 1) {
             $ajaxObj->addContent('shortcut', $shortcutName);
         } else {
             $ajaxObj->addContent('shortcut', 'failed');
         }
     }
     $ajaxObj->setContentFormat('plain');
 }
Esempio n. 13
0
 /**
  * this is an intermediate clickmenu handler
  *
  * @param array $parameters
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxRequestHandler
  */
 public function printContentForAjaxRequest($parameters, AjaxRequestHandler $ajaxRequestHandler)
 {
     // XML has to be parsed, no parse errors allowed
     @ini_set('display_errors', 0);
     $clipObj = GeneralUtility::makeInstance(Clipboard::class);
     $clipObj->initializeClipboard();
     // This locks the clipboard to the Normal for this request.
     $clipObj->lockToNormal();
     // Update clipboard if some actions are sent.
     $CB = GeneralUtility::_GET('CB');
     $clipObj->setCmd($CB);
     $clipObj->cleanCurrent();
     // Saves
     $clipObj->endClipboard();
     // Create clickmenu object
     $clickMenu = GeneralUtility::makeInstance(ClickMenu::class);
     // Set internal vars in clickmenu object:
     $clickMenu->clipObj = $clipObj;
     $clickMenu->extClassArray = $this->extClassArray;
     // Set content of the clickmenu with the incoming var, "item"
     $ajaxContent = $clickMenu->init();
     // send the data
     $ajaxContent = '<?xml version="1.0"?><t3ajax>' . $ajaxContent . '</t3ajax>';
     $ajaxRequestHandler->addContent('ClickMenu', $ajaxContent);
     $ajaxRequestHandler->setContentFormat('xml');
 }
Esempio n. 14
0
 /**
  * Checks if a key for an element is available
  *
  * @param array $params Array of parameters from the AJAX interface, not
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj Object of type AjaxRequestHandler
  * @author Benjamin Butschell <*****@*****.**>
  * @return void
  */
 public function checkElementKey($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj = NULL)
 {
     $this->objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $this->storageRepository = $this->objectManager->get("MASK\\Mask\\Domain\\Repository\\StorageRepository");
     // Get parameters, is there a better way? $params is not used yet
     $elementKey = $_GET["key"];
     // check if elementKey is available
     $isAvailable = TRUE;
     if ($this->storageRepository->loadElement("tt_content", $elementKey)) {
         $isAvailable = FALSE;
     }
     // return infos as json
     $ajaxObj->setContentFormat("plain");
     $ajaxObj->addContent("isAvailable", json_encode($isAvailable));
 }
Esempio n. 15
0
 /**
  * Renders the menu so that it can be returned as response to an AJAX call
  *
  * @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 renderAjax($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj = NULL)
 {
     $menuContent = $this->renderMenu();
     $ajaxObj->addContent('opendocsMenu', $menuContent);
 }
 /**
  * get list rows
  *
  * @param    AjaxRequestHandler $ajaxObj the parent ajax object
  *
  * @return    void
  */
 public function getListRows(AjaxRequestHandler &$ajaxObj)
 {
     $uid = (int) $this->getParamValue('uid');
     if ($uid > 0) {
         $table = (string) $this->getParamValue('table');
         $table = $table ? $table : 'tt_content';
         $level = (int) $this->getParamValue('level');
         $this->initializeTemplateContainer();
         $elementChildren = Helper::getInstance()->getChildren($table, $uid, GeneralUtility::_GP('sortField'), (int) GeneralUtility::_GP('sortRev'));
         $row = BackendUtility::getRecord($table, $uid);
         $recordList = $this->getRecordList($table, $uid, $row);
         if ($recordList instanceof DatabaseRecordList) {
             $level++;
             foreach ($elementChildren as $elementChild) {
                 $listRows[] = $recordList->renderListRow($elementChild->getTable(), BackendUtility::getRecord($elementChild->getTable(), $elementChild->getId()), 0, $GLOBALS['TCA'][$table]['ctrl']['label'], $GLOBALS['TCA'][$table]['ctrl']['thumbnail'], 1, $level);
             }
         }
         $ajaxObj->addContent('list', $listRows);
     }
 }
Esempio n. 17
0
 /**
  * Gets called when a shortcut is changed, checks whether the user has
  * permissions to do so and saves the changes if everything is ok
  *
  * @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 setAjaxShortcut($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj = NULL)
 {
     $shortcutId = (int) \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('shortcutId');
     $shortcutName = strip_tags(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST('value'));
     $shortcutGroupId = (int) \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('shortcut-group');
     if ($shortcutGroupId > 0 || $GLOBALS['BE_USER']->isAdmin()) {
         // Users can delete only their own shortcuts (except admins)
         $addUserWhere = !$GLOBALS['BE_USER']->isAdmin() ? ' AND userid=' . intval($GLOBALS['BE_USER']->user['uid']) : '';
         $fieldValues = array('description' => $shortcutName, 'sc_group' => $shortcutGroupId);
         if ($fieldValues['sc_group'] < 0 && !$GLOBALS['BE_USER']->isAdmin()) {
             $fieldValues['sc_group'] = 0;
         }
         $GLOBALS['TYPO3_DB']->exec_UPDATEquery('sys_be_shortcuts', 'uid=' . $shortcutId . $addUserWhere, $fieldValues);
         $affectedRows = $GLOBALS['TYPO3_DB']->sql_affected_rows();
         if ($affectedRows == 1) {
             $ajaxObj->addContent('shortcut', $shortcutName);
         } else {
             $ajaxObj->addContent('shortcut', 'failed');
         }
     }
     $ajaxObj->setContentFormat('plain');
 }
 /**
  * Makes the AJAX call to expand or collapse the foldertree.
  * Called by typo3/ajax.php
  *
  * @param array $params Additional parameters (not used here)
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj The AjaxRequestHandler object of this request
  * @return void
  */
 public function ajaxExpandCollapse($params, $ajaxObj)
 {
     $this->init();
     $tree = $this->foldertree->getBrowsableTree();
     if ($this->foldertree->getAjaxStatus() === FALSE) {
         $ajaxObj->setError($tree);
     } else {
         $ajaxObj->addContent('tree', $tree);
     }
 }
 /**
  * Renders the menu for AJAX calls
  *
  * @param array $params
  * @param AjaxRequestHandler $ajaxObj
  */
 public function renderAjax($params = array(), $ajaxObj)
 {
     $this->collectInformation();
     $ajaxObj->addContent('systemInformationMenu', $this->getDropDown());
 }
Esempio n. 20
0
 /**
  * Returns the Module menu for the AJAX API
  *
  * @param array $params
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxRequestHandler
  * @return void
  */
 public function getModuleMenuForReload($params, $ajaxRequestHandler)
 {
     $content = $this->generateModuleMenu();
     $ajaxRequestHandler->addContent('menu', $content);
     $ajaxRequestHandler->setContentFormat('json');
 }
 /**
  * make the ajax update
  *
  * @param array $params Array of parameters from the AJAX interface, currently unused
  * @param AjaxRequestHandler $ajaxObj Object of type AjaxRequestHandler
  * @return void
  */
 public function ajaxUpdate($params = array(), AjaxRequestHandler &$ajaxObj = NULL)
 {
     $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class);
     $this->evaluationRepository = $this->objectManager->get(EvaluationRepository::class);
     $this->persistenceManager = $this->objectManager->get(PersistenceManager::class);
     // get parameter
     if (empty($params)) {
         $uid = $GLOBALS['GLOBALS']['HTTP_POST_VARS']['uid'];
     } else {
         $attr = $params['request']->getParsedBody();
         $uid = $attr['uid'];
     }
     $this->processResults($uid);
     $ajaxObj->addContent('uid', $uid);
 }
 /**
  * Makes the AJAX call to expand or collapse the pagetree.
  * Called by typo3/ajax.php
  *
  * @param array $params Additional parameters (not used here)
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj The TYPO3AJAX object of this request
  * @return void
  */
 public function ajaxExpandCollapse($params, $ajaxObj)
 {
     $this->init();
     $tree = $this->pagetree->getBrowsableTree();
     if (!$this->pagetree->ajaxStatus) {
         $ajaxObj->setError($tree);
     } else {
         $ajaxObj->addContent('tree', $tree);
     }
 }
Esempio n. 23
0
 /**
  * Handles the actual process from within the ajaxExec function
  * therefore, it does exactly the same as the real typo3/tce_file.php
  * but without calling the "finish" method, thus makes it simpler to deal with the
  * actual return value
  *
  * @param array $params Always empty.
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj The Ajax object used to return content and set content types
  * @return void
  */
 public function processAjaxRequest(array $params, \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj)
 {
     $this->init();
     $this->main();
     $errors = $this->fileProcessor->getErrorMessages();
     if (count($errors)) {
         $ajaxObj->setError(implode(',', $errors));
     } else {
         $ajaxObj->addContent('result', $this->fileData);
         if ($this->redirect) {
             $ajaxObj->addContent('redirect', $this->redirect);
         }
         $ajaxObj->setContentFormat('json');
     }
 }
 /**
  * The main dispatcher function. Collect data and prepare HTML output.
  *
  * @param array $params array of parameters from the AJAX interface, currently unused
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj object of type AjaxRequestHandler
  * @return void
  */
 public function dispatch($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj = NULL)
 {
     $content = '';
     // Basic test for required value
     if ($this->conf['page'] > 0) {
         // Init TCE for execution of update
         /** @var $tce \TYPO3\CMS\Core\DataHandling\DataHandler */
         $tce = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
         $tce->stripslashes_values = 1;
         // Determine the scripts to execute
         switch ($this->conf['action']) {
             case 'show_change_owner_selector':
                 $content = $this->renderUserSelector($this->conf['page'], $this->conf['ownerUid'], $this->conf['username']);
                 break;
             case 'change_owner':
                 if (is_int($this->conf['new_owner_uid'])) {
                     // Prepare data to change
                     $data = array();
                     $data['pages'][$this->conf['page']]['perms_userid'] = $this->conf['new_owner_uid'];
                     // Execute TCE Update
                     $tce->start($data, array());
                     $tce->process_datamap();
                     $content = self::renderOwnername($this->conf['page'], $this->conf['new_owner_uid'], $this->conf['new_owner_username']);
                 } else {
                     $ajaxObj->setError('An error occurred: No page owner uid specified.');
                 }
                 break;
             case 'show_change_group_selector':
                 $content = $this->renderGroupSelector($this->conf['page'], $this->conf['groupUid'], $this->conf['groupname']);
                 break;
             case 'change_group':
                 if (is_int($this->conf['new_group_uid'])) {
                     // Prepare data to change
                     $data = array();
                     $data['pages'][$this->conf['page']]['perms_groupid'] = $this->conf['new_group_uid'];
                     // Execute TCE Update
                     $tce->start($data, array());
                     $tce->process_datamap();
                     $content = self::renderGroupname($this->conf['page'], $this->conf['new_group_uid'], $this->conf['new_group_username']);
                 } else {
                     $ajaxObj->setError('An error occurred: No page group uid specified.');
                 }
                 break;
             case 'toggle_edit_lock':
                 // Prepare data to change
                 $data = array();
                 $data['pages'][$this->conf['page']]['editlock'] = $this->conf['editLockState'] === 1 ? 0 : 1;
                 // Execute TCE Update
                 $tce->start($data, array());
                 $tce->process_datamap();
                 $content = $this->renderToggleEditLock($this->conf['page'], $data['pages'][$this->conf['page']]['editlock']);
                 break;
             default:
                 if ($this->conf['mode'] == 'delete') {
                     $this->conf['permissions'] = (int) ($this->conf['permissions'] - $this->conf['bits']);
                 } else {
                     $this->conf['permissions'] = (int) ($this->conf['permissions'] + $this->conf['bits']);
                 }
                 // Prepare data to change
                 $data = array();
                 $data['pages'][$this->conf['page']]['perms_' . $this->conf['who']] = $this->conf['permissions'];
                 // Execute TCE Update
                 $tce->start($data, array());
                 $tce->process_datamap();
                 $content = self::renderPermissions($this->conf['permissions'], $this->conf['page'], $this->conf['who']);
         }
     } else {
         $ajaxObj->setError('This script cannot be called directly.');
     }
     $ajaxObj->addContent($this->conf['page'] . '_' . $this->conf['who'], $content);
 }
Esempio n. 25
0
 /**
  * Renders the menu so that it can be returned as response to an AJAX call
  *
  * @param array $params Array of parameters from the AJAX interface, currently unused
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj Object of type AjaxRequestHandler
  * @return void
  */
 public function update($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj = NULL)
 {
     // get parameter
     $postdata = file_get_contents("php://input");
     $attr = json_decode($postdata);
     // prepare data array
     $tableName = 'pages';
     $uid = $attr->entry->uid;
     $field = $attr->field;
     // check for language overlay
     if ($attr->entry->_PAGES_OVERLAY && isset($GLOBALS['TCA']['pages_language_overlay']['columns'][$field])) {
         $tableName = 'pages_language_overlay';
         $uid = $attr->entry->_PAGES_OVERLAY_UID;
     }
     // update map
     $data[$tableName][$uid][$field] = $attr->value;
     // update data
     $dataHandler = $this->getDataHandler();
     $dataHandler->datamap = $data;
     $dataHandler->process_datamap();
     if (!empty($dataHandler->errorLog)) {
         $ajaxObj->addContent('Error', implode(',', $dataHandler->errorLog));
     }
 }
Esempio n. 26
0
 /**
  * Checks if the user session is expired yet
  *
  * @param array $parameters Parameters (not used)
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj The calling parent AJAX object
  * @return void
  */
 public function isTimedOut(array $parameters, \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj)
 {
     $ajaxObj->setContentFormat('json');
     if (@is_file(PATH_typo3conf . 'LOCK_BACKEND')) {
         $ajaxObj->addContent('login', array('will_time_out' => FALSE, 'locked' => TRUE));
     } elseif (!isset($GLOBALS['BE_USER']->user['uid'])) {
         $ajaxObj->addContent('login', array('timed_out' => TRUE));
     } else {
         $GLOBALS['BE_USER']->fetchUserSession(TRUE);
         $ses_tstamp = $GLOBALS['BE_USER']->user['ses_tstamp'];
         $timeout = $GLOBALS['BE_USER']->auth_timeout_field;
         // If 120 seconds from now is later than the session timeout, we need to show the refresh dialog.
         // 120 is somewhat arbitrary to allow for a little room during the countdown and load times, etc.
         if ($GLOBALS['EXEC_TIME'] >= $ses_tstamp + $timeout - 120) {
             $ajaxObj->addContent('login', array('will_time_out' => TRUE));
         } else {
             $ajaxObj->addContent('login', array('will_time_out' => FALSE));
         }
     }
 }
Esempio n. 27
0
 /**
  * Ajax handler for the "suggest" feature in TCEforms.
  *
  * @param array $params The parameters from the AJAX call
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj The AJAX object representing the AJAX call
  * @return void
  */
 public function processAjaxRequest($params, &$ajaxObj)
 {
     // Get parameters from $_GET/$_POST
     $search = GeneralUtility::_GP('value');
     $table = GeneralUtility::_GP('table');
     $field = GeneralUtility::_GP('field');
     $uid = GeneralUtility::_GP('uid');
     $pageId = GeneralUtility::_GP('pid');
     $newRecordRow = GeneralUtility::_GP('newRecordRow');
     // If the $uid is numeric, we have an already existing element, so get the
     // TSconfig of the page itself or the element container (for non-page elements)
     // otherwise it's a new element, so use given id of parent page (i.e., don't modify it here)
     $row = NULL;
     if (is_numeric($uid)) {
         $row = BackendUtility::getRecord($table, $uid);
         if ($table == 'pages') {
             $pageId = $uid;
         } else {
             $pageId = $row['pid'];
         }
     } else {
         $row = unserialize($newRecordRow);
     }
     $TSconfig = BackendUtility::getPagesTSconfig($pageId);
     $queryTables = array();
     $foreign_table_where = '';
     $fieldConfig = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
     $parts = explode('|', $field);
     if ($GLOBALS['TCA'][$table]['columns'][$parts[0]]['config']['type'] === 'flex') {
         $flexfieldTCAConfig = $GLOBALS['TCA'][$table]['columns'][$parts[0]]['config'];
         $flexformDSArray = BackendUtility::getFlexFormDS($flexfieldTCAConfig, $row, $table, $parts[0]);
         $flexformDSArray = GeneralUtility::resolveAllSheetsInDS($flexformDSArray);
         $flexformElement = $parts[count($parts) - 2];
         $continue = TRUE;
         foreach ($flexformDSArray as $sheet) {
             foreach ($sheet as $dataStructure) {
                 $fieldConfig = $this->getNestedDsFieldConfig($dataStructure, $flexformElement);
                 if (!empty($fieldConfig)) {
                     $continue = FALSE;
                     break;
                 }
             }
             if (!$continue) {
                 break;
             }
         }
         $field = str_replace('|', '][', $field);
     }
     $wizardConfig = $fieldConfig['wizards']['suggest'];
     if (isset($fieldConfig['allowed'])) {
         if ($fieldConfig['allowed'] === '*') {
             foreach ($GLOBALS['TCA'] as $tableName => $tableConfig) {
                 // @todo Refactor function to BackendUtility
                 if (empty($tableConfig['ctrl']['hideTable']) && ($GLOBALS['BE_USER']->isAdmin() || empty($tableConfig['ctrl']['adminOnly']) && (empty($tableConfig['ctrl']['rootLevel']) || !empty($tableConfig['ctrl']['security']['ignoreRootLevelRestriction'])))) {
                     $queryTables[] = $tableName;
                 }
             }
             unset($tableName, $tableConfig);
         } else {
             $queryTables = GeneralUtility::trimExplode(',', $fieldConfig['allowed']);
         }
     } elseif (isset($fieldConfig['foreign_table'])) {
         $queryTables = array($fieldConfig['foreign_table']);
         $foreign_table_where = $fieldConfig['foreign_table_where'];
         // strip ORDER BY clause
         $foreign_table_where = trim(preg_replace('/ORDER[[:space:]]+BY.*/i', '', $foreign_table_where));
     }
     $resultRows = array();
     // fetch the records for each query table. A query table is a table from which records are allowed to
     // be added to the TCEForm selector, originally fetched from the "allowed" config option in the TCA
     foreach ($queryTables as $queryTable) {
         // if the table does not exist, skip it
         if (!is_array($GLOBALS['TCA'][$queryTable]) || empty($GLOBALS['TCA'][$queryTable])) {
             continue;
         }
         $config = (array) $wizardConfig['default'];
         if (is_array($wizardConfig[$queryTable])) {
             \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($config, $wizardConfig[$queryTable]);
         }
         // merge the configurations of different "levels" to get the working configuration for this table and
         // field (i.e., go from the most general to the most special configuration)
         if (is_array($TSconfig['TCEFORM.']['suggest.']['default.'])) {
             \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($config, $TSconfig['TCEFORM.']['suggest.']['default.']);
         }
         if (is_array($TSconfig['TCEFORM.']['suggest.'][$queryTable . '.'])) {
             \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($config, $TSconfig['TCEFORM.']['suggest.'][$queryTable . '.']);
         }
         // use $table instead of $queryTable here because we overlay a config
         // for the input-field here, not for the queried table
         if (is_array($TSconfig['TCEFORM.'][$table . '.'][$field . '.']['suggest.']['default.'])) {
             \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($config, $TSconfig['TCEFORM.'][$table . '.'][$field . '.']['suggest.']['default.']);
         }
         if (is_array($TSconfig['TCEFORM.'][$table . '.'][$field . '.']['suggest.'][$queryTable . '.'])) {
             \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($config, $TSconfig['TCEFORM.'][$table . '.'][$field . '.']['suggest.'][$queryTable . '.']);
         }
         //process addWhere
         if (!isset($config['addWhere']) && $foreign_table_where) {
             $config['addWhere'] = $foreign_table_where;
         }
         if (isset($config['addWhere'])) {
             $replacement = array('###THIS_UID###' => (int) $uid, '###CURRENT_PID###' => (int) $pageId);
             if (isset($TSconfig['TCEFORM.'][$table . '.'][$field . '.'])) {
                 $fieldTSconfig = $TSconfig['TCEFORM.'][$table . '.'][$field . '.'];
                 if (isset($fieldTSconfig['PAGE_TSCONFIG_ID'])) {
                     $replacement['###PAGE_TSCONFIG_ID###'] = (int) $fieldTSconfig['PAGE_TSCONFIG_ID'];
                 }
                 if (isset($fieldTSconfig['PAGE_TSCONFIG_IDLIST'])) {
                     $replacement['###PAGE_TSCONFIG_IDLIST###'] = $GLOBALS['TYPO3_DB']->cleanIntList($fieldTSconfig['PAGE_TSCONFIG_IDLIST']);
                 }
                 if (isset($fieldTSconfig['PAGE_TSCONFIG_STR'])) {
                     $replacement['###PAGE_TSCONFIG_STR###'] = $GLOBALS['TYPO3_DB']->quoteStr($fieldTSconfig['PAGE_TSCONFIG_STR'], $fieldConfig['foreign_table']);
                 }
             }
             $config['addWhere'] = strtr(' ' . $config['addWhere'], $replacement);
         }
         // instantiate the class that should fetch the records for this $queryTable
         $receiverClassName = $config['receiverClass'];
         if (!class_exists($receiverClassName)) {
             $receiverClassName = SuggestWizardDefaultReceiver::class;
         }
         $receiverObj = GeneralUtility::makeInstance($receiverClassName, $queryTable, $config);
         $params = array('value' => $search);
         $rows = $receiverObj->queryTable($params);
         if (empty($rows)) {
             continue;
         }
         $resultRows = $rows + $resultRows;
         unset($rows);
     }
     $listItems = array();
     if (!empty($resultRows)) {
         // traverse all found records and sort them
         $rowsSort = array();
         foreach ($resultRows as $key => $row) {
             $rowsSort[$key] = $row['text'];
         }
         asort($rowsSort);
         $rowsSort = array_keys($rowsSort);
         // Limit the number of items in the result list
         $maxItems = $config['maxItemsInResultList'] ?: 10;
         $maxItems = min(count($resultRows), $maxItems);
         // put together the selector entry
         for ($i = 0; $i < $maxItems; $i++) {
             $row = $resultRows[$rowsSort[$i]];
             $rowId = $row['table'] . '-' . $row['uid'] . '-' . $table . '-' . $uid . '-' . $field;
             $listItems[] = '<li' . ($row['class'] != '' ? ' class="' . $row['class'] . '"' : '') . ' id="' . $rowId . '"' . ($row['style'] != '' ? ' style="' . $row['style'] . '"' : '') . '>' . $row['sprite'] . $row['text'] . '</li>';
         }
     }
     if (!empty($listItems)) {
         $list = implode('', $listItems);
     } else {
         $list = '<li class="suggest-noresults"><i>' . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.noRecordFound') . '</i></li>';
     }
     $list = '<ul class="' . $this->cssClass . '-resultlist">' . $list . '</ul>';
     $ajaxObj->addContent(0, $list);
 }
Esempio n. 28
0
 /**
  * Makes the AJAX call to expand or collapse the categorytree.
  * Called by typo3/ajax.php
  *
  * @param array $params Additional parameters (not used here)
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj Ajax object
  *
  * @return void
  */
 public function ajaxExpandCollapse(array $params, \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj)
 {
     $parameter = GeneralUtility::_GP('PM');
     // IE takes anchor as parameter
     if (($parameterPosition = strpos($parameter, '#')) !== FALSE) {
         $parameter = substr($parameter, 0, $parameterPosition);
     }
     $parameter = GeneralUtility::trimExplode('_', $parameter);
     // Load the tree
     $this->initTree();
     $tree = $this->treeObj->getBrowseableAjaxTree($parameter);
     $ajaxObj->addContent('tree', $tree);
 }
Esempio n. 29
0
 /**
  * Gets a MD5 challenge.
  *
  * @param array $parameters Parameters (not used)
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $parent The calling parent AJAX object
  * @return void
  */
 public function getChallenge(array $parameters, \TYPO3\CMS\Core\Http\AjaxRequestHandler $parent)
 {
     session_start();
     $_SESSION['login_challenge'] = md5(uniqid('', TRUE) . getmypid());
     session_commit();
     $parent->addContent('challenge', $_SESSION['login_challenge']);
     $parent->setContentFormat('json');
 }
Esempio n. 30
0
 /**
  * Ajax handler for the "suggest" feature in TCEforms.
  *
  * @param array $params The parameters from the AJAX call
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj The AJAX object representing the AJAX call
  * @return void
  */
 public function processAjaxRequest($params, &$ajaxObj)
 {
     // Get parameters from $_GET/$_POST
     $search = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('value');
     $table = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('table');
     $field = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('field');
     $uid = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('uid');
     $pageId = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('pid');
     \TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($table);
     // If the $uid is numeric, we have an already existing element, so get the
     // TSconfig of the page itself or the element container (for non-page elements)
     // otherwise it's a new element, so use given id of parent page (i.e., don't modify it here)
     if (is_numeric($uid)) {
         if ($table == 'pages') {
             $pageId = $uid;
         } else {
             $row = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($table, $uid);
             $pageId = $row['pid'];
         }
     }
     $TSconfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($pageId);
     $queryTables = array();
     $foreign_table_where = '';
     $fieldConfig = $GLOBALS['TCA'][$table]['columns'][$field]['config'];
     $parts = explode('|', $field);
     if ($GLOBALS['TCA'][$table]['columns'][$parts[0]]['config']['type'] === 'flex') {
         if (is_array($row) && count($row) > 0) {
             $flexfieldTCAConfig = $GLOBALS['TCA'][$table]['columns'][$parts[0]]['config'];
             $flexformDSArray = \TYPO3\CMS\Backend\Utility\BackendUtility::getFlexFormDS($flexfieldTCAConfig, $row, $table);
             $flexformDSArray = \TYPO3\CMS\Core\Utility\GeneralUtility::resolveAllSheetsInDS($flexformDSArray);
             $flexformElement = $parts[count($parts) - 2];
             $continue = TRUE;
             foreach ($flexformDSArray as $sheet) {
                 foreach ($sheet as $_ => $dataStructure) {
                     if (isset($dataStructure['ROOT']['el'][$flexformElement]['TCEforms']['config'])) {
                         $fieldConfig = $dataStructure['ROOT']['el'][$flexformElement]['TCEforms']['config'];
                         $continue = FALSE;
                         break;
                     }
                 }
                 if (!$continue) {
                     break;
                 }
             }
             $field = str_replace('|', '][', $field);
         }
     }
     $wizardConfig = $fieldConfig['wizards']['suggest'];
     if (isset($fieldConfig['allowed'])) {
         $queryTables = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $fieldConfig['allowed']);
     } elseif (isset($fieldConfig['foreign_table'])) {
         $queryTables = array($fieldConfig['foreign_table']);
         $foreign_table_where = $fieldConfig['foreign_table_where'];
         // strip ORDER BY clause
         $foreign_table_where = trim(preg_replace('/ORDER[[:space:]]+BY.*/i', '', $foreign_table_where));
     }
     $resultRows = array();
     // fetch the records for each query table. A query table is a table from which records are allowed to
     // be added to the TCEForm selector, originally fetched from the "allowed" config option in the TCA
     foreach ($queryTables as $queryTable) {
         \TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($queryTable);
         // if the table does not exist, skip it
         if (!is_array($GLOBALS['TCA'][$queryTable]) || !count($GLOBALS['TCA'][$queryTable])) {
             continue;
         }
         $config = (array) $wizardConfig['default'];
         if (is_array($wizardConfig[$queryTable])) {
             $config = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($config, $wizardConfig[$queryTable]);
         }
         // merge the configurations of different "levels" to get the working configuration for this table and
         // field (i.e., go from the most general to the most special configuration)
         if (is_array($TSconfig['TCEFORM.']['suggest.']['default.'])) {
             $config = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($config, $TSconfig['TCEFORM.']['suggest.']['default.']);
         }
         if (is_array($TSconfig['TCEFORM.']['suggest.'][$queryTable . '.'])) {
             $config = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($config, $TSconfig['TCEFORM.']['suggest.'][$queryTable . '.']);
         }
         // use $table instead of $queryTable here because we overlay a config
         // for the input-field here, not for the queried table
         if (is_array($TSconfig['TCEFORM.'][$table . '.'][$field . '.']['suggest.']['default.'])) {
             $config = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($config, $TSconfig['TCEFORM.'][$table . '.'][$field . '.']['suggest.']['default.']);
         }
         if (is_array($TSconfig['TCEFORM.'][$table . '.'][$field . '.']['suggest.'][$queryTable . '.'])) {
             $config = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($config, $TSconfig['TCEFORM.'][$table . '.'][$field . '.']['suggest.'][$queryTable . '.']);
         }
         //process addWhere
         if (!isset($config['addWhere']) && $foreign_table_where) {
             $config['addWhere'] = $foreign_table_where;
         }
         if (isset($config['addWhere'])) {
             $config['addWhere'] = strtr(' ' . $config['addWhere'], array('###THIS_UID###' => intval($uid), '###CURRENT_PID###' => intval($pageId)));
         }
         // instantiate the class that should fetch the records for this $queryTable
         $receiverClassName = $config['receiverClass'];
         if (!class_exists($receiverClassName)) {
             $receiverClassName = 'TYPO3\\CMS\\Backend\\Form\\Element\\SuggestDefaultReceiver';
         }
         $receiverObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance($receiverClassName, $queryTable, $config);
         $params = array('value' => $search);
         $rows = $receiverObj->queryTable($params);
         if (empty($rows)) {
             continue;
         }
         $resultRows = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge($resultRows, $rows);
         unset($rows);
     }
     $listItems = array();
     if (count($resultRows) > 0) {
         // traverse all found records and sort them
         $rowsSort = array();
         foreach ($resultRows as $key => $row) {
             $rowsSort[$key] = $row['text'];
         }
         asort($rowsSort);
         $rowsSort = array_keys($rowsSort);
         // Limit the number of items in the result list
         $maxItems = $config['maxItemsInResultList'] ? $config['maxItemsInResultList'] : 10;
         $maxItems = min(count($resultRows), $maxItems);
         // put together the selector entry
         for ($i = 0; $i < $maxItems; $i++) {
             $row = $resultRows[$rowsSort[$i]];
             $rowId = $row['table'] . '-' . $row['uid'] . '-' . $table . '-' . $uid . '-' . $field;
             $listItems[] = '<li' . ($row['class'] != '' ? ' class="' . $row['class'] . '"' : '') . ' id="' . $rowId . '" style="' . $row['style'] . '">' . $row['text'] . '</li>';
         }
     }
     if (count($listItems) > 0) {
         $list = implode('', $listItems);
     } else {
         $list = '<li class="suggest-noresults"><i>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:labels.noRecordFound') . '</i></li>';
     }
     $list = '<ul class="' . $this->cssClass . '-resultlist">' . $list . '</ul>';
     $ajaxObj->addContent(0, $list);
 }