felogin:" redirect after logout does not work " mit access restricted pages [Gelöst]

  • basterl basterl
    T3PO
    0 x
    12 Beiträge
    0 Hilfreiche Beiträge
    11. 09. 2008, 15:41

    Hallo,

    nachdem mein Logout/Login von "jeder" Seite eingerichtet war habe ich folgendes Problem.

    Als redirect nach logout habe ich meine "start"-seite eingetragen.

    [TS]#redirect
    redirectMode = userLogin,groupLogin,login,logout
    redirectFirstMethod = 1 #
    redirectPageLogin = 164 # 164 ist meine Forumsseite (nur nach
    # Anmeldung sichtbar
    redirectPageLogout = 96 #96 ist meine Startseite[/TS]

    wenn ich aber dieses logout von einer resticted-area-seite mache bringt er mir eine Fehlermeldung :

    The requested page didn't have a proper connection to the tree-root!

    Von einer allgemein zugänglichen Seite gibt es hier kein Problem. Logout funktioniert.

    Jetzt habe ich ein wenig herumgestöbert.

    Unter http://bugs.typo3.org/view.php?id=8677 finde ich eine Beschreibung die, denke ich, mein Problem beschreibt.

    Leider schreibt Martin Kutschker (manager) : Fixed in 4.2. Meine aktuelle Version ist 4.2.1

    Leider funktioniert es bei mir nicht. Kann es wahrscheinlich auch nicht. Gerade noch mal Datum geschaut. 07.09.2008 => erst neu gefixed; muss ich da jetzt auf 4.2.2 warten oder gibt es da andere Möglichkeiten.

    Hat hier jemand Erfahrungen oder ähnliche Schwierigkeiten. Oder evtl eine Lösung.

    Viele Grüße

    Sebastian


  • 1
  • basterl basterl
    T3PO
    0 x
    12 Beiträge
    0 Hilfreiche Beiträge
    12. 09. 2008, 09:26

    Da war ich wohl ein bisserl langsam.

    siehe http://www.typo3.net/forum/list/list_post//78871/

    Wahrscheinlich muss ich auf 4.2.2 warten.

    Oder werde zum erstem Mal in meiner Typo3 Zeit selber php Code austauschen.

    Na das wird was geben

    Viele Grüße

    Sebastian

  • basterl basterl
    T3PO
    0 x
    12 Beiträge
    0 Hilfreiche Beiträge
    12. 09. 2008, 09:52

    Vielen Dank für den schnellen Patch.

    Habe den Code angepasst und es funktioniert.

    D.h. man kann sich abmelden wenn man sich auf Seiten befindet die restricted sind und wird jetzt redirected.

    Tolle Sache und vielen Dank an Steffen

    Grüße

    Sebastian

    Hier nochmal zum geniessen:

    class.tx_felogin_pi1.php

    1. <?php
    2. /***************************************************************
    3. * Copyright notice
    4. *
    5. * (c) 2007-2008 Steffen Kamper <info@sk-typo3.de>
    6. * Based on Newloginbox (c) 2002-2004 Kasper Skaarhoj <kasper@typo3.com>
    7. *
    8. * All rights reserved
    9. *
    10. * This script is part of the TYPO3 project. The TYPO3 project is
    11. * free software; you can redistribute it and/or modify
    12. * it under the terms of the GNU General Public License as published by
    13. * the Free Software Foundation; either version 2 of the License, or
    14. * (at your option) any later version.
    15. *
    16. * The GNU General Public License can be found at
    17. * http://www.gnu.org/copyleft/gpl.html.
    18. *
    19. * This script is distributed in the hope that it will be useful,
    20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
    21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    22. * GNU General Public License for more details.
    23. *
    24. * This copyright notice MUST APPEAR in all copies of the script!
    25. *
    26. * The code was adapted from newloginbox, see manual for detailed description
    27. ***************************************************************/
    28.  
    29. require_once(PATH_tslib.'class.tslib_pibase.php');
    30.  
    31.  
    32. /**
    33.  * Plugin 'Website User Login' for the 'felogin' extension.
    34.  *
    35.  * @author Steffen Kamper <info@sk-typo3.de>
    36.  * @package TYPO3
    37.  * @subpackage tx_felogin
    38.  */
    39. class tx_felogin_pi1 extends tslib_pibase {
    40. var $prefixId = 'tx_felogin_pi1'; // Same as class name
    41. var $scriptRelPath = 'pi1/class.tx_felogin_pi1.php'; // Path to this script relative to the extension dir.
    42. var $extKey = 'felogin'; // The extension key.
    43. var $pi_checkCHash = true;
    44. var $userIsLoggedIn; // Is user logged in?
    45. var $template;
    46. var $uploadDir;
    47. var $redirectUrl;
    48.  
    49. /**
    50. * The main method of the plugin
    51. *
    52. * @param string $content: The PlugIn content
    53. * @param array $conf: The PlugIn configuration
    54. *
    55. * @return string The content that is displayed on the website
    56. */
    57. public function main($content,$conf) {
    58.  
    59. // Loading TypoScript array into object variable:
    60. $this->conf = $conf;
    61. $this->uploadDir = 'uploads/tx_felogin/';
    62.  
    63. // Loading language-labels
    64. $this->pi_loadLL();
    65.  
    66. // Init FlexForm configuration for plugin:
    67. $this->pi_initPIflexForm();
    68. $this->mergeflexFormValuesIntoConf();
    69.  
    70.  
    71. // Get storage PIDs:
    72. if ($this->conf['storagePid']) {
    73. $this->spid = $this->conf['storagePid'];
    74. } else {
    75. $pids = $GLOBALS['TSFE']->getStorageSiterootPids();
    76. $this->spid = $pids['_STORAGE_PID'];
    77. }
    78.  
    79. // GPvars:
    80. $this->logintype = t3lib_div::_GP('logintype');
    81. $this->redirectUrl = t3lib_div::_GP('redirect_url');
    82.  
    83.  
    84.  
    85. // Get Template
    86. $templateFile = $this->conf['templateFile'] ? $this->conf['templateFile'] : 'EXT:felogin/template.html';
    87. $this->template = $this->cObj->fileResource($templateFile);
    88.  
    89. // Is user logged in?
    90. $this->userIsLoggedIn = $GLOBALS['TSFE']->loginUser;
    91.  
    92. // Redirect
    93. if ($this->conf['redirectMode'] && !$this->conf['redirectDisable']) {
    94. $this->redirectUrl = $this->processRedirect();
    95. }
    96.  
    97.  
    98. // What to display
    99. $content='';
    100. if ($this->piVars['forgot']) {
    101. $content .= $this->showForgot();
    102. } else {
    103. if($this->userIsLoggedIn && !$this->logintype) {
    104. $content .= $this->showLogout();
    105. } else {
    106. $content .= $this->showLogin();
    107. }
    108. }
    109.  
    110.  
    111.  
    112. // Process the redirect
    113. if (($this->logintype === 'login' || $this->logintype === 'logout') && $this->redirectUrl) {
    114. if (!$GLOBALS['TSFE']->fe_user->cookieId) {
    115. $content .= '<p style="color:red; font-weight:bold;">' . $this->pi_getLL('cookie_warning', '', 1) . '</p>';
    116. } else {
    117. header('Location: '.t3lib_div::locationHeaderUrl($this->redirectUrl));
    118. }
    119. }
    120. return $this->conf['wrapContentInBaseClass'] ? $this->pi_wrapInBaseClass($content) : $content;
    121.  
    122. }
    123.  
    124. /**
    125. * Shows the forgot password form
    126. *
    127. * @return string content
    128. */
    129. protected function showForgot() {
    130. $subpart = $this->cObj->getSubpart($this->template, '###TEMPLATE_FORGOT###');
    131. if ($this->piVars['forgot_email']) {
    132. if (t3lib_div::validEmail($this->piVars['forgot_email'])) {
    133. // look for user record and send the password
    134. $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
    135. 'uid, username, password',
    136. 'fe_users',
    137. 'email='.$GLOBALS['TYPO3_DB']->fullQuoteStr($this->piVars['forgot_email'], 'fe_users').' AND pid IN ('.$GLOBALS['TYPO3_DB']->cleanIntList($this->spid).') '.$this->cObj->enableFields('fe_users')
    138. );
    139.  
    140. if ($GLOBALS['TYPO3_DB']->sql_num_rows($res)) {
    141. $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res);
    142. $msg = sprintf($this->pi_getLL('ll_forgot_email_password', '', 0), $this->piVars['forgot_email'], $row['username'], $row['password']);
    143. } else {
    144. $msg = sprintf($this->pi_getLL('ll_forgot_email_nopassword', '', 0), $this->piVars['forgot_email']);
    145. }
    146.  
    147.  
    148. // Generate new password with md5 and save it in user record
    149. if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) && t3lib_extMgm::isLoaded('kb_md5fepw')) {
    150. $newPass = $this->generatePassword(<i class="mmforum-iconset-20-cool"></i>;
    151. $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
    152. 'fe_users',
    153. 'uid=' . $row['uid'],
    154. array('password' => md5($newPass))
    155. );
    156. $msg = sprintf($this->pi_getLL('ll_forgot_email_password', '', 0),$this->piVars['forgot_email'], $row['username'], $newPass);
    157. }
    158.  
    159. $this->cObj->sendNotifyEmail($msg, $this->piVars['forgot_email'], '', $this->conf['email_from'], $this->conf['email_fromName'], $this->conf['replyTo']);
    160. $markerArray['###STATUS_MESSAGE###'] = sprintf($this->pi_getLL('ll_forgot_message_emailSent', '', 1),'<em>' . htmlspecialchars($this->piVars['forgot_email']) .'</em>');
    161. $subpartArray['###FORGOT_FORM###'] = '';
    162.  
    163.  
    164. } else {
    165. //wrong email
    166. $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('forgot_message',$this->conf['forgotMessage_stdWrap.']);
    167. $markerArray['###BACKLINK_LOGIN###'] = '';
    168. }
    169. } else {
    170. $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('forgot_message',$this->conf['forgotMessage_stdWrap.']);
    171. $markerArray['###BACKLINK_LOGIN###'] = '';
    172. }
    173.  
    174. $markerArray['###BACKLINK_LOGIN###'] = $this->getPageLink($this->pi_getLL('ll_forgot_header_backToLogin', '', 1), array());
    175. $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('forgot_header',$this->conf['forgotHeader_stdWrap.']);
    176.  
    177. $markerArray['###LEGEND###'] = $this->pi_getLL('send_password', '', 1);
    178. $markerArray['###ACTION_URI###'] = $this->getPageLink('',array($this->prefixId.'[forgot]'=>1),true);
    179. $markerArray['###EMAIL_LABEL###'] = $this->pi_getLL('your_email', '', 1);
    180. $markerArray['###FORGOT_PASSWORD_ENTEREMAIL###'] = $this->pi_getLL('forgot_password_enterEmail', '', 1);
    181. $markerArray['###FORGOT_EMAIL###'] = $this->prefixId.'[forgot_email]';
    182. $markerArray['###SEND_PASSWORD###'] = $this->pi_getLL('send_password', '', 1);
    183.  
    184. return $this->cObj->substituteMarkerArrayCached($subpart, $markerArray, $subpartArray, $linkpartArray);
    185. }
    186.  
    187. /**
    188. * Shows logout form
    189. *
    190. * @return string The content.
    191. */
    192. protected function showLogout() {
    193. $subpart = $this->cObj->getSubpart($this->template, '###TEMPLATE_LOGOUT###');
    194.  
    195. $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('status_header',$this->conf['logoutHeader_stdWrap.']);
    196. $markerArray['###STATUS_MESSAGE###']=$this->getDisplayText('status_message',$this->conf['logoutMessage_stdWrap.']);$this->cObj->stdWrap($this->flexFormValue('message','s_status'),$this->conf['logoutMessage_stdWrap.']);
    197.  
    198. $markerArray['###LEGEND###'] = $this->pi_getLL('logout', '', 1);
    199. $markerArray['###ACTION_URI###'] = $this->getPageLink('',array(),true);
    200. $markerArray['###LOGOUT_LABEL###'] = $this->pi_getLL('logout', '', 1);
    201. $markerArray['###NAME###'] = htmlspecialchars($GLOBALS['TSFE']->fe_user->user['name']);
    202. $markerArray['###STORAGE_PID###'] = $this->spid;
    203. $markerArray['###USERNAME###'] = htmlspecialchars($GLOBALS['TSFE']->fe_user->user['username']);
    204. $markerArray['###USERNAME_LABEL###'] = $this->pi_getLL('username', '', 1);
    205.  
    206. if ($this->redirectUrl) {
    207. // use redirectUrl for action tag because of possible access restricted pages
    208. $markerArray['###ACTION_URI###'] = $this->redirectUrl;
    209. $this->redirectUrl = '';
    210. }
    211. return $this->cObj->substituteMarkerArrayCached($subpart, $markerArray, $subpartArray, $linkpartArray);
    212. }
    213.  
    214. /**
    215. * Shows login form
    216. *
    217. * @return string content
    218. */
    219. protected function showLogin() {
    220. $subpart = $this->cObj->getSubpart($this->template, '###TEMPLATE_LOGIN###');
    221.  
    222. $markerArray['###LEGEND###'] = $this->pi_getLL('oLabel_header_welcome', '', 1);
    223.  
    224. if($this->logintype === 'login') {
    225. if($this->userIsLoggedIn) {
    226. // login success
    227. $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('success_header',$this->conf['successHeader_stdWrap.']);
    228. $markerArray['###STATUS_MESSAGE###'] = str_replace('###USER###',htmlspecialchars($GLOBALS['TSFE']->fe_user->user['username']),$this->getDisplayText('success_message',$this->conf['successMessage_stdWrap.']));
    229. $subpartArray['###LOGIN_FORM###'] = '';
    230.  
    231. // Hook for general actions after after login has been confirmed (by Thomas Danzl <thomas@danzl.org>)
    232. if ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['login_confirmed']) {
    233. $_params = array();
    234. foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['login_confirmed'] as $_funcRef) {
    235. if ($_funcRef) {
    236. t3lib_div::callUserFunction($_funcRef, $_params, $this);
    237. }
    238. }
    239. }
    240.  
    241. } else {
    242. // login error
    243. $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('error_header',$this->conf['errorHeader_stdWrap.']);
    244. $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('error_message',$this->conf['errorMessage_stdWrap.']);
    245. }
    246. } else {
    247. if($this->logintype === 'logout') {
    248. // login form after logout
    249. $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('logout_header',$this->conf['welcomeHeader_stdWrap.']);
    250. $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('logout_message',$this->conf['welcomeMessage_stdWrap.']);
    251. } else {
    252. // login form
    253. $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('welcome_header',$this->conf['welcomeHeader_stdWrap.']);
    254. $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('welcome_message',$this->conf['welcomeMessage_stdWrap.']);
    255. }
    256. }
    257.  
    258.  
    259. // Hook (used by kb_md5fepw extension by Kraft Bernhard <kraftb@gmx.net>)
    260. // This hook allows to call User JS functions.
    261. // The methods should also set the required JS functions to get included
    262. $onSubmit = '';
    263. $extraHidden = '';
    264. if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['loginFormOnSubmitFuncs'])) {
    265. $_params = array();
    266. $onSubmitAr = array();
    267. $extraHiddenAr = array();
    268. foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['loginFormOnSubmitFuncs'] as $funcRef) {
    269. list($onSub, $hid) = t3lib_div::callUserFunction($funcRef, $_params, $this);
    270. $onSubmitAr[] = $onSub;
    271. $extraHiddenAr[] = $hid;
    272. }
    273. }
    274. if (count($onSubmitAr)) {
    275. $onSubmit = implode('; ', $onSubmitAr).'; return true;';
    276. $extraHidden = implode(chr(10), $extraHiddenAr);
    277. }
    278.  
    279. // Login form
    280. $markerArray['###ACTION_URI###'] = $this->getPageLink('',array(),true);
    281. $markerArray['###EXTRA_HIDDEN###'] = $extraHidden; // used by kb_md5fepw extension...
    282. $markerArray['###LEGEND###'] = $this->pi_getLL('login', '', 1);
    283. $markerArray['###LOGIN_LABEL###'] = $this->pi_getLL('login', '', 1);
    284. $markerArray['###ON_SUBMIT###'] = $onSubmit; // used by kb_md5fepw extension...
    285. $markerArray['###PASSWORD_LABEL###'] = $this->pi_getLL('password', '', 1);
    286. $markerArray['###STORAGE_PID###'] = $this->spid;
    287. $markerArray['###USERNAME_LABEL###'] = $this->pi_getLL('username', '', 1);
    288. $markerArray['###REDIRECT_URL###'] = $this->redirectUrl;
    289.  
    290. if ($this->flexFormValue('showForgotPassword','sDEF') || $this->conf['showForgotPasswordLink']) {
    291. $linkpartArray['###FORGOT_PASSWORD_LINK###'] = explode('|',$this->getPageLink('|',array($this->prefixId.'[forgot]'=>1)));
    292. $markerArray['###FORGOT_PASSWORD###'] = $this->pi_getLL('ll_forgot_header', '', 1);
    293. } else {
    294. $subpartArray['###FORGOTP_VALID###'] = '';
    295. }
    296.  
    297.  
    298.  
    299. if (($this->conf['showPermaLogin']) && ($GLOBALS['TYPO3_CONF_VARS']['FE']['permalogin'] == 0 || $GLOBALS['TYPO3_CONF_VARS']['FE']['permalogin'] == 1) && $GLOBALS['TYPO3_CONF_VARS']['FE']['lifetime'] > 0) {
    300. $markerArray['###PERMALOGIN###'] = $this->pi_getLL('permalogin', '', 1);
    301. if($GLOBALS['TYPO3_CONF_VARS']['FE']['permalogin'] == 1) {
    302. $markerArray['###PERMALOGIN_HIDDENFIELD_ATTRIBUTES###'] = 'disabled="disabled"';
    303. $markerArray['###PERMALOGIN_CHECKBOX_ATTRIBUTES###'] = 'checked="checked"';
    304. } else {
    305. $markerArray['###PERMALOGIN_HIDDENFIELD_ATTRIBUTES###'] = '';
    306. $markerArray['###PERMALOGIN_CHECKBOX_ATTRIBUTES###'] = '';
    307. }
    308. } else {
    309. $subpartArray['###PERMALOGIN_VALID###'] = '';
    310. }
    311. return $this->cObj->substituteMarkerArrayCached($subpart, $markerArray, $subpartArray, $linkpartArray);
    312. }
    313.  
    314. /**
    315. * Process redirect methods. The function searches for a redirect url using all configured methods.
    316. *
    317. * @return string redirect url
    318. */
    319. protected function processRedirect() {
    320. if ($this->conf['redirectMode']) {
    321. foreach (t3lib_div::trimExplode(',', $this->conf['redirectMode'],1) as $redirMethod) {
    322. if ($GLOBALS['TSFE']->loginUser && $this->logintype === 'login') {
    323. // logintype is needed because the login-page wouldn't be accessible anymore after a login (would always redirect)
    324. switch ($redirMethod) {
    325. case 'groupLogin': // taken from dkd_redirect_at_login written by Ingmar Schlecht; database-field changed
    326. $groupData = $GLOBALS['TSFE']->fe_user->groupData;
    327. $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
    328. 'felogin_redirectPid',
    329. $GLOBALS['TSFE']->fe_user->usergroup_table,
    330. 'felogin_redirectPid!="" AND uid IN ('.implode(',',$groupData['uid']).')'
    331. );
    332. if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res)) {
    333. $redirect_url = $this->pi_getPageLink($row[0],array(),true); // take the first group with a redirect page
    334. }
    335. break;
    336. case 'userLogin':
    337. $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
    338. 'felogin_redirectPid',
    339. $GLOBALS['TSFE']->fe_user->user_table,
    340. $GLOBALS['TSFE']->fe_user->userid_column . '=' . $GLOBALS['TSFE']->fe_user->user['uid'] . ' AND felogin_redirectPid!=""'
    341. );
    342. if ($row = $GLOBALS['TYPO3_DB']->sql_fetch_row($res)) {
    343. $redirect_url = $this->pi_getPageLink($row[0],array(),true);
    344. }
    345. break;
    346. case 'login':
    347. if ($this->conf['redirectPageLogin']) {
    348. $redirect_url = $this->pi_getPageLink(intval($this->conf['redirectPageLogin']),array(),true);
    349. }
    350. break;
    351. case 'getpost':
    352. $redirect_url = $this->redirectUrl;
    353. break;
    354. case 'referer':
    355. $redirect_url = t3lib_div::getIndpEnv('HTTP_REFERER');
    356. // avoid forced logout, when trying to login immediatly after a logout
    357. $redirect_url = ereg_replace("[&?]logintype=[a-z]+", '', $redirect_url);
    358. break;
    359. case 'refererDomains':
    360. // Auto redirect.
    361. // Feature to redirect to the page where the user came from (HTTP_REFERER).
    362. // Allowed domains to redirect to, can be configured with plugin.tx_felogin_pi1.domains
    363. // Thanks to plan2.net / Martin Kutschker for implementing this feature.
    364. if (!$redirect_url && $this->conf['domains']) {
    365. $redirect_url = t3lib_div::getIndpEnv('HTTP_REFERER');
    366. // is referring url allowed to redirect?
    367. $match = array();
    368. if (ereg('^http://([[:alnum:]._-]+)/', $redirect_url, $match)) {
    369. $redirect_domain = $match[1];
    370. $found = false;
    371. foreach(split(',', $this->conf['domains']) as $d) {
    372. if (ereg('(^|\.)'.$d.'$', $redirect_domain)) {
    373. $found = true;
    374. break;
    375. }
    376. }
    377. if (!$found) {
    378. $redirect_url = '';
    379. }
    380. }
    381.  
    382. // Avoid forced logout, when trying to login immediatly after a logout
    383. $redirect_url = ereg_replace("[&?]logintype=[a-z]+", "", $redirect_url);
    384. }
    385. break;
    386. }
    387. } else if ($this->logintype === 'login') { // after login-error
    388. switch ($redirMethod) {
    389. case 'loginError':
    390. if ($this->conf['redirectPageLoginError']) {
    391. $redirect_url = $this->pi_getPageLink(intval($this->conf['redirectPageLoginError']), array(), true);
    392. }
    393. break;
    394. }
    395. } elseif ($this->logintype === 'logout' || !$this->logintype) { // after logout
    396.  
    397. // Hook for general actions after after logout has been confirmed
    398. if ($this->logintype === 'logout' && $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['logout_confirmed']) {
    399. $_params = array();
    400. foreach($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['logout_confirmed'] as $_funcRef) {
    401. if ($_funcRef) {
    402. t3lib_div::callUserFunction($_funcRef, $_params, $this);
    403. }
    404. }
    405. }
    406.  
    407. switch ($redirMethod) {
    408. case 'logout':
    409. if ($this->conf['redirectPageLogout']) {
    410. $redirect_url = $this->pi_getPageLink(intval($this->conf['redirectPageLogout']), array(), true);
    411. }
    412. break;
    413. }
    414. } else { // not logged in
    415. // Placeholder for maybe future options
    416. switch ($redirMethod) {
    417. }
    418. }
    419.  
    420. if ($redirect_url && $this->conf['redirectFirstMethod']) {
    421. break;
    422. }
    423. }
    424. }
    425. return $redirect_url;
    426. }
    427.  
    428. /**
    429. * Reads flexform configuration and merge it with $this->conf
    430. *
    431. * @return void
    432. */
    433. protected function mergeflexFormValuesIntoConf() {
    434. $flex = array();
    435. if ($this->flexFormValue('showForgotPassword', 'sDEF')) {
    436. $flex['showForgotPassword'] = $this->flexFormValue('showForgotPassword','sDEF');
    437. }
    438.  
    439. if ($this->flexFormValue('showPermaLogin', 'sDEF')) {
    440. $flex['showPermaLogin'] = $this->flexFormValue('showPermaLogin', 'sDEF');
    441. }
    442.  
    443. if ($this->flexFormValue('pages', 'sDEF')) {
    444. $flex['pages'] = $this->flexFormValue('pages', 'sDEF');
    445. }
    446.  
    447. if ($this->flexFormValue('recursive', 'sDEF')) {
    448. $flex['recursive'] = $this->flexFormValue('recursive', 'sDEF');
    449. }
    450.  
    451. if ($this->flexFormValue('templateFile', 'sDEF')) {
    452. $flex['templateFile'] = $this->uploadDir . $this->flexFormValue('templateFile', 'sDEF');
    453. }
    454.  
    455. if ($this->flexFormValue('redirectMode', 's_redirect')) {
    456. $flex['redirectMode'] = $this->flexFormValue('redirectMode', 's_redirect');
    457. }
    458.  
    459. if ($this->flexFormValue('redirectFirstMethod', 's_redirect')) {
    460. $flex['redirectFirstMethod'] = $this->flexFormValue('redirectFirstMethod', 's_redirect');
    461. }
    462.  
    463. if ($this->flexFormValue('redirectDisable', 's_redirect')) {
    464. $flex['redirectDisable'] = $this->flexFormValue('redirectDisable', 's_redirect');
    465. }
    466.  
    467. if ($this->flexFormValue('redirectPageLogin', 's_redirect')) {
    468. $flex['redirectPageLogin'] = $this->flexFormValue('redirectPageLogin', 's_redirect');
    469. }
    470.  
    471. if ($this->flexFormValue('redirectPageLoginError', 's_redirect')) {
    472. $flex['redirectPageLoginError'] = $this->flexFormValue('redirectPageLoginError','s_redirect');
    473. }
    474.  
    475. if ($this->flexFormValue('redirectPageLogout', 's_redirect')) {
    476. $flex['redirectPageLogout'] = $this->flexFormValue('redirectPageLogout', 's_redirect');
    477. }
    478.  
    479. $pid = $flex['pages'] ? $this->pi_getPidList($flex['pages'], $flex['recursive']) : 0;
    480. if ($pid > 0) {
    481. $flex['storagePid'] = $pid;
    482. }
    483.  
    484. $this->conf = array_merge($this->conf, $flex);
    485. }
    486.  
    487. /**
    488. * Loads a variable from the flexform
    489. *
    490. * @param string name of variable
    491. * @param string name of sheet
    492. * @return string value of var
    493. */
    494. protected function flexFormValue($var, $sheet) {
    495. return $this->pi_getFFvalue($this->cObj->data['pi_flexform'], $var,$sheet);
    496. }
    497.  
    498. /**
    499. * Generate link with typolink function
    500. *
    501. * @param string linktext
    502. * @param array link vars
    503. * @param boolean true: returns only url false (default) returns the link)
    504. *
    505. * @return string link or url
    506. */
    507. protected function getPageLink($label, $piVars,$returnUrl = false) {
    508. $additionalParams = '';
    509.  
    510. if (count($piVars)) {
    511. foreach($piVars as $key=>$val) {
    512. $additionalParams .= '&' . $key . '=' . $val;
    513. }
    514. }
    515. // should GETvars be preserved?
    516. if ($this->conf['preserveGETvars']) {
    517. $additionalParams .= $this->getPreserveGetVars();
    518. }
    519.  
    520. $this->conf['linkConfig.']['parameter'] = $GLOBALS['TSFE']->id;
    521. if ($additionalParams) {
    522. $this->conf['linkConfig.']['additionalParams'] = $additionalParams;
    523. }
    524.  
    525. if ($returnUrl) {
    526. return $this->cObj->typolink_url($this->conf['linkConfig.']);
    527. } else {
    528. return $this->cObj->typolink($label,$this->conf['linkConfig.']);
    529. }
    530. }
    531.  
    532. /**
    533. * Is used by TS-setting preserveGETvars
    534. * possible values are "all" or a commaseperated list of GET-vars
    535. * they are used as additionalParams for link generation
    536. *
    537. * @return string additionalParams-string
    538. */
    539. protected function getPreserveGetVars() {
    540.  
    541. $params = '';
    542. $preserveVars =! ($this->conf['preserveGETvars'] || $this->conf['preserveGETvars']=='all' ? array() : implode(',', (array)$this->conf['preserveGETvars']));
    543. $getVars = t3lib_div::_GET();
    544.  
    545. foreach ($getVars as $key=>$val) {
    546. if (stristr($key,$this->prefixId) === false) {
    547. if (is_array($val)) {
    548. foreach ($val as $key1=>$val1) {
    549. if ($this->conf['preserveGETvars']=='all' || in_array($key.'['.$key1.']',$preserveVars)) {
    550. $params.='&'.$key.'['.$key1.']='.$val1;
    551. }
    552. }
    553. } else {
    554. if (!in_array($key,array('id','no_cache','logintype','redirect_url','cHash'))) {
    555. $params.='&'.$key.'='.$val;
    556. }
    557. }
    558. }
    559. }
    560. return $params;
    561. }
    562.  
    563. /**
    564. * Is used by forgot password - function with md5 option.
    565. *
    566. * @author Bernhard Kraft
    567. *
    568. * @param int length of new password
    569. * @return string new password
    570. */
    571. protected function generatePassword($len) {
    572. $pass = '';
    573. while ($len--) {
    574. $char = rand(0,35);
    575. if ($char < 10) {
    576. $pass .= ''.$char;
    577. } else {
    578. $pass .= chr($char-10+97);
    579. }
    580. }
    581. return $pass;
    582. }
    583.  
    584. /**
    585. * Returns the header / message value from flexform if present, else from locallang.xml
    586. *
    587. * @param string label name
    588. * @param string TS stdWrap array
    589. * @return string label text
    590. */
    591. protected function getDisplayText($label, $stdWrapArray=array()) {
    592. return $this->flexFormValue($label,'s_messages') ? $this->cObj->stdWrap($this->flexFormValue($label,'s_messages'),$stdWrapArray) : $this->cObj->stdWrap($this->pi_getLL('ll_'.$label, '', 1), $stdWrapArray);
    593. }
    594. }
    595.  
    596.  
    597.  
    598. if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/felogin/pi1/class.tx_felogin_pi1.php']) {
    599. include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/felogin/pi1/class.tx_felogin_pi1.php']);
    600. }
    601.  
    602. ?>
    [/code]

  • x13 x13
    T3PO
    0 x
    9 Beiträge
    0 Hilfreiche Beiträge
    17. 09. 2008, 09:55

    Typo3-Neuling benötigt Hilfe:

    Hallo Leute,

    schade des es keine StepByStep Anleitung für das neue FELogin gibt. Aber nach langem hin und her, einigen (ok sehr vielen) Threads und etwas herum probieren habe ich es hinbekommen. Wenn man es einmal verstanden hat, ist es auch nicht mehr so kompliziert

    Dennoch habe ich ein Problem: Wenn ich ohne Login oder nach Logout eine gesperrte Seite aufrufe (Beispielsweise als Lesezeichen), möchte ich natürlich, dass auf die Loginseite weitergeleitet wird. Stattdessen bekomme ich folgende Meldung:

    "Error! The requested page didn't have a proper connection to the tree-root!()"

    Grundaufbau: Meine komplette Website ist bis auf die Loginseite gesperrt. Auf der Loginseite habe ich das Anmeldeformular als Inhaltselement eingefügt - "after Login/Logout" funktioniert.

    Es wäre also sehr nett, wenn mir da jemand auf die Sprünge helfen könnte ...

    DANKE im Voraus ... MfG X13

  • Gernott Gernott
    Jedi-Meister
    0 x
    265 Beiträge
    0 Hilfreiche Beiträge
    20. 05. 2009, 07:56

    Hallo!

    Ich habe das gleiche Problem beim Logout (Fehlermeldung nach Logout, wenn ich auf einer Seite bin die nur für Members sichtbar ist).

    Ich habe allerdings schon die aktuellste TYPO3 Version 4.2.6. Ich habe es auch mit dem hier angegebenen Code probiert und die originale class.tx_felogin_pi1.php ersetzt - ohne Erfolg.

    Habt Ihr das Problem auch noch?

    Liebe Grüße
    Gernot

  • 1