Ejemplo n.º 1
1
 /**
  * Render the captcha image html
  *
  * @param string suffix to be appended to the extenstion key when forming css class names
  * @return string The html used to render the captcha image
  */
 public function render($suffix = '')
 {
     $value = '';
     // Include the required JavaScript
     $GLOBALS['TSFE']->additionalHeaderData[$this->extensionKey . '_freeCap'] = '<script type="text/javascript" src="' . GeneralUtility::createVersionNumberedFilename(ExtensionManagementUtility::siteRelPath($this->extensionKey) . 'Resources/Public/JavaScript/freeCap.js') . '"></script>';
     // Disable caching
     $GLOBALS['TSFE']->no_cache = 1;
     // Get the plugin configuration
     $settings = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS, $this->extensionName);
     // Get the translation view helper
     $objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $translator = $objectManager->get('SJBR\\SrFreecap\\ViewHelpers\\TranslateViewHelper');
     $translator->injectConfigurationManager($this->configurationManager);
     // Generate the image url
     $fakeId = GeneralUtility::shortMD5(uniqid(rand()), 5);
     $siteURL = GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
     $L = GeneralUtility::_GP('L');
     $urlParams = array('eID' => 'sr_freecap_EidDispatcher', 'id' => $GLOBALS['TSFE']->id, 'vendorName' => 'SJBR', 'extensionName' => 'SrFreecap', 'pluginName' => 'ImageGenerator', 'controllerName' => 'ImageGenerator', 'actionName' => 'show', 'formatName' => 'png', 'L' => $GLOBALS['TSFE']->sys_language_uid);
     if ($GLOBALS['TSFE']->MP) {
         $urlParams['MP'] = $GLOBALS['TSFE']->MP;
     }
     $urlParams['set'] = $fakeId;
     $imageUrl = $siteURL . 'index.php?' . ltrim(GeneralUtility::implodeArrayForUrl('', $urlParams), '&');
     // Generate the html text
     $value = '<img' . $this->getClassAttribute('image', $suffix) . ' id="tx_srfreecap_captcha_image_' . $fakeId . '"' . ' src="' . htmlspecialchars($imageUrl) . '"' . ' alt="' . $translator->render('altText') . ' "/>' . '<span' . $this->getClassAttribute('cant-read', $suffix) . '>' . $translator->render('cant_read1') . ' <a href="#" onclick="this.blur();' . $this->extensionName . '.newImage(\'' . $fakeId . '\', \'' . $translator->render('noImageMessage') . '\');return false;">' . $translator->render('click_here') . '</a>' . $translator->render('cant_read2') . '</span>';
     return $value;
 }
Ejemplo n.º 2
0
 /**
  * @param string $parameter
  * @param string $target
  * @param int $noCache
  * @param int $useCacheHash
  * @param array $additionalParams
  * @param string $ATagParams
  * @param string $extTarget
  * @return mixed
  */
 public function render($parameter, $target = '', $noCache = 0, $useCacheHash = 1, $additionalParams = array(), $ATagParams = '', $extTarget = '')
 {
     $typoLinkConf = array('parameter' => $parameter);
     if ($target) {
         $typoLinkConf['target'] = $target;
     }
     if ($target) {
         $typoLinkConf['extTarget'] = $extTarget;
     }
     if ($noCache) {
         $typoLinkConf['no_cache'] = 1;
     }
     if ($useCacheHash) {
         $typoLinkConf['useCacheHash'] = 1;
     }
     if (count($additionalParams)) {
         $typoLinkConf['additionalParams'] = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $additionalParams);
     }
     if (strlen($ATagParams)) {
         $typoLinkConf['ATagParams'] = $ATagParams;
     }
     $linkText = $this->renderChildren();
     $textContentConf = array('typolink.' => $typoLinkConf, 'value' => $linkText);
     return $GLOBALS['TSFE']->cObj->cObjGetSingle('TEXT', $textContentConf);
 }
 /**
  * Renders entry for one page of the current document.
  *
  * @access	protected
  *
  * @param	integer		$number: The page to render
  * @param	string		$template: Parsed template subpart
  *
  * @return	string		The rendered entry ready for output
  */
 protected function getEntry($number, $template)
 {
     // Set current page if applicable.
     if (!empty($this->piVars['page']) && $this->piVars['page'] == $number) {
         $markerArray['###STATE###'] = 'cur';
     } else {
         $markerArray['###STATE###'] = 'no';
     }
     // Set page number.
     $markerArray['###NUMBER###'] = $number;
     // Set pagination.
     $markerArray['###PAGINATION###'] = $this->doc->physicalPagesInfo[$this->doc->physicalPages[$number]]['label'];
     // Get thumbnail or placeholder.
     if (!empty($this->doc->physicalPagesInfo[$this->doc->physicalPages[$number]]['files'][$this->conf['fileGrpThumbs']])) {
         $thumbnailFile = $this->doc->getFileLocation($this->doc->physicalPagesInfo[$this->doc->physicalPages[$number]]['files'][$this->conf['fileGrpThumbs']]);
     } elseif (!empty($this->conf['placeholder'])) {
         $thumbnailFile = $GLOBALS['TSFE']->tmpl->getFileName($this->conf['placeholder']);
     } else {
         $thumbnailFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey) . 'plugins/pagegrid/placeholder.jpg';
     }
     $thumbnail = '<img alt="' . $markerArray['###PAGINATION###'] . '" src="' . $thumbnailFile . '" />';
     // Get new plugin variables for typolink.
     $piVars = $this->piVars;
     // Unset no longer needed plugin variables.
     // unset($piVars['pagegrid']) is for DFG Viewer compatibility!
     unset($piVars['pointer'], $piVars['DATA'], $piVars['pagegrid']);
     $piVars['page'] = $number;
     $linkConf = array('useCacheHash' => 1, 'parameter' => $this->conf['targetPid'], 'additionalParams' => \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($this->prefixId, $piVars, '', TRUE, FALSE), 'title' => $markerArray['###PAGINATION###']);
     $markerArray['###THUMBNAIL###'] = $this->cObj->typoLink($thumbnail, $linkConf);
     return $this->cObj->substituteMarkerArray($template, $markerArray);
 }
Ejemplo n.º 4
0
 /**
  * Post-processing to define which control items to show. Possibly own icons can be added here.
  *
  * @param string $parentUid The uid of the parent (embedding) record (uid or NEW...)
  * @param string $foreignTable The table (foreign_table) we create control-icons for
  * @param array $childRecord The current record of that foreign_table
  * @param array $childConfig TCA configuration of the current field of the child record
  * @param boolean $isVirtual Defines whether the current records is only virtually shown and not physically part of the parent record
  * @param array $controlItems (reference) Associative array with the currently available control items
  *
  * @return void
  */
 public function renderForeignRecordHeaderControl_postProcess($parentUid, $foreignTable, array $childRecord, array $childConfig, $isVirtual, array &$controlItems)
 {
     if ($foreignTable != 'sys_file_reference') {
         return;
     }
     if (!GeneralUtility::isFirstPartOfStr($childRecord['uid_local'], 'sys_file_')) {
         return;
     }
     $parts = BackendUtility::splitTable_Uid($childRecord['uid_local']);
     if (!isset($parts[1])) {
         return;
     }
     $table = $childRecord['tablenames'];
     $uid = $parentUid;
     $arguments = GeneralUtility::_GET();
     if ($this->isValidRecord($table, $uid) && isset($arguments['edit'])) {
         $returnUrl = ['edit' => $arguments['edit'], 'returnUrl' => $arguments['returnUrl']];
         if (GeneralUtility::compat_version('7.0')) {
             $returnUrlGenerated = BackendUtility::getModuleUrl('record_edit', $returnUrl);
         } else {
             $returnUrlGenerated = 'alt_doc.php?' . ltrim(GeneralUtility::implodeArrayForUrl('', $returnUrl, '', true, true), '&') . BackendUtility::getUrlToken('editRecord');
         }
         $wizardArguments = ['P' => ['referenceUid' => $childRecord['uid'], 'returnUrl' => $returnUrlGenerated]];
         $wizardUri = BackendUtility::getModuleUrl('focuspoint', $wizardArguments);
     } else {
         $wizardUri = 'javascript:alert(\'Please save the base record first, because open this wizard will not save the changes in the current form!\');';
     }
     /** @var WizardService $wizardService */
     $wizardService = GeneralUtility::makeInstance('HDNET\\Focuspoint\\Service\\WizardService');
     $this->arrayUnshiftAssoc($controlItems, 'focuspoint', $wizardService->getWizardButton($wizardUri));
 }
