/**
  * Setting stage of record
  *
  * @param string $table Table name
  * @param integer $integer Record UID
  * @param integer $stageId Stage ID to set
  * @param string $comment Comment that goes into log
  * @param boolean $notificationEmailInfo Accumulate state changes in memory for compiled notification email?
  * @param t3lib_TCEmain $tcemainObj TCEmain object
  * @param string $notificationAlternativeRecipients comma separated list of recipients to notificate instead of normal be_users
  * @return void
  */
 protected function version_setStage($table, $id, $stageId, $comment = '', $notificationEmailInfo = FALSE, t3lib_TCEmain $tcemainObj, $notificationAlternativeRecipients = FALSE)
 {
     if ($errorCode = $tcemainObj->BE_USER->workspaceCannotEditOfflineVersion($table, $id)) {
         $tcemainObj->newlog('Attempt to set stage for record failed: ' . $errorCode, 1);
     } elseif ($tcemainObj->checkRecordUpdateAccess($table, $id)) {
         $record = t3lib_BEfunc::getRecord($table, $id);
         $stat = $tcemainObj->BE_USER->checkWorkspace($record['t3ver_wsid']);
         // check if the usere is allowed to the current stage, so it's also allowed to send to next stage
         if ($GLOBALS['BE_USER']->workspaceCheckStageForCurrent($record['t3ver_stage'])) {
             // Set stage of record:
             $updateData = array('t3ver_stage' => $stageId);
             $GLOBALS['TYPO3_DB']->exec_UPDATEquery($table, 'uid=' . intval($id), $updateData);
             $tcemainObj->newlog2('Stage for record was changed to ' . $stageId . '. Comment was: "' . substr($comment, 0, 100) . '"', $table, $id);
             // TEMPORARY, except 6-30 as action/detail number which is observed elsewhere!
             $tcemainObj->log($table, $id, 6, 0, 0, 'Stage raised...', 30, array('comment' => $comment, 'stage' => $stageId));
             if ((int) $stat['stagechg_notification'] > 0) {
                 if ($notificationEmailInfo) {
                     $this->notificationEmailInfo[$stat['uid'] . ':' . $stageId . ':' . $comment]['shared'] = array($stat, $stageId, $comment);
                     $this->notificationEmailInfo[$stat['uid'] . ':' . $stageId . ':' . $comment]['elements'][] = $table . ':' . $id;
                     $this->notificationEmailInfo[$stat['uid'] . ':' . $stageId . ':' . $comment]['alternativeRecipients'] = $notificationAlternativeRecipients;
                 } else {
                     $this->notifyStageChange($stat, $stageId, $table, $id, $comment, $tcemainObj, $notificationAlternativeRecipients);
                 }
             }
         } else {
             $tcemainObj->newlog('The member user tried to set a stage value "' . $stageId . '" that was not allowed', 1);
         }
     } else {
         $tcemainObj->newlog('Attempt to set stage for record failed because you do not have edit access', 1);
     }
 }
Exemplo n.º 2
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');
         }
     }
 }