示例#1
0
 /**
  * Creates a link to a given page with a given link text with the current
  * tx_solr parameters appended to the URL
  *
  * @param array Array of arguments, [0] is the link text, [1] is the (optional) page Id to link to (otherwise TSFE->id), [2] are additional URL parameters, [3] use cache, defaults to FALSE
  * @return string complete anchor tag with URL and link text
  */
 public function execute(array $arguments = array())
 {
     $linkText = $arguments[0];
     $pageId = $this->determinePageId(trim($arguments[1]));
     $additionalUrlParameters = $arguments[2] ? $arguments[2] : '';
     $useCache = $arguments[3] ? true : false;
     $returnOnlyUrl = $arguments[4] ? true : false;
     // FIXME pass anything not prefixed with tx_solr in $additionalParameters as 4th parameter
     $additionalUrlParameters = GeneralUtility::explodeUrl2Array($additionalUrlParameters, true);
     $solrUrlParameters = array();
     if (!empty($additionalUrlParameters['tx_solr'])) {
         $solrUrlParameters = $additionalUrlParameters['tx_solr'];
     }
     $linkConfiguration = array('useCacheHash' => $useCache);
     if ($returnOnlyUrl) {
         $linkConfiguration['returnLast'] = 'url';
     }
     if ($this->search->hasSearched()) {
         $query = $this->search->getQuery();
     } else {
         $query = GeneralUtility::makeInstance('ApacheSolrForTypo3\\Solr\\Query', '');
     }
     $linkBuilder = GeneralUtility::makeInstance('ApacheSolrForTypo3\\Solr\\Query\\LinkBuilder', $query);
     $linkBuilder->setLinkTargetPageId($pageId);
     $queryLink = $linkBuilder->getQueryLink($linkText, $solrUrlParameters, $linkConfiguration);
     return $queryLink;
 }
 /**
  * Restores link handler generated preview link on save-n-preview event. This link is overwritten by the workspace module.
  *
  * @param  integer $pageUid
  * @param  string  $backPath
  * @param  array   $rootLine
  * @param  string  $anchorSection
  * @param  string  $viewScript
  * @param  array   $additionalGetVars
  * @param  boolean $switchFocus
  */
 public function preProcess($pageUid, $backPath, $rootLine, $anchorSection, &$viewScript, $additionalGetVars, $switchFocus)
 {
     if ($GLOBALS['BE_USER']->workspace != 0) {
         $additionalGetVars = GeneralUtility::explodeUrl2Array($additionalGetVars);
         if (isset($additionalGetVars['eID']) && $additionalGetVars['eID'] === 'linkhandlerPreview' && isset($GLOBALS['_POST']['viewUrl'])) {
             $viewScript = $GLOBALS['_POST']['viewUrl'];
         }
     }
 }
 /**
  * Returns a URL to link to FormEngine
  *
  * @param string $parameters Is a set of GET params to send to FormEngine
  * @return string URL to FormEngine module + parameters
  * @see \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl()
  */
 public function render($parameters)
 {
     // Make sure record_edit module is available
     if (GeneralUtility::compat_version('7.0')) {
         $parameters = GeneralUtility::explodeUrl2Array($parameters);
         return BackendUtility::getModuleUrl('record_edit', $parameters);
     } else {
         return 'alt_doc.php?' . $parameters;
     }
 }
 /**
  * @param array $arguments
  * @param callable $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  *
  * @return string
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     /** @var BackendUserAuthentication $beUser */
     $beUser = $GLOBALS['BE_USER'];
     $urlParameters = ['vC' => $beUser->veriCode(), 'prErr' => 1, 'uPT' => 1, 'redirect' => $arguments['redirectUrl'] ?: GeneralUtility::getIndpEnv('REQUEST_URI')];
     if (isset($arguments['parameters'])) {
         $parametersArray = GeneralUtility::explodeUrl2Array($arguments['parameters']);
         $urlParameters += $parametersArray;
     }
     return htmlspecialchars(BackendUtility::getModuleUrl('tce_db', $urlParameters));
 }
 /**
  * modifies the menu definition and returns it
  *
  * @param array $menuDef menu definition
  * @return array modified menu definition
  */
 public function modifyMenuDefinition($menuDef)
 {
     $tabs = $this->getTabsConfig();
     foreach ($tabs as $key => $tabConfig) {
         $menuDef[$key]['isActive'] = $this->pObj->act == $key;
         $menuDef[$key]['label'] = $tabConfig['label'];
         $menuDef[$key]['url'] = '#';
         $addPassOnParams = $this->getaddPassOnParams();
         $addPassOnParams = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', \TYPO3\CMS\Core\Utility\GeneralUtility::explodeUrl2Array($addPassOnParams), '', TRUE);
         $menuDef[$key]['addParams'] = 'onclick="jumpToUrl(\'?act=' . $key . '&editorNo=' . $this->pObj->editorNo . '&contentTypo3Language=' . $this->pObj->contentTypo3Language . '&contentTypo3Charset=' . $this->pObj->contentTypo3Charset . $addPassOnParams . '\');return false;"';
     }
     return $menuDef;
 }
 /**
  * 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');
 }
    /**
     * Constructor function for class
     *
     * @return 	void
     * @todo Define visibility
     */
    public function init()
    {
        // Initialize GPvars:
        $this->target = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('target');
        $this->returnUrl = \TYPO3\CMS\Core\Utility\GeneralUtility::sanitizeLocalUrl(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('returnUrl'));
        // Cleaning and checking target
        if ($this->target) {
            $this->fileOrFolderObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->retrieveFileOrFolderObject($this->target);
        }
        if (!$this->fileOrFolderObject) {
            $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:paramError', TRUE);
            $message = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_mod_file_list.xml:targetNoDir', TRUE);
            throw new \RuntimeException($title . ': ' . $message, 1294586844);
        }
        // If a folder should be renamed, AND the returnURL should go to the old directory name, the redirect is forced
        // so the redirect will NOT end in a error message
        // this case only happens if you select the folder itself in the foldertree and then use the clickmenu to
        // rename the folder
        if ($this->fileOrFolderObject instanceof \TYPO3\CMS\Core\Resource\Folder) {
            $parsedUrl = parse_url($this->returnUrl);
            $queryParts = \TYPO3\CMS\Core\Utility\GeneralUtility::explodeUrl2Array(urldecode($parsedUrl['query']));
            if ($queryParts['id'] === $this->fileOrFolderObject->getCombinedIdentifier()) {
                $this->returnUrl = str_replace(urlencode($queryParts['id']), urlencode($this->fileOrFolderObject->getStorage()->getRootLevelFolder()->getCombinedIdentifier()), $this->returnUrl);
            }
        }
        // Setting icon and title
        $icon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('apps-filetree-root');
        $this->title = $icon . htmlspecialchars($this->fileOrFolderObject->getStorage()->getName()) . ': ' . htmlspecialchars($this->fileOrFolderObject->getIdentifier());
        // Setting template object
        $this->doc = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
        $this->doc->setModuleTemplate('templates/file_rename.html');
        $this->doc->backPath = $GLOBALS['BACK_PATH'];
        $this->doc->JScode = $this->doc->wrapScriptTags('
			function backToList() {	//
				top.goToModule("file_list");
			}
		');
    }
示例#8
0
 /**
  * Creates a shortcut through an AJAX call
  *
  * @param array $params Array of parameters from the AJAX interface, currently unused
  * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj Oject of type AjaxRequestHandler
  * @return void
  */
 public function createAjaxShortcut($params = array(), AjaxRequestHandler $ajaxObj = NULL)
 {
     $databaseConnection = $this->getDatabaseConnection();
     $languageService = $this->getLanguageService();
     $shortcutCreated = 'failed';
     // Default name
     $shortcutName = 'Shortcut';
     $shortcutNamePrepend = '';
     $url = GeneralUtility::_POST('url');
     $module = GeneralUtility::_POST('module');
     $motherModule = GeneralUtility::_POST('motherModName');
     // Determine shortcut type
     $url = rawurldecode($url);
     $queryParts = parse_url($url);
     $queryParameters = GeneralUtility::explodeUrl2Array($queryParts['query'], TRUE);
     // Proceed only if no scheme is defined, as URL is expected to be relative
     if (empty($queryParts['scheme'])) {
         if (is_array($queryParameters['edit'])) {
             $shortcut['table'] = key($queryParameters['edit']);
             $shortcut['recordid'] = key($queryParameters['edit'][$shortcut['table']]);
             if ($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'edit') {
                 $shortcut['type'] = 'edit';
                 $shortcutNamePrepend = $languageService->getLL('shortcut_edit', TRUE);
             } elseif ($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'new') {
                 $shortcut['type'] = 'new';
                 $shortcutNamePrepend = $languageService->getLL('shortcut_create', TRUE);
             }
         } else {
             $shortcut['type'] = 'other';
         }
         // Lookup the title of this page and use it as default description
         $pageId = $shortcut['recordid'] ? $shortcut['recordid'] : $this->getLinkedPageId($url);
         if (MathUtility::canBeInterpretedAsInteger($pageId)) {
             $page = BackendUtility::getRecord('pages', $pageId);
             if (count($page)) {
                 // Set the name to the title of the page
                 if ($shortcut['type'] == 'other') {
                     $shortcutName = $page['title'];
                 } else {
                     $shortcutName = $shortcutNamePrepend . ' ' . $languageService->sL($GLOBALS['TCA'][$shortcut['table']]['ctrl']['title']) . ' (' . $page['title'] . ')';
                 }
             }
         } else {
             $dirName = urldecode($pageId);
             if (preg_match('/\\/$/', $dirName)) {
                 // If $pageId is a string and ends with a slash,
                 // assume it is a fileadmin reference and set
                 // the description to the basename of that path
                 $shortcutName .= ' ' . basename($dirName);
             }
         }
         // adding the shortcut
         if ($module && $url) {
             $fieldValues = array('userid' => $this->getBackendUser()->user['uid'], 'module_name' => $module . '|' . $motherModule, 'url' => $url, 'description' => $shortcutName, 'sorting' => $GLOBALS['EXEC_TIME']);
             $databaseConnection->exec_INSERTquery('sys_be_shortcuts', $fieldValues);
             if ($databaseConnection->sql_affected_rows() == 1) {
                 $shortcutCreated = 'success';
             }
         }
         $ajaxObj->addContent('create', $shortcutCreated);
     }
 }
示例#9
0
 /**
  * @param array $arguments
  * @param callable $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  *
  * @return string
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $parameters = GeneralUtility::explodeUrl2Array($arguments['parameters']);
     $parameters['returnUrl'] = 'index.php?M=web_NewsTxNewsM2&id=' . (int) GeneralUtility::_GET('id') . '&moduleToken=' . FormProtectionFactory::get()->generateToken('moduleCall', 'web_NewsTxNewsM2');
     return BackendUtility::getModuleUrl('record_edit', $parameters);
 }
 /**
  * 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 boolean $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 = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET();
             break;
         case 'POST':
             $currentQueryArray = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST();
             break;
         case 'GET,POST':
             $currentQueryArray = array_merge(\TYPO3\CMS\Core\Utility\GeneralUtility::_GET(), \TYPO3\CMS\Core\Utility\GeneralUtility::_POST());
             break;
         case 'POST,GET':
             $currentQueryArray = array_merge(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST(), \TYPO3\CMS\Core\Utility\GeneralUtility::_GET());
             break;
         default:
             $currentQueryArray = \TYPO3\CMS\Core\Utility\GeneralUtility::explodeUrl2Array(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('QUERY_STRING'), TRUE);
     }
     if ($conf['exclude']) {
         $exclude = str_replace(',', '&', $conf['exclude']);
         $exclude = \TYPO3\CMS\Core\Utility\GeneralUtility::explodeUrl2Array($exclude, TRUE);
         // never repeat id
         $exclude['id'] = 0;
         $newQueryArray = \TYPO3\CMS\Core\Utility\GeneralUtility::arrayDiffAssocRecursive($currentQueryArray, $exclude);
     } else {
         $newQueryArray = $currentQueryArray;
     }
     if ($forceOverruleArguments) {
         $newQueryArray = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($newQueryArray, $overruleQueryArguments);
     } else {
         $newQueryArray = \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule($newQueryArray, $overruleQueryArguments, TRUE);
     }
     return \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', $newQueryArray, '', FALSE, TRUE);
 }
 /**
  * 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]);
         }
     }
 }
 /**
  * Registers the Icons into the docheader
  *
  * @return void
  * @throws \InvalidArgumentException
  */
 protected function registerDocheaderButtons()
 {
     /** @var ButtonBar $buttonBar */
     $buttonBar = $this->view->getModuleTemplate()->getDocHeaderComponent()->getButtonBar();
     $currentRequest = $this->request;
     $moduleName = $currentRequest->getPluginName();
     $getVars = $this->request->getArguments();
     $extensionName = $currentRequest->getControllerExtensionName();
     if (count($getVars) === 0) {
         $modulePrefix = strtolower('tx_' . $extensionName . '_' . $moduleName);
         $getVars = array('id', 'M', $modulePrefix);
     }
     $shortcutName = $this->getLanguageService()->sL('LLL:EXT:beuser/Resources/Private/Language/locallang.xml:backendUsers');
     if ($this->request->getControllerName() === 'BackendUser') {
         if ($this->request->getControllerActionName() === 'index') {
             $returnUrl = rawurlencode(BackendUtility::getModuleUrl('system_BeuserTxBeuser'));
             $parameters = GeneralUtility::explodeUrl2Array('edit[be_users][0]=new&returnUrl=' . $returnUrl);
             $addUserLink = BackendUtility::getModuleUrl('record_edit', $parameters);
             $title = $this->getLanguageService()->sL('LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:newRecordGeneral', true);
             $icon = $this->view->getModuleTemplate()->getIconFactory()->getIcon('actions-document-new', Icon::SIZE_SMALL);
             $addUserButton = $buttonBar->makeLinkButton()->setHref($addUserLink)->setTitle($title)->setIcon($icon);
             $buttonBar->addButton($addUserButton, ButtonBar::BUTTON_POSITION_LEFT);
         }
         if ($this->request->getControllerActionName() === 'compare') {
             $addUserLink = BackendUtility::getModuleUrl('system_BeuserTxBeuser');
             $title = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', true);
             $icon = $this->view->getModuleTemplate()->getIconFactory()->getIcon('actions-view-go-back', Icon::SIZE_SMALL);
             $addUserButton = $buttonBar->makeLinkButton()->setHref($addUserLink)->setTitle($title)->setIcon($icon);
             $buttonBar->addButton($addUserButton, ButtonBar::BUTTON_POSITION_LEFT);
         }
         if ($this->request->getControllerActionName() === 'online') {
             $shortcutName = $this->getLanguageService()->sL('LLL:EXT:beuser/Resources/Private/Language/locallang.xml:onlineUsers');
         }
     }
     if ($this->request->getControllerName() === 'BackendUserGroup') {
         $shortcutName = $this->getLanguageService()->sL('LLL:EXT:beuser/Resources/Private/Language/locallang.xml:backendUserGroupsMenu');
         $returnUrl = rawurlencode(BackendUtility::getModuleUrl('system_BeuserTxBeuser', array('tx_beuser_system_beusertxbeuser' => array('action' => 'index', 'controller' => 'BackendUserGroup'))));
         $parameters = GeneralUtility::explodeUrl2Array('edit[be_groups][0]=new&returnUrl=' . $returnUrl);
         $addUserLink = BackendUtility::getModuleUrl('record_edit', $parameters);
         $title = $this->getLanguageService()->sL('LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:newRecordGeneral', true);
         $icon = $this->view->getModuleTemplate()->getIconFactory()->getIcon('actions-document-new', Icon::SIZE_SMALL);
         $addUserGroupButton = $buttonBar->makeLinkButton()->setHref($addUserLink)->setTitle($title)->setIcon($icon);
         $buttonBar->addButton($addUserGroupButton, ButtonBar::BUTTON_POSITION_LEFT);
     }
     $shortcutButton = $buttonBar->makeShortcutButton()->setModuleName($moduleName)->setDisplayName($shortcutName)->setGetVariables($getVars);
     $buttonBar->addButton($shortcutButton);
 }
示例#13
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);
 }