Ejemplo n.º 5
0
 /**
  * @param array $requestArguments
  * @param bool $failOnFailure
  * @return Response
  */
 protected function fetchFrontendResponse(array $requestArguments, $failOnFailure = true)
 {
     if (!empty($requestArguments['url'])) {
         $requestUrl = '/' . ltrim($requestArguments['url'], '/');
     } else {
         $requestUrl = '/?' . GeneralUtility::implodeArrayForUrl('', $requestArguments);
     }
     if (property_exists($this, 'instancePath')) {
         $instancePath = $this->instancePath;
     } else {
         $instancePath = ORIGINAL_ROOT . 'typo3temp/functional-' . substr(sha1(get_class($this)), 0, 7);
     }
     $arguments = array('documentRoot' => $instancePath, 'requestUrl' => 'http://localhost' . $requestUrl);
     $template = new \Text_Template(ORIGINAL_ROOT . 'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/request.tpl');
     $template->setVar(array('arguments' => var_export($arguments, true), 'originalRoot' => ORIGINAL_ROOT));
     $php = \PHPUnit_Util_PHP::factory();
     $response = $php->runJob($template->render());
     $result = json_decode($response['stdout'], true);
     if ($result === null) {
         $this->fail('Frontend Response is empty');
     }
     if ($failOnFailure && $result['status'] === Response::STATUS_Failure) {
         $this->fail('Frontend Response has failure:' . LF . $result['error']);
     }
     $response = new Response($result['status'], $result['content'], $result['error']);
     return $response;
 }
 /**
  * renders the templavoila preview
  *
  * @param	pointer		$row: affected record
  * @param	pointer		$table: affected table
  * @param	pointer		$alreadyRendered: is the preview already rendered by another extension?
  * @param	pointer		$reference: pointer to the parent class
  * @return	string		preview content
  */
 function renderPreviewContent_preProcess($row, $table, &$alreadyRendered, &$reference)
 {
     if ($row['CType'] == 'list' && $row['list_type'] == 'piwikintegration_pi1') {
         $content = '<strong>Piwik in FE</strong>';
         $content = $reference->link_edit($content, $table, $row['uid']);
         $piFlexForm = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($row['pi_flexform']);
         foreach ($piFlexForm['data'] as $sheet => $data) {
             foreach ($data as $lang => $value) {
                 foreach ($value as $key => $val) {
                     $conf[$key] = $piFlexForm['data'][$sheet]['lDEF'][$key]['vDEF'];
                 }
             }
         }
         $this->extConf = array('widget' => json_decode(base64_decode($conf['widget']), true), 'height' => $conf['div_height']);
         $this->extConf['widget']['idSite'] = $conf['idsite'];
         $this->extConf['widget']['period'] = $conf['period'];
         $this->extConf['widget']['date'] = 'yesterday';
         $this->extConf['widget']['viewDataTable'] = $conf['viewDataTable'];
         $this->extConf['widget']['moduleToWidgetize'] = $this->extConf['widget']['module'];
         $this->extConf['widget']['actionToWidgetize'] = $this->extConf['widget']['action'];
         unset($this->extConf['widget']['module']);
         unset($this->extConf['widget']['action']);
         #$helper = new tx_piwikintegration_helper();
         $obj .= '<div style="width:' . $this->extConf['height'] . 'px;"><object width="100%" type="text/html" height="' . intval($this->extConf['height']) . '" data="';
         $obj .= '../../../../typo3conf/piwik/piwik/index.php?module=Widgetize&action=iframe' . \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $this->extConf['widget']);
         $obj .= '&disableLink=1"></object></div>';
         $content .= $obj;
         $alreadyRendered = true;
         return $content;
     }
 }
Ejemplo n.º 7
0
 /**
  * Generate a different preview link     *
  * @param string $status status
  * @param string $table table name
  * @param integer $recordUid id of the record
  * @param array $fields fieldArray
  * @param \TYPO3\CMS\Core\DataHandling\DataHandler $parentObject parent Object
  * @return void
  */
 public function processDatamap_afterDatabaseOperations($status, $table, $recordUid, array $fields, \TYPO3\CMS\Core\DataHandling\DataHandler $parentObject)
 {
     // Clear category cache
     if ($table === 'sys_category') {
         /** @var \TYPO3\CMS\Core\Cache\Frontend\FrontendInterface $cache */
         $cache = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Cache\\CacheManager')->getCache('cache_news_category');
         $cache->flush();
     }
     // Preview link
     if ($table === 'tx_news_domain_model_news') {
         // direct preview
         if (!is_numeric($recordUid)) {
             $recordUid = $parentObject->substNEWwithIDs[$recordUid];
         }
         if (isset($GLOBALS['_POST']['_savedokview_x']) && !$fields['type']) {
             // If "savedokview" has been pressed and current article has "type" 0 (= normal news article)
             $pagesTsConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($GLOBALS['_POST']['popViewId']);
             if ($pagesTsConfig['tx_news.']['singlePid']) {
                 $record = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord('tx_news_domain_model_news', $recordUid);
                 $parameters = array('no_cache' => 1, 'tx_news_pi1[controller]' => 'News', 'tx_news_pi1[action]' => 'detail', 'tx_news_pi1[news_preview]' => $record['uid']);
                 if ($record['sys_language_uid'] > 0) {
                     if ($record['l10n_parent'] > 0) {
                         $parameters['tx_news_pi1[news_preview]'] = $record['l10n_parent'];
                     }
                     $parameters['L'] = $record['sys_language_uid'];
                 }
                 $GLOBALS['_POST']['popViewId_addParams'] = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $parameters, '', FALSE, TRUE);
                 $GLOBALS['_POST']['popViewId'] = $pagesTsConfig['tx_news.']['singlePid'];
             }
         }
     }
 }
Ejemplo n.º 8
0
 /**
  * Constructor
  */
 public function __construct()
 {
     $urlParameters = $_GET;
     \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($urlParameters, $_POST);
     $this->currentPage = max(1, intval($urlParameters['page']));
     unset($urlParameters['page']);
     unset($urlParameters['cmd']);
     $this->baseURL = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_SCRIPT') . '?' . \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $urlParameters);
     $this->resultsPerPage = self::RESULTS_PER_PAGE_DEFAULT;
 }
 /**
  * Wrapping the title in a link, if applicable.
  *
  * @param string $title Title, ready for output.
  * @param array $v The record
  * @param bool $ext_pArrPages If set, pages clicked will return immediately, otherwise reload page.
  * @return string Wrapping title string.
  */
 public function wrapTitle($title, $v, $ext_pArrPages = false)
 {
     if ($ext_pArrPages && $v['uid']) {
         $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
         $ficon = $iconFactory->getIconForRecord('pages', $v, Icon::SIZE_SMALL)->render();
         $out = '<span data-uid="' . htmlspecialchars($v['uid']) . '" data-table="pages" data-title="' . htmlspecialchars($v['title']) . '" data-icon="' . htmlspecialchars($ficon) . '">';
         $out .= '<a href="#" data-close="1">' . $title . '</a>';
         $out .= '</span>';
         return $out;
     }
     $parameters = GeneralUtility::implodeArrayForUrl('', $this->linkParameterProvider->getUrlParameters(['pid' => $v['uid']]));
     return '<a href="#" onclick="return jumpToUrl(' . htmlspecialchars(GeneralUtility::quoteJSvalue($this->getThisScript() . ltrim($parameters, '&'))) . ');">' . $title . '</a>';
 }
Ejemplo n.º 10
0
 /**
  * Initialize the class
  *
  * @param \TYPO3\CMS\Recordlist\Browser\ElementBrowser $browseLinksObj
  * @param string $addPassOnParams
  * @param array $configuration
  * @param string $currentLinkValue
  * @param bool $isRte
  * @param int $currentPid
  */
 public function __construct(\TYPO3\CMS\Recordlist\Browser\ElementBrowser $browseLinksObj, $addPassOnParams, $configuration, $currentLinkValue, $isRte, $currentPid)
 {
     $environment = '';
     $this->browseLinksObj = $browseLinksObj;
     // first step to refactoring (no dependenciy to $browseLinksObj), make the required methodcalls known in membervariables
     $this->isRte = $isRte;
     $this->expandPage = $browseLinksObj->expandPage;
     $this->configuration = $configuration;
     $this->pointer = $browseLinksObj->pointer;
     if (is_array(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('P'))) {
         $environment = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('P', \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('P'));
     }
     $this->addPassOnParams = $addPassOnParams . $environment;
 }
 /**
  * Returns a URL to link to quick command
  *
  * @param string $parameters Is a set of GET params to send to FormEngine
  * @return string URL to FormEngine module + parameters
  */
 public function render($parameters)
 {
     $parameters = GeneralUtility::explodeUrl2Array($parameters);
     $parameters['vC'] = $this->getBackendUserAuthentication()->veriCode();
     $parameters['prErr'] = 1;
     $parameters['uPT'] = 1;
     // Make sure record_edit module is available
     if (GeneralUtility::compat_version('7.0')) {
         $url = BackendUtility::getModuleUrl('tce_db', $parameters);
     } else {
         $url = 'tce_db.php?' . GeneralUtility::implodeArrayForUrl('', $parameters);
     }
     return $url . BackendUtility::getUrlToken('tceAction');
 }
Ejemplo n.º 12
0
 /**
  * Renders the view
  *
  * @return string
  */
 public function render()
 {
     $args = array();
     if ((int) $this->arguments['size'] > 0) {
         $args['s'] = (int) $this->arguments['size'];
     }
     if ($this->arguments['default']) {
         $args['d'] = $this->arguments['default'];
     }
     if (count($args) > 0) {
         $urlArgs = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $args);
         $urlArgs = '?' . ltrim($urlArgs, '&');
     }
     $this->tag->addAttribute('src', self::GRAVATAR_IMAGE_REQUEST_URL . md5($this->arguments['email']) . $urlArgs);
     $this->tag->addAttribute('alt', $this->arguments['alt']);
     return $this->tag->render();
 }
