Komplett falscher Ansatz von mir. Habs jetzt gelöst und die Extension einfach erweitert (xclass). Mit dem Kickstarter im nachhinein eigentlich kein Problem. #giggle# Ich brauchte eigentlich nur zwei neue Links (Mehrsprachig). Hab das dann so angelegt das ich im TS die ID der Seiten setzten kann.
Falls es jemand braucht, hier einen kleine Anleitung.
1. Mit Kickstarter eine neue Extension erstellen. z. B. td_test_fe_login
Ich brauchte keine DB-Felder also wird auch sonst nicht wirklich was erweitert. Also "General info" setzen, "Setup languages" Standard ist Englisch, also noch Deutsch hinzugefügt. Die ganze Geschichte installiert.
2. Dann die Datei erstellt im Ordner pi1: class_ux_tx_felogin_pi1
<?php
class ux_tx_felogin_pi1 extends tx_felogin_pi1 {
var $scriptRelPath = 'pi1/class.ux_tx_felogin_pi1.php'; // Path to this script relative to the extension dir.
var $prefixId = 'tx_felogin_pi1'; // Same as class name
var $extKey = 'td_test_fe_login'; // The extension key.
/**
* The main method of the plugin
*
* @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration
*
* @return string The content that is displayed on the website
*/
public function main($content,$conf) {
$this->sysLanguageId = $GLOBALS['TSFE']->sys_language_uid;
// Loading TypoScript array into object variable:
$this->conf = $conf;
$this->uploadDir = 'uploads/tx_felogin/';
// Loading default pivars
$this->pi_setPiVarDefaults();
// Loading language-labels
$this->pi_loadLL();
// Init FlexForm configuration for plugin:
$this->pi_initPIflexForm();
$this->mergeflexFormValuesIntoConf();
// Get storage PIDs:
if ($this->conf['storagePid']) {
$this->spid = $this->conf['storagePid'];
} else {
$pids = $GLOBALS['TSFE']->getStorageSiterootPids();
$this->spid = $pids['_STORAGE_PID'];
}
// GPvars:
$this->logintype = t3lib_div::_GP('logintype');
$this->redirectUrl = t3lib_div::_GP('redirect_url');
// if config.typolinkLinkAccessRestrictedPages is set, the var is return_url
$returnUrl = t3lib_div::_GP('return_url');
if ($returnUrl) {
$this->redirectUrl = $returnUrl;
}
// Get Template
$templateFile = $this->conf['templateFile'] ? $this->conf['templateFile'] : 'EXT:felogin/template.html';
$this->template = $this->cObj->fileResource($templateFile);
// Is user logged in?
$this->userIsLoggedIn = $GLOBALS['TSFE']->loginUser;
// Redirect
if ($this->conf['redirectMode'] && !$this->conf['redirectDisable']) {
$this->redirectUrl = $this->processRedirect();
}
// What to display
$content='';
if ($this->piVars['forgot']) {
$content .= $this->showForgot();
} else {
if($this->userIsLoggedIn && !$this->logintype) {
$content .= $this->showLogout();
} else {
$content .= $this->showLogin();
}
}
// Process the redirect
if (($this->logintype === 'login' || $this->logintype === 'logout') && $this->redirectUrl) {
if (!$GLOBALS['TSFE']->fe_user->cookieId) {
$content .= '<p style="color:red; font-weight:bold;">' . $this->pi_getLL('cookie_warning', '', 1) . '</p>';
} else {
header('Location: '.t3lib_div::locationHeaderUrl($this->redirectUrl));
exit;
}
}
return $this->conf['wrapContentInBaseClass'] ? $this->pi_wrapInBaseClass($content) : $content;
}
/**
* Shows logout form
*
* @return string The content.
*/
protected function showLogout() {
$subpart = $this->cObj->getSubpart($this->template, '###TEMPLATE_LOGOUT###');
$subpartArray = $linkpartArray = array();
$markerArray['###STATUS_HEADER###'] = $this->getDisplayText('status_header',$this->conf['logoutHeader_stdWrap.']);
$markerArray['###STATUS_MESSAGE###']=$this->getDisplayText('status_message',$this->conf['logoutMessage_stdWrap.']);$this->cObj->stdWrap($this->flexFormValue('message','s_status'),$this->conf['logoutMessage_stdWrap.']);
$markerArray['###LEGEND###'] = $this->pi_getLL('logout', '', 1);
$markerArray['###ACTION_URI###'] = $this->getPageLink('',array(),true);
$markerArray['###LOGOUT_LABEL###'] = $this->pi_getLL('logout', '', 1);
$markerArray['###NAME###'] = htmlspecialchars($GLOBALS['TSFE']->fe_user->user['name']);
$markerArray['###STORAGE_PID###'] = $this->spid;
$markerArray['###USERNAME###'] = htmlspecialchars($GLOBALS['TSFE']->fe_user->user['username']);
$markerArray['###USERNAME_LABEL###'] = $this->pi_getLL('username', '', 1);
/* HIER WIRD DER NEUE MARKER ZUSAMMENGEBAUT */
$markerArray['###QUESTIONS###'] = '<a href="' . $this->pi_getPageLink($this->conf['questionsPid'], '', array('L'=> $this->sysLanguageId)) . '">' . $this->pi_getLL('questions', '', 1) . '</a>';
if ($this->redirectUrl) {
// use redirectUrl for action tag because of possible access restricted pages
$markerArray['###ACTION_URI###'] = htmlspecialchars($this->redirectUrl);
$this->redirectUrl = '';
}
return $this->cObj->substituteMarkerArrayCached($subpart, $markerArray, $subpartArray, $linkpartArray);
}
/**
* 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);
if($this->logintype === 'login') {
if($this->userIsLoggedIn) {
// login success
$markerArray['###STATUS_HEADER###'] = $this->getDisplayText('success_header',$this->conf['successHeader_stdWrap.']);
$markerArray['###STATUS_MESSAGE###'] = str_replace('###USER###',htmlspecialchars($GLOBALS['TSFE']->fe_user->user['username']),$this->getDisplayText('success_message',$this->conf['successMessage_stdWrap.']));
$subpartArray['###LOGIN_FORM###'] = '';
// Hook for general actions after after login has been confirmed (by Thomas Danzl <thomas@danzl.org>)
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);
}
}
}
} else {
// login error
$markerArray['###STATUS_HEADER###'] = $this->getDisplayText('error_header',$this->conf['errorHeader_stdWrap.']);
$markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('error_message',$this->conf['errorMessage_stdWrap.']);
$gpRedirectUrl = t3lib_div::_GP('redirect_url');
}
} else {
if($this->logintype === 'logout') {
// login form after logout
$markerArray['###STATUS_HEADER###'] = $this->getDisplayText('logout_header',$this->conf['welcomeHeader_stdWrap.']);
$markerArray['###STATUS_MESSAGE###'] = $this->getDisplayText('logout_message',$this->conf['welcomeMessage_stdWrap.']);
} 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 <kraftb@gmx.net>)
// This hook allows to call User JS functions.
// The methods should also set the required JS functions to get included
$onSubmit = '';
$extraHidden = '';
if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['felogin']['loginFormOnSubmitFuncs'])) {
$_params = array();
$onSubmitAr = array();
$extraHiddenAr = 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;';
$extraHidden = implode(chr(10), $extraHiddenAr);
}
// 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###'] = $gpRedirectUrl ? htmlspecialchars($gpRedirectUrl) : htmlspecialchars($this->redirectUrl);
/* HIER WIRD DER NEUE MARKER ZUSAMMENGEBAUT */
$markerArray['###INFOS###'] = '<a href="' . $this->pi_getPageLink($this->conf['infosPid'], '', array('L'=> $this->sysLanguageId)) . '">' . $this->pi_getLL('infos', '', 1) . '</a>';
if ($this->flexFormValue('showForgotPassword','sDEF') || $this->conf['showForgotPasswordLink']) {
$linkpartArray['###FORGOT_PASSWORD_LINK###'] = explode('|',$this->getPageLink('|',array($this->prefixId.'[forgot]'=>1)));
$markerArray['###FORGOT_PASSWORD###'] = $this->pi_getLL('ll_forgot_header', '', 1);
} else {
$subpartArray['###FORGOTP_VALID###'] = '';
}
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) {
$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);
}
/**
* Returns the header / message value from flexform if present, else from locallang.xml
*
* @param string label name
* @param string TS stdWrap array
* @return string label text
*/
protected function getDisplayText($label, $stdWrapArray=array()) {
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);
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/td_test_fe_login/pi1/class.ux_tx_felogin_pi1.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/td_test_fe_login/pi1/class.ux_tx_felogin_pi1.php']);
}
?>
3. Noch eine Datei ext_localconf.php im Root der neuen Extension mit folg. Inhalt erstellt.
<?php
$TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/felogin/pi1/class.tx_felogin_pi1.php'] = t3lib_extMgm::extPath('td_lindner_fe_login')."pi1/class.ux_tx_felogin_pi1.php";
?>
4. Noch die XML vom felogin in pi1 kopiert, da die ja sonst beim nächsten Update überschrieben werden, ausserdem kann diese dann wunderbar mit der "llxmltranslate" Extension übersetzt werden. 😉
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3locallang>
<meta type="array">
<description>Texts for plugin 'newloginbox'</description>
<type></type>
<csh_table></csh_table>
<labelContext type="array">
</labelContext>
</meta>
<data type="array">
<languageKey index="default" type="array">
<label index="ll_welcome_header">User login</label>
<label index="ll_welcome_message">Enter your username and password here in order to log in on the website:</label>
<label index="ll_logout_header">You have logged out.</label>
<label index="ll_logout_message">You just logged out from your user session on this website. You can login again or as another user by the form below.</label>
<label index="ll_error_header">Login failure</label>
<label index="ll_error_message">An error occurred during login. Most likely you didn't enter the username or password correctly.
Be certain that you enter them precisely as they are, including upper/lower case.
Another possibility is that cookies might be disabled in your webbrowser.</label>
<label index="ll_success_header">Login successful</label>
<label index="ll_success_message">You are now logged in as '###USER###'</label>
<label index="ll_status_header">Current status</label>
<label index="ll_status_message">This is your current status:</label>
<label index="cookie_warning">Warning: There is a possibility that cookies are not enabled in your webbrowser! If your login disappears on your next click that is the case and you should enable cookies (or accept cookies from this website) immediately!</label>
<label index="username">Username:</label>
<label index="password">Password:</label>
<label index="login">Login</label>
<label index="permalogin">Stay logged in:</label>
<label index="logout">Logout</label>
<label index="send_password">Send password</label>
<label index="your_email">Your email:</label>
<label index="ll_forgot_header">Forgot your password?</label>
<label index="questions">Frequently asked questions about the Extranet</label>
<label index="infos">Infos & Register</label>
<label index="ll_forgot_email_password">Your password
Hi %s
Your username is "%s"
Your password is "%s"
</label>
<label index="ll_forgot_email_nopassword">Your password
Hi %s
We couldn't find a username for this email address and so cannot send the password to you. Probably you misspelled the email address (upper/lower case makes a difference) or maybe you even didn't register yet?
</label>
<label index="ll_forgot_message">Please enter the email address by which you registered your user account. Then press "Send password" and your password will immediately be emailed to you. Make sure to spell your email address correctly.</label>
<label index="ll_forgot_message_emailSent">Your password has now been sent to the email address %s</label>
<label index="ll_forgot_header_backToLogin">Return to login form</label>
</languageKey>
</data>
<orig_hash type="array">
</orig_hash>
<orig_text type="array">
</orig_text>
</T3locallang>
5. Und dann kann man die IDs auch schon im TS setzen.
plugin.tx_felogin_pi1 {
infosPid = 414
questionsPid = 414
}
Hoffe ich hab nichts vergessen und vielleicht hilfts ja jemanden. War meine erste Erweiterung also kann Sie bestimmt auch noch besser gelöst werden...