コード例 #1
0
ファイル: class.tx_felogin_pi1.php プロジェクト: r1zib/typo3
 /**
  * Shows login form
  *
  * @return	string		content
  */
 protected function showLogin()
 {
     $subpart = $this->cObj->getSubpart($this->template, '###TEMPLATE_LOGIN###');
     $subpartArray = $linkpartArray = array();
     $gpRedirectUrl = '';
     $markerArray['###LEGEND###'] = $this->pi_getLL('oLabel_header_welcome', '', 1);
     $markerArray['###ERROR###'] = "";
     $markerArray['###CLASS###'] = "";
     if ($this->logintype === 'login') {
         if ($this->userIsLoggedIn) {
             // login success
             $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('success_header', $this->conf['successHeader_stdWrap.']);
             $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('success_message', $this->conf['successMessage_stdWrap.']);
             $markerArray = array_merge($markerArray, $this->getUserFieldMarkers());
             $subpartArray['###LOGIN_FORM###'] = '';
             // Hook for general actions after after login has been confirmed (by Thomas Danzl <*****@*****.**>)
             if ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['login_confirmed']) {
                 $_params = array();
                 foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['login_confirmed'] as $_funcRef) {
                     if ($_funcRef) {
                         t3lib_div::callUserFunction($_funcRef, $_params, $this);
                     }
                 }
             }
             // show logout form directly
             if ($this->conf['showLogoutFormAfterLogin']) {
                 // BOf Erwand  9/02/12
                 //$this->redirectUrl = '';
                 // EOf Erwand  9/02/12
                 return $this->showLogout();
             }
         } else {
             // login error
             /* BOf Erwand  9/12/11	
             			$markerArray['###STATUS_HEADER###'] = $this->getDisplayText('error_header',$this->conf['errorHeader_stdWrap.']);
             			$markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('error_message',$this->conf['errorMessage_stdWrap.']);
             			*/
             // Affiche le message d'erreur dans le sous menu
             $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('welcome_header', $this->conf['welcomeHeader_stdWrap.']);
             $markerArray['###ERROR###'] = $this->getDisplayText('error_header', $this->conf['errorHeader_stdWrap.']);
             $markerArray['###CLASS###'] = "active";
             //EOF Erwand 9/12/11
             $gpRedirectUrl = t3lib_div::_GP('redirect_url');
         }
     } else {
         if ($this->logintype === 'logout') {
             // login form after logout
             /* BOf Erwand  9/12/11
             			$markerArray['###STATUS_HEADER###'] = $this->getDisplayText('logout_header', $this->conf['logoutHeader_stdWrap.']);	
             			*/
             $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('logout_header', $this->conf['welcomeHeader_stdWrap.']);
             $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('logout_message', $this->conf['welcomeMessage_stdWrap.']);
             // EOF Erwand 9/12/11
         } else {
             // login form
             $markerArray['###STATUS_HEADER###'] = $this->getDisplayText('welcome_header', $this->conf['welcomeHeader_stdWrap.']);
             $markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('welcome_message', $this->conf['welcomeMessage_stdWrap.']);
         }
     }
     // Hook (used by kb_md5fepw extension by Kraft Bernhard <*****@*****.**>)
     // This hook allows to call User JS functions.
     // The methods should also set the required JS functions to get included
     $onSubmit = '';
     $extraHidden = '';
     $onSubmitAr = array();
     $extraHiddenAr = array();
     // check for referer redirect method. if present, save referer in form field
     if (t3lib_div::inList($this->conf['redirectMode'], 'referer') || t3lib_div::inList($this->conf['redirectMode'], 'refererDomains')) {
         $referer = $this->referer ? $this->referer : t3lib_div::getIndpEnv('HTTP_REFERER');
         if ($referer) {
             $extraHiddenAr[] = '<input type="hidden" name="referer" value="' . htmlspecialchars($referer) . '" />';
         }
     }
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['loginFormOnSubmitFuncs'])) {
         $_params = array();
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['loginFormOnSubmitFuncs'] as $funcRef) {
             list($onSub, $hid) = t3lib_div::callUserFunction($funcRef, $_params, $this);
             $onSubmitAr[] = $onSub;
             $extraHiddenAr[] = $hid;
         }
     }
     if (count($onSubmitAr)) {
         $onSubmit = implode('; ', $onSubmitAr) . '; return true;';
     }
     if (count($extraHiddenAr)) {
         $extraHidden = implode(LF, $extraHiddenAr);
     }
     if (!$gpRedirectUrl && $this->redirectUrl) {
         $gpRedirectUrl = $this->redirectUrl;
     }
     // Login form
     $markerArray['###ACTION_URI###'] = $this->getPageLink('', array(), true);
     $markerArray['###EXTRA_HIDDEN###'] = $extraHidden;
     // used by kb_md5fepw extension...
     $markerArray['###LEGEND###'] = $this->pi_getLL('login', '', 1);
     $markerArray['###LOGIN_LABEL###'] = $this->pi_getLL('login', '', 1);
     $markerArray['###ON_SUBMIT###'] = $onSubmit;
     // used by kb_md5fepw extension...
     $markerArray['###PASSWORD_LABEL###'] = $this->pi_getLL('password', '', 1);
     $markerArray['###STORAGE_PID###'] = $this->spid;
     $markerArray['###USERNAME_LABEL###'] = $this->pi_getLL('username', '', 1);
     $markerArray['###REDIRECT_URL###'] = htmlspecialchars($gpRedirectUrl);
     $markerArray['###NOREDIRECT###'] = $this->noRedirect ? '1' : '0';
     $markerArray['###PREFIXID###'] = $this->prefixId;
     $markerArray = array_merge($markerArray, $this->getUserFieldMarkers());
     if ($this->flexFormValue('showForgotPassword', 'sDEF') || $this->conf['showForgotPasswordLink']) {
         $markerArray['###FORGOT_PASSWORD###'] = $this->pi_getLL('ll_forgot_header', '', 1);
         // BOF ErwanD redirection un page
         // print_r($this->conf);
         if (isset($this->conf['ForgotPasswordLinkPID'])) {
             $url = tslib_pibase::pi_getPageLink(194, '', array($this->prefixId . '[forgot]' => 1));
             $linkpartArray['###FORGOT_PASSWORD###'] = '<a href="' . $url . '">' . $this->pi_getLL('ll_forgot_header', '', 1) . '</a>';
             $linkpartArray['###FORGOT_PASSWORD_LINK###'] = '';
         } else {
             $linkpartArray['###FORGOT_PASSWORD_LINK###'] = explode('|', $this->getPageLink('|', array($this->prefixId . '[forgot]' => 1)));
         }
     } else {
         $subpartArray['###FORGOTP_VALID###'] = '';
     }
     // The permanent login checkbox should only be shown if permalogin is not deactivated (-1), not forced to be always active (2) and lifetime is greater than 0
     if ($this->conf['showPermaLogin'] && t3lib_div::inList('0,1', $GLOBALS['TYPO3_CONF_VARS']['FE']['permalogin']) && $GLOBALS['TYPO3_CONF_VARS']['FE']['lifetime'] > 0) {
         $markerArray['###PERMALOGIN###'] = $this->pi_getLL('permalogin', '', 1);
         if ($GLOBALS['TYPO3_CONF_VARS']['FE']['permalogin'] == 1) {
             $markerArray['###PERMALOGIN_HIDDENFIELD_ATTRIBUTES###'] = 'disabled="disabled"';
             $markerArray['###PERMALOGIN_CHECKBOX_ATTRIBUTES###'] = 'checked="checked"';
         } else {
             $markerArray['###PERMALOGIN_HIDDENFIELD_ATTRIBUTES###'] = '';
             $markerArray['###PERMALOGIN_CHECKBOX_ATTRIBUTES###'] = '';
         }
     } else {
         $subpartArray['###PERMALOGIN_VALID###'] = '';
     }
     return $this->cObj->substituteMarkerArrayCached($subpart, $markerArray, $subpartArray, $linkpartArray);
 }