Beispiel #1
0
 /**
  * Executing the posted actions ...
  *
  * @return	void
  */
 function main()
 {
     global $BE_USER, $TYPO3_CONF_VARS;
     // LOAD TCEmain with data and cmd arrays:
     $this->tce->start($this->data, $this->cmd);
     if (is_array($this->mirror)) {
         $this->tce->setMirror($this->mirror);
     }
     // Checking referer / executing
     $refInfo = parse_url(t3lib_div::getIndpEnv('HTTP_REFERER'));
     $httpHost = t3lib_div::getIndpEnv('TYPO3_HOST_ONLY');
     if ($httpHost != $refInfo['host'] && $this->vC != $BE_USER->veriCode() && !$TYPO3_CONF_VARS['SYS']['doNotCheckReferer']) {
         $this->tce->log('', 0, 0, 0, 1, 'Referer host "%s" and server host "%s" did not match and veriCode was not valid either!', 1, array($refInfo['host'], $httpHost));
     } else {
         // Register uploaded files
         $this->tce->process_uploads($_FILES);
         // Execute actions:
         $this->tce->process_datamap();
         $this->tce->process_cmdmap();
         // Clearing cache:
         $this->tce->clear_cacheCmd($this->cacheCmd);
         // Update page tree?
         if ($this->uPT && (isset($this->data['pages']) || isset($this->cmd['pages']))) {
             t3lib_BEfunc::setUpdateSignal('updatePageTree');
         }
     }
 }
 /**
  * This method is used to extend the tce_main process_cmdmap function. It provides the functionallity to
  * disallow users to move, cut or copy any element which has an overlay. Moving and Cutting of elements
  * with overlays is dangerous because the extisting overlays may also need to be moved.
  *
  *
  */
 function process_cmdmap()
 {
     if (t3lib_extMgm::isLoaded('languagevisibility') && $this->isCutCopyAndMoveObservationEnabled()) {
         require_once t3lib_extMgm::extPath("languagevisibility") . 'patch/lib/class.tx_languagevisibility_commandMap.php';
         //user has no rights to cut move copy or delete, therefore the commands need to be filtered
         $command_map = t3lib_div::makeInstance('tx_languagevisibility_commandMap');
         $command_map->setMap($this->cmdmap);
         $command_elements = $command_map->getElementsByCommands(array('cut', 'move', 'copy', 'delete'));
         if (is_array($command_elements)) {
             foreach ($command_elements as $command_element) {
                 try {
                     //get row
                     $table = $command_element['table'];
                     $uid = $command_element['uid'];
                     $row = tx_languagevisibility_daocommon::getRecord($uid, $table);
                     $command = $command_element['cmd'];
                     if (tx_languagevisibility_beservices::isOverlayRecord($row, $table)) {
                         //current element is an overlay -> restrict cut copy and move in general -> filter the command map
                         if (($command == 'move' || $command == 'cut' || $command == 'copy') && $this->isCutCopyAndMoveRestrictedForOverlays()) {
                             $this->newlog('The command ' . $command . ' can not be applied on overlays', 1);
                             //overlay records should no be move,copy or cutable but it should be possible to delete them
                             //therefore we remove all elements which have the comment cut, copy or move
                             $command_map->removeElement($command_element);
                         }
                     } else {
                         //current element is no overlay
                         if (!tx_languagevisibility_beservices::canCurrrentUserCutCopyMoveDelete()) {
                             //if the record has any translation disallow move, cut, copy and delete
                             $elementObj = tx_languagevisibility_beservices::getElement($uid, $table);
                             if ($elementObj->hasAnyTranslationInAnyWorkspace()) {
                                 $command_map->removeElement($command_element);
                                 $this->newlog('You have no rights to apply the command ' . $command . ' on elements with overlays', 1);
                             }
                         }
                     }
                 } catch (Exception $e) {
                     //element not supported by language visibility
                 }
             }
         }
         //overwrite the internal map an process the base tce_main method
         $this->cmdmap = $command_map->getMap();
     }
     //process parent method to use basic functionallity
     parent::process_cmdmap();
 }