--- pi1/class.tx_newloginbox_pi1.php Sat Jan 20 10:33:54 2007 +++ pi1/class.tx_newloginbox_pi1.php Thu Feb 08 21:35:55 2007 @@ -78,11 +78,7 @@ $this->pi_initPIflexForm(); // Get storage PIDs: - if ($this->conf['storagePid']) { - $spid['_STORAGE_PID'] = $this->conf['storagePid']; - } else { - $spid = $GLOBALS['TSFE']->getStorageSiterootPids(); - } + $spid['_STORAGE_PID'] = $this->initUserPIDList(); // GPvars: $logintype = t3lib_div::GPvar('logintype'); @@ -135,12 +131,12 @@ $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( 'username, password', 'fe_users', - sprintf('email=\'%s\' and pid=\'%d\' %s', + sprintf('email=\'%s\' and pid IN (%s) %s', addslashes($workingData['forgot_email'] ), - intval($spid['_STORAGE_PID'] ), + $spid['_STORAGE_PID'], $this->cObj->enableFields('fe_users') ) ); - if ($GLOBALS['TYPO3_DB']->sql_num_rows($res ) ) { + if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) ) { $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res ); $msg = sprintf($this->pi_getLL('forgot_password_pswmsg', '', 0), $workingData['forgot_email'], $row['username'], $row['password']); @@ -226,7 +222,7 @@ $markerArray['###ACTION_URI###'] = htmlspecialchars($this->pi_getPageLink($GLOBALS['TSFE']->id, '_top')); $markerArray['###LOGOUT_LABEL###'] = $this->pi_getLL('logout', '', 1); $markerArray['###NAME###'] = $GLOBALS['TSFE']->fe_user->user['name']; - $markerArray['###STORAGE_PID###'] = intval($spid['_STORAGE_PID']); + $markerArray['###STORAGE_PID###'] = $spid['_STORAGE_PID']; $markerArray['###USERNAME###'] = $GLOBALS['TSFE']->fe_user->user['username']; $markerArray['###USERNAME_LABEL###'] = $this->pi_getLL('username', '', 1); } else { @@ -273,7 +269,7 @@ $markerArray['###ON_SUBMIT###'] = $onSubmit; // used by kb_md5fepw extension... $markerArray['###PASSWORD_LABEL###'] = $this->pi_getLL('password', '', 1); $markerArray['###REDIRECT_URL###'] = htmlspecialchars($redirect_url); - $markerArray['###STORAGE_PID###'] = intval($spid['_STORAGE_PID']); + $markerArray['###STORAGE_PID###'] = $spid['_STORAGE_PID']; $markerArray['###USERNAME_LABEL###'] = $this->pi_getLL('username', '', 1); if ($this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'show_forgot_password', 'sDEF') || $this->conf['showForgotPassword']) { @@ -313,6 +309,37 @@ $content = $this->cObj->substituteMarkerArrayCached($template, $markerArray, $subPartArray, array()); return $this->pi_wrapInBaseClass($content); } + + /** + * Returns a generated string with all the PIDs which will be used for the login and logout process. The string is created by the given PIDs and the level of recursion. + * + * @return string The result string + */ + function initUserPIDList() { + + # Get the PIDs configured either in TypoScript or in the Plugin Configuration. + # Standard: current page + $pidList = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'users', 'sDEF'); + $pidList = $pidList ? $pidList : trim($this->cObj->stdWrap($this->conf['storagePid'], $this->conf['storagePid.'])); + $pidList = $pidList ? implode(t3lib_div::intExplode(',', $pidList), ',') : $GLOBALS['TSFE']->id; + + # Get the level of recursion configured either in TypoScript or in the Plugin Configuration. + # Standard: 0 + $recursive = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'recursive', 'sDEF'); + $recursive = $recursive ? $recursive : $this->cObj->stdWrap($this->conf['recursive'], $this->conf['recursive.']); + $recursive = $recursive ? $recursive : intval(0); + + $spid = $GLOBALS['TSFE']->getStorageSiterootPids(); + + # If a PID was also set in the General Record Storage page, add it to the list of PIDs. + if($spid['_STORAGE_PID'] > 0) { + $pidList = $this->pi_getPidList($pidList, $recursive) . "," . $spid['_STORAGE_PID']; + } else { + $pidList = $this->pi_getPidList($pidList, $recursive); + } + + return $pidList; + } /** * Returns the headers/messages for the login/logout/status etc state of the login form. If a value is found int cObj->data[...] then that is used, otherwise the default from local_lang.