Ejemplo n.º 13
0
 /**
  * Render the captcha audio rendering request icon
  *
  * @param string suffix to be appended to the extenstion key when forming css class names
  * @return string The html used to render the captcha audio rendering request icon
  */
 public function render($suffix = '')
 {
     $value = '';
     // Get the plugin configuration
     $settings = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, $this->extensionName, $this->pluginName);
     // Get the translation view helper
     $objectManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     $translator = $objectManager->get('SJBR\\SrFreecap\\ViewHelpers\\TranslateViewHelper');
     $translator->injectConfigurationManager($this->configurationManager);
     // Get browser info: in IE 8, we will use a simple link, as dynamic insertion of object element gives unpredictable results
     $browserInfo = \TYPO3\CMS\Core\Utility\ClientUtility::getBrowserInfo(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_USER_AGENT'));
     $browerIsIE8 = $browserInfo['browser'] == 'msie' && $browserInfo['version'] == '8';
     // Generate the icon
     if ($settings['accessibleOutput'] && in_array('mcrypt', get_loaded_extensions()) && intval($GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem'])) {
         $fakeId = \TYPO3\CMS\Core\Utility\GeneralUtility::shortMD5(uniqid(rand()), 5);
         $siteURL = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
         $urlParams = array('eID' => 'sr_freecap_EidDispatcher', 'id' => $GLOBALS['TSFE']->id, 'vendorName' => 'SJBR', 'extensionName' => $this->extensionName, 'pluginName' => 'AudioPlayer', 'controllerName' => 'AudioPlayer', 'actionName' => 'play', 'formatName' => $browerIsIE8 ? 'mp3' : 'wav');
         $L = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('L');
         if (isset($L)) {
             $urlParams['L'] = htmlspecialchars($L);
         }
         if ($GLOBALS['TSFE']->MP) {
             $urlParams['MP'] = $GLOBALS['TSFE']->MP;
         }
         $audioURL = $siteURL . 'index.php?' . ltrim(\TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $urlParams), '&');
         if ($settings['accessibleOutputImage']) {
             if ($browerIsIE8) {
                 $value = '<a href="' . $audioURL . '&set=' . rand() . '" title="' . $translator->render('click_here_accessible') . '">' . '<img alt="' . $translator->render('click_here_accessible') . '"' . ' src="' . $siteURL . str_replace(PATH_site, '', \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($settings['accessibleOutputImage'])) . '"' . $this->getClassAttribute('image-accessible', $suffix) . ' />' . '</a>';
             } else {
                 $value = '<input type="image" alt="' . $translator->render('click_here_accessible') . '"' . ' title="' . $translator->render('click_here_accessible') . '"' . ' src="' . $siteURL . str_replace(PATH_site, '', \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($settings['accessibleOutputImage'])) . '"' . ' onclick="' . $this->extensionName . '.playCaptcha(\'' . $fakeId . '\', \'' . $audioURL . '\', \'' . $translator->render('noPlayMessage') . '\');return false;" style="cursor: pointer;"' . $this->getClassAttribute('image-accessible', $suffix) . ' />';
             }
         } else {
             if ($browerIsIE8) {
                 $value = '<span id="tx_srfreecap_captcha_playLink_' . $fakeId . '"' . $this->getClassAttribute('accessible-link', $suffix) . '>' . $translator->render('click_here_accessible_before_link') . '<a href="' . $audioURL . '&set=' . rand() . '"' . ' title="' . $translator->render('click_here_accessible') . '">' . $translator->render('click_here_accessible_link') . '</a>' . $translator->render('click_here_accessible_after_link') . '</span>';
             } else {
                 $value = '<span id="tx_srfreecap_captcha_playLink_' . $fakeId . '"' . $this->getClassAttribute('accessible-link', $suffix) . '>' . $translator->render('click_here_accessible_before_link') . '<a onClick="' . $this->extensionName . '.playCaptcha(\'' . $fakeId . '\', \'' . $audioURL . '\', \'' . $translator->render('noPlayMessage') . '\');" style="cursor: pointer;" title="' . $translator->render('click_here_accessible') . '">' . $translator->render('click_here_accessible_link') . '</a>' . $translator->render('click_here_accessible_after_link') . '</span>';
             }
         }
         $value .= '<span' . $this->getClassAttribute('accessible', $suffix) . ' id="tx_srfreecap_captcha_playAudio_' . $fakeId . '"></span>';
     }
     return $value;
 }
Ejemplo n.º 14
0
 public function processDatamap_afterDatabaseOperations($status, $table, $recordUid, array $fields, \TYPO3\CMS\Core\DataHandling\DataHandler $parentObject)
 {
     // Preview link
     if ($table === 'tx_hwtaddress_domain_model_address') {
         // direct preview
         if (!is_numeric($recordUid)) {
             $recordUid = $parentObject->substNEWwithIDs[$recordUid];
         }
         if (isset($GLOBALS['_POST']['_savedokview_x'])) {
             // If "savedokview" has been pressed
             $pagesTsConfig = \TYPO3\CMS\Backend\Utility\BackendUtility::getPagesTSconfig($GLOBALS['_POST']['popViewId']);
             $pagesTsConfigSinglePid = $pagesTsConfig['tx_hwtaddress.']['singlePidAddress'];
             if ($pagesTsConfigSinglePid) {
                 $record = \TYPO3\CMS\Backend\Utility\BackendUtility::getRecord($table, $recordUid);
                 $parameters = array('no_cache' => 1, 'tx_hwtaddress_address[address]' => $recordUid);
                 $GLOBALS['_POST']['popViewId_addParams'] = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $parameters, '', FALSE, TRUE);
                 $GLOBALS['_POST']['popViewId'] = $pagesTsConfigSinglePid;
             }
         }
     }
 }
Ejemplo n.º 15
0
 public function render()
 {
     $content = $this->renderChildren();
     if (empty($this->arguments['parameter'])) {
         $this->arguments['parameter'] = $content;
         $content = '';
     }
     $config = array('parameter' => $this->arguments['parameter'], 'useCacheHash' => $this->arguments['useCacheHash'], 'no_cache' => !$this->arguments['useCacheHash']);
     unset($this->arguments['parameter'], $this->arguments['useCacheHash']);
     foreach ($this->arguments as $name => $value) {
         if (is_array($value)) {
             if (substr($name, -5) === 'Array') {
                 $name = substr($name, 0, -5) . '.';
             } elseif (strtolower(substr($name, -7)) === 'stdwrap') {
                 $name = substr($name, 0, -7) . '.';
             } elseif (!empty($value)) {
                 $value = '&' . GeneralUtility::implodeArrayForUrl('', $value);
             }
         }
         $config[$name] = $value;
     }
     return $this->configurationManager->getContentObject()->TEXT(array('value' => $content, 'typolink.' => $config));
 }
Ejemplo n.º 16
0
 /**
  * returns additional addonparamaters - required to keep several informations for the RTE linkwizard
  */
 protected function getaddPassOnParams()
 {
     $urlParams = '';
     if (!$this->isRTE()) {
         $P2 = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('P');
         if (is_array($P2) && !empty($P2)) {
             $urlParams = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('P', $P2);
         }
     }
     return $urlParams;
 }
Ejemplo n.º 17
0
 /**
  * Add additional parameters for links according to TS setting preserveGETvars.
  * Possible values are "all" or a comma separated list of allowed GET-vars.
  * Supports multi-dimensional GET-vars.
  * Some hardcoded values are dropped.
  *
  * @return string additionalParams-string
  */
 protected function getPreserveGetVars()
 {
     $getVars = GeneralUtility::_GET();
     unset($getVars['id'], $getVars['no_cache'], $getVars['logintype'], $getVars['redirect_url'], $getVars['cHash'], $getVars[$this->prefixId]);
     if ($this->conf['preserveGETvars'] === 'all') {
         $preserveQueryParts = $getVars;
     } else {
         $preserveQueryParts = GeneralUtility::trimExplode(',', $this->conf['preserveGETvars']);
         $preserveQueryParts = GeneralUtility::explodeUrl2Array(implode('=1&', $preserveQueryParts) . '=1', TRUE);
         $preserveQueryParts = \TYPO3\CMS\Core\Utility\ArrayUtility::intersectRecursive($getVars, $preserveQueryParts);
     }
     $parameters = GeneralUtility::implodeArrayForUrl('', $preserveQueryParts);
     return $parameters;
 }
Ejemplo n.º 18
0
 /**
  * Get the HTML data required for a bulk selection of files of the TYPO3 Element Browser.
  *
  * @param int $filesCount Number of files currently displayed
  * @return string HTML data required for a bulk selection of files - if $filesCount is 0, nothing is returned
  */
 protected function getBulkSelector($filesCount)
 {
     if (!$filesCount) {
         return '';
     }
     $lang = $this->getLanguageService();
     $out = '';
     // Getting flag for showing/not showing thumbnails:
     $noThumbsInEB = $this->getBackendUser()->getTSConfigVal('options.noThumbsInEB');
     if (!$noThumbsInEB && $this->selectedFolder) {
         // MENU-ITEMS, fetching the setting for thumbnails from File>List module:
         $_MOD_MENU = array('displayThumbs' => '');
         $_MCONF['name'] = 'file_list';
         $_MOD_SETTINGS = BackendUtility::getModuleData($_MOD_MENU, GeneralUtility::_GP('SET'), $_MCONF['name']);
         $addParams = GeneralUtility::implodeArrayForUrl('', $this->getUrlParameters(['identifier' => $this->selectedFolder->getCombinedIdentifier()]));
         $thumbNailCheck = '<div class="checkbox" style="padding:5px 0 15px 0"><label for="checkDisplayThumbs">' . BackendUtility::getFuncCheck('', 'SET[displayThumbs]', $_MOD_SETTINGS['displayThumbs'], $this->thisScript, $addParams, 'id="checkDisplayThumbs"') . $lang->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:displayThumbs', true) . '</label></div>';
         $out .= $thumbNailCheck;
     } else {
         $out .= '<div style="padding-top: 15px;"></div>';
     }
     return $out;
 }