示例#14
0
 /**
  * Returns a URL to link to FormEngine
  *
  * @param array $arguments
  * @param \Closure $renderChildrenClosure
  * @param RenderingContextInterface $renderingContext
  *
  * @see \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl()
  * @return string URL to FormEngine module + parameters
  */
 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 {
     $parameters = GeneralUtility::explodeUrl2Array($arguments['parameters']);
     return BackendUtility::getModuleUrl('record_edit', $parameters);
 }
示例#15
0
 /**
 * Merge all TypoScript for the typoLink from the global and local defined settings.
 
 *
 *@param array $linkConfigurationArray Global defined TypoScript cofiguration for the linkHandler
 * @param array $typoLinkConfigurationArray Local typolink TypoScript configuration for current link
 * @param string $recordTableName The name of database table
 * @access protected
 * @return array
 */
 protected function mergeTypoScript(array $linkConfigurationArray, array $typoLinkConfigurationArray, $recordTableName)
 {
     // precompile the "additionalParams"
     $linkConfigurationArray[$recordTableName . '.']['additionalParams'] = $this->localContentObject->stdWrap($linkConfigurationArray[$recordTableName . '.']['additionalParams'], $linkConfigurationArray[$recordTableName . '.']['additionalParams.']);
     unset($linkConfigurationArray[$recordTableName . '.']['additionalParams.']);
     // merge recursive the "additionalParams" from "$typoScriptConfiguration" with the "$typoLinkConfigurationArray"
     if (array_key_exists('additionalParams', $typoLinkConfigurationArray)) {
         $typoLinkConfigurationArray['additionalParams'] = \TYPO3\CMS\Core\Utility\GeneralUtility::implodeArrayForUrl('', \TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule(\TYPO3\CMS\Core\Utility\GeneralUtility::explodeUrl2Array($linkConfigurationArray[$recordTableName . '.']['additionalParams']), \TYPO3\CMS\Core\Utility\GeneralUtility::explodeUrl2Array($typoLinkConfigurationArray['additionalParams'])));
     }
     /**
      * @internal Merge the linkhandler configuration from $typoScriptConfiguration with the current $typoLinkConfiguration.
      */
     if (is_array($typoLinkConfigurationArray) && !empty($typoLinkConfigurationArray)) {
         if (array_key_exists('parameter.', $typoLinkConfigurationArray)) {
             unset($typoLinkConfigurationArray['parameter.']);
         }
         $linkConfigurationArray[$recordTableName . '.'] = array_merge($linkConfigurationArray[$recordTableName . '.'], $typoLinkConfigurationArray);
     }
     return $linkConfigurationArray[$recordTableName . '.'];
 }
