68 $this->tsfeObj = $pObj;
70 if (is_array($this->previewConfiguration)) {
76 'TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController',
92 unset($_COOKIE[
'be_typo_user']);
105 public function initializePreviewUser(&$params, &$pObj) {
107 $workspaceUid = $this->previewConfiguration[
'fullWorkspace'];
108 $workspaceRecord = null;
109 if ((is_null($params[
'BE_USER']) || $params[
'BE_USER'] === FALSE) && $this->previewConfiguration !== FALSE && $this->previewConfiguration[
'BEUSER_uid'] > 0) {
113 $tempBackendUser->userTS_dontGetCached = 1;
114 $tempBackendUser->setBeUserByUid($this->previewConfiguration[
'BEUSER_uid']);
115 if ($tempBackendUser->user[
'uid']) {
116 $tempBackendUser->unpack_uc(
'');
117 $tempBackendUser->fetchGroupData();
120 $workspaceRecord =
$GLOBALS[
'TYPO3_DB']->exec_SELECTgetSingleRow(
121 'uid, adminusers, reviewers, members, db_mountpoints',
126 if (empty($tempBackendUser->groupData[
'webmounts'])) {
127 $tempBackendUser->groupData[
'webmounts'] = !empty($workspaceRecord[
'db_mountpoints']) ? $workspaceRecord[
'db_mountpoints'] : $pObj->id;
130 $workspaceRecord[
'members'] =
'be_users_' . $this->previewConfiguration[
'BEUSER_uid'];
132 $this->forceReadPermissions = TRUE;
137 $BE_USER->user = $tempBackendUser->user;
139 $BE_USER->groupData[
'webmounts'] = $tempBackendUser->groupData[
'webmounts'];
140 $BE_USER->groupList = $tempBackendUser->groupList;
141 $BE_USER->userGroups = $tempBackendUser->userGroups;
142 $BE_USER->userGroupsUID = $tempBackendUser->userGroupsUID;
143 $pObj->beUserLogin = TRUE;
146 $pObj->beUserLogin = FALSE;
147 $_SESSION[
'TYPO3-TT-start'] = FALSE;
149 unset($tempBackendUser);
154 && is_object($params[
'BE_USER'])
155 && \
TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($workspaceUid)
156 && $params[
'BE_USER']->isInWebMount($pObj->id)
158 if ($workspaceUid == 0 || $workspaceUid >= -1 && $params[
'BE_USER']->checkWorkspace($workspaceRecord ?: $workspaceUid)) {
160 $pObj->workspacePreview = (int)$workspaceUid;
163 $pObj->workspacePreview = -99;
178 $clause = $parameters[
'currentClause'];
179 if ($parameters[
'perms'] & 1 && $this->forceReadPermissions) {
195 $permissions = $parameters[
'outputPermissions'];
196 if (!($permissions & 1) && $this->forceReadPermissions) {
221 if ($inputCode && $inputCode !==
'IGNORE') {
223 if ($inputCode ==
'LOGOUT') {
225 if ($this->tsfeObj->TYPO3_CONF_VARS[
'FE'][
'workspacePreviewLogoutTemplate']) {
226 $templateFile = PATH_site . $this->tsfeObj->TYPO3_CONF_VARS[
'FE'][
'workspacePreviewLogoutTemplate'];
227 if (@is_file($templateFile)) {
228 $message =
GeneralUtility::getUrl(PATH_site . $this->tsfeObj->TYPO3_CONF_VARS[
'FE'][
'workspacePreviewLogoutTemplate']);
230 $message =
'<strong>ERROR!</strong><br>Template File "' 231 . $this->tsfeObj->TYPO3_CONF_VARS[
'FE'][
'workspacePreviewLogoutTemplate']
232 .
'" configured with $TYPO3_CONF_VARS["FE"]["workspacePreviewLogoutTemplate"] not found. Please contact webmaster about this problem.';
235 $message =
'You logged out from Workspace preview mode. Click this link to <a href="%1$s">go back to the website</a>';
238 die(sprintf($message, htmlspecialchars(preg_replace(
'/\\&?' . $this->previewKey .
'=[[:alnum:]]+/',
'', $returnUrl))));
241 $where =
'keyword=' .
$GLOBALS[
'TYPO3_DB']->fullQuoteStr($inputCode,
'sys_preview') .
' AND endtime>' .
$GLOBALS[
'EXEC_TIME'];
242 $previewData =
$GLOBALS[
'TYPO3_DB']->exec_SELECTgetSingleRow(
'*',
'sys_preview', $where);
246 if (is_array($previewData)) {
249 $previewConfig = unserialize($previewData[
'config']);
256 if ($previewConfig[
'fullWorkspace']) {
267 return $previewConfig;
271 parse_str($previewConfig[
'getVars'], $GET_VARS);
274 return $previewConfig;
278 throw new \Exception(htmlspecialchars(
'Request URL did not match "' 280 . $inputCode .
'"', 1294585190));
283 throw new \Exception(
'POST requests are incompatible with keyword preview.', 1294585191);
286 throw new \Exception(
'ADMCMD command could not be executed! (No keyword configuration found)', 1294585192);
300 if (!$inputCode && $_COOKIE[$this->previewKey]) {
322 'keyword' => md5(uniqid(microtime(), TRUE)),
324 'endtime' =>
$GLOBALS[
'EXEC_TIME'] + $ttl,
325 'config' => serialize(array(
326 'fullWorkspace' => $fullWorkspace,
327 'getVars' => $getVarsStr,
328 'BEUSER_uid' => $backendUserUid
331 $GLOBALS[
'TYPO3_DB']->exec_INSERTquery(
'sys_preview', $fieldData);
332 return $fieldData[
'keyword'];
343 $ttlHours = (int)
$GLOBALS[
'BE_USER']->getTSConfigVal(
'options.workspaces.previewLinkTTLHours');
344 return $ttlHours ? $ttlHours : 24 * 2;
352 'TYPO3\\CMS\\Backend\\FrontendBackendUserAuthentication'
overridePagePermissionClause(array $parameters)
createFrontendBackendUser()
checkForPreview($params, &$pObj)
static getIndpEnv($getEnvName)
getPreviewConfiguration()
static makeInstance($className)
static _GETset($inputGet, $key='')
static getUrl($url, $includeHeader=0, $requestHeaders=FALSE, &$report=NULL)
static isLoaded($key, $exitOnError=FALSE)
overridePermissionCalculation(array $parameters)
compilePreviewKeyword($getVarsStr, $backendUserUid, $ttl=172800, $fullWorkspace=NULL)
static sanitizeLocalUrl($url='')
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static deleteClause($table, $tableAlias='')