Ejemplo n.º 19
0
 /**
  * Wrap the plus/minus icon in a link
  *
  * @param string $icon HTML string to wrap, probably an image tag.
  * @param string $cmd Command for 'PM' get var
  * @param string $bMark If set, the link will have an anchor point (=$bMark) and a name attribute (=$bMark)
  * @param bool $isOpen
  * @return string Link-wrapped input string
  */
 public function PM_ATagWrap($icon, $cmd, $bMark = '', $isOpen = false)
 {
     $anchor = $bMark ? '#' . $bMark : '';
     $name = $bMark ? ' name=' . $bMark : '';
     $urlParameters = $this->linkParameterProvider->getUrlParameters([]);
     $urlParameters['PM'] = $cmd;
     $aOnClick = 'return jumpToUrl(' . GeneralUtility::quoteJSvalue($this->getThisScript() . ltrim(GeneralUtility::implodeArrayForUrl('', $urlParameters), '&')) . ',' . GeneralUtility::quoteJSvalue($anchor) . ');';
     return '<a class="list-tree-control ' . ($isOpen ? 'list-tree-control-open' : 'list-tree-control-closed') . '" href="#"' . htmlspecialchars($name) . ' onclick="' . htmlspecialchars($aOnClick) . '"><i class="fa"></i></a>';
 }
Ejemplo n.º 20
0
    /**
     * Basically makes sure that the workspace preview is rendered.
     * The preview itself consists of three frames, so there are
     * only the frames-urls we've to generate here
     *
     * @param integer $previewWS
     * @return void
     */
    public function indexAction($previewWS = NULL)
    {
        // Get all the GET parameters to pass them on to the frames
        $queryParameters = GeneralUtility::_GET();
        // Remove the GET parameters related to the workspaces module and the page id
        unset($queryParameters['tx_workspaces_web_workspacesworkspaces']);
        unset($queryParameters['M']);
        unset($queryParameters['id']);
        // Assemble a query string from the retrieved parameters
        $queryString = GeneralUtility::implodeArrayForUrl('', $queryParameters);
        // fetch the next and previous stage
        $workspaceItemsArray = $this->workspaceService->selectVersionsInWorkspace($this->stageService->getWorkspaceId(), $filter = 1, $stage = -99, $this->pageId, $recursionLevel = 0, $selectionType = 'tables_modify');
        list(, $nextStage) = $this->stageService->getNextStageForElementCollection($workspaceItemsArray);
        list(, $previousStage) = $this->stageService->getPreviousStageForElementCollection($workspaceItemsArray);
        /** @var $wsService \TYPO3\CMS\Workspaces\Service\WorkspaceService */
        $wsService = GeneralUtility::makeInstance('TYPO3\\CMS\\Workspaces\\Service\\WorkspaceService');
        $wsList = $wsService->getAvailableWorkspaces();
        $activeWorkspace = $GLOBALS['BE_USER']->workspace;
        if (!is_null($previewWS)) {
            if (in_array($previewWS, array_keys($wsList)) && $activeWorkspace != $previewWS) {
                $activeWorkspace = $previewWS;
                $GLOBALS['BE_USER']->setWorkspace($activeWorkspace);
                BackendUtility::setUpdateSignal('updatePageTree');
            }
        }
        /** @var $uriBuilder \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder */
        $uriBuilder = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder');
        $wsSettingsPath = GeneralUtility::getIndpEnv('TYPO3_SITE_URL') . 'typo3/';
        $wsSettingsUri = $uriBuilder->uriFor('singleIndex', array(), 'TYPO3\\CMS\\Workspaces\\Controller\\ReviewController', 'workspaces', 'web_workspacesworkspaces');
        $wsSettingsParams = '&tx_workspaces_web_workspacesworkspaces[controller]=Review';
        $wsSettingsUrl = $wsSettingsPath . $wsSettingsUri . $wsSettingsParams;
        $viewDomain = BackendUtility::getViewDomain($this->pageId);
        $wsBaseUrl = $viewDomain . '/index.php?id=' . $this->pageId . $queryString;
        // @todo - handle new pages here
        // branchpoints are not handled anymore because this feature is not supposed anymore
        if (\TYPO3\CMS\Workspaces\Service\WorkspaceService::isNewPage($this->pageId)) {
            $wsNewPageUri = $uriBuilder->uriFor('newPage', array(), 'TYPO3\\CMS\\Workspaces\\Controller\\PreviewController', 'workspaces', 'web_workspacesworkspaces');
            $wsNewPageParams = '&tx_workspaces_web_workspacesworkspaces[controller]=Preview';
            $this->view->assign('liveUrl', $wsSettingsPath . $wsNewPageUri . $wsNewPageParams);
        } else {
            $this->view->assign('liveUrl', $wsBaseUrl . '&ADMCMD_noBeUser=1');
        }
        $this->view->assign('wsUrl', $wsBaseUrl . '&ADMCMD_view=1&ADMCMD_editIcons=1&ADMCMD_previewWS=' . $GLOBALS['BE_USER']->workspace);
        $this->view->assign('wsSettingsUrl', $wsSettingsUrl);
        $this->view->assign('backendDomain', GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY'));
        $splitPreviewTsConfig = BackendUtility::getModTSconfig($this->pageId, 'workspaces.splitPreviewModes');
        $splitPreviewModes = GeneralUtility::trimExplode(',', $splitPreviewTsConfig['value']);
        $allPreviewModes = array('slider', 'vbox', 'hbox');
        if (!array_intersect($splitPreviewModes, $allPreviewModes)) {
            $splitPreviewModes = $allPreviewModes;
        }
        $this->pageRenderer->addInlineSetting('Workspaces', 'SplitPreviewModes', $splitPreviewModes);
        $GLOBALS['BE_USER']->setAndSaveSessionData('workspaces.backend_domain', GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY'));
        $this->pageRenderer->addInlineSetting('Workspaces', 'disableNextStageButton', $this->isInvalidStage($nextStage));
        $this->pageRenderer->addInlineSetting('Workspaces', 'disablePreviousStageButton', $this->isInvalidStage($previousStage));
        $this->pageRenderer->addInlineSetting('Workspaces', 'disableDiscardStageButton', $this->isInvalidStage($nextStage) && $this->isInvalidStage($previousStage));
        $resourcePath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('lang') . 'Resources/Public/JavaScript/';
        $this->pageRenderer->addJsFile($resourcePath . 'Typo3Lang.js');
        $this->pageRenderer->addJsInlineCode('workspaces.preview.lll', '
		TYPO3.lang = {
			visualPreview: ' . Utility\GeneralUtility::quoteJSvalue($GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:preview.visualPreview', TRUE)) . ',
			listView: ' . Utility\GeneralUtility::quoteJSvalue($GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:preview.listView', TRUE)) . ',
			livePreview: ' . Utility\GeneralUtility::quoteJSvalue($GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:preview.livePreview', TRUE)) . ',
			livePreviewDetail: ' . Utility\GeneralUtility::quoteJSvalue($GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:preview.livePreviewDetail', TRUE)) . ',
			workspacePreview: ' . Utility\GeneralUtility::quoteJSvalue($GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:preview.workspacePreview', TRUE)) . ',
			workspacePreviewDetail: ' . Utility\GeneralUtility::quoteJSvalue($GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:preview.workspacePreviewDetail', TRUE)) . ',
			modeSlider: ' . Utility\GeneralUtility::quoteJSvalue($GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:preview.modeSlider', TRUE)) . ',
			modeVbox: ' . Utility\GeneralUtility::quoteJSvalue($GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:preview.modeVbox', TRUE)) . ',
			modeHbox: ' . Utility\GeneralUtility::quoteJSvalue($GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:preview.modeHbox', TRUE)) . ',
			discard: ' . Utility\GeneralUtility::quoteJSvalue($GLOBALS['LANG']->sL('LLL:EXT:workspaces/Resources/Private/Language/locallang.xlf:label_doaction_discard', TRUE)) . ',
			nextStage: ' . Utility\GeneralUtility::quoteJSvalue($nextStage['title']) . ',
			previousStage: ' . Utility\GeneralUtility::quoteJSvalue($previousStage['title']) . '
		};TYPO3.l10n.initialize();
');
        $resourcePath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('workspaces') . 'Resources/Public/';
        $this->pageRenderer->addJsFile($resourcePath . 'JavaScript/preview.js');
    }
