das Modul ist nicht wirklich neu, sondern eine Überarbeitung des Standardmoduls vom Beispielmandanten.
Folgende Features sind dazu gekommen oder angepasst worden:
- Angabe des Zielartikels nach erfolgreicher Anmeldung in den Mandanteneinstellungen auch über idcatart möglich
- Eigene Logout-Zielartikel über die Mandanteneinstellungen definierbar (idcat, idart, idcat und idart, idcatart)
- Login-Fehlerbehandlung in der gleichen Seite innerhalb des Login-Blocks
- Im Backend wird nicht die Ansicht nach erfolgreichem Login angezeigt, sondern das Anmeldeformular ohne Anmeldefunktionalität
Modul-Output
Code: Alles auswählen
<?php
/**
* $RCSfile$
*
* Description: Display login form
*
* @version 1.1.0
* @author Rudi Bieller
* @copyright four for business AG <www.4fb.de>
*
* {@internal
* created 2008-04-07
* modified 2008-12-12 by funomat TG
* }}
*
* $Id$
*/
if (!isset($tpl) || !is_object($tpl)) {
$tpl = new Template();
}
$tpl->reset();
if ($auth->auth["uid"] == "nobody") {
$sTargetIdcatart = getEffectiveSetting('login_page', 'idcatart', '1');
$sTargetIdcat = getEffectiveSetting('login_page', 'idcat', '1');
$sTargetIdart = getEffectiveSetting('login_page', 'idart', '1');
$sErrorReturn = getEffectiveSetting('login_error_page', 'return', 'false');
$sUrl = "?idcat=".$idcat."&idart=".$idart;
$sUrl = ($sTargetIdcatart != '') ? "?idcatart=".$sTargetIdcatart : $sUrl;
$sUrl = ($sTargetIdart != '' && $sTargetIdcat != '') ? "?idcat=".$sTargetIdcat."&idart=".$sTargetIdart : $sUrl;
$sUrl = ($sTargetIdcat != '') ? "?idcat=".$sTargetIdcat : $sUrl;
$sUrl = ($sTargetIdart != '') ? "?idart=".$sTargetIdart : $sUrl;
if ($sErrorReturn){
$tpl->set('s', 'return', '<input type="hidden" name="return" value="1" />');
$sFormAction = 'front_content.php?idcat='.$idcat.'&idart='.$idart;
}else{
$tpl->set('s', 'return', '');
$sFormAction = 'front_content.php?'.$sUrl;
}
if (!isset($wrongpass)){
$tpl->set('s', 'warning', '');
}else{
$tpl->set('s', 'warning', '<p class="login_warning">'.mi18n("Anmeldung fehlgeschlagen!").'</p>');
}
$tpl->set('s', 'headline', mi18n("Geschlossener Bereich"));
$tpl->set('s', 'form_action', $sFormAction);
$tpl->set('s', 'label_name', mi18n("Benutzername"));
$tpl->set('s', 'label_pass', mi18n("Passwort"));
$tpl->set('s', 'label_login', mi18n("einloggen"));
$tpl->generate('templates/login_form.html');
} else {
if (!$edit){
cInclude('classes', 'class.frontend.users.php');
cInclude('classes', 'Contenido_Category/Contenido_Category.class.php');
try {
$oConCat = new Contenido_Category($db, $cfg);
$oConCat->load($idcat, true, $lang);
$bCatIsPublic = ($oConCat->getCategoryLanguage()->getVisible() == 1 && $oConCat->getCategoryLanguage()->getPublic() == 1) ? true : false;
} catch (Exception $e) {
echo $e->getMessage();
}
$oFeUserCollection = new FrontendUserCollection();
$oFeUser = $oFeUserCollection->loadItem($auth->auth["uid"]);
$sText = str_replace('[uname]', $oFeUser->get('username'), mi18n("Willkommen <strong>[uname]</strong>, schön dass Sie wieder bei uns vorbeischauen."));
if ($bCatIsPublic === true) {
$sFormAction = 'front_content.php?idcat='.$idcat.'&idart='.$idart.'&logout=true';
} else {
$sTargetIdcatart = getEffectiveSetting('logout_page', 'idcatart', '1');
$sTargetIdcat = getEffectiveSetting('logout_page', 'idcat', '1');
$sTargetIdart = getEffectiveSetting('logout_page', 'idart', '1');
$sUrl = "?idcat=".$idcat."&idart=".$idart;
$sUrl = ($sTargetIdcatart != '') ? "?idcatart=".$sTargetIdcatart : $sUrl;
$sUrl = ($sTargetIdart != '' && $sTargetIdcat != '') ? "?idcat=".$sTargetIdcat."&idart=".$sTargetIdart : $sUrl;
$sUrl = ($sTargetIdcat != '') ? "?idcat=".$sTargetIdcat : $sUrl;
$sUrl = ($sTargetIdart != '') ? "?idart=".$sTargetIdart : $sUrl;
$sFormAction = 'front_content.php'.$sUrl.'&logout=true';
}
$tpl->set('s', 'headline', mi18n("Geschlossener Bereich Logout"));
$tpl->set('s', 'text', $sText);
$tpl->set('s', 'form_action', $sFormAction);
$tpl->set('s', 'label_logout', mi18n("ausloggen"));
$tpl->generate('templates/login_form_loggedin.html');
}else{
$sFormAction = '#';
$tpl->set('s', 'return', '');
$tpl->set('s', 'warning', '');
$tpl->set('s', 'headline', mi18n("Geschlossener Bereich"));
$tpl->set('s', 'form_action', $sFormAction);
$tpl->set('s', 'label_name', mi18n("Benutzername"));
$tpl->set('s', 'label_pass', mi18n("Passwort"));
$tpl->set('s', 'label_login', mi18n("einloggen"));
$tpl->generate('templates/login_form.html');
}
}
?>
Code: Alles auswählen
<h6>{headline}</h6>
<form action="{form_action}" method="post">
<label for="username">{label_name}</label> <input type="text" id="username" name="username" /><br />
<label for="password">{label_pass}</label> <input type="password" id="password" name="password" /><br />
<input id="loginBtn" type="submit" name="login" value="{label_login}" />
{return}
</form>
{warning}
Code: Alles auswählen
<h6>{headline}</h6>
<form action="{form_action}" method="post">
<p>{text}</p>
<input id="loginBtn" type="submit" name="logout" value="{label_logout}" />
</form>
Code: Alles auswählen
.login_warning { color: #F00; text-align: center; }
Code: Alles auswählen
login_page idcatart WERT
login_page idcat WERT
login_page idart WERT
login_error_page idcatart WERT
login_error_page idcat WERT
login_error_page idart WERT
login_error_page return false/true (standard false - true bewirkt Fehlerbehandlung innerhalb des Moduls)
logout_page idcatart WERT
logout_page idcat WERT
logout_page idart WERT

Wenn man sich für die Fehlerbehandlung im Modul entscheidet, sollte man wissen, das es nicht mehr möglich ist die Werte für login_page zu benutzen. Das heißt, dass man nach erfolgreichem Login auf der Seite bleibt in der man sich beim Anmelden befunden hat!!!
Sollte man doch wünschen login_page einzustellen und gleichzeitig die Fehlerbehandlung im Modul durchzuführen, muss man noch folgende Änderungen vornehmen:
Im Modul Zeile 39
Code: Alles auswählen
$sFormAction = 'front_content.php?idcat='.$idcat.'&idart='.$idart;
Code: Alles auswählen
$sFormAction = 'front_content.php?'.$sUrl.'&rIdcat='.$idcat.'&rIdart='.$idart;
Code: Alles auswählen
global $cfg, $idcat, $idart, $idcatart, $lang, $client, $username;
Code: Alles auswählen
global $cfg, $idcat, $rIdcat, $idart, $rIdart, $idcatart, $lang, $client, $username;
Code: Alles auswählen
if ($idcat > 0) {
$aLocator[] = "idcat=".intval($idcat);
}
if ($idart > 0) {
$aLocator[] = "idart=".intval($idart);
}
Code: Alles auswählen
if ($idcat > 0) {
$aLocator[] = "idcat=".intval($rIdcat);
}
if ($idart > 0) {
$aLocator[] = "idart=".intval($rIdart);
}
Info:
Support kann ich nur über diesen Thread anbieten!
Viel Spaß damit,
funomat