示例#16
0
 /**
  * Builds the URI, backend flavour
  * The resulting URI is relative and starts with "index.php".
  * The settings pageUid, pageType, noCache, useCacheHash & linkAccessRestrictedPages
  * will be ignored in the backend.
  *
  * @return string The URI
  */
 public function buildBackendUri()
 {
     if ($this->addQueryString === true) {
         if ($this->addQueryStringMethod) {
             switch ($this->addQueryStringMethod) {
                 case 'GET':
                     $arguments = GeneralUtility::_GET();
                     break;
                 case 'POST':
                     $arguments = GeneralUtility::_POST();
                     break;
                 case 'GET,POST':
                     $arguments = array_replace_recursive(GeneralUtility::_GET(), GeneralUtility::_POST());
                     break;
                 case 'POST,GET':
                     $arguments = array_replace_recursive(GeneralUtility::_POST(), GeneralUtility::_GET());
                     break;
                 default:
                     $arguments = GeneralUtility::explodeUrl2Array(GeneralUtility::getIndpEnv('QUERY_STRING'), true);
             }
         } else {
             $arguments = GeneralUtility::_GET();
         }
         foreach ($this->argumentsToBeExcludedFromQueryString as $argumentToBeExcluded) {
             $argumentToBeExcluded = GeneralUtility::explodeUrl2Array($argumentToBeExcluded, true);
             $arguments = ArrayUtility::arrayDiffAssocRecursive($arguments, $argumentToBeExcluded);
         }
     } else {
         $arguments = array('M' => GeneralUtility::_GP('M'), 'id' => GeneralUtility::_GP('id'));
     }
     ArrayUtility::mergeRecursiveWithOverrule($arguments, $this->arguments);
     $arguments = $this->convertDomainObjectsToIdentityArrays($arguments);
     $this->lastArguments = $arguments;
     $moduleName = $arguments['M'];
     unset($arguments['M'], $arguments['moduleToken']);
     $backendUriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
     if ($this->request instanceof WebRequest && $this->createAbsoluteUri) {
         $uri = (string) $backendUriBuilder->buildUriFromModule($moduleName, $arguments, \TYPO3\CMS\Backend\Routing\UriBuilder::ABSOLUTE_URL);
     } else {
         $uri = (string) $backendUriBuilder->buildUriFromModule($moduleName, $arguments);
     }
     if ($this->section !== '') {
         $uri .= '#' . $this->section;
     }
     return $uri;
 }
 /**
  * Main function of the class, will run the function call process.
  *
  * See class documentation for more information.
  */
 public function run()
 {
     $content = null;
     $this->objectManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Object\\ObjectManager');
     // Bootstrap initialization.
     Bootstrap::getInstance()->initializeTypo3DbGlobal()->applyAdditionalConfigurationSettings()->initializeBackendUser();
     // Gets the Ajax call parameters.
     $arguments = GeneralUtility::_GP('request');
     // Checking if the real arguments are serialized.
     if (is_array($arguments) && array_key_exists('arguments', $arguments)) {
         if (array_key_exists('serialized', $arguments['arguments']) && array_key_exists('value', $arguments['arguments'])) {
             $arguments['arguments'] = GeneralUtility::explodeUrl2Array($arguments['arguments']['value'], true);
         }
     }
     $id = isset($arguments['id']) ? $arguments['id'] : 0;
     // Initializing TypoScript Frontend Controller.
     if (TYPO3_MODE == 'FE') {
         // Creating global time tracker.
         $GLOBALS['TT'] = $this->objectManager->get('TYPO3\\CMS\\Core\\TimeTracker\\TimeTracker');
         $this->initializeTSFE($id);
     } else {
         Bootstrap::getInstance()->loadExtensionTables();
     }
     // If the argument "mvc" is sent, then we should be able to call a controller.
     if (isset($arguments['mvc'])) {
         $content = $this->callExtbaseController($arguments);
     }
     // If the argument "function" is sent, we call a user function.
     if (isset($arguments['function'])) {
         $content = $this->callUserFunction($arguments);
     }
     // If the argument "function" is sent, we call a user function.
     if (isset($arguments['typoScriptLib'])) {
         $content = $this->callTypoScriptLibrary($arguments, $id);
     }
     if (TYPO3_MODE == 'FE') {
         $content = $this->manageInternalObjects($content);
     }
     // Display the final content on screen.
     echo $content;
     die;
 }
 /**
  * The mother of all functions creating links/URLs etc in a TypoScript environment.
  * See the references below.
  * Basically this function takes care of issues such as type,id,alias and Mount Points, URL rewriting (through hooks), M5/B6 encoded parameters etc.
  * It is important to pass all links created through this function since this is the guarantee that globally configured settings for link creating are observed and that your applications will conform to the various/many configuration options in TypoScript Templates regarding this.
  *
  * @param array $page The page record of the page to which we are creating a link. Needed due to fields like uid, alias, target, no_cache, title and sectionIndex_uid.
  * @param string $oTarget Default target string to use IF not $page['target'] is set.
  * @param boolean $no_cache If set, then the "&no_cache=1" parameter is included in the URL.
  * @param string $script Alternative script name if you don't want to use $GLOBALS['TSFE']->config['mainScript'] (normally set to "index.php")
  * @param array $overrideArray Array with overriding values for the $page array.
  * @param string $addParams Additional URL parameters to set in the URL. Syntax is "&foo=bar&foo2=bar2" etc. Also used internally to add parameters if needed.
  * @param string $typeOverride If you set this value to something else than a blank string, then the typeNumber used in the link will be forced to this value. Normally the typeNum is based on the target set OR on $GLOBALS['TSFE']->config['config']['forceTypeValue'] if found.
  * @param string $targetDomain The target Doamin, if any was detected in typolink
  * @return array Contains keys like "totalURL", "url", "sectionIndex", "linkVars", "no_cache", "type", "target" of which "totalURL" is normally the value you would use while the other keys contains various parts that was used to construct "totalURL
  * @see \TYPO3\CMS\Frontend\Page\FramesetRenderer::frameParams(), \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::typoLink(), \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::SEARCHRESULT(), TSpagegen::pagegenInit(), \TYPO3\CMS\Frontend\ContentObject\Menu\AbstractMenuContentObject::link()
  * @todo Define visibility
  */
 public function linkData($page, $oTarget, $no_cache, $script, $overrideArray = NULL, $addParams = '', $typeOverride = '', $targetDomain = '')
 {
     $LD = array();
     // Overriding some fields in the page record and still preserves the values by adding them as parameters. Little strange function.
     if (is_array($overrideArray)) {
         foreach ($overrideArray as $theKey => $theNewVal) {
             $addParams .= '&real_' . $theKey . '=' . rawurlencode($page[$theKey]);
             $page[$theKey] = $theNewVal;
         }
     }
     // Adding Mount Points, "&MP=", parameter for the current page if any is set:
     if (!strstr($addParams, '&MP=')) {
         // Looking for hardcoded defaults:
         if (trim($GLOBALS['TSFE']->MP_defaults[$page['uid']])) {
             $addParams .= '&MP=' . rawurlencode(trim($GLOBALS['TSFE']->MP_defaults[$page['uid']]));
         } elseif ($GLOBALS['TSFE']->config['config']['MP_mapRootPoints']) {
             // Else look in automatically created map:
             $m = $this->getFromMPmap($page['uid']);
             if ($m) {
                 $addParams .= '&MP=' . rawurlencode($m);
             }
         }
     }
     // Setting ID/alias:
     if (!$script) {
         $script = $GLOBALS['TSFE']->config['mainScript'];
     }
     if ($page['alias']) {
         $LD['url'] = $script . '?id=' . rawurlencode($page['alias']);
     } else {
         $LD['url'] = $script . '?id=' . $page['uid'];
     }
     // Setting target
     $LD['target'] = trim($page['target']) ?: $oTarget;
     // typeNum
     $typeNum = $this->setup[$LD['target'] . '.']['typeNum'];
     if (!\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($typeOverride) && (int) $GLOBALS['TSFE']->config['config']['forceTypeValue']) {
         $typeOverride = (int) $GLOBALS['TSFE']->config['config']['forceTypeValue'];
     }
     if ((string) $typeOverride !== '') {
         $typeNum = $typeOverride;
     }
     // Override...
     if ($typeNum) {
         $LD['type'] = '&type=' . (int) $typeNum;
     } else {
         $LD['type'] = '';
     }
     // Preserving the type number.
     $LD['orig_type'] = $LD['type'];
     // noCache
     $LD['no_cache'] = trim($page['no_cache']) || $no_cache ? '&no_cache=1' : '';
     // linkVars
     if ($GLOBALS['TSFE']->config['config']['uniqueLinkVars']) {
         if ($addParams) {
             $LD['linkVars'] = GeneralUtility::implodeArrayForUrl('', GeneralUtility::explodeUrl2Array($GLOBALS['TSFE']->linkVars . $addParams), '', FALSE, TRUE);
         } else {
             $LD['linkVars'] = $GLOBALS['TSFE']->linkVars;
         }
     } else {
         $LD['linkVars'] = $GLOBALS['TSFE']->linkVars . $addParams;
     }
     // Add absRefPrefix if exists.
     $LD['url'] = $GLOBALS['TSFE']->absRefPrefix . $LD['url'];
     // If the special key 'sectionIndex_uid' (added 'manually' in tslib/menu.php to the page-record) is set, then the link jumps directly to a section on the page.
     $LD['sectionIndex'] = $page['sectionIndex_uid'] ? '#c' . $page['sectionIndex_uid'] : '';
     // Compile the normal total url
     $LD['totalURL'] = $this->removeQueryString($LD['url'] . $LD['type'] . $LD['no_cache'] . $LD['linkVars'] . $GLOBALS['TSFE']->getMethodUrlIdToken) . $LD['sectionIndex'];
     // Call post processing function for link rendering:
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tstemplate.php']['linkData-PostProc'])) {
         $_params = array('LD' => &$LD, 'args' => array('page' => $page, 'oTarget' => $oTarget, 'no_cache' => $no_cache, 'script' => $script, 'overrideArray' => $overrideArray, 'addParams' => $addParams, 'typeOverride' => $typeOverride, 'targetDomain' => $targetDomain), 'typeNum' => $typeNum);
         foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tstemplate.php']['linkData-PostProc'] as $_funcRef) {
             GeneralUtility::callUserFunction($_funcRef, $_params, $this);
         }
     }
     // Return the LD-array
     return $LD;
 }
 /**
  * action show
  *
  * @return void
  */
 public function showAction()
 {
     $viewAssign = array();
     // add css file
     if (!empty($this->settings['cssFile'])) {
         $filename = $this->settings['cssFile'];
         // resolve EXT: to path
         if (substr($filename, 0, 4) == 'EXT:') {
             list($extKey, $local) = explode('/', substr($filename, 4), 2);
             $filename = '';
             if (strcmp($extKey, '') && ExtensionManagementUtility::isLoaded($extKey) && strcmp($local, '')) {
                 $filename = ExtensionManagementUtility::siteRelPath($extKey) . $local;
             }
         }
         if (!empty($filename)) {
             $this->response->addAdditionalHeaderData($this->wrapCssFile($filename));
         }
     }
     // get default settings from template-setup
     $viewAssign['width'] = $this->settings['width'];
     $viewAssign['height'] = $this->settings['height'];
     // get settings flexform (flexform overrides template-setup if available)
     $viewAssign['id'] = $this->settings[id];
     if (!empty($this->settings['flex_width'])) {
         $viewAssign['width'] = $this->settings['flex_width'];
     }
     if (!empty($this->settings['flex_height'])) {
         $viewAssign['height'] = $this->settings['flex_height'];
     }
     // calculate padding-bottom inline-style for video-container
     $viewAssign['paddingBottom'] = $viewAssign['height'] / $viewAssign['width'] * 100;
     // get player parameters
     $playerParameters = '';
     $enableHtml5 = false;
     $viewAssign['allowfullscreen'] = '';
     // html5
     if ($this->settings['flex_html5'] == -1 && $this->settings['html5'] == 1 || $this->settings['flex_html5'] == 1) {
         $playerParameters .= '&html5=1';
         $enableHtml5 = true;
     }
     // end (end time in seconds - only supported in flash-player)
     /*if(!$enableHtml5 && !empty($this->settings[end])) {
     			if(strstr($this->settings[end], ':')) {
     				$endArray = explode(':', $this->settings[end]);
     				$endSeconds = ($endArray[0] * 60) + $endArray[1];
     				$playerParameters .= '&end='.$endSeconds;
     			} else {
     				$playerParameters .= '&end='.$this->settings[end];
     			}
     		}*/
     // fs (fullscreen)
     if (!$enableHtml5 && !$this->settings['allowfullscreen']) {
         $playerParameters .= '&fs=0';
     } else {
         if ($enableHtml5 && $this->settings['allowfullscreen']) {
             $viewAssign['allowfullscreen'] = 'allowfullscreen';
         }
     }
     // rel (related videos)
     if ($this->settings[rel] == 0) {
         $playerParameters .= '&rel=0';
     }
     //start (start time in seconds)
     /*if(!empty($this->settings[start])) {
     			if(strstr($this->settings[start], ':')) {
     				$startArray = explode(':', $this->settings[start]);
     				$startSeconds = ($startArray[0] * 60) + $startArray[1];
     				$playerParameters .= '&start='.$startSeconds;
     			} else {
     				$playerParameters .= '&start='.$this->settings[start];
     			}
     		}*/
     // merge default- and custom-parameters
     $defaultPlayerParameters = $this->settings['defaultPlayerParameters'];
     $customPlayerParameters = GeneralUtility::explodeUrl2Array($this->settings['flex_customParameters']);
     $mergedPlayerParameters = array_merge($defaultPlayerParameters, $customPlayerParameters);
     $playerParameters .= '' . GeneralUtility::implodeArrayForUrl('', $mergedPlayerParameters);
     if ($playerParameters != '') {
         // remove first '&' and prepend '?'
         $viewAssign['playerParameters'] = '?' . substr($playerParameters, 1);
     }
     // assign array to fluid-template
     $this->view->assignMultiple($viewAssign);
 }
 /**
  * Returns the link url parameters that should be added to a facet as array.
  *
  * plugin.tx_solr.search.faceting.facetLinkUrlParameters
  *
  * @param array $defaultIfEmpty
  * @return array
  */
 public function getSearchFacetingFacetLinkUrlParametersAsArray($defaultIfEmpty = array())
 {
     $linkUrlParameters = $this->getSearchFacetingFacetLinkUrlParameters();
     if ($linkUrlParameters === '') {
         return $defaultIfEmpty;
     }
     return GeneralUtility::explodeUrl2Array($linkUrlParameters);
 }
 /**
  * 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;
 }
示例#22
0
 /**
  * Creates a shortcut through an AJAX call
  *
  * @param ServerRequestInterface $request
  * @param ResponseInterface $response
  * @return ResponseInterface
  */
 public function createShortcutAction(ServerRequestInterface $request, ResponseInterface $response)
 {
     $languageService = $this->getLanguageService();
     $parsedBody = $request->getParsedBody();
     $queryParams = $request->getQueryParams();
     // Default name
     $shortcutName = 'Shortcut';
     $shortcutNamePrepend = '';
     $url = isset($parsedBody['url']) ? $parsedBody['url'] : $queryParams['url'];
     // Use given display name
     if (!empty($parsedBody['displayName'])) {
         $shortcutName = $parsedBody['displayName'];
     }
     // Determine shortcut type
     $url = rawurldecode($url);
     $queryParts = parse_url($url);
     $queryParameters = GeneralUtility::explodeUrl2Array($queryParts['query'], true);
     // Proceed only if no scheme is defined, as URL is expected to be relative
     if (empty($queryParts['scheme'])) {
         if (is_array($queryParameters['edit'])) {
             $shortcut['table'] = key($queryParameters['edit']);
             $shortcut['recordid'] = key($queryParameters['edit'][$shortcut['table']]);
             $shortcut['pid'] = BackendUtility::getRecord($shortcut['table'], $shortcut['recordid'])['pid'];
             if ($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'edit') {
                 $shortcut['type'] = 'edit';
                 $shortcutNamePrepend = htmlspecialchars($languageService->getLL('shortcut_edit'));
             } elseif ($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'new') {
                 $shortcut['type'] = 'new';
                 $shortcutNamePrepend = htmlspecialchars($languageService->getLL('shortcut_create'));
             }
         } else {
             $shortcut['type'] = 'other';
             $shortcut['table'] = '';
             $shortcut['recordid'] = 0;
         }
         // Check if given id is a combined identifier
         if (!empty($queryParameters['id']) && preg_match('/^[0-9]+:/', $queryParameters['id'])) {
             try {
                 $resourceFactory = ResourceFactory::getInstance();
                 $resource = $resourceFactory->getObjectFromCombinedIdentifier($queryParameters['id']);
                 $shortcutName = trim($shortcutNamePrepend . ' ' . $resource->getName());
             } catch (ResourceDoesNotExistException $e) {
             }
         } else {
             // Lookup the title of this page and use it as default description
             $pageId = (int) ($shortcut['pid'] ?: ($shortcut['recordid'] ?: $this->getLinkedPageId($url)));
             $page = false;
             if ($pageId) {
                 $page = BackendUtility::getRecord('pages', $pageId);
             }
             if (!empty($page)) {
                 // Set the name to the title of the page
                 if ($shortcut['type'] === 'other') {
                     if (empty($shortcutName)) {
                         $shortcutName = $page['title'];
                     } else {
                         $shortcutName .= ' (' . $page['title'] . ')';
                     }
                 } else {
                     $shortcutName = $shortcutNamePrepend . ' ' . $languageService->sL($GLOBALS['TCA'][$shortcut['table']]['ctrl']['title']) . ' (' . $page['title'] . ')';
                 }
             } elseif ($shortcut['table'] !== '' && $shortcut['type'] !== 'other') {
                 $shortcutName = $shortcutNamePrepend . ' ' . $languageService->sL($GLOBALS['TCA'][$shortcut['table']]['ctrl']['title']);
             }
         }
         return $this->tryAddingTheShortcut($response, $url, $shortcutName);
     }
 }
 /**
  * Analyzes the parameters to find if the link needs a cHash parameter.
  *
  * @param string $queryString
  * @return void
  */
 protected function analyzeCacheHashRequirements($queryString)
 {
     $parameters = \TYPO3\CMS\Core\Utility\GeneralUtility::explodeUrl2Array($queryString);
     if (count($parameters) > 0) {
         $cacheHashCalculator = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\CacheHashCalculator');
         /** @var \TYPO3\CMS\Frontend\Page\CacheHashCalculator $cacheHashCalculator */
         $cHashParameters = $cacheHashCalculator->getRelevantParameters($queryString);
         if (count($cHashParameters) > 1) {
             $this->useCacheHash = $GLOBALS['TYPO3_CONF_VARS']['FE']['disableNoCacheParameter'] || !isset($parameters['no_cache']) || !$parameters['no_cache'];
         }
     }
 }
 /**
  * @test
  * @dataProvider explodeUrl2ArrayDataProvider
  */
 public function explodeUrl2ArrayTransformsParameterStringToFlatArray($input, $expected)
 {
     $this->assertEquals($expected, Utility\GeneralUtility::explodeUrl2Array($input, FALSE));
 }
 /**
  * Analyzes the parameters to find if the link needs a cHash parameter.
  *
  * @param string $queryString
  * @return void
  */
 protected function analyzeCacheHashRequirements($queryString)
 {
     $parameters = GeneralUtility::explodeUrl2Array($queryString);
     if (!empty($parameters)) {
         /** @var CacheHashCalculator $cacheHashCalculator */
         $cacheHashCalculator = GeneralUtility::makeInstance(CacheHashCalculator::class);
         $cHashParameters = $cacheHashCalculator->getRelevantParameters($queryString);
         if (count($cHashParameters) > 1) {
             $this->useCacheHash = $GLOBALS['TYPO3_CONF_VARS']['FE']['disableNoCacheParameter'] || !isset($parameters['no_cache']) || !$parameters['no_cache'];
         }
     }
 }