Ejemplo n.º 21
0
 /**
  * Gets the query arguments and assembles them for URLs.
  * Arguments may be removed or set, depending on configuration.
  *
  * @param string $conf Configuration
  * @param array $overruleQueryArguments Multidimensional key/value pairs that overrule incoming query arguments
  * @param bool $forceOverruleArguments If set, key/value pairs not in the query but the overrule array will be set
  * @return string The URL query part (starting with a &)
  */
 public function getQueryArguments($conf, $overruleQueryArguments = array(), $forceOverruleArguments = false)
 {
     switch ((string) $conf['method']) {
         case 'GET':
             $currentQueryArray = GeneralUtility::_GET();
             break;
         case 'POST':
             $currentQueryArray = GeneralUtility::_POST();
             break;
         case 'GET,POST':
             $currentQueryArray = GeneralUtility::_GET();
             ArrayUtility::mergeRecursiveWithOverrule($currentQueryArray, GeneralUtility::_POST());
             break;
         case 'POST,GET':
             $currentQueryArray = GeneralUtility::_POST();
             ArrayUtility::mergeRecursiveWithOverrule($currentQueryArray, GeneralUtility::_GET());
             break;
         default:
             $currentQueryArray = GeneralUtility::explodeUrl2Array($this->getEnvironmentVariable('QUERY_STRING'), true);
     }
     if ($conf['exclude']) {
         $exclude = str_replace(',', '&', $conf['exclude']);
         $exclude = GeneralUtility::explodeUrl2Array($exclude, true);
         // never repeat id
         $exclude['id'] = 0;
         $newQueryArray = ArrayUtility::arrayDiffAssocRecursive($currentQueryArray, $exclude);
     } else {
         $newQueryArray = $currentQueryArray;
     }
     if ($forceOverruleArguments) {
         ArrayUtility::mergeRecursiveWithOverrule($newQueryArray, $overruleQueryArguments);
     } else {
         ArrayUtility::mergeRecursiveWithOverrule($newQueryArray, $overruleQueryArguments, false);
     }
     return GeneralUtility::implodeArrayForUrl('', $newQueryArray, '', false, true);
 }
Ejemplo n.º 22
0
    /**
     * Generate JS code to be used on the link insert/modify dialogue
     *
     * @return string the generated JS code
     * @todo Define visibility
     */
    public function getJsCode()
    {
        // Rich Text Editor specific configuration:
        $addPassOnParams = '';
        if ((string) $this->mode == 'rte') {
            $addPassOnParams .= '&RTEtsConfigParams=' . rawurlencode($this->RTEtsConfigParams);
        }
        // BEGIN accumulation of header JavaScript:
        $JScode = '
			// This JavaScript is primarily for RTE/Link. jumpToUrl is used in the other cases as well...
			var add_href=' . GeneralUtility::quoteJSvalue($this->curUrlArray['href'] ? '&curUrl[href]=' . rawurlencode($this->curUrlArray['href']) : '') . ';
			var add_target=' . GeneralUtility::quoteJSvalue($this->setTarget ? '&curUrl[target]=' . rawurlencode($this->setTarget) : '') . ';
			var add_class=' . GeneralUtility::quoteJSvalue($this->setClass ? '&curUrl[class]=' . rawurlencode($this->setClass) : '') . ';
			var add_title=' . GeneralUtility::quoteJSvalue($this->setTitle ? '&curUrl[title]=' . rawurlencode($this->setTitle) : '') . ';
			var add_params=' . GeneralUtility::quoteJSvalue($this->bparams ? '&bparams=' . rawurlencode($this->bparams) : '') . ';

			var cur_href=' . GeneralUtility::quoteJSvalue($this->curUrlArray['href'] ?: '') . ';
			var cur_target=' . GeneralUtility::quoteJSvalue($this->setTarget ?: '') . ';
			var cur_class=' . GeneralUtility::quoteJSvalue($this->setClass ?: '') . ';
			var cur_title=' . GeneralUtility::quoteJSvalue($this->setTitle ?: '') . ';
			var cur_params=' . GeneralUtility::quoteJSvalue($this->setParams ?: '') . ';

			function browse_links_setTarget(target) {	//
				cur_target=target;
				add_target="&curUrl[target]="+escape(target);
			}
			function browse_links_setClass(cssClass) {   //
				cur_class = cssClass;
				add_class = "&curUrl[class]=" + escape(cssClass);
			}
			function browse_links_setTitle(title) {	//
				cur_title=title;
				add_title="&curUrl[title]="+escape(title);
			}
			function browse_links_setValue(value) {	//
				cur_href=value;
				add_href="&curUrl[href]="+value;
			}
			function browse_links_setParams(params) {	//
				cur_params=params;
				add_params="&curUrl[params]="+escape(params);
			}
		';
        // Functions used, if the link selector is in wizard mode (= TCEforms fields)
        if ($this->mode == 'wizard') {
            if (!$this->areFieldChangeFunctionsValid() && !$this->areFieldChangeFunctionsValid(TRUE)) {
                $this->P['fieldChangeFunc'] = array();
            }
            unset($this->P['fieldChangeFunc']['alert']);
            $update = '';
            foreach ($this->P['fieldChangeFunc'] as $v) {
                $update .= '
				window.opener.' . $v;
            }
            $P2 = array();
            $P2['uid'] = $this->P['uid'];
            $P2['pid'] = $this->P['pid'];
            $P2['itemName'] = $this->P['itemName'];
            $P2['formName'] = $this->P['formName'];
            $P2['fieldChangeFunc'] = $this->P['fieldChangeFunc'];
            $P2['fieldChangeFuncHash'] = GeneralUtility::hmac(serialize($this->P['fieldChangeFunc']));
            $P2['params']['allowedExtensions'] = isset($this->P['params']['allowedExtensions']) ? $this->P['params']['allowedExtensions'] : '';
            $P2['params']['blindLinkOptions'] = isset($this->P['params']['blindLinkOptions']) ? $this->P['params']['blindLinkOptions'] : '';
            $P2['params']['blindLinkFields'] = isset($this->P['params']['blindLinkFields']) ? $this->P['params']['blindLinkFields'] : '';
            $addPassOnParams .= GeneralUtility::implodeArrayForUrl('P', $P2);
            $JScode .= '
				function link_typo3Page(id,anchor) {	//
					updateValueInMainForm(id + (anchor ? anchor : ""));
					close();
					return false;
				}
				function link_folder(folder) {	//
					updateValueInMainForm(folder);
					close();
					return false;
				}
				function link_current() {	//
					if (cur_href!="http://" && cur_href!="mailto:") {
						returnBeforeCleaned = cur_href;
						if (returnBeforeCleaned.substr(0, 7) == "http://") {
							returnToMainFormValue = returnBeforeCleaned.substr(7);
						} else if (returnBeforeCleaned.substr(0, 7) == "mailto:") {
							if (returnBeforeCleaned.substr(0, 14) == "mailto:mailto:") {
								returnToMainFormValue = returnBeforeCleaned.substr(14);
							} else {
								returnToMainFormValue = returnBeforeCleaned.substr(7);
							}
						} else {
							returnToMainFormValue = returnBeforeCleaned;
						}
						updateValueInMainForm(returnToMainFormValue);
						close();
					}
					return false;
				}
				function checkReference() {	//
					if (window.opener && window.opener.document && window.opener.document.' . $this->P['formName'] . ' && window.opener.document.' . $this->P['formName'] . '["' . $this->P['itemName'] . '"] ) {
						return window.opener.document.' . $this->P['formName'] . '["' . $this->P['itemName'] . '"];
					} else {
						close();
					}
				}
				function updateValueInMainForm(input) {	//
					var field = checkReference();
					if (field) {
						if (cur_target == "" && (cur_class != "" || cur_title != "" || cur_params != "")) {
							cur_target = "-";
						}
						if (cur_class == "" && (cur_title != "" || cur_params != "")) {
							cur_class = "-";
						}
						cur_class = cur_class.replace(/[\'\\"]/g, "");
						if (cur_class.indexOf(" ") != -1) {
							cur_class = "\\"" + cur_class + "\\"";
						}
						if (cur_title == "" && cur_params != "") {
 							cur_title = "-";
 						}
						cur_title = cur_title.replace(/(^\\")|(\\"$)/g, "");
						if (cur_title.indexOf(" ") != -1) {
							cur_title = "\\"" + cur_title + "\\"";
						}
						if (cur_params) {
							cur_params = cur_params.replace(/\\bid\\=.*?(\\&|$)/, "");
						}
						input = input + " " + cur_target + " " + cur_class + " " + cur_title + " " + cur_params;
						if(field.value && field.className.search(/textarea/) != -1) {
							field.value += "\\n" + input;
						} else {
							field.value = input;
						}
						' . $update . '
					}
				}
			';
        } else {
            // Functions used, if the link selector is in RTE mode:
            $JScode .= '
				function link_typo3Page(id,anchor) {	//
					var theLink = \'' . $this->siteURL . '?id=\'+id+(anchor?anchor:"");
					self.parent.parent.renderPopup_addLink(theLink, cur_target, cur_class, cur_title);
					return false;
				}
				function link_folder(folder) {	//
					var theLink = \'' . $this->siteURL . '\'+folder;
					self.parent.parent.renderPopup_addLink(theLink, cur_target, cur_class, cur_title);
					return false;
				}
				function link_spec(theLink) {	//
					self.parent.parent.renderPopup_addLink(theLink, cur_target, cur_class, cur_title);
					return false;
				}
				function link_current() {	//
					if (cur_href!="http://" && cur_href!="mailto:") {
						self.parent.parent.renderPopup_addLink(cur_href, cur_target, cur_class, cur_title);
					}
					return false;
				}
			';
        }
        // General "jumpToUrl" function:
        $JScode .= '
			function jumpToUrl(URL,anchor) {	//
				if (URL.charAt(0) === \'?\') {
					URL = ' . GeneralUtility::quoteJSvalue($this->getThisScript()) . ' + URL.substring(1);
				}
				var add_act = URL.indexOf("act=")==-1 ? "&act=' . $this->act . '" : "";
				var add_mode = URL.indexOf("mode=")==-1 ? "&mode=' . $this->mode . '" : "";
				var theLocation = URL + add_act + add_mode + add_href + add_target + add_class + add_title + add_params' . ($addPassOnParams ? '+' . GeneralUtility::quoteJSvalue($addPassOnParams) : '') . '+(typeof(anchor)=="string"?anchor:"");
				window.location.href = theLocation;
				return false;
			}
		';
        /**
         * Splits parts of $this->bparams
         *
         * @see $bparams
         */
        $pArr = explode('|', $this->bparams);
        // This is JavaScript especially for the TBE Element Browser!
        $formFieldName = 'data[' . $pArr[0] . '][' . $pArr[1] . '][' . $pArr[2] . ']';
        // insertElement - Call check function (e.g. for uniqueness handling):
        $JScodeCheck = '';
        if ($pArr[4] && $pArr[5]) {
            $JScodeCheck = '
					// Call a check function in the opener window (e.g. for uniqueness handling):
				if (parent.window.opener) {
					var res = parent.window.opener.' . $pArr[5] . '("' . addslashes($pArr[4]) . '",table,uid,type);
					if (!res.passed) {
						if (res.message) alert(res.message);
						performAction = false;
					}
				} else {
					alert("Error - reference to main window is not set properly!");
					parent.close();
				}
			';
        }
        // insertElement - Call helper function:
        $JScodeHelper = '';
        if ($pArr[4] && $pArr[6]) {
            $JScodeHelper = '
						// Call helper function to manage data in the opener window:
					if (parent.window.opener) {
						parent.window.opener.' . $pArr[6] . '("' . addslashes($pArr[4]) . '",table,uid,type,"' . addslashes($pArr[0]) . '");
					} else {
						alert("Error - reference to main window is not set properly!");
						parent.close();
					}
			';
        }
        // insertElement - perform action commands:
        $JScodeActionMultiple = '';
        if ($pArr[4] && $pArr[7]) {
            // Call user defined action function:
            $JScodeAction = '
					if (parent.window.opener) {
						parent.window.opener.' . $pArr[7] . '("' . addslashes($pArr[4]) . '",table,uid,type);
						if (close) { focusOpenerAndClose(close); }
					} else {
						alert("Error - reference to main window is not set properly!");
						if (close) { parent.close(); }
					}
			';
            $JScodeActionMultiple = '
						// Call helper function to manage data in the opener window:
					if (parent.window.opener) {
						parent.window.opener.' . $pArr[7] . 'Multiple("' . addslashes($pArr[4]) . '",table,uid,type,"' . addslashes($pArr[0]) . '");
					} else {
						alert("Error - reference to main window is not set properly!");
						parent.close();
					}
			';
        } elseif ($pArr[0] && !$pArr[1] && !$pArr[2]) {
            $JScodeAction = '
					addElement(filename,table+"_"+uid,fp,close);
			';
        } else {
            $JScodeAction = '
					if (setReferences()) {
						parent.window.opener.group_change("add","' . $pArr[0] . '","' . $pArr[1] . '","' . $pArr[2] . '",elRef,targetDoc);
					} else {
						alert("Error - reference to main window is not set properly!");
					}
					focusOpenerAndClose(close);
			';
        }
        $JScode .= '
			var elRef="";
			var targetDoc="";

			function launchView(url) {	//
				var thePreviewWindow="";
				thePreviewWindow = window.open("' . $GLOBALS['BACK_PATH'] . 'show_item.php?table="+url,"ShowItem",' . '"height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0");
				if (thePreviewWindow && thePreviewWindow.focus) {
					thePreviewWindow.focus();
				}
			}
			function setReferences() {	//
				if (parent.window.opener && parent.window.opener.content && parent.window.opener.content.document.editform' . '&& parent.window.opener.content.document.editform["' . $formFieldName . '"]) {
					targetDoc = parent.window.opener.content.document;
					elRef = targetDoc.editform["' . $formFieldName . '"];
					return true;
				} else {
					return false;
				}
			}
			function insertElement(table, uid, type, filename, fp, filetype, imagefile, action, close) {	//
				var performAction = true;
				' . $JScodeCheck . '
					// Call performing function and finish this action:
				if (performAction) {
						' . $JScodeHelper . $JScodeAction . '
				}
				return false;
			}
			function insertMultiple(table, uid) {
				var type = "";
						' . $JScodeActionMultiple . '
				return false;
			}
			function addElement(elName, elValue, altElValue, close) {	//
				if (parent.window.opener && parent.window.opener.setFormValueFromBrowseWin) {
					parent.window.opener.setFormValueFromBrowseWin("' . $pArr[0] . '",altElValue?altElValue:elValue,elName);
					focusOpenerAndClose(close);
				} else {
					alert("Error - reference to main window is not set properly!");
					parent.close();
				}
			}
			function focusOpenerAndClose(close) {	//
				BrowseLinks.focusOpenerAndClose(close);
			}
		';
        // extends JavaScript code
        if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['extendJScode']) && is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['extendJScode'])) {
            $conf = array();
            $update = '';
            $_params = array('conf' => &$conf, 'wizardUpdate' => $update, 'addPassOnParams' => $addPassOnParams);
            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.browse_links.php']['extendJScode'] as $objRef) {
                $processor =& GeneralUtility::getUserObj($objRef);
                $JScode .= $processor->extendJScode($_params, $this);
            }
        }
        return $JScode;
    }
