Created
September 8, 2012 18:47
-
-
Save SimonWpt/3678531 to your computer and use it in GitHub Desktop.
TYPO3 - Weiche für 404 oder FE-Login
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$TYPO3_CONF_VARS['SYS']['curlUse'] = '1'; | |
$TYPO3_CONF_VARS['FE']['pageNotFound_handling'] = 'USER_FUNCTION:fileadmin/scripts/pageNotFoundHandling.php:user_pageNotFound->pageNotFound'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define(LOGIN_URL, 'http://www.example.com/login'); | |
define(NOTFOUND_URL, 'http://www.example.com/page-not-found'); | |
class user_pageNotFound { | |
function pageNotFound($param, $ref) { | |
if ($param['pageAccessFailureReasons']['fe_group'] != array(''=>0)) { | |
header('HTTP/1.0 403 Forbidden'); | |
$url = LOGIN_URL.'?redirect_url=' . $param['currentUrl']; | |
} else { | |
$url = NOTFOUND_URL; | |
} | |
session_start(); | |
$strCookie = 'PHPSESSID=' . $_COOKIE['PHPSESSID'] . '; path=/'; | |
session_write_close(); | |
$c = curl_init(); | |
curl_setopt($c, CURLOPT_URL, $url); | |
curl_setopt($c, CURLOPT_COOKIE, $strCookie); | |
$contents = curl_exec($c); | |
curl_close($c); | |
if ($contents) return $contents; | |
else return FALSE; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The author of this source is Michael Cannon:
http://typo3vagabond.com/typo3/redirect-to-login-for-access-denied-typo3-users/
Important