TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Version\Hook\PreviewHook Class Reference
Inheritance diagram for TYPO3\CMS\Version\Hook\PreviewHook:
TYPO3\CMS\Core\SingletonInterface Tx_Version_Preview

Public Member Functions

 checkForPreview ($params, &$pObj)
 
 overridePagePermissionClause (array $parameters)
 
 overridePermissionCalculation (array $parameters)
 
 getPreviewConfiguration ()
 
 compilePreviewKeyword ($getVarsStr, $backendUserUid, $ttl=172800, $fullWorkspace=NULL)
 
 getPreviewLinkLifetime ()
 

Protected Member Functions

 getPreviewInputCode ()
 
 createFrontendBackendUser ()
 

Protected Attributes

 $previewKey = 'ADMCMD_prev'
 
 $tsfeObj
 
 $previewConfiguration = FALSE
 
 $forceReadPermissions = FALSE
 

Detailed Description

Hook for checking if the preview mode is activated preview mode = show a page of a workspace without having to log in

Author
Workspaces Team (http://forge.typo3.org/projects/show/typo3v4-workspaces)

Definition at line 28 of file PreviewHook.php.

Member Function Documentation

◆ checkForPreview()

TYPO3\CMS\Version\Hook\PreviewHook::checkForPreview (   $params,
$pObj 
)

hook to check if the preview is activated right now, this hook is called at the end of "$TSFE->connectToDB"

Parameters
array$params(not needed right now)
\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController$pObj
Returns
void

Definition at line 67 of file PreviewHook.php.

References $BE_USER, $GLOBALS, TYPO3\CMS\Version\Hook\PreviewHook\$tsfeObj, TYPO3\CMS\Core\Utility\GeneralUtility\_GP(), TYPO3\CMS\Version\Hook\PreviewHook\createFrontendBackendUser(), TYPO3\CMS\Backend\Utility\BackendUtility\deleteClause(), TYPO3\CMS\Version\Hook\PreviewHook\getPreviewConfiguration(), TYPO3\CMS\Core\Utility\ExtensionManagementUtility\isLoaded(), and TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

◆ compilePreviewKeyword()

TYPO3\CMS\Version\Hook\PreviewHook::compilePreviewKeyword (   $getVarsStr,
  $backendUserUid,
  $ttl = 172800,
  $fullWorkspace = NULL 
)

Set preview keyword, eg: $previewUrl = GeneralUtility::getIndpEnv('TYPO3_SITE_URL').'index.php?ADMCMD_prev='.$this->compilePreviewKeyword('id='.$pageId.'&L='.$language.'&ADMCMD_view=1&ADMCMD_editIcons=1&ADMCMD_previewWS='.$this->workspace, $GLOBALS['BE_USER']->user['uid'], 120);

todo for sys_preview:

  • Add a comment which can be shown to previewer in frontend in some way (plus maybe ability to write back, take other action?)
  • Add possibility for the preview keyword to work in the backend as well: So it becomes a quick way to a certain action of sorts?
Parameters
string$getVarsStrGet variables to preview, eg. 'id=1150&L=0&ADMCMD_view=1&ADMCMD_editIcons=1&ADMCMD_previewWS=8'
string$backendUserUid32 byte MD5 hash keyword for the URL: "?ADMCMD_prev=[keyword]
int$ttlTime-To-Live for keyword
int | NULL$fullWorkspaceWhich workspace to preview. Workspace UID, -1 or >0. If set, the getVars is ignored in the frontend, so that string can be empty
Returns
string Returns keyword to use in URL for ADMCMD_prev=

Definition at line 320 of file PreviewHook.php.

References $GLOBALS.

◆ createFrontendBackendUser()

TYPO3\CMS\Version\Hook\PreviewHook::createFrontendBackendUser ( )
protected
Returns
FrontendBackendUserAuthentication

Definition at line 350 of file PreviewHook.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\makeInstance().

Referenced by TYPO3\CMS\Version\Hook\PreviewHook\checkForPreview().

◆ getPreviewConfiguration()

TYPO3\CMS\Version\Hook\PreviewHook::getPreviewConfiguration ( )

Looking for a ADMCMD_prev code, looks it up if found and returns configuration data. Background: From the backend a request to the frontend to show a page, possibly with workspace preview can be "recorded" and associated with a keyword. When the frontend is requested with this keyword the associated request parameters are restored from the database AND the backend user is loaded - only for that request. The main point is that a special URL valid for a limited time, eg. http://localhost/typo3site/index.php?ADMCMD_prev=035d9bf938bd23cb657735f68a8cedbf will open up for a preview that doesn't require login. Thus it's useful for sending in an email to someone without backend account. This can also be used to generate previews of hidden pages, start/endtimes, usergroups and those other settings from the Admin Panel - just not implemented yet.

Exceptions

Definition at line 218 of file PreviewHook.php.

References $GLOBALS, TYPO3\CMS\Core\Utility\GeneralUtility\_GET(), TYPO3\CMS\Core\Utility\GeneralUtility\_GETset(), TYPO3\CMS\Core\Utility\GeneralUtility\_GP(), TYPO3\CMS\Core\Utility\GeneralUtility\_POST(), die, TYPO3\CMS\Core\Utility\GeneralUtility\getIndpEnv(), TYPO3\CMS\Version\Hook\PreviewHook\getPreviewInputCode(), TYPO3\CMS\Core\Utility\GeneralUtility\getUrl(), and TYPO3\CMS\Core\Utility\GeneralUtility\sanitizeLocalUrl().

Referenced by TYPO3\CMS\Version\Hook\PreviewHook\checkForPreview().

◆ getPreviewInputCode()

TYPO3\CMS\Version\Hook\PreviewHook::getPreviewInputCode ( )
protected

returns the input code value from the admin command variable

Returns
string Input code

Definition at line 297 of file PreviewHook.php.

References TYPO3\CMS\Version\Hook\PreviewHook\$previewKey, and TYPO3\CMS\Core\Utility\GeneralUtility\_GP().

Referenced by TYPO3\CMS\Version\Hook\PreviewHook\getPreviewConfiguration().

◆ getPreviewLinkLifetime()

TYPO3\CMS\Version\Hook\PreviewHook::getPreviewLinkLifetime ( )

easy function to just return the number of hours a preview link is valid, based on the TSconfig value "options.workspaces.previewLinkTTLHours" by default, it's 48hs

Returns
integer The hours as a number

Definition at line 342 of file PreviewHook.php.

References $GLOBALS.

◆ overridePagePermissionClause()

TYPO3\CMS\Version\Hook\PreviewHook::overridePagePermissionClause ( array  $parameters)

Overrides the page permission clause in case an admin user has been degraded to a regular user without any user group assignments. This method is used as hook callback.

Parameters
array$parameters
Returns
string
See also
::getPagePermsClause

Definition at line 177 of file PreviewHook.php.

◆ overridePermissionCalculation()

TYPO3\CMS\Version\Hook\PreviewHook::overridePermissionCalculation ( array  $parameters)

Overrides the row permission value in case an admin user has been degraded to a regular user without any user group assignments. This method is used as hook callback.

Parameters
array$parameters
Returns
int
See also
::calcPerms

Definition at line 194 of file PreviewHook.php.

Member Data Documentation

◆ $forceReadPermissions

TYPO3\CMS\Version\Hook\PreviewHook::$forceReadPermissions = FALSE
protected

Definition at line 57 of file PreviewHook.php.

◆ $previewConfiguration

TYPO3\CMS\Version\Hook\PreviewHook::$previewConfiguration = FALSE
protected

Definition at line 49 of file PreviewHook.php.

◆ $previewKey

TYPO3\CMS\Version\Hook\PreviewHook::$previewKey = 'ADMCMD_prev'
protected

◆ $tsfeObj

TYPO3\CMS\Version\Hook\PreviewHook::$tsfeObj
protected

Definition at line 42 of file PreviewHook.php.

Referenced by TYPO3\CMS\Version\Hook\PreviewHook\checkForPreview().