Ejemplo n.º 23
0
 /**
  * As we can't use BackendUtility::getModuleUrl this method needs
  * to be overridden to set the url to $this->script
  *
  * NOTE: Since Typo3 4.5 we can't use listURL from parent class
  * we need to link to $this->script instead of web_list
  *
  * Creates the URL to this script, including all relevant GPvars
  * Fixed GPvars are id, table, imagemode, returlUrl, search_field,
  * search_levels and showLimit The GPvars "sortField" and "sortRev"
  * are also included UNLESS they are found in the $exclList variable.
  *
  * @param string $altId Alternative id value.
  * 	Enter blank string for the current id ($this->id)
  * @param string $table Tablename to display. Enter "-1" for the current table.
  * @param string $excludeList Commalist of fields
  * 	NOT to include ("sortField" or "sortRev")
  *
  * @return string URL
  */
 public function listURL($altId = '', $table = '-1', $excludeList = '')
 {
     $urlParameters = array();
     if (strcmp($altId, '')) {
         $urlParameters['id'] = $altId;
     } else {
         $urlParameters['id'] = $this->id;
     }
     if ($this->parentUid) {
         $urlParameters['control']['tx_commerce_categories']['uid'] = $this->parentUid;
     }
     if ($table === '-1') {
         $urlParameters['table'] = $this->table;
     } else {
         $urlParameters['table'] = $table;
     }
     if ($this->thumbs) {
         $urlParameters['imagemode'] = $this->thumbs;
     }
     if ($this->returnUrl) {
         $urlParameters['returnUrl'] = $this->returnUrl;
     }
     if ($this->searchString) {
         $urlParameters['search_field'] = $this->searchString;
     }
     if ($this->searchLevels) {
         $urlParameters['search_levels'] = $this->searchLevels;
     }
     if ($this->showLimit) {
         $urlParameters['showLimit'] = $this->showLimit;
     }
     if ((!$excludeList || !GeneralUtility::inList($excludeList, 'firstElementNumber')) && $this->firstElementNumber) {
         $urlParameters['pointer'] = $this->firstElementNumber;
     }
     if ((!$excludeList || !GeneralUtility::inList($excludeList, 'sortField')) && $this->sortField) {
         $urlParameters['sortField'] = $this->sortField;
     }
     if ((!$excludeList || !GeneralUtility::inList($excludeList, 'sortRev')) && $this->sortRev) {
         $urlParameters['sortRev'] = $this->sortRev;
     }
     return $this->script . GeneralUtility::implodeArrayForUrl('', $urlParameters, '', TRUE);
 }
 /**
  * Calculates and sets the internal linkVars based upon the current
  * $_GET parameters and the setting "config.linkVars".
  *
  * @return void
  */
 public function calculateLinkVars()
 {
     $this->linkVars = '';
     $linkVars = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', (string) $this->config['config']['linkVars']);
     if (empty($linkVars)) {
         return;
     }
     $getData = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET();
     foreach ($linkVars as $linkVar) {
         $test = $value = '';
         if (preg_match('/^(.*)\\((.+)\\)$/', $linkVar, $match)) {
             $linkVar = trim($match[1]);
             $test = trim($match[2]);
         }
         if ($linkVar === '' || !isset($getData[$linkVar])) {
             continue;
         }
         if (!is_array($getData[$linkVar])) {
             $temp = rawurlencode($getData[$linkVar]);
             if ($test !== '' && !\TYPO3\CMS\Frontend\Page\PageGenerator::isAllowedLinkVarValue($temp, $test)) {
                 // Error: This value was not allowed for this key
                 continue;
             }
             $value = '&' . $linkVar . '=' . $temp;
         } else {
             if ($test !== '' && strcmp('array', $test)) {
                 // Error: This key must not be an array!
                 continue;
             }
             $value = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl($linkVar, $getData[$linkVar]);
         }
         $this->linkVars .= $value;
     }
 }
