| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | namespace TYPO3\CMS\Feedit; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  | /* | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * This file is part of the TYPO3 CMS project. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * It is free software; you can redistribute it and/or modify it under | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * the terms of the GNU General Public License, either version 2 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * of the License, or any later version. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  * For the full copyright and license information, please read the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  |  * LICENSE.txt file that was distributed with this source code. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |  * The TYPO3 project - inspiring people to share! | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | use TYPO3\CMS\Backend\FrontendBackendUserAuthentication; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use TYPO3\CMS\Core\Imaging\Icon; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | use TYPO3\CMS\Core\Imaging\IconFactory; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | use TYPO3\CMS\Core\Type\Bitmask\JsConfirmation; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | use TYPO3\CMS\Core\Utility\GeneralUtility; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | use TYPO3\CMS\Core\Utility\MathUtility; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | use TYPO3\CMS\Core\Utility\PathUtility; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | use TYPO3\CMS\Frontend\View\AdminPanelView; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |  * View class for the edit panels in frontend editing. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | class FrontendEditPanel | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |      * The Content Object Renderer | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |      * @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |     protected $cObj; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |      * Property for accessing TypoScriptFrontendController centrally | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |      * @var TypoScriptFrontendController | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |     protected $frontendController; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |      * @var FrontendBackendUserAuthentication | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |     protected $backendUser; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |      * @var \TYPO3\CMS\Core\Imaging\IconFactory | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |     protected $iconFactory; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |      * Constructor for the edit panel | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |      * @param mixed $_ Previous the database connection | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |      * @param TypoScriptFrontendController $frontendController | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |      * @param FrontendBackendUserAuthentication $backendUser | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |     public function __construct($_ = null, TypoScriptFrontendController $frontendController = null, FrontendBackendUserAuthentication $backendUser = null) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |         $this->frontendController = $frontendController ?: $GLOBALS['TSFE']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |         $this->backendUser = $backendUser ?: $GLOBALS['BE_USER']; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |         $this->cObj = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |         $this->cObj->start([]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |         $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |      * Generates the "edit panels" which can be shown for a page or records on a page when the Admin Panel is enabled for a backend users surfing the frontend. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |      * With the "edit panel" the user will see buttons with links to editing, moving, hiding, deleting the element | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |      * This function is used for the cObject EDITPANEL and the stdWrap property ".editPanel" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |      * @param string $content A content string containing the content related to the edit panel. For cObject "EDITPANEL" this is empty but not so for the stdWrap property. The edit panel is appended to this string and returned. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |      * @param array $conf TypoScript configuration properties for the editPanel | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |      * @param string $currentRecord The "table:uid" of the record being shown. If empty string then $this->currentRecord is used. For new records (set by $conf['newRecordFromTable']) it's auto-generated to "[tablename]:NEW | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |      * @param array $dataArr Alternative data array to use. Default is $this->data | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |      * @param string $table | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |      * @param array $allow | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |      * @param int $newUID | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |      * @param array $hiddenFields | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |      * @return string The input content string with the editPanel appended. This function returns only an edit panel appended to the content string if a backend user is logged in (and has the correct permissions). Otherwise the content string is directly returned. | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 85 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 86 |  |  |     public function editPanel($content, array $conf, $currentRecord = '', array $dataArr = [], $table = '', array $allow = [], $newUID = 0, array $hiddenFields = []) | 
            
                                                                        
                            
            
                                    
            
            
                | 87 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 88 |  |  |         $hiddenFieldString = $command = ''; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 89 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 90 |  |  |         // Special content is about to be shown, so the cache must be disabled. | 
            
                                                                        
                            
            
                                    
            
            
                | 91 |  |  |         $this->frontendController->set_no_cache('Frontend edit panel is shown', true); | 
            
                                                                        
                            
            
                                    
            
            
                | 92 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 93 |  |  |         $formName = 'TSFE_EDIT_FORM_' . substr($this->frontendController->uniqueHash(), 0, 4); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 94 |  |  |         $formTag = '<form name="' . $formName . '" id ="' . $formName . '" action="' . htmlspecialchars(GeneralUtility::getIndpEnv('REQUEST_URI')) . '" method="post" enctype="multipart/form-data" onsubmit="return TBE_EDITOR.checkSubmit(1);">'; | 
            
                                                                        
                            
            
                                    
            
            
                | 95 |  |  |         $sortField = $GLOBALS['TCA'][$table]['ctrl']['sortby']; | 
            
                                                                        
                            
            
                                    
            
            
                | 96 |  |  |         $labelField = $GLOBALS['TCA'][$table]['ctrl']['label']; | 
            
                                                                        
                            
            
                                    
            
            
                | 97 |  |  |         $hideField = $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled']; | 
            
                                                                        
                            
            
                                    
            
            
                | 98 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 99 |  |  |         $panel = ''; | 
            
                                                                        
                            
            
                                    
            
            
                | 100 |  |  |         if (isset($allow['toolbar']) && $this->backendUser->adminPanel instanceof AdminPanelView) { | 
            
                                                                        
                            
            
                                    
            
            
                | 101 |  |  |             $panel .= $this->backendUser->adminPanel->ext_makeToolBar(); | 
            
                                                                        
                            
            
                                    
            
            
                | 102 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 103 |  |  |         if (isset($allow['edit'])) { | 
            
                                                                        
                            
            
                                    
            
            
                | 104 |  |  |             $icon = '<span title="' . $this->backendUser->extGetLL('p_editRecord') . '">' . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render('inline') . '</span>'; | 
            
                                                                        
                            
            
                                    
            
            
                | 105 |  |  |             $panel .= $this->editPanelLinkWrap($icon, $formName, 'edit', $dataArr['_LOCALIZED_UID'] ? $table . ':' . $dataArr['_LOCALIZED_UID'] : $currentRecord); | 
            
                                                                        
                            
            
                                    
            
            
                | 106 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 107 |  |  |         // Hiding in workspaces because implementation is incomplete | 
            
                                                                        
                            
            
                                    
            
            
                | 108 |  |  |         if (isset($allow['move']) && $sortField && $this->backendUser->workspace === 0) { | 
            
                                                                        
                            
            
                                    
            
            
                | 109 |  |  |             $icon = '<span title="' . $this->backendUser->extGetLL('p_moveUp') . '">' . $this->iconFactory->getIcon('actions-move-up', Icon::SIZE_SMALL)->render('inline') . '</span>'; | 
            
                                                                        
                            
            
                                    
            
            
                | 110 |  |  |             $panel .= $this->editPanelLinkWrap($icon, $formName, 'up'); | 
            
                                                                        
                            
            
                                    
            
            
                | 111 |  |  |             $icon = '<span title="' . $this->backendUser->extGetLL('p_moveDown') . '">' . $this->iconFactory->getIcon('actions-move-down', Icon::SIZE_SMALL)->render('inline') . '</span>'; | 
            
                                                                        
                            
            
                                    
            
            
                | 112 |  |  |             $panel .= $this->editPanelLinkWrap($icon, $formName, 'down'); | 
            
                                                                        
                            
            
                                    
            
            
                | 113 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 114 |  |  |         // Hiding in workspaces because implementation is incomplete | 
            
                                                                        
                            
            
                                    
            
            
                | 115 |  |  |         // Hiding for localizations because it is unknown what should be the function in that case | 
            
                                                                        
                            
            
                                    
            
            
                | 116 |  |  |         if (isset($allow['hide']) && $hideField && $this->backendUser->workspace === 0 && !$dataArr['_LOCALIZED_UID']) { | 
            
                                                                        
                            
            
                                    
            
            
                | 117 |  |  |             if ($dataArr[$hideField]) { | 
            
                                                                        
                            
            
                                    
            
            
                | 118 |  |  |                 $icon = $this->iconFactory->getIcon('actions-edit-unhide', Icon::SIZE_SMALL)->render('inline'); | 
            
                                                                        
                            
            
                                    
            
            
                | 119 |  |  |                 $panel .= $this->editPanelLinkWrap($icon, $formName, 'unhide'); | 
            
                                                                        
                            
            
                                    
            
            
                | 120 |  |  |             } else { | 
            
                                                                        
                            
            
                                    
            
            
                | 121 |  |  |                 $icon = $this->iconFactory->getIcon('actions-edit-hide', Icon::SIZE_SMALL)->render('inline'); | 
            
                                                                        
                            
            
                                    
            
            
                | 122 |  |  |                 $panel .= $this->editPanelLinkWrap($icon, $formName, 'hide', '', $this->backendUser->extGetLL('p_hideConfirm')); | 
            
                                                                        
                            
            
                                    
            
            
                | 123 |  |  |             } | 
            
                                                                        
                            
            
                                    
            
            
                | 124 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 125 |  |  |         if (isset($allow['new'])) { | 
            
                                                                        
                            
            
                                    
            
            
                | 126 |  |  |             if ($table === 'pages') { | 
            
                                                                        
                            
            
                                    
            
            
                | 127 |  |  |                 $icon = '<span title="' . $this->backendUser->extGetLL('p_newSubpage') . '">' | 
            
                                                                        
                            
            
                                    
            
            
                | 128 |  |  |                     . $this->iconFactory->getIcon('actions-page-new', Icon::SIZE_SMALL)->render('inline') | 
            
                                                                        
                            
            
                                    
            
            
                | 129 |  |  |                     . '</span>'; | 
            
                                                                        
                            
            
                                    
            
            
                | 130 |  |  |                 $panel .= $this->editPanelLinkWrap($icon, $formName, 'new', $currentRecord, ''); | 
            
                                                                        
                            
            
                                    
            
            
                | 131 |  |  |             } else { | 
            
                                                                        
                            
            
                                    
            
            
                | 132 |  |  |                 $icon = '<span title="' . $this->backendUser->extGetLL('p_newRecordAfter') . '">' | 
            
                                                                        
                            
            
                                    
            
            
                | 133 |  |  |                     . $this->iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL)->render('inline') | 
            
                                                                        
                            
            
                                    
            
            
                | 134 |  |  |                     . '</span>'; | 
            
                                                                        
                            
            
                                    
            
            
                | 135 |  |  |                 $panel .= $this->editPanelLinkWrap($icon, $formName, 'new', $currentRecord, '', $newUID); | 
            
                                                                        
                            
            
                                    
            
            
                | 136 |  |  |             } | 
            
                                                                        
                            
            
                                    
            
            
                | 137 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 138 |  |  |         // Hiding in workspaces because implementation is incomplete | 
            
                                                                        
                            
            
                                    
            
            
                | 139 |  |  |         // Hiding for localizations because it is unknown what should be the function in that case | 
            
                                                                        
                            
            
                                    
            
            
                | 140 |  |  |         if (isset($allow['delete']) && $this->backendUser->workspace === 0 && !$dataArr['_LOCALIZED_UID']) { | 
            
                                                                        
                            
            
                                    
            
            
                | 141 |  |  |             $icon = '<span title="' . $this->backendUser->extGetLL('p_delete') . '">' | 
            
                                                                        
                            
            
                                    
            
            
                | 142 |  |  |                 . $this->iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render('inline') | 
            
                                                                        
                            
            
                                    
            
            
                | 143 |  |  |                 . '</span>'; | 
            
                                                                        
                            
            
                                    
            
            
                | 144 |  |  |             $panel .= $this->editPanelLinkWrap($icon, $formName, 'delete', '', $this->backendUser->extGetLL('p_deleteConfirm')); | 
            
                                                                        
                            
            
                                    
            
            
                | 145 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 146 |  |  |         // Final | 
            
                                                                        
                            
            
                                    
            
            
                | 147 |  |  |         $labelTxt = $this->cObj->stdWrap($conf['label'], $conf['label.']); | 
            
                                                                        
                            
            
                                    
            
            
                | 148 |  |  |         foreach ((array)$hiddenFields as $name => $value) { | 
            
                                                                        
                            
            
                                    
            
            
                | 149 |  |  |             $hiddenFieldString .= '<input type="hidden" name="TSFE_EDIT[' . htmlspecialchars($name) . ']" value="' . htmlspecialchars($value) . '"/>' . LF; | 
            
                                                                        
                            
            
                                    
            
            
                | 150 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 151 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 152 |  |  |         $panel = '<!-- BE_USER Edit Panel: --> | 
            
                                                                        
                            
            
                                    
            
            
                | 153 |  |  | 								' . $formTag . $hiddenFieldString . ' | 
            
                                                                        
                            
            
                                    
            
            
                | 154 |  |  | 									<input type="hidden" name="TSFE_EDIT[cmd]" value="" /> | 
            
                                                                        
                            
            
                                    
            
            
                | 155 |  |  | 									<input type="hidden" name="TSFE_EDIT[record]" value="' . $currentRecord . '" /> | 
            
                                                                        
                            
            
                                    
            
            
                | 156 |  |  | 									<div class="typo3-editPanel" style="display: none;">' | 
            
                                                                        
                            
            
                                    
            
            
                | 157 |  |  |                                         . '<div class="typo3-editPanel-btn-group">' | 
            
                                                                        
                            
            
                                    
            
            
                | 158 |  |  |                                         . $panel | 
            
                                                                        
                            
            
                                    
            
            
                | 159 |  |  |                                         . '</div>' . | 
            
                                                                        
                            
            
                                    
            
            
                | 160 |  |  |             ($labelTxt ? '<div class="typo3-editPanel-label">' . sprintf($labelTxt, htmlspecialchars(GeneralUtility::fixed_lgd_cs($dataArr[$labelField], 50))) . '</div>' : '') . ' | 
            
                                                                        
                            
            
                                    
            
            
                | 161 |  |  | 									</div> | 
            
                                                                        
                            
            
                                    
            
            
                | 162 |  |  | 								</form>'; | 
            
                                                                        
                            
            
                                    
            
            
                | 163 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 164 |  |  |         // Wrap the panel | 
            
                                                                        
                            
            
                                    
            
            
                | 165 |  |  |         if ($conf['innerWrap']) { | 
            
                                                                        
                            
            
                                    
            
            
                | 166 |  |  |             $panel = $this->cObj->wrap($panel, $conf['innerWrap']); | 
            
                                                                        
                            
            
                                    
            
            
                | 167 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 168 |  |  |         if ($conf['innerWrap.']) { | 
            
                                                                        
                            
            
                                    
            
            
                | 169 |  |  |             $panel = $this->cObj->stdWrap($panel, $conf['innerWrap.']); | 
            
                                                                        
                            
            
                                    
            
            
                | 170 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 171 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 172 |  |  |         // Wrap the complete panel | 
            
                                                                        
                            
            
                                    
            
            
                | 173 |  |  |         if ($conf['outerWrap']) { | 
            
                                                                        
                            
            
                                    
            
            
                | 174 |  |  |             $panel = $this->cObj->wrap($panel, $conf['outerWrap']); | 
            
                                                                        
                            
            
                                    
            
            
                | 175 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 176 |  |  |         if ($conf['outerWrap.']) { | 
            
                                                                        
                            
            
                                    
            
            
                | 177 |  |  |             $panel = $this->cObj->stdWrap($panel, $conf['outerWrap.']); | 
            
                                                                        
                            
            
                                    
            
            
                | 178 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 179 |  |  |         if ($conf['printBeforeContent']) { | 
            
                                                                        
                            
            
                                    
            
            
                | 180 |  |  |             $finalOut = $panel . $content; | 
            
                                                                        
                            
            
                                    
            
            
                | 181 |  |  |         } else { | 
            
                                                                        
                            
            
                                    
            
            
                | 182 |  |  |             $finalOut = $content . $panel; | 
            
                                                                        
                            
            
                                    
            
            
                | 183 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 184 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 185 |  |  |         $hidden = $this->isDisabled($table, $dataArr) ? ' typo3-feedit-element-hidden' : ''; | 
            
                                                                        
                            
            
                                    
            
            
                | 186 |  |  |         $outerWrapConfig = isset($conf['stdWrap.']) | 
            
                                                                        
                            
            
                                    
            
            
                | 187 |  |  |             ? $conf['stdWrap.'] | 
            
                                                                        
                            
            
                                    
            
            
                | 188 |  |  |             : ['wrap' => '<div class="typo3-feedit-element' . $hidden . '">|</div>']; | 
            
                                                                        
                            
            
                                    
            
            
                | 189 |  |  |         $finalOut = $this->cObj->stdWrap($finalOut, $outerWrapConfig); | 
            
                                                                        
                            
            
                                    
            
            
                | 190 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 191 |  |  |         return $finalOut; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |      * Adds an edit icon to the content string. The edit icon links to EditDocumentController with proper parameters for editing the table/fields of the context. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |      * This implements TYPO3 context sensitive editing facilities. Only backend users will have access (if properly configured as well). | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |      * @param string $content The content to which the edit icons should be appended | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |      * @param string $params The parameters defining which table and fields to edit. Syntax is [tablename]:[fieldname],[fieldname],[fieldname],... OR [fieldname],[fieldname],[fieldname],... (basically "[tablename]:" is optional, default table is the one of the "current record" used in the function). The fieldlist is sent as "&columnsOnly=" parameter to EditDocumentController | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |      * @param array $conf TypoScript properties for configuring the edit icons. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |      * @param string $currentRecord The "table:uid" of the record being shown. If empty string then $this->currentRecord is used. For new records (set by $conf['newRecordFromTable']) it's auto-generated to "[tablename]:NEW | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |      * @param array $dataArr Alternative data array to use. Default is $this->data | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |      * @param string $addUrlParamStr Additional URL parameters for the link pointing to EditDocumentController | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |      * @param string $table | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |      * @param int $editUid | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |      * @param string $fieldList | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |      * @return string The input content string, possibly with edit icons added (not necessarily in the end but just after the last string of normal content. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |     public function editIcons($content, $params, array $conf = [], $currentRecord = '', array $dataArr = [], $addUrlParamStr = '', $table, $editUid, $fieldList) | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |         // Special content is about to be shown, so the cache must be disabled. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |         $this->frontendController->set_no_cache('Display frontend edit icons', true); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |         $iconTitle = $this->cObj->stdWrap($conf['iconTitle'], $conf['iconTitle.']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |         $iconImg = '<span title="' . htmlspecialchars($iconTitle, ENT_COMPAT, 'UTF-8', false) . '" style="' . ($conf['styleAttribute'] ? htmlspecialchars($conf['styleAttribute']) : '') . '">' | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |             . $this->iconFactory->getIcon('actions-document-open', Icon::SIZE_SMALL)->render('inline') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |             . '</span>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |         $noView = GeneralUtility::_GP('ADMCMD_view') ? 1 : 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |         $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |         $url = (string)$uriBuilder->buildUriFromRoute( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |             'record_edit', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |             [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |                 'edit[' . $table . '][' . $editUid . ']' => 'edit', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |                 'columnsOnly' => $fieldList, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |                 'noView' => $noView, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |                 'feEdit' => 1 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |             ] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |         ) . $addUrlParamStr; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |         $icon = $this->editPanelLinkWrap_doWrap($iconImg, $url, 'content-link'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |         if ($conf['beforeLastTag'] < 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  |             $content = $icon . $content; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |         } elseif ($conf['beforeLastTag'] > 0) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |             $cBuf = rtrim($content); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |             $secureCount = 30; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |             while ($secureCount && substr($cBuf, -1) === '>' && substr($cBuf, -4) !== '</a>') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |                 $cBuf = rtrim(preg_replace('/<[^<]*>$/', '', $cBuf)); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |                 $secureCount--; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |             $content = strlen($cBuf) && $secureCount ? substr($content, 0, strlen($cBuf)) . $icon . substr($content, strlen($cBuf)) : ($content = $icon . $content); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                            
                                                                                            
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |             $content .= $icon; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |         return $content; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |      * Helper function for editPanel() which wraps icons in the panel in a link with the action of the panel. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |      * The links are for some of them not simple hyperlinks but onclick-actions which submits a little form which the panel is wrapped in. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  |      * @param string $string The string to wrap in a link, typ. and image used as button in the edit panel. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |      * @param string $formName The name of the form wrapping the edit panel. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |      * @param string $cmd The command of the link. There is a predefined list available: edit, new, up, down etc. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |      * @param string $currentRecord The "table:uid" of the record being processed by the panel. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |      * @param string $confirm Text string with confirmation message; If set a confirm box will be displayed before carrying out the action (if Yes is pressed) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  |      * @param int|string $nPid "New pid" - for new records | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |      * @return string A <a> tag wrapped string. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |     protected function editPanelLinkWrap($string, $formName, $cmd, $currentRecord = '', $confirm = '', $nPid = '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |         $noView = GeneralUtility::_GP('ADMCMD_view') ? 1 : 0; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |         /** @var \TYPO3\CMS\Backend\Routing\UriBuilder $uriBuilder */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 |  |  |         $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 |  |  |         if ($cmd === 'edit') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 |  |  |             $rParts = explode(':', $currentRecord); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  |             $out = $this->editPanelLinkWrap_doWrap($string, (string)$uriBuilder->buildUriFromRoute('record_edit', ['edit[' . $rParts[0] . '][' . $rParts[1] . ']' => 'edit', 'noView' => $noView, 'feEdit' => 1]), $currentRecord); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |         } elseif ($cmd === 'new') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 |  |  |             $rParts = explode(':', $currentRecord); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 |  |  |             if ($rParts[0] === 'pages') { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  |                 $out = $this->editPanelLinkWrap_doWrap($string, (string)$uriBuilder->buildUriFromRoute('db_new', ['id' => $rParts[1], 'pagesOnly' => 1]), $currentRecord); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 |  |  |                 if (!(int)$nPid) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |                     $nPid = MathUtility::canBeInterpretedAsInteger($rParts[1]) ? -$rParts[1] : $this->frontendController->id; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |                 } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |                 $out = $this->editPanelLinkWrap_doWrap($string, (string)$uriBuilder->buildUriFromRoute('record_edit', ['edit[' . $rParts[0] . '][' . $nPid . ']' => 'new', 'noView' => $noView]), $currentRecord); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  |         } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  |             if ($confirm && $this->backendUser->jsConfirmation(JsConfirmation::FE_EDIT)) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |                 // Gets htmlspecialchared later | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |                 $cf1 = 'if (confirm(' . GeneralUtility::quoteJSvalue($confirm) . ')) {'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |                 $cf2 = '}'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |             } else { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |                 $cf1 = ($cf2 = ''); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |             } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |             $out = '<a href="#" class="typo3-editPanel-btn typo3-editPanel-btn-default" onclick="' . htmlspecialchars(($cf1 . 'document.' . $formName . '[\'TSFE_EDIT[cmd]\'].value=\'' . $cmd . '\'; document.' . $formName . '.submit();' . $cf2 . ' return false;')) . '">' . $string . '</a>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |         return $out; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |      * Creates a link to a script (eg. EditDocumentController or NewRecordController) which either opens in the current frame OR in a pop-up window. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |      * @param string $string The string to wrap in a link, typ. and image used as button in the edit panel. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |      * @param string $url The URL of the link. Should be absolute if supposed to work with <base> path set. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |      * @param string $additionalClasses Additional CSS classes | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |      * @return string A <a> tag wrapped string. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |      * @see editPanelLinkWrap() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  |     protected function editPanelLinkWrap_doWrap($string, $url, $additionalClasses = '') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |         $width = MathUtility::forceIntegerInRange($this->backendUser->getTSConfigVal('options.feedit.popupWidth'), 690, 5000, 690); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  |         $height = MathUtility::forceIntegerInRange($this->backendUser->getTSConfigVal('options.feedit.popupHeight'), 500, 5000, 500); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  |         $onclick = 'vHWin=window.open(' . GeneralUtility::quoteJSvalue($url . '&returnUrl=' . rawurlencode(PathUtility::getAbsoluteWebPath(GeneralUtility::getFileAbsFileName('EXT:backend/Resources/Private/Templates/Close.html')))) . ',\'FEquickEditWindow\',\'width=' . $width . ',height=' . $height . ',status=0,menubar=0,scrollbars=1,resizable=1\');vHWin.focus();return false;'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  |         return '<a href="#" class="typo3-editPanel-btn typo3-editPanel-btn-default frontEndEditIconLinks ' . htmlspecialchars($additionalClasses) . '" onclick="' . htmlspecialchars($onclick) . '" style="display: none;">' . $string . '</a>'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  |      * Returns TRUE if the input table/row would be hidden in the frontend, according to the current time and simulate user group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  |      * @param string $table The table name | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  |      * @param array $row The data record | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  |      * @return bool | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  |     protected function isDisabled($table, array $row) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |         $status = false; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |         if ( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |             $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled'] && | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |             $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['disabled']] || | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  |             $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['fe_group'] && | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |             $this->frontendController->simUserGroup && | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |             $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['fe_group']] == $this->frontendController->simUserGroup || | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |             $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['starttime'] && | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |             $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['starttime']] > $GLOBALS['EXEC_TIME'] || | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  |             $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['endtime'] && | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  |             $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['endtime']] && | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  |             $row[$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']['endtime']] < $GLOBALS['EXEC_TIME'] | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  |         ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  |             $status = true; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |         return $status; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 333 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 334 |  |  |  |