示例#26
0
 /**
  * Builds the URI, backend flavour
  * The resulting URI is relative and starts with "mod.php".
  * The settings pageUid, pageType, noCache, useCacheHash & linkAccessRestrictedPages
  * will be ignored in the backend.
  *
  * @return string The URI
  */
 public function buildBackendUri()
 {
     if ($this->addQueryString === TRUE) {
         if ($this->addQueryStringMethod) {
             switch ($this->addQueryStringMethod) {
                 case 'GET':
                     $arguments = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET();
                     break;
                 case 'POST':
                     $arguments = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST();
                     break;
                 case 'GET,POST':
                     $arguments = array_replace_recursive(\TYPO3\CMS\Core\Utility\GeneralUtility::_GET(), \TYPO3\CMS\Core\Utility\GeneralUtility::_POST());
                     break;
                 case 'POST,GET':
                     $arguments = array_replace_recursive(\TYPO3\CMS\Core\Utility\GeneralUtility::_POST(), \TYPO3\CMS\Core\Utility\GeneralUtility::_GET());
                     break;
                 default:
                     $arguments = \TYPO3\CMS\Core\Utility\GeneralUtility::explodeUrl2Array(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('QUERY_STRING'), TRUE);
             }
         } else {
             $arguments = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET();
         }
         foreach ($this->argumentsToBeExcludedFromQueryString as $argumentToBeExcluded) {
             $argumentToBeExcluded = \TYPO3\CMS\Core\Utility\GeneralUtility::explodeUrl2Array($argumentToBeExcluded, TRUE);
             $arguments = \TYPO3\CMS\Core\Utility\GeneralUtility::arrayDiffAssocRecursive($arguments, $argumentToBeExcluded);
         }
     } else {
         $arguments = array('M' => \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('M'), 'id' => \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id'));
     }
     \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($arguments, $this->arguments);
     $arguments = $this->convertDomainObjectsToIdentityArrays($arguments);
     $this->lastArguments = $arguments;
     $moduleName = $arguments['M'];
     unset($arguments['M'], $arguments['moduleToken']);
     $uri = BackendUtility::getModuleUrl($moduleName, $arguments, '');
     if ($this->section !== '') {
         $uri .= '#' . $this->section;
     }
     if ($this->createAbsoluteUri === TRUE) {
         $uri = $this->request->getBaseUri() . $uri;
     }
     return $uri;
 }
示例#27
0
 /**
  * Renders facets selected by the user.
  *
  * @return string rendered selected facets subpart
  */
 protected function renderUsedFacets()
 {
     $template = clone $this->parentPlugin->getTemplate();
     $template->workOnSubpart('used_facets');
     $query = $this->search->getQuery();
     $queryLinkBuilder = GeneralUtility::makeInstance('ApacheSolrForTypo3\\Solr\\Query\\LinkBuilder', $this->search->getQuery());
     /* @var $queryLinkBuilder LinkBuilder */
     $queryLinkBuilder->setLinkTargetPageId($this->parentPlugin->getLinkTargetPageId());
     // URL parameters added to facet URLs may not need to be added to the facets reset URL
     if (!empty($this->configuration['search.']['faceting.']['facetLinkUrlParameters']) && isset($this->configuration['search.']['faceting.']['facetLinkUrlParameters.']['useForFacetResetLinkUrl']) && $this->configuration['search.']['faceting.']['facetLinkUrlParameters.']['useForFacetResetLinkUrl'] === '0') {
         $addedUrlParameters = GeneralUtility::explodeUrl2Array($this->configuration['search.']['faceting.']['facetLinkUrlParameters']);
         $addedUrlParameterKeys = array_keys($addedUrlParameters);
         foreach ($addedUrlParameterKeys as $addedUrlParameterKey) {
             if (GeneralUtility::isFirstPartOfStr($addedUrlParameterKey, 'tx_solr')) {
                 $addedUrlParameterKey = substr($addedUrlParameterKey, 8, -1);
                 $queryLinkBuilder->addUnwantedUrlParameter($addedUrlParameterKey);
             }
         }
     }
     $resultParameters = GeneralUtility::_GET('tx_solr');
     $filterParameters = array();
     if (isset($resultParameters['filter'])) {
         $filterParameters = (array) array_map('urldecode', $resultParameters['filter']);
     }
     $facetsInUse = array();
     foreach ($filterParameters as $filter) {
         // only split by the first ":" to allow the use of colons in the filter value
         list($filterName, $filterValue) = explode(':', $filter, 2);
         $facetConfiguration = $this->configuration['search.']['faceting.']['facets.'][$filterName . '.'];
         // don't render facets that should not be included in used facets
         if (isset($facetConfiguration['includeInUsedFacets']) && $facetConfiguration['includeInUsedFacets'] == '0') {
             continue;
         }
         $usedFacetRenderer = GeneralUtility::makeInstance('ApacheSolrForTypo3\\Solr\\Facet\\UsedFacetRenderer', $filterName, $filterValue, $filter, $this->parentPlugin->getTemplate(), $query);
         $usedFacetRenderer->setLinkTargetPageId($this->parentPlugin->getLinkTargetPageId());
         $facetToRemove = $usedFacetRenderer->render();
         $facetsInUse[] = $facetToRemove;
     }
     $template->addLoop('facets_in_use', 'remove_facet', $facetsInUse);
     $template->addVariable('remove_all_facets', array('url' => $queryLinkBuilder->getQueryUrl(array('filter' => array())), 'text' => '###LLL:faceting_removeAllFilters###'));
     $content = '';
     if (count($facetsInUse)) {
         $content = $template->render();
     }
     return $content;
 }
示例#28
0
 /**
  * Get statistics from DB and compile them.
  *
  * @param array $row DB record
  *
  * @return string Statistics of a mail
  */
 function cmd_stats($row)
 {
     if (GeneralUtility::_GP("recalcCache")) {
         $this->makeStatTempTableContent($row);
     }
     $thisurl = BackendUtility::getModuleUrl('txdirectmailM1_txdirectmailM4') . '&id=' . $this->id . '&sys_dmail_uid=' . $row['uid'] . '&CMD=' . $this->CMD . '&recalcCache=1';
     $output = $this->directMail_compactView($row);
     // *****************************
     // Mail responses, general:
     // *****************************
     $mailingId = intval($row['uid']);
     $queryArray = array('response_type,count(*) as counter', 'sys_dmail_maillog', 'mid=' . $mailingId, 'response_type');
     $table = $this->getQueryRows($queryArray, 'response_type');
     // Plaintext/HTML
     $res = $GLOBALS["TYPO3_DB"]->exec_SELECTquery('html_sent,count(*) as counter', 'sys_dmail_maillog', 'mid=' . $mailingId . ' AND response_type=0', 'html_sent');
     $textHtml = array();
     while ($row2 = $GLOBALS["TYPO3_DB"]->sql_fetch_assoc($res)) {
         // 0:No mail; 1:HTML; 2:TEXT; 3:HTML+TEXT
         $textHtml[$row2['html_sent']] = $row2['counter'];
     }
     $GLOBALS["TYPO3_DB"]->sql_free_result($res);
     // Unique responses, html
     $res = $GLOBALS["TYPO3_DB"]->exec_SELECTquery('count(*) as counter', 'sys_dmail_maillog', 'mid=' . $mailingId . ' AND response_type=1', 'rid,rtbl', 'counter');
     $uniqueHtmlResponses = $GLOBALS["TYPO3_DB"]->sql_num_rows($res);
     $GLOBALS["TYPO3_DB"]->sql_free_result($res);
     // Unique responses, Plain
     $res = $GLOBALS["TYPO3_DB"]->exec_SELECTquery('count(*) as counter', 'sys_dmail_maillog', 'mid=' . $mailingId . ' AND response_type=2', 'rid,rtbl', 'counter');
     $uniquePlainResponses = $GLOBALS["TYPO3_DB"]->sql_num_rows($res);
     $GLOBALS["TYPO3_DB"]->sql_free_result($res);
     // Unique responses, pings
     $res = $GLOBALS["TYPO3_DB"]->exec_SELECTquery('count(*) as counter', 'sys_dmail_maillog', 'mid=' . $mailingId . ' AND response_type=-1', 'rid,rtbl', 'counter');
     $uniquePingResponses = $GLOBALS["TYPO3_DB"]->sql_num_rows($res);
     $GLOBALS["TYPO3_DB"]->sql_free_result($res);
     $tblLines = array();
     $tblLines[] = array('', $this->getLanguageService()->getLL('stats_total'), $this->getLanguageService()->getLL('stats_HTML'), $this->getLanguageService()->getLL('stats_plaintext'));
     $totalSent = intval($textHtml['1'] + $textHtml['2'] + $textHtml['3']);
     $htmlSent = intval($textHtml['1'] + $textHtml['3']);
     $plainSent = intval($textHtml['2']);
     $tblLines[] = array($this->getLanguageService()->getLL('stats_mails_sent'), $totalSent, $htmlSent, $plainSent);
     $tblLines[] = array($this->getLanguageService()->getLL('stats_mails_returned'), $this->showWithPercent($table['-127']['counter'], $totalSent));
     $tblLines[] = array($this->getLanguageService()->getLL('stats_HTML_mails_viewed'), '', $this->showWithPercent($uniquePingResponses, $htmlSent));
     $tblLines[] = array($this->getLanguageService()->getLL('stats_unique_responses'), $this->showWithPercent($uniqueHtmlResponses + $uniquePlainResponses, $totalSent), $this->showWithPercent($uniqueHtmlResponses, $htmlSent), $this->showWithPercent($uniquePlainResponses, $plainSent ? $plainSent : $htmlSent));
     $output .= '<br /><h2>' . $this->getLanguageService()->getLL('stats_general_information') . '</h2>';
     $output .= DirectMailUtility::formatTable($tblLines, array('nowrap', 'nowrap', 'nowrap', 'nowrap'), 1, array());
     // ******************
     // Links:
     // ******************
     // initialize $urlCounter
     $urlCounter = array('total' => array(), 'plain' => array(), 'html' => array());
     // Most popular links, html:
     $queryArray = array('url_id,count(*) as counter', 'sys_dmail_maillog', 'mid=' . intval($row['uid']) . ' AND response_type=1', 'url_id', 'counter');
     $htmlUrlsTable = $this->getQueryRows($queryArray, 'url_id');
     // Most popular links, plain:
     $queryArray = array('url_id,count(*) as counter', 'sys_dmail_maillog', 'mid=' . intval($row['uid']) . ' AND response_type=2', 'url_id', 'counter');
     $plainUrlsTable = $this->getQueryRows($queryArray, 'url_id');
     // Find urls:
     $unpackedMail = unserialize(base64_decode($row['mailContent']));
     // this array will include a unique list of all URLs that are used in the mailing
     $urlArr = array();
     $urlMd5Map = array();
     if (is_array($unpackedMail['html']['hrefs'])) {
         foreach ($unpackedMail['html']['hrefs'] as $k => $v) {
             // convert &amp; of query params back
             $urlArr[$k] = html_entity_decode($v['absRef']);
             $urlMd5Map[md5($v['absRef'])] = $k;
         }
     }
     if (is_array($unpackedMail['plain']['link_ids'])) {
         foreach ($unpackedMail['plain']['link_ids'] as $k => $v) {
             $urlArr[intval(-$k)] = $v;
         }
     }
     // Traverse plain urls:
     $mappedPlainUrlsTable = array();
     foreach ($plainUrlsTable as $id => $c) {
         $url = $urlArr[intval($id)];
         if (isset($urlMd5Map[md5($url)])) {
             $mappedPlainUrlsTable[$urlMd5Map[md5($url)]] = $c;
         } else {
             $mappedPlainUrlsTable[$id] = $c;
         }
     }
     $urlCounter['total'] = array();
     // Traverse html urls:
     $urlCounter['html'] = array();
     if (count($htmlUrlsTable) > 0) {
         foreach ($htmlUrlsTable as $id => $c) {
             $urlCounter['html'][$id]['counter'] = $urlCounter['total'][$id]['counter'] = $c['counter'];
         }
     }
     // Traverse plain urls:
     $urlCounter['plain'] = array();
     foreach ($mappedPlainUrlsTable as $id => $c) {
         // Look up plain url in html urls
         $htmlLinkFound = FALSE;
         foreach ($urlCounter['html'] as $htmlId => $_) {
             if ($urlArr[$id] == $urlArr[$htmlId]) {
                 $urlCounter['html'][$htmlId]['plainId'] = $id;
                 $urlCounter['html'][$htmlId]['plainCounter'] = $c['counter'];
                 $urlCounter['total'][$htmlId]['counter'] = $urlCounter['total'][$htmlId]['counter'] + $c['counter'];
                 $htmlLinkFound = TRUE;
                 break;
             }
         }
         if (!$htmlLinkFound) {
             $urlCounter['plain'][$id]['counter'] = $c['counter'];
             $urlCounter['total'][$id]['counter'] = $urlCounter['total'][$id]['counter'] + $c['counter'];
         }
     }
     $tblLines = array();
     $tblLines[] = array('', $this->getLanguageService()->getLL('stats_total'), $this->getLanguageService()->getLL('stats_HTML'), $this->getLanguageService()->getLL('stats_plaintext'));
     $tblLines[] = array($this->getLanguageService()->getLL('stats_total_responses'), $table['1']['counter'] + $table['2']['counter'], $table['1']['counter'] ? $table['1']['counter'] : '0', $table['2']['counter'] ? $table['2']['counter'] : '0');
     $tblLines[] = array($this->getLanguageService()->getLL('stats_unique_responses'), $this->showWithPercent($uniqueHtmlResponses + $uniquePlainResponses, $totalSent), $this->showWithPercent($uniqueHtmlResponses, $htmlSent), $this->showWithPercent($uniquePlainResponses, $plainSent ? $plainSent : $htmlSent));
     $tblLines[] = array($this->getLanguageService()->getLL('stats_links_clicked_per_respondent'), $uniqueHtmlResponses + $uniquePlainResponses ? number_format(($table['1']['counter'] + $table['2']['counter']) / ($uniqueHtmlResponses + $uniquePlainResponses), 2) : '-', $uniqueHtmlResponses ? number_format($table['1']['counter'] / $uniqueHtmlResponses, 2) : '-', $uniquePlainResponses ? number_format($table['2']['counter'] / $uniquePlainResponses, 2) : '-');
     $output .= '<br /><h2>' . $this->getLanguageService()->getLL('stats_response') . '</h2>';
     $output .= DirectMailUtility::formatTable($tblLines, array('nowrap', 'nowrap', 'nowrap', 'nowrap'), 1, array(0, 0, 0, 0));
     arsort($urlCounter['total']);
     arsort($urlCounter['html']);
     arsort($urlCounter['plain']);
     reset($urlCounter['total']);
     $tblLines = array();
     $tblLines[] = array('', $this->getLanguageService()->getLL('stats_HTML_link_nr'), $this->getLanguageService()->getLL('stats_plaintext_link_nr'), $this->getLanguageService()->getLL('stats_total'), $this->getLanguageService()->getLL('stats_HTML'), $this->getLanguageService()->getLL('stats_plaintext'), '');
     // HTML mails
     if (intval($row['sendOptions']) & 0x2) {
         $htmlContent = $unpackedMail['html']['content'];
         $htmlLinks = array();
         if (is_array($unpackedMail['html']['hrefs'])) {
             foreach ($unpackedMail['html']['hrefs'] as $jumpurlId => $data) {
                 $htmlLinks[$jumpurlId] = array('url' => $data['ref'], 'label' => '');
             }
         }
         // Parse mail body
         $dom = new \DOMDocument();
         @$dom->loadHTML($htmlContent);
         $links = array();
         // Get all links
         foreach ($dom->getElementsByTagName('a') as $node) {
             $links[] = $node;
         }
         // Process all links found
         foreach ($links as $link) {
             /* @var \DOMElement $link */
             $url = $link->getAttribute('href');
             if (empty($url)) {
                 // Drop a tags without href
                 continue;
             }
             if (GeneralUtility::isFirstPartOfStr($url, 'mailto:')) {
                 // Drop mail links
                 continue;
             }
             $parsedUrl = GeneralUtility::explodeUrl2Array($url);
             if (!array_key_exists('jumpurl', $parsedUrl)) {
                 // Ignore non-jumpurl links
                 continue;
             }
             $jumpurlId = $parsedUrl['jumpurl'];
             $targetUrl = $htmlLinks[$jumpurlId]['url'];
             $title = $link->getAttribute('title');
             if (!empty($title)) {
                 // no title attribute
                 $label = '<span title="' . $title . '">' . GeneralUtility::fixed_lgd_cs(substr($targetUrl, -40), 40) . '</span>';
             } else {
                 $label = '<span title="' . $targetUrl . '">' . GeneralUtility::fixed_lgd_cs(substr($targetUrl, -40), 40) . '</span>';
             }
             $htmlLinks[$jumpurlId]['label'] = $label;
         }
     }
     foreach ($urlCounter['total'] as $id => $_) {
         // $id is the jumpurl ID
         $origId = $id;
         $id = abs(intval($id));
         $url = $htmlLinks[$id]['url'] ? $htmlLinks[$id]['url'] : $urlArr[$origId];
         // a link to this host?
         $uParts = @parse_url($url);
         $urlstr = $this->getUrlStr($uParts);
         $label = $this->getLinkLabel($url, $urlstr, FALSE, $htmlLinks[$id]['label']);
         $img = '<a href="' . $urlstr . '" target="_blank">' . $this->iconFactory->getIcon('apps-toolbar-menu-search', Icon::SIZE_SMALL) . '</a>';
         if (isset($urlCounter['html'][$id]['plainId'])) {
             $tblLines[] = array($label, $id, $urlCounter['html'][$id]['plainId'], $urlCounter['total'][$origId]['counter'], $urlCounter['html'][$id]['counter'], $urlCounter['html'][$id]['plainCounter'], $img);
         } else {
             $html = empty($urlCounter['html'][$id]['counter']) ? 0 : 1;
             $tblLines[] = array($label, $html ? $id : '-', $html ? '-' : $id, $html ? $urlCounter['html'][$id]['counter'] : $urlCounter['plain'][$origId]['counter'], $urlCounter['html'][$id]['counter'], $urlCounter['plain'][$origId]['counter'], $img);
         }
     }
     // go through all links that were not clicked yet and that have a label
     $clickedLinks = array_keys($urlCounter['total']);
     foreach ($urlArr as $id => $link) {
         if (!in_array($id, $clickedLinks) && isset($htmlLinks['id'])) {
             // a link to this host?
             $uParts = @parse_url($link);
             $urlstr = $this->getUrlStr($uParts);
             $label = $htmlLinks[$id]['label'] . ' (' . ($urlstr ? $urlstr : '/') . ')';
             $img = '<a href="' . htmlspecialchars($link) . '" target="_blank">' . $this->iconFactory->getIcon('apps-toolbar-menu-search', Icon::SIZE_SMALL) . '</a>';
             $tblLines[] = array($label, $html ? $id : '-', $html ? '-' : abs($id), $html ? $urlCounter['html'][$id]['counter'] : $urlCounter['plain'][$id]['counter'], $urlCounter['html'][$id]['counter'], $urlCounter['plain'][$id]['counter'], $img);
         }
     }
     if ($urlCounter['total']) {
         $output .= '<br /><h2>' . $this->getLanguageService()->getLL('stats_response_link') . '</h2>';
         $output .= DirectMailUtility::formatTable($tblLines, array('nowrap', 'nowrap width="100"', 'nowrap width="100"', 'nowrap', 'nowrap', 'nowrap', 'nowrap'), 1, array(1, 0, 0, 0, 0, 0, 1));
     }
     // ******************
     // Returned mails
     // ******************
     // The icons:
     $listIcons = $this->iconFactory->getIcon('actions-system-list-open', Icon::SIZE_SMALL);
     $csvIcons = $this->iconFactory->getIcon('actions-document-export-csv', Icon::SIZE_SMALL);
     if (ExtensionManagementUtility::isLoaded('tt_address')) {
         $iconPath = ExtensionManagementUtility::extRelPath('tt_address') . 'ext_icon__h.gif';
         $iconParam = 'width="18" height="16"';
     } else {
         $iconPath = 'gfx/button_hide.gif';
         $iconParam = 'width="11" height="10"';
     }
     $hideIcons = '<img ' . IconUtility::skinImg($GLOBALS["BACK_PATH"], $iconPath, $iconParam . ' alt=""') . ' />';
     // Icons mails returned
     $iconsMailReturned[] = '<a href="' . $thisurl . '&returnList=1" class="bubble"><span class="help" title="' . $this->getLanguageService()->getLL('stats_list_returned') . '"> ' . $listIcons . '</span></a>';
     $iconsMailReturned[] = '<a href="' . $thisurl . '&returnDisable=1" class="bubble"><span class="help" title="' . $this->getLanguageService()->getLL('stats_disable_returned') . '"> ' . $hideIcons . '</span></a>';
     $iconsMailReturned[] = '<a href="' . $thisurl . '&returnCSV=1" class="bubble"><span class="help" title="' . $this->getLanguageService()->getLL('stats_CSV_returned') . '"> ' . $csvIcons . '</span></a>';
     // Icons unknown recip
     $iconsUnknownRecip[] = '<a href="' . $thisurl . '&unknownList=1" class="bubble"><span class="help" title="' . $this->getLanguageService()->getLL('stats_list_returned_unknown_recipient') . '"> ' . $listIcons . '</span></a>';
     $iconsUnknownRecip[] = '<a href="' . $thisurl . '&unknownDisable=1" class="bubble"><span class="help" title="' . $this->getLanguageService()->getLL('stats_disable_returned_unknown_recipient') . '"> ' . $hideIcons . '</span></a>';
     $iconsUnknownRecip[] = '<a href="' . $thisurl . '&unknownCSV=1" class="bubble"><span class="help" title="' . $this->getLanguageService()->getLL('stats_CSV_returned_unknown_recipient') . '"> ' . $csvIcons . '</span></a>';
     // Icons mailbox full
     $iconsMailbox[] = '<a href="' . $thisurl . '&fullList=1" class="bubble"><span class="help" title="' . $this->getLanguageService()->getLL('stats_list_returned_mailbox_full') . '"> ' . $listIcons . '</span></a>';
     $iconsMailbox[] = '<a href="' . $thisurl . '&fullDisable=1" class="bubble"><span class="help" title="' . $this->getLanguageService()->getLL('stats_disable_returned_mailbox_full') . '"> ' . $hideIcons . '</span></a>';
     $iconsMailbox[] = '<a href="' . $thisurl . '&fullCSV=1" class="bubble"><span class="help" title="' . $this->getLanguageService()->getLL('stats_CSV_returned_mailbox_full') . '"> ' . $csvIcons . '</span></a>';
     // Icons bad host
     $iconsBadhost[] = '<a href="' . $thisurl . '&badHostList=1" class="bubble"><span class="help" title="' . $this->getLanguageService()->getLL('stats_list_returned_bad_host') . '"> ' . $listIcons . '</span></a>';
     $iconsBadhost[] = '<a href="' . $thisurl . '&badHostDisable=1" class="bubble"><span class="help" title="' . $this->getLanguageService()->getLL('stats_disable_returned_bad_host') . '"> ' . $hideIcons . '</span></a>';
     $iconsBadhost[] = '<a href="' . $thisurl . '&badHostCSV=1" class="bubble"><span class="help" title="' . $this->getLanguageService()->getLL('stats_CSV_returned_bad_host') . '"> ' . $csvIcons . '</span></a>';
     // Icons bad header
     $iconsBadheader[] = '<a href="' . $thisurl . '&badHeaderList=1" class="bubble"><span class="help" title="' . $this->getLanguageService()->getLL('stats_list_returned_bad_header') . '"> ' . $listIcons . '</span></a>';
     $iconsBadheader[] = '<a href="' . $thisurl . '&badHeaderDisable=1" class="bubble"><span class="help" title="' . $this->getLanguageService()->getLL('stats_disable_returned_bad_header') . '"> ' . $hideIcons . '</span></a>';
     $iconsBadheader[] = '<a href="' . $thisurl . '&badHeaderCSV=1" class="bubble"><span class="help" title="' . $this->getLanguageService()->getLL('stats_CSV_returned_bad_header') . '"> ' . $csvIcons . '</span></a>';
     // Icons unknown reasons
     // TODO: link to show all reason
     $iconsUnknownReason[] = '<a href="' . $thisurl . '&reasonUnknownList=1" class="bubble"><span class="help" title="' . $this->getLanguageService()->getLL('stats_list_returned_reason_unknown') . '"> ' . $listIcons . '</span></a>';
     $iconsUnknownReason[] = '<a href="' . $thisurl . '&reasonUnknownDisable=1" class="bubble"><span class="help" title="' . $this->getLanguageService()->getLL('stats_disable_returned_reason_unknown') . '"> ' . $hideIcons . '</span></a>';
     $iconsUnknownReason[] = '<a href="' . $thisurl . '&reasonUnknownCSV=1" class="bubble"><span class="help" title="' . $this->getLanguageService()->getLL('stats_CSV_returned_reason_unknown') . '"> ' . $csvIcons . '</span></a>';
     // Table with Icon
     $queryArray = array('count(*) as counter,return_code', 'sys_dmail_maillog', 'mid=' . intval($row['uid']) . ' AND response_type=-127', 'return_code');
     $responseResult = $this->getQueryRows($queryArray, 'return_code');
     $tblLines = array();
     $tblLines[] = array('', $this->getLanguageService()->getLL('stats_count'), '');
     $tblLines[] = array($this->getLanguageService()->getLL('stats_total_mails_returned'), $table['-127']['counter'] ? number_format(intval($table['-127']['counter'])) : '0', implode('&nbsp;', $iconsMailReturned));
     $tblLines[] = array($this->getLanguageService()->getLL('stats_recipient_unknown'), $this->showWithPercent($responseResult['550']['counter'] + $responseResult['553']['counter'], $table['-127']['counter']), implode('&nbsp;', $iconsUnknownRecip));
     $tblLines[] = array($this->getLanguageService()->getLL('stats_mailbox_full'), $this->showWithPercent($responseResult['551']['counter'], $table['-127']['counter']), implode('&nbsp;', $iconsMailbox));
     $tblLines[] = array($this->getLanguageService()->getLL('stats_bad_host'), $this->showWithPercent($responseResult['552']['counter'], $table['-127']['counter']), implode('&nbsp;', $iconsBadhost));
     $tblLines[] = array($this->getLanguageService()->getLL('stats_error_in_header'), $this->showWithPercent($responseResult['554']['counter'], $table['-127']['counter']), implode('&nbsp;', $iconsBadheader));
     $tblLines[] = array($this->getLanguageService()->getLL('stats_reason_unkown'), $this->showWithPercent($responseResult['-1']['counter'], $table['-127']['counter']), implode('&nbsp;', $iconsUnknownReason));
     $output .= '<br /><h2>' . $this->getLanguageService()->getLL('stats_mails_returned') . '</h2>';
     $output .= DirectMailUtility::formatTable($tblLines, array('nowrap', 'nowrap', ''), 1, array(0, 0, 1));
     // Find all returned mail
     if (GeneralUtility::_GP('returnList') || GeneralUtility::_GP('returnDisable') || GeneralUtility::_GP('returnCSV')) {
         $res = $GLOBALS["TYPO3_DB"]->exec_SELECTquery('rid,rtbl,email', 'sys_dmail_maillog', 'mid=' . intval($row['uid']) . ' AND response_type=-127');
         $idLists = array();
         while ($rrow = $GLOBALS["TYPO3_DB"]->sql_fetch_assoc($res)) {
             switch ($rrow['rtbl']) {
                 case 't':
                     $idLists['tt_address'][] = $rrow['rid'];
                     break;
                 case 'f':
                     $idLists['fe_users'][] = $rrow['rid'];
                     break;
                 case 'P':
                     $idLists['PLAINLIST'][] = $rrow['email'];
                     break;
                 default:
                     $idLists[$rrow['rtbl']][] = $rrow['rid'];
             }
         }
         if (GeneralUtility::_GP('returnList')) {
             if (is_array($idLists['tt_address'])) {
                 $output .= '<h3>' . $this->getLanguageService()->getLL('stats_emails') . '</h3>' . DirectMailUtility::getRecordList(DirectMailUtility::fetchRecordsListValues($idLists['tt_address'], 'tt_address'), 'tt_address', $this->id, 1, $this->sys_dmail_uid);
             }
             if (is_array($idLists['fe_users'])) {
                 $output .= '<h3>' . $this->getLanguageService()->getLL('stats_website_users') . '</h3>' . DirectMailUtility::getRecordList(DirectMailUtility::fetchRecordsListValues($idLists['fe_users'], 'fe_users'), 'fe_users', $this->id, 1, $this->sys_dmail_uid);
             }
             if (is_array($idLists['PLAINLIST'])) {
                 $output .= '<h3>' . $this->getLanguageService()->getLL('stats_plainlist') . '</h3>';
                 $output .= '<ul><li>' . join('</li><li>', $idLists['PLAINLIST']) . '</li></ul>';
             }
         }
         if (GeneralUtility::_GP('returnDisable')) {
             if (is_array($idLists['tt_address'])) {
                 $c = $this->disableRecipients(DirectMailUtility::fetchRecordsListValues($idLists['tt_address'], 'tt_address'), 'tt_address');
                 $output .= '<br />' . $c . ' ' . $this->getLanguageService()->getLL('stats_emails_disabled');
             }
             if (is_array($idLists['fe_users'])) {
                 $c = $this->disableRecipients(DirectMailUtility::fetchRecordsListValues($idLists['fe_users'], 'fe_users'), 'fe_users');
                 $output .= '<br />' . $c . ' ' . $this->getLanguageService()->getLL('stats_website_users_disabled');
             }
         }
         if (GeneralUtility::_GP('returnCSV')) {
             $emails = array();
             if (is_array($idLists['tt_address'])) {
                 $arr = DirectMailUtility::fetchRecordsListValues($idLists['tt_address'], 'tt_address');
                 foreach ($arr as $v) {
                     $emails[] = $v['email'];
                 }
             }
             if (is_array($idLists['fe_users'])) {
                 $arr = DirectMailUtility::fetchRecordsListValues($idLists['fe_users'], 'fe_users');
                 foreach ($arr as $v) {
                     $emails[] = $v['email'];
                 }
             }
             if (is_array($idLists['PLAINLIST'])) {
                 $emails = array_merge($emails, $idLists['PLAINLIST']);
             }
             $output .= '<br />' . $this->getLanguageService()->getLL('stats_emails_returned_list') . '<br />';
             $output .= '<textarea' . $this->doc->formWidth() . ' rows="6" name="nothing">' . LF . htmlspecialchars(implode(LF, $emails)) . '</textarea>';
         }
     }
     // Find Unknown Recipient
     if (GeneralUtility::_GP('unknownList') || GeneralUtility::_GP('unknownDisable') || GeneralUtility::_GP('unknownCSV')) {
         $res = $GLOBALS["TYPO3_DB"]->exec_SELECTquery('rid,rtbl,email', 'sys_dmail_maillog', 'mid=' . intval($row['uid']) . ' AND response_type=-127' . ' AND (return_code=550 OR return_code=553)');
         $idLists = array();
         while ($rrow = $GLOBALS["TYPO3_DB"]->sql_fetch_assoc($res)) {
             switch ($rrow['rtbl']) {
                 case 't':
                     $idLists['tt_address'][] = $rrow['rid'];
                     break;
                 case 'f':
                     $idLists['fe_users'][] = $rrow['rid'];
                     break;
                 case 'P':
                     $idLists['PLAINLIST'][] = $rrow['email'];
                     break;
                 default:
                     $idLists[$rrow['rtbl']][] = $rrow['rid'];
             }
         }
         if (GeneralUtility::_GP('unknownList')) {
             if (is_array($idLists['tt_address'])) {
                 $output .= '<br />' . $this->getLanguageService()->getLL('stats_emails') . '<br />' . DirectMailUtility::getRecordList(DirectMailUtility::fetchRecordsListValues($idLists['tt_address'], 'tt_address'), 'tt_address', $this->id, 1, $this->sys_dmail_uid);
             }
             if (is_array($idLists['fe_users'])) {
                 $output .= '<br />' . $this->getLanguageService()->getLL('stats_website_users') . DirectMailUtility::getRecordList(DirectMailUtility::fetchRecordsListValues($idLists['fe_users'], 'fe_users'), 'fe_users', $this->id, 1, $this->sys_dmail_uid);
             }
             if (is_array($idLists['PLAINLIST'])) {
                 $output .= '<br />' . $this->getLanguageService()->getLL('stats_plainlist');
                 $output .= '<ul><li>' . join('</li><li>', $idLists['PLAINLIST']) . '</li></ul>';
             }
         }
         if (GeneralUtility::_GP('unknownDisable')) {
             if (is_array($idLists['tt_address'])) {
                 $c = $this->disableRecipients(DirectMailUtility::fetchRecordsListValues($idLists['tt_address'], 'tt_address'), 'tt_address');
                 $output .= '<br />' . $c . ' ' . $this->getLanguageService()->getLL('stats_emails_disabled');
             }
             if (is_array($idLists['fe_users'])) {
                 $c = $this->disableRecipients(DirectMailUtility::fetchRecordsListValues($idLists['fe_users'], 'fe_users'), 'fe_users');
                 $output .= '<br />' . $c . ' ' . $this->getLanguageService()->getLL('stats_website_users_disabled');
             }
         }
         if (GeneralUtility::_GP('unknownCSV')) {
             $emails = array();
             if (is_array($idLists['tt_address'])) {
                 $arr = DirectMailUtility::fetchRecordsListValues($idLists['tt_address'], 'tt_address');
                 foreach ($arr as $v) {
                     $emails[] = $v['email'];
                 }
             }
             if (is_array($idLists['fe_users'])) {
                 $arr = DirectMailUtility::fetchRecordsListValues($idLists['fe_users'], 'fe_users');
                 foreach ($arr as $v) {
                     $emails[] = $v['email'];
                 }
             }
             if (is_array($idLists['PLAINLIST'])) {
                 $emails = array_merge($emails, $idLists['PLAINLIST']);
             }
             $output .= '<br />' . $this->getLanguageService()->getLL('stats_emails_returned_unknown_recipient_list') . '<br />';
             $output .= '<textarea' . $this->doc->formWidth() . ' rows="6" name="nothing">' . LF . htmlspecialchars(implode(LF, $emails)) . '</textarea>';
         }
     }
     // Mailbox Full
     if (GeneralUtility::_GP('fullList') || GeneralUtility::_GP('fullDisable') || GeneralUtility::_GP('fullCSV')) {
         $res = $GLOBALS["TYPO3_DB"]->exec_SELECTquery('rid,rtbl,email', 'sys_dmail_maillog', 'mid=' . intval($row['uid']) . ' AND response_type=-127' . ' AND return_code=551');
         $idLists = array();
         while ($rrow = $GLOBALS["TYPO3_DB"]->sql_fetch_assoc($res)) {
             switch ($rrow['rtbl']) {
                 case 't':
                     $idLists['tt_address'][] = $rrow['rid'];
                     break;
                 case 'f':
                     $idLists['fe_users'][] = $rrow['rid'];
                     break;
                 case 'P':
                     $idLists['PLAINLIST'][] = $rrow['email'];
                     break;
                 default:
                     $idLists[$rrow['rtbl']][] = $rrow['rid'];
             }
         }
         if (GeneralUtility::_GP('fullList')) {
             if (is_array($idLists['tt_address'])) {
                 $output .= '<br />' . $this->getLanguageService()->getLL('stats_emails') . '<br />' . DirectMailUtility::getRecordList(DirectMailUtility::fetchRecordsListValues($idLists['tt_address'], 'tt_address'), 'tt_address', $this->id, 1, $this->sys_dmail_uid);
             }
             if (is_array($idLists['fe_users'])) {
                 $output .= '<br />' . $this->getLanguageService()->getLL('stats_website_users') . DirectMailUtility::getRecordList(DirectMailUtility::fetchRecordsListValues($idLists['fe_users'], 'fe_users'), 'fe_users', $this->id, 1, $this->sys_dmail_uid);
             }
             if (is_array($idLists['PLAINLIST'])) {
                 $output .= '<br />' . $this->getLanguageService()->getLL('stats_plainlist');
                 $output .= '<ul><li>' . join('</li><li>', $idLists['PLAINLIST']) . '</li></ul>';
             }
         }
         if (GeneralUtility::_GP('fullDisable')) {
             if (is_array($idLists['tt_address'])) {
                 $c = $this->disableRecipients(DirectMailUtility::fetchRecordsListValues($idLists['tt_address'], 'tt_address'), 'tt_address');
                 $output .= '<br />' . $c . ' ' . $this->getLanguageService()->getLL('stats_emails_disabled');
             }
             if (is_array($idLists['fe_users'])) {
                 $c = $this->disableRecipients(DirectMailUtility::fetchRecordsListValues($idLists['fe_users'], 'fe_users'), 'fe_users');
                 $output .= '<br />' . $c . ' ' . $this->getLanguageService()->getLL('stats_website_users_disabled');
             }
         }
         if (GeneralUtility::_GP('fullCSV')) {
             $emails = array();
             if (is_array($idLists['tt_address'])) {
                 $arr = DirectMailUtility::fetchRecordsListValues($idLists['tt_address'], 'tt_address');
                 foreach ($arr as $v) {
                     $emails[] = $v['email'];
                 }
             }
             if (is_array($idLists['fe_users'])) {
                 $arr = DirectMailUtility::fetchRecordsListValues($idLists['fe_users'], 'fe_users');
                 foreach ($arr as $v) {
                     $emails[] = $v['email'];
                 }
             }
             if (is_array($idLists['PLAINLIST'])) {
                 $emails = array_merge($emails, $idLists['PLAINLIST']);
             }
             $output .= '<br />' . $this->getLanguageService()->getLL('stats_emails_returned_mailbox_full_list') . '<br />';
             $output .= '<textarea' . $this->doc->formWidth() . ' rows="6" name="nothing">' . LF . htmlspecialchars(implode(LF, $emails)) . '</textarea>';
         }
     }
     // find Bad Host
     if (GeneralUtility::_GP('badHostList') || GeneralUtility::_GP('badHostDisable') || GeneralUtility::_GP('badHostCSV')) {
         $res = $GLOBALS["TYPO3_DB"]->exec_SELECTquery('rid,rtbl,email', 'sys_dmail_maillog', 'mid=' . intval($row['uid']) . ' AND response_type=-127' . ' AND return_code=552');
         $idLists = array();
         while ($rrow = $GLOBALS["TYPO3_DB"]->sql_fetch_assoc($res)) {
             switch ($rrow['rtbl']) {
                 case 't':
                     $idLists['tt_address'][] = $rrow['rid'];
                     break;
                 case 'f':
                     $idLists['fe_users'][] = $rrow['rid'];
                     break;
                 case 'P':
                     $idLists['PLAINLIST'][] = $rrow['email'];
                     break;
                 default:
                     $idLists[$rrow['rtbl']][] = $rrow['rid'];
             }
         }
         if (GeneralUtility::_GP('badHostList')) {
             if (is_array($idLists['tt_address'])) {
                 $output .= '<br />' . $this->getLanguageService()->getLL('stats_emails') . '<br />' . DirectMailUtility::getRecordList(DirectMailUtility::fetchRecordsListValues($idLists['tt_address'], 'tt_address'), 'tt_address', $this->id, 1, $this->sys_dmail_uid);
             }
             if (is_array($idLists['fe_users'])) {
                 $output .= '<br />' . $this->getLanguageService()->getLL('stats_website_users') . DirectMailUtility::getRecordList(DirectMailUtility::fetchRecordsListValues($idLists['fe_users'], 'fe_users'), 'fe_users', $this->id, 1, $this->sys_dmail_uid);
             }
             if (is_array($idLists['PLAINLIST'])) {
                 $output .= '<br />' . $this->getLanguageService()->getLL('stats_plainlist');
                 $output .= '<ul><li>' . join('</li><li>', $idLists['PLAINLIST']) . '</li></ul>';
             }
         }
         if (GeneralUtility::_GP('badHostDisable')) {
             if (is_array($idLists['tt_address'])) {
                 $c = $this->disableRecipients(DirectMailUtility::fetchRecordsListValues($idLists['tt_address'], 'tt_address'), 'tt_address');
                 $output .= '<br />' . $c . ' ' . $this->getLanguageService()->getLL('stats_emails_disabled');
             }
             if (is_array($idLists['fe_users'])) {
                 $c = $this->disableRecipients(DirectMailUtility::fetchRecordsListValues($idLists['fe_users'], 'fe_users'), 'fe_users');
                 $output .= '<br />' . $c . ' ' . $this->getLanguageService()->getLL('stats_website_users_disabled');
             }
         }
         if (GeneralUtility::_GP('badHostCSV')) {
             $emails = array();
             if (is_array($idLists['tt_address'])) {
                 $arr = DirectMailUtility::fetchRecordsListValues($idLists['tt_address'], 'tt_address');
                 foreach ($arr as $v) {
                     $emails[] = $v['email'];
                 }
             }
             if (is_array($idLists['fe_users'])) {
                 $arr = DirectMailUtility::fetchRecordsListValues($idLists['fe_users'], 'fe_users');
                 foreach ($arr as $v) {
                     $emails[] = $v['email'];
                 }
             }
             if (is_array($idLists['PLAINLIST'])) {
                 $emails = array_merge($emails, $idLists['PLAINLIST']);
             }
             $output .= '<br />' . $this->getLanguageService()->getLL('stats_emails_returned_bad_host_list') . '<br />';
             $output .= '<textarea' . $this->doc->formWidth() . ' rows="6" name="nothing">' . LF . htmlspecialchars(implode(LF, $emails)) . '</textarea>';
         }
     }
     // find Bad Header
     if (GeneralUtility::_GP('badHeaderList') || GeneralUtility::_GP('badHeaderDisable') || GeneralUtility::_GP('badHeaderCSV')) {
         $res = $GLOBALS["TYPO3_DB"]->exec_SELECTquery('rid,rtbl,email', 'sys_dmail_maillog', 'mid=' . intval($row['uid']) . ' AND response_type=-127' . ' AND return_code=554');
         $idLists = array();
         while ($rrow = $GLOBALS["TYPO3_DB"]->sql_fetch_assoc($res)) {
             switch ($rrow['rtbl']) {
                 case 't':
                     $idLists['tt_address'][] = $rrow['rid'];
                     break;
                 case 'f':
                     $idLists['fe_users'][] = $rrow['rid'];
                     break;
                 case 'P':
                     $idLists['PLAINLIST'][] = $rrow['email'];
                     break;
                 default:
                     $idLists[$rrow['rtbl']][] = $rrow['rid'];
             }
         }
         if (GeneralUtility::_GP('badHeaderList')) {
             if (is_array($idLists['tt_address'])) {
                 $output .= '<br />' . $this->getLanguageService()->getLL('stats_emails') . '<br />' . DirectMailUtility::getRecordList(DirectMailUtility::fetchRecordsListValues($idLists['tt_address'], 'tt_address'), 'tt_address', $this->id, 1, $this->sys_dmail_uid);
             }
             if (is_array($idLists['fe_users'])) {
                 $output .= '<br />' . $this->getLanguageService()->getLL('stats_website_users') . DirectMailUtility::getRecordList(DirectMailUtility::fetchRecordsListValues($idLists['fe_users'], 'fe_users'), 'fe_users', $this->id, 1, $this->sys_dmail_uid);
             }
             if (is_array($idLists['PLAINLIST'])) {
                 $output .= '<br />' . $this->getLanguageService()->getLL('stats_plainlist');
                 $output .= '<ul><li>' . join('</li><li>', $idLists['PLAINLIST']) . '</li></ul>';
             }
         }
         if (GeneralUtility::_GP('badHeaderDisable')) {
             if (is_array($idLists['tt_address'])) {
                 $c = $this->disableRecipients(DirectMailUtility::fetchRecordsListValues($idLists['tt_address'], 'tt_address'), 'tt_address');
                 $output .= '<br />' . $c . ' ' . $this->getLanguageService()->getLL('stats_emails_disabled');
             }
             if (is_array($idLists['fe_users'])) {
                 $c = $this->disableRecipients(DirectMailUtility::fetchRecordsListValues($idLists['fe_users'], 'fe_users'), 'fe_users');
                 $output .= '<br />' . $c . ' ' . $this->getLanguageService()->getLL('stats_website_users_disabled');
             }
         }
         if (GeneralUtility::_GP('badHeaderCSV')) {
             $emails = array();
             if (is_array($idLists['tt_address'])) {
                 $arr = DirectMailUtility::fetchRecordsListValues($idLists['tt_address'], 'tt_address');
                 foreach ($arr as $v) {
                     $emails[] = $v['email'];
                 }
             }
             if (is_array($idLists['fe_users'])) {
                 $arr = DirectMailUtility::fetchRecordsListValues($idLists['fe_users'], 'fe_users');
                 foreach ($arr as $v) {
                     $emails[] = $v['email'];
                 }
             }
             if (is_array($idLists['PLAINLIST'])) {
                 $emails = array_merge($emails, $idLists['PLAINLIST']);
             }
             $output .= '<br />' . $this->getLanguageService()->getLL('stats_emails_returned_bad_header_list') . '<br />';
             $output .= '<textarea' . $this->doc->formWidth() . ' rows="6" name="nothing">' . LF . htmlspecialchars(implode(LF, $emails)) . '</textarea>';
         }
     }
     // find Unknown Reasons
     // TODO: list all reason
     if (GeneralUtility::_GP('reasonUnknownList') || GeneralUtility::_GP('reasonUnknownDisable') || GeneralUtility::_GP('reasonUnknownCSV')) {
         $res = $GLOBALS["TYPO3_DB"]->exec_SELECTquery('rid,rtbl,email', 'sys_dmail_maillog', 'mid=' . intval($row['uid']) . ' AND response_type=-127' . ' AND return_code=-1');
         $idLists = array();
         while ($rrow = $GLOBALS["TYPO3_DB"]->sql_fetch_assoc($res)) {
             switch ($rrow['rtbl']) {
                 case 't':
                     $idLists['tt_address'][] = $rrow['rid'];
                     break;
                 case 'f':
                     $idLists['fe_users'][] = $rrow['rid'];
                     break;
                 case 'P':
                     $idLists['PLAINLIST'][] = $rrow['email'];
                     break;
                 default:
                     $idLists[$rrow['rtbl']][] = $rrow['rid'];
             }
         }
         if (GeneralUtility::_GP('reasonUnknownList')) {
             if (is_array($idLists['tt_address'])) {
                 $output .= '<br />' . $this->getLanguageService()->getLL('stats_emails') . '<br />' . DirectMailUtility::getRecordList(DirectMailUtility::fetchRecordsListValues($idLists['tt_address'], 'tt_address'), 'tt_address', $this->id, 1, $this->sys_dmail_uid);
             }
             if (is_array($idLists['fe_users'])) {
                 $output .= '<br />' . $this->getLanguageService()->getLL('stats_website_users') . DirectMailUtility::getRecordList(DirectMailUtility::fetchRecordsListValues($idLists['fe_users'], 'fe_users'), 'fe_users', $this->id, 1, $this->sys_dmail_uid);
             }
             if (is_array($idLists['PLAINLIST'])) {
                 $output .= '<br />' . $this->getLanguageService()->getLL('stats_plainlist');
                 $output .= '<ul><li>' . join('</li><li>', $idLists['PLAINLIST']) . '</li></ul>';
             }
         }
         if (GeneralUtility::_GP('reasonUnknownDisable')) {
             if (is_array($idLists['tt_address'])) {
                 $c = $this->disableRecipients(DirectMailUtility::fetchRecordsListValues($idLists['tt_address'], 'tt_address'), 'tt_address');
                 $output .= '<br />' . $c . ' ' . $this->getLanguageService()->getLL('stats_emails_disabled');
             }
             if (is_array($idLists['fe_users'])) {
                 $c = $this->disableRecipients(DirectMailUtility::fetchRecordsListValues($idLists['fe_users'], 'fe_users'), 'fe_users');
                 $output .= '<br />' . $c . ' ' . $this->getLanguageService()->getLL('stats_website_users_disabled');
             }
         }
         if (GeneralUtility::_GP('reasonUnknownCSV')) {
             $emails = array();
             if (is_array($idLists['tt_address'])) {
                 $arr = DirectMailUtility::fetchRecordsListValues($idLists['tt_address'], 'tt_address');
                 foreach ($arr as $v) {
                     $emails[] = $v['email'];
                 }
             }
             if (is_array($idLists['fe_users'])) {
                 $arr = DirectMailUtility::fetchRecordsListValues($idLists['fe_users'], 'fe_users');
                 foreach ($arr as $v) {
                     $emails[] = $v['email'];
                 }
             }
             if (is_array($idLists['PLAINLIST'])) {
                 $emails = array_merge($emails, $idLists['PLAINLIST']);
             }
             $output .= '<br />' . $this->getLanguageService()->getLL('stats_emails_returned_reason_unknown_list') . '<br />';
             $output .= '<textarea' . $this->doc->formWidth() . ' rows="6" name="nothing">' . LF . htmlspecialchars(implode(LF, $emails)) . '</textarea>';
         }
     }
     /**
      * Hook for cmd_stats_postProcess
      * insert a link to open extended importer
      */
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['direct_mail']['mod4']['cmd_stats'])) {
         $hookObjectsArr = array();
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['direct_mail']['mod4']['cmd_stats'] as $classRef) {
             $hookObjectsArr[] =& GeneralUtility::getUserObj($classRef);
         }
         // assigned $output to class property to make it acesssible inside hook
         $this->output = $output;
         // and clear the former $output to collect hoot return code there
         $output = '';
         foreach ($hookObjectsArr as $hookObj) {
             if (method_exists($hookObj, 'cmd_stats_postProcess')) {
                 $output .= $hookObj->cmd_stats_postProcess($row, $this);
             }
         }
     }
     $this->noView = 1;
     // put all the stats tables in a section
     $theOutput = $this->doc->section($this->getLanguageService()->getLL('stats_direct_mail'), $output, 1, 1, 0, TRUE);
     $theOutput .= '<div style="padding-top: 20px;"></div>';
     $link = '<p><a style="text-decoration: underline;" href="' . $thisurl . '">' . $this->getLanguageService()->getLL('stats_recalculate_stats') . '</a></p>';
     $theOutput .= $this->doc->section($this->getLanguageService()->getLL('stats_recalculate_cached_data'), $link, 1, 1, 0, TRUE);
     return $theOutput;
 }
 /**
  * Init
  *
  * @return void
  * @throws \RuntimeException
  * @throws InsufficientFileAccessPermissionsException
  */
 protected function init()
 {
     // Initialize GPvars:
     $this->uid = (int) GeneralUtility::_GP('uid');
     $lang = $this->getLanguageService();
     $this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
     // Cleaning and checking uid
     if ($this->uid > 0) {
         $this->fileOrFolderObject = ResourceFactory::getInstance()->retrieveFileOrFolderObject('file:' . $this->uid);
     }
     if (!$this->fileOrFolderObject) {
         $title = $lang->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:paramError', true);
         $message = $lang->sL('LLL:EXT:lang/locallang_mod_file_list.xlf:targetNoDir', true);
         throw new \RuntimeException($title . ': ' . $message, 1436895930);
     }
     if ($this->fileOrFolderObject->getStorage()->getUid() === 0) {
         throw new InsufficientFileAccessPermissionsException('You are not allowed to access files outside your storages', 1436895931);
     }
     // If a folder should be renamed, AND the returnURL should go to the old directory name, the redirect is forced
     // so the redirect will NOT end in an error message
     // this case only happens if you select the folder itself in the foldertree and then use the clickmenu to
     // rename the folder
     if ($this->fileOrFolderObject instanceof Folder) {
         $parsedUrl = parse_url($this->returnUrl);
         $queryParts = GeneralUtility::explodeUrl2Array(urldecode($parsedUrl['query']));
         if ($queryParts['id'] === $this->fileOrFolderObject->getCombinedIdentifier()) {
             $this->returnUrl = str_replace(urlencode($queryParts['id']), urlencode($this->fileOrFolderObject->getStorage()->getRootLevelFolder()->getCombinedIdentifier()), $this->returnUrl);
         }
     }
     $pathInfo = ['combined_identifier' => $this->fileOrFolderObject->getCombinedIdentifier()];
     $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($pathInfo);
     $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
     $this->moduleTemplate->addJavaScriptCode('ReplaceFileOnlineJavaScript', 'function backToList() {top.goToModule("file_FilelistList");}');
 }
