@EVAL if ($modx->getLoginUserID()) return 'Logout'; else return 'Login';
<?php
# WebLogin 1.0
# Created By Raymond Irving 2004
#::::::::::::::::::::::::::::::::::::::::
# Usage:
# Allows a web user to login to the website
#
# Params:
# &loginhomeid - (Optional)
# redirects the user to first authorized page in the list.
# If no id was specified then the login home page id or
# the current document id will be used
#
# &logouthomeid - (Optional)
# document id to load when user logs out
#
# &pwdreqid - (Optional)
# document id to load after the user has submited
# a request for a new password
#
# &pwdactid - (Optional)
# document id to load when the after the user has activated
# their new password
#
# &logintext - (Optional)
# Text to be displayed inside login button (for built-in form)
#
# &logouttext - (Optional)
# Text to be displayed inside logout link (for built-in form)
#
# &tpl - (Optional)
# Chunk name or document id to as a template
#
# Note: Templats design:
# section 1: login template
# section 2: logout template
# section 3: password reminder template
#
# See weblogin.tpl for more information
#
# Examples:
#
# [[WebLogin? &loginhomeid=`8` &logouthomeid=`1`]]
#
# [[WebLogin? &loginhomeid=`8,18,7,5` &tpl=`Login`]]
# Set Snippet Paths
$snipPath = $modx->config['base_path'] . "assets/snippets/";
# check if inside manager
if ($m = $modx->insideManager()) {
return ''; # don't go any further when inside manager
}
# deprecated params - only for backward compatibility
if(isset($loginid)) $loginhomeid=$loginid;
if(isset($logoutid)) $logouthomeid = $logoutid;
if(isset($template)) $tpl = $template;
# Snippet customize settings
$liHomeId = isset($loginhomeid)? explode(",",$loginhomeid):array($modx->config['login_home'],$modx->documentIdentifier);
$loHomeId = isset($logouthomeid)? $logouthomeid:$modx->documentIdentifier;
$pwdReqId = isset($pwdreqid)? $pwdreqid:0;
$pwdActId = isset($pwdactid)? $pwdactid:0;
$loginText = isset($logintext)? $logintext:'Login';
$logoutText = isset($logouttext)? $logouttext:'Logout';
$tpl = isset($tpl)? $tpl:"";
# System settings
$webLoginMode = isset($_REQUEST['webloginmode'])? $_REQUEST['webloginmode']: '';
$isLogOut = $webLoginMode=='lo' ? 1:0;
$isPWDActivate = $webLoginMode=='actp' ? 1:0;
$isPostBack = count($_POST) && (isset($_POST['cmdweblogin']) || isset($_POST['cmdweblogin_x']));
$txtPwdRem = isset($_REQUEST['txtpwdrem'])? $_REQUEST['txtpwdrem']: 0;
$isPWDReminder = $isPostBack && $txtPwdRem=='1' ? 1:0;
$site_id = isset($site_id)? $site_id: '';
$cookieKey = substr(md5($site_id."Web-User"),0,15);
# Start processing
include_once $snipPath."weblogin/weblogin.common.inc.php";
include_once ($modx->config['base_path'] . "manager/includes/crypt.class.inc.php");
if ($isPWDActivate || $isPWDReminder || $isLogOut || $isPostBack) {
# include the logger class
include_once $modx->config['base_path'] . "manager/includes/log.class.inc.php";
include_once $snipPath."weblogin/weblogin.processor.inc.php";
}
include_once $snipPath."weblogin/weblogin.inc.php";
# Return
return $output;
?><!-- #declare:separator <hr> -->
<!-- login form section-->
<form method="post" name="loginfrm" action="[+action+]">
<input type="hidden" value="[+rememberme+]" name="rememberme" />
<fieldset>
<h3>Your Login Details</h3>
<label for="username">User: <input type="text" name="username" id="username" tabindex="1" onkeypress="return webLoginEnter(document.loginfrm.password);" value="[+username+]" /></label>
<label for="password">Password: <input type="password" name="password" id="password" tabindex="2" onkeypress="return webLoginEnter(document.loginfrm.cmdweblogin);" value="" /></label>
<input type="checkbox" id="checkbox_1" name="checkbox_1" tabindex="3" size="1" value="" [+checkbox+] onclick="webLoginCheckRemember()" /><label for="checkbox_1" class="checkbox">Remember me</label>
<input type="submit" value="[+logintext+]" name="cmdweblogin" class="button" />
<a href="#" onclick="webLoginShowForm(2);return false;" id="forgotpsswd">Forget Your Password?</a>
</fieldset>
</form>
<hr>
<!-- log out hyperlink section -->
<h4>You're already logged in</h4>
Do you wish to <a href="[+action+]" class="button">[+logouttext+]</a>?
<hr>
<!-- Password reminder form section -->
<form name="loginreminder" method="post" action="[+action+]">
<fieldset>
<h3>It happens to everyone...</h3>
<input type="hidden" name="txtpwdrem" value="0" />
<label for="txtwebemail">Enter the email address of your account to reset your password: <input type="text" name="txtwebemail" id="txtwebemail" size="24" /></label>
<label>To return to the login form, press the cancel button.</label>
<input type="submit" value="Submit" name="cmdweblogin" class="button" /> <input type="reset" value="Cancel" name="cmdcancel" onclick="webLoginShowForm(1);" class="button" style="clear:none;display:inline" />
</fieldset>
</form>
<?php
$e = &$modx->event;
if($e->name=='OnPageUnauthorized') {
$id = $_REQUEST['refurl'];
$doc = $modx->getDocument($id);
swicth ($doc['template'])
{
case 'themes_ru': $modx->config['unauthorized_page'] = 4; break;
case 'themes_en': $modx->config['unauthorized_page'] = 5; break;
case 'themes_de': $modx->config['unauthorized_page'] = 6; break;
}
}
?>Подходящее решение проблемы описано => http://modxcms.com/forums/index.php/topic,19877.0.html
UltimateParent - был по дефолту, PHx прикрутил. Чисто теоритически все понятно, не подскажите как сделать все это дело на правтике, есть три шаблона, например themeR, themeD, themeE для трех разных языков рашн, бундес и инглиш соответственно, есть 3 чанка FormLoginR, FormLoginD, FormLoginE - разные формы ...
This discussion is closed to further replies. Keep calm and carry on.