Ejemplo n.º 25
0
 /**
  * Returns the Ajax URL for a given AjaxID including a CSRF token.
  *
  * This method is only called by the core and must not be used by extensions.
  * Ajax URLs of all registered backend Ajax handlers are automatically published
  * to JavaScript inline settings: TYPO3.settings.ajaxUrls['ajaxId']
  *
  * @param string $ajaxIdentifier Identifier of the AJAX callback
  * @param array $urlParameters URL parameters that should be added as key value pairs
  * @param bool/string $backPathOverride Backpath that should be used instead of the global $BACK_PATH
  * @param bool $returnAbsoluteUrl If set to TRUE, the URL returned will be absolute, $backPathOverride will be ignored in this case
  * @return string Calculated URL
  * @internal
  */
 public static function getAjaxUrl($ajaxIdentifier, array $urlParameters = array(), $backPathOverride = FALSE, $returnAbsoluteUrl = FALSE)
 {
     if ($backPathOverride) {
         $backPath = $backPathOverride;
     } else {
         $backPath = isset($GLOBALS['BACK_PATH']) ? $GLOBALS['BACK_PATH'] : '';
     }
     $additionalUrlParameters = array('ajaxID' => $ajaxIdentifier);
     if (!empty($GLOBALS['TYPO3_CONF_VARS']['BE']['AJAX'][$ajaxIdentifier]['csrfTokenCheck'])) {
         $additionalUrlParameters['ajaxToken'] = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get()->generateToken('ajaxCall', $ajaxIdentifier);
     }
     $url = 'ajax.php?' . ltrim(GeneralUtility::implodeArrayForUrl('', $additionalUrlParameters + $urlParameters, '', TRUE, TRUE), '&');
     if ($returnAbsoluteUrl) {
         return GeneralUtility::getIndpEnv('TYPO3_REQUEST_DIR') . $url;
     } else {
         return $backPath . $url;
     }
 }
Ejemplo n.º 26
0
 /**
  * Checks the array for elements which might contain unallowed default values and will unset them!
  * Looks for the "tt_content_defValues" key in each element and if found it will traverse that array as fieldname /
  * value pairs and check.
  * The values will be added to the "params" key of the array (which should probably be unset or empty by default).
  *
  * @param array $wizardItems Wizard items, passed by reference
  * @return void
  */
 public function removeInvalidElements(&$wizardItems)
 {
     // Get TCEFORM from TSconfig of current page
     $row = array('pid' => $this->id);
     $TCEFORM_TSconfig = BackendUtility::getTCEFORM_TSconfig('tt_content', $row);
     $headersUsed = array();
     // Traverse wizard items:
     foreach ($wizardItems as $key => $cfg) {
         // Exploding parameter string, if any (old style)
         if ($wizardItems[$key]['params']) {
             // Explode GET vars recursively
             $tempGetVars = GeneralUtility::explodeUrl2Array($wizardItems[$key]['params'], true);
             // If tt_content values are set, merge them into the tt_content_defValues array,
             // unset them from $tempGetVars and re-implode $tempGetVars into the param string
             // (in case remaining parameters are around).
             if (is_array($tempGetVars['defVals']['tt_content'])) {
                 $wizardItems[$key]['tt_content_defValues'] = array_merge(is_array($wizardItems[$key]['tt_content_defValues']) ? $wizardItems[$key]['tt_content_defValues'] : array(), $tempGetVars['defVals']['tt_content']);
                 unset($tempGetVars['defVals']['tt_content']);
                 $wizardItems[$key]['params'] = GeneralUtility::implodeArrayForUrl('', $tempGetVars);
             }
         }
         // If tt_content_defValues are defined...:
         if (is_array($wizardItems[$key]['tt_content_defValues'])) {
             $backendUser = $this->getBackendUser();
             // Traverse field values:
             foreach ($wizardItems[$key]['tt_content_defValues'] as $fN => $fV) {
                 if (is_array($GLOBALS['TCA']['tt_content']['columns'][$fN])) {
                     // Get information about if the field value is OK:
                     $config =& $GLOBALS['TCA']['tt_content']['columns'][$fN]['config'];
                     $authModeDeny = $config['type'] == 'select' && $config['authMode'] && !$backendUser->checkAuthMode('tt_content', $fN, $fV, $config['authMode']);
                     // explode TSconfig keys only as needed
                     if (!isset($removeItems[$fN])) {
                         $removeItems[$fN] = GeneralUtility::trimExplode(',', $TCEFORM_TSconfig[$fN]['removeItems'], true);
                     }
                     if (!isset($keepItems[$fN])) {
                         $keepItems[$fN] = GeneralUtility::trimExplode(',', $TCEFORM_TSconfig[$fN]['keepItems'], true);
                     }
                     $isNotInKeepItems = !empty($keepItems[$fN]) && !in_array($fV, $keepItems[$fN]);
                     if ($authModeDeny || $fN === 'CType' && in_array($fV, $removeItems[$fN]) || $isNotInKeepItems) {
                         // Remove element all together:
                         unset($wizardItems[$key]);
                         break;
                     } else {
                         // Add the parameter:
                         $wizardItems[$key]['params'] .= '&defVals[tt_content][' . $fN . ']=' . rawurlencode($fV);
                         $tmp = explode('_', $key);
                         $headersUsed[$tmp[0]] = $tmp[0];
                     }
                 }
             }
         }
     }
     // remove headers without elements
     foreach ($wizardItems as $key => $cfg) {
         $tmp = explode('_', $key);
         if ($tmp[0] && !$tmp[1] && !in_array($tmp[0], $headersUsed)) {
             unset($wizardItems[$key]);
         }
     }
 }