示例#30
0
 /**
  * Creates a shortcut through an AJAX call
  *
  * @param ServerRequestInterface $request
  * @param ResponseInterface $response
  * @return ResponseInterface
  */
 public function createShortcutAction(ServerRequestInterface $request, ResponseInterface $response)
 {
     $languageService = $this->getLanguageService();
     $parsedBody = $request->getParsedBody();
     $queryParams = $request->getQueryParams();
     // Default name
     $shortcutName = 'Shortcut';
     $shortcutNamePrepend = '';
     $url = isset($parsedBody['url']) ? $parsedBody['url'] : $queryParams['url'];
     // Determine shortcut type
     $url = rawurldecode($url);
     $queryParts = parse_url($url);
     $queryParameters = GeneralUtility::explodeUrl2Array($queryParts['query'], true);
     // Proceed only if no scheme is defined, as URL is expected to be relative
     if (empty($queryParts['scheme'])) {
         if (is_array($queryParameters['edit'])) {
             $shortcut['table'] = key($queryParameters['edit']);
             $shortcut['recordid'] = key($queryParameters['edit'][$shortcut['table']]);
             $shortcut['pid'] = BackendUtility::getRecord($shortcut['table'], $shortcut['recordid'])['pid'];
             if ($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'edit') {
                 $shortcut['type'] = 'edit';
                 $shortcutNamePrepend = $languageService->getLL('shortcut_edit', true);
             } elseif ($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'new') {
                 $shortcut['type'] = 'new';
                 $shortcutNamePrepend = $languageService->getLL('shortcut_create', true);
             }
         } else {
             $shortcut['type'] = 'other';
             $shortcut['table'] = '';
             $shortcut['recordid'] = 0;
         }
         // Lookup the title of this page and use it as default description
         $pageId = (int) ($shortcut['pid'] ?: ($shortcut['recordid'] ?: $this->getLinkedPageId($url)));
         if ($pageId) {
             $page = BackendUtility::getRecord('pages', $pageId);
             if (!empty($page)) {
                 // Set the name to the title of the page
                 if ($shortcut['type'] === 'other') {
                     $shortcutName = $page['title'];
                 } else {
                     $shortcutName = $shortcutNamePrepend . ' ' . $languageService->sL($GLOBALS['TCA'][$shortcut['table']]['ctrl']['title']) . ' (' . $page['title'] . ')';
                 }
             }
         } else {
             $dirName = urldecode($pageId);
             if (preg_match('/\\/$/', $dirName)) {
                 // If $pageId is a string and ends with a slash,
                 // assume it is a fileadmin reference and set
                 // the description to the basename of that path
                 $shortcutName .= ' ' . basename($dirName);
             }
         }
         return $this->tryAddingTheShortcut($response, $url, $shortcutName);
     }
 }