Ejemplo n.º 27
0
 /**
  * This returns tablerows for the files in the array $items['sorting'].
  *
  * @param File[] $files File items
  * @return string HTML table rows.
  */
 public function formatFileList(array $files)
 {
     $out = '';
     // first two keys are "0" (default) and "-1" (multiple), after that comes the "other languages"
     $allSystemLanguages = GeneralUtility::makeInstance(TranslationConfigurationProvider::class)->getSystemLanguages();
     $systemLanguages = array_filter($allSystemLanguages, function ($languageRecord) {
         if ($languageRecord['uid'] === -1 || $languageRecord['uid'] === 0 || !$this->getBackendUser()->checkLanguageAccess($languageRecord['uid'])) {
             return FALSE;
         } else {
             return TRUE;
         }
     });
     foreach ($files as $fileObject) {
         // Initialization
         $this->counter++;
         $this->totalbytes += $fileObject->getSize();
         $ext = $fileObject->getExtension();
         $fileName = trim($fileObject->getName());
         // The icon with link
         $theIcon = IconUtility::getSpriteIconForResource($fileObject, array('title' => $fileName . ' [' . (int) $fileObject->getUid() . ']'));
         if ($this->clickMenus) {
             $theIcon = $GLOBALS['SOBE']->doc->wrapClickMenuOnIcon($theIcon, $fileObject->getCombinedIdentifier());
         }
         // Preparing and getting the data-array
         $theData = array();
         foreach ($this->fieldArray as $field) {
             switch ($field) {
                 case 'size':
                     $theData[$field] = GeneralUtility::formatSize($fileObject->getSize(), $this->getLanguageService()->getLL('byteSizeUnits', TRUE));
                     break;
                 case 'rw':
                     $theData[$field] = '' . (!$fileObject->checkActionPermission('read') ? ' ' : '<strong class="text-danger">' . $this->getLanguageService()->getLL('read', TRUE) . '</strong>') . (!$fileObject->checkActionPermission('write') ? '' : '<strong class="text-danger">' . $this->getLanguageService()->getLL('write', TRUE) . '</strong>');
                     break;
                 case 'fileext':
                     $theData[$field] = strtoupper($ext);
                     break;
                 case 'tstamp':
                     $theData[$field] = BackendUtility::date($fileObject->getModificationTime());
                     break;
                 case '_CONTROL_':
                     $theData[$field] = $this->makeEdit($fileObject);
                     break;
                 case '_CLIPBOARD_':
                     $theData[$field] = $this->makeClip($fileObject);
                     break;
                 case '_LOCALIZATION_':
                     if (!empty($systemLanguages) && $fileObject->isIndexed() && $fileObject->checkActionPermission('write') && $this->getBackendUser()->check('tables_modify', 'sys_file_metadata')) {
                         $metaDataRecord = $fileObject->_getMetaData();
                         $translations = $this->getTranslationsForMetaData($metaDataRecord);
                         $languageCode = '';
                         foreach ($systemLanguages as $language) {
                             $languageId = $language['uid'];
                             $flagIcon = $language['flagIcon'];
                             if (array_key_exists($languageId, $translations)) {
                                 $flagButtonIcon = IconUtility::getSpriteIcon('actions-document-open', array('title' => sprintf($GLOBALS['LANG']->getLL('editMetadataForLanguage'), $language['title'])), array($flagIcon . '-overlay' => array()));
                                 $data = array('sys_file_metadata' => array($translations[$languageId]['uid'] => 'edit'));
                                 $editOnClick = BackendUtility::editOnClick(GeneralUtility::implodeArrayForUrl('edit', $data), $GLOBALS['BACK_PATH'], $this->listUrl());
                                 $languageCode .= '<a href="#" class="btn btn-default" onclick="' . htmlspecialchars($editOnClick) . '">' . $flagButtonIcon . '</a>';
                             } else {
                                 $parameters = ['justLocalized' => 'sys_file_metadata:' . $metaDataRecord['uid'] . ':' . $languageId, 'returnUrl' => $this->listURL()];
                                 $returnUrl = BackendUtility::getModuleUrl('record_edit', $parameters, $this->backPath) . BackendUtility::getUrlToken('editRecord');
                                 $href = $GLOBALS['SOBE']->doc->issueCommand('&cmd[sys_file_metadata][' . $metaDataRecord['uid'] . '][localize]=' . $languageId, $returnUrl);
                                 $flagButtonIcon = IconUtility::getSpriteIcon($flagIcon, array('title' => sprintf($GLOBALS['LANG']->getLL('createMetadataForLanguage'), $language['title'])), array($flagIcon . '-overlay' => array()));
                                 $languageCode .= '<a href="' . htmlspecialchars($href) . '" class="btn btn-default">' . $flagButtonIcon . '</a> ';
                             }
                         }
                         // Hide flag button bar when not translated yet
                         $theData[$field] = ' <div class="localisationData btn-group" data-fileid="' . $fileObject->getUid() . '"' . (empty($translations) ? ' style="display: none;"' : '') . '>' . $languageCode . '</div>';
                         $theData[$field] .= '<a class="btn btn-default filelist-translationToggler" data-fileid="' . $fileObject->getUid() . '">' . IconUtility::getSpriteIcon('mimetypes-x-content-page-language-overlay', array('title' => $GLOBALS['LANG']->getLL('translateMetadata'))) . '</a>';
                     }
                     break;
                 case '_REF_':
                     $theData[$field] = $this->makeRef($fileObject);
                     break;
                 case 'file':
                     // Edit metadata of file
                     $theData[$field] = $this->linkWrapFile(htmlspecialchars($fileName), $fileObject);
                     if ($fileObject->isMissing()) {
                         $flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($fileObject);
                         $theData[$field] .= $flashMessage->render();
                         // Thumbnails?
                     } elseif ($this->thumbs && $this->isImage($ext)) {
                         $processedFile = $fileObject->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, array());
                         if ($processedFile) {
                             $thumbUrl = $processedFile->getPublicUrl(TRUE);
                             $theData[$field] .= '<br /><img src="' . $thumbUrl . '" ' . 'width="' . $processedFile->getProperty('width') . '" ' . 'height="' . $processedFile->getProperty('height') . '" ' . 'title="' . htmlspecialchars($fileName) . '" alt="" />';
                         }
                     }
                     break;
                 default:
                     $theData[$field] = '';
                     if ($fileObject->hasProperty($field)) {
                         $theData[$field] = htmlspecialchars(GeneralUtility::fixed_lgd_cs($fileObject->getProperty($field), $this->fixedL));
                     }
             }
         }
         $out .= $this->addelement(1, $theIcon, $theData);
     }
     return $out;
 }
Ejemplo n.º 28
0
    /**
     * Result row display
     *
     * @param array $row
     * @param array $conf
     * @param string $table
     * @return string
     */
    public function resultRowDisplay($row, $conf, $table)
    {
        $SET = $GLOBALS['SOBE']->MOD_SETTINGS;
        $out = '<tr>';
        foreach ($row as $fieldName => $fieldValue) {
            if (GeneralUtility::inList($SET['queryFields'], $fieldName) || !$SET['queryFields'] && $fieldName != 'pid' && $fieldName != 'deleted') {
                if ($SET['search_result_labels']) {
                    $fVnew = $this->getProcessedValueExtra($table, $fieldName, $fieldValue, $conf, '<br />');
                } else {
                    $fVnew = htmlspecialchars($fieldValue);
                }
                $out .= '<td>' . $fVnew . '</td>';
            }
        }
        $out .= '<td><div class="btn-group">';
        if (!$row['deleted']) {
            $url = BackendUtility::getModuleUrl('record_edit', ['edit' => [$table => [$row['uid'] => 'edit']], 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI') . GeneralUtility::implodeArrayForUrl('SET', (array) GeneralUtility::_POST('SET'))]);
            $out .= '<a class="btn btn-default" href="#" onClick="top.launchView(\'' . $table . '\',' . $row['uid'] . ');return false;">' . $this->iconFactory->getIcon('actions-document-info', Icon::SIZE_SMALL)->render() . '</a>';
            $out .= '<a class="btn btn-default" href="' . htmlspecialchars($url) . '">' . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render() . '</a>';
        } else {
            $out .= '<a class="btn btn-default" href="' . GeneralUtility::linkThisUrl(BackendUtility::getModuleUrl('tce_db'), array('cmd[' . $table . '][' . $row['uid'] . '][undelete]' => '1', 'redirect' => GeneralUtility::linkThisScript(array()))) . '" title="' . $GLOBALS['LANG']->getLL('undelete_only', true) . '">';
            $out .= $this->iconFactory->getIcon('actions-edit-restore', Icon::SIZE_SMALL)->render() . '</a>';
            $formEngineParameters = array('edit[' . $table . '][' . $row['uid'] . ']' => 'edit', 'returnUrl' => GeneralUtility::linkThisScript(array()));
            $redirectUrl = BackendUtility::getModuleUrl('record_edit', $formEngineParameters);
            $out .= '<a class="btn btn-default" href="' . GeneralUtility::linkThisUrl(BackendUtility::getModuleUrl('tce_db'), array('cmd[' . $table . '][' . $row['uid'] . '][undelete]' => '1', 'redirect' => $redirectUrl)) . '" title="' . $GLOBALS['LANG']->getLL('undelete_and_edit', true) . '">';
            $out .= $this->iconFactory->getIcon('actions-edit-restore-edit', Icon::SIZE_SMALL)->render() . '</a>';
        }
        $_params = array($table => $row);
        if (is_array($this->hookArray['additionalButtons'])) {
            foreach ($this->hookArray['additionalButtons'] as $_funcRef) {
                $out .= GeneralUtility::callUserFunction($_funcRef, $_params, $this);
            }
        }
        $out .= '</div></td>
		</tr>
		';
        return $out;
    }
Ejemplo n.º 29
0
 /**
  * @test
  */
 public function implodeArrayForUrlCanUrlEncodeKeyNames()
 {
     $input = array('one' => '√', '');
     $expected = '&foo%5Bone%5D=%E2%88%9A&foo%5B0%5D=';
     $this->assertSame($expected, Utility\GeneralUtility::implodeArrayForUrl('foo', $input, '', FALSE, TRUE));
 }
Ejemplo n.º 30
0
 /**
  * Links the $str to page $id
  *
  * @param 	integer		Page id
  * @param 	string		Title String to link
  * @param 	array		Result row
  * @param 	array		Additional parameters for marking up seach words
  * @return 	string		<A> tag wrapped title string.
  * @todo Define visibility
  */
 public function linkPage($id, $str, $row = array(), $markUpSwParams = array())
 {
     // Parameters for link:
     $urlParameters = (array) unserialize($row['cHashParams']);
     // Add &type and &MP variable:
     if ($row['data_page_type']) {
         $urlParameters['type'] = $row['data_page_type'];
     }
     if ($row['data_page_mp']) {
         $urlParameters['MP'] = $row['data_page_mp'];
     }
     if ($row['sys_language_uid']) {
         $urlParameters['L'] = $row['sys_language_uid'];
     }
     // markup-GET vars:
     $urlParameters = array_merge($urlParameters, $markUpSwParams);
     // This will make sure that the path is retrieved if it hasn't been already. Used only for the sake of the domain_record thing...
     if (!is_array($this->domain_records[$id])) {
         $this->getPathFromPageId($id);
     }
     // If external domain, then link to that:
     if (count($this->domain_records[$id])) {
         reset($this->domain_records[$id]);
         $firstDom = current($this->domain_records[$id]);
         $scheme = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SSL') ? 'https://' : 'http://';
         $addParams = '';
         if (is_array($urlParameters)) {
             if (count($urlParameters)) {
                 $addParams .= \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $urlParameters);
             }
         }
         if ($target = $this->conf['search.']['detect_sys_domain_records.']['target']) {
             $target = ' target="' . $target . '"';
         }
         return '<a href="' . htmlspecialchars($scheme . $firstDom . '/index.php?id=' . $id . $addParams) . '"' . $target . '>' . htmlspecialchars($str) . '</a>';
     } else {
         return $this->pi_linkToPage($str, $id, $this->conf['result_link_target'], $urlParameters);
     }
 }