1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-17 20:01:47 +02:00

Login page shortcodes updated to use class. {LOGO=login} added for consistent logo site-wide. ie. use pref or use file.

This commit is contained in:
Cameron
2013-03-20 18:41:27 -07:00
parent 8143448903
commit 0fbb9acf2b
4 changed files with 251 additions and 71 deletions

View File

@@ -0,0 +1,118 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2013 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
*/
if (!defined('e107_INIT')) { exit; }
class login_shortcodes extends e_shortcode
{
var $secImg = false;
function __construct()
{
$pref = e107::getPref();
$this->secImg = ($pref['logcode'] && extension_loaded("gd")) ? true : false;
}
function sc_login_username_label($parm='')
{
$pref = e107::getPref();
$allowEmailLogin = varset($pref['allowEmailLogin'],0);
$ulabel = array(LAN_LOGIN_1,LAN_LOGIN_28,LAN_LOGIN_29);
return $ulabel[$allowEmailLogin];
}
function sc_login_table_loginmessage($parm='')
{
return LOGINMESSAGE;
}
function sc_login_table_username($parm='') //FIXME use $frm
{
return "<input class='tbox' type='text' name='username' id='username' size='40' maxlength='100' />";
}
function sc_login_table_password($parm='') //FIXME use $frm
{
$pref = e107::getPref();
$text = "<input class='tbox' type='password' name='userpass' id='userpass' size='40' maxlength='100' />";
if (!USER && e107::getSession()->is('challenge') && varset($pref['password_CHAP'],0))
{
$text .= "<input type='hidden' name='hashchallenge' id='hashchallenge' value='".e107::getSession()->get('challenge')."' />\n\n";
}
return $text;
}
function sc_login_table_secimg_lan($parm='')
{
if(!$this->secImg){ return; }
return e107::getSecureImg()->renderLabel();
// return LAN_LOGIN_13;
}
function sc_login_table_secimg_hidden($parm='')
{
if(!$this->secImg){ return; }
// return "<input type='hidden' name='rand_num' value='".$sec_img->random_number."' />"; // Not required.
}
function sc_login_table_secimg_secimg($parm='')
{
if(!$this->secImg){ return; }
return e107::getSecureImg()->renderImage();
// return e107::getSecureImg()->r_image();
}
function sc_login_table_secimg_textboc($parm='')
{
if(!$this->secImg){ return; }
return e107::getSecureImg()->renderInput();
// return "<input class='tbox' type='text' name='code_verify' size='15' maxlength='20' />";
}
function sc_login_table_autologin($parm='')//FIXME use $frm
{
return "<input type='checkbox' name='autologin' value='1' />";
}
function sc_login_table_autologin_lan($parm='')
{
return LAN_LOGIN_8;
}
function sc_login_table_submit($parm="") //FIXME use $frm
{
return "<input class='btn btn-primary button' type='submit' name='userlogin' value=\"".LAN_LOGIN_9."\" />";
}
function sc_login_table_footer_userreg()
{
$pref = e107::getPref();
if ($pref['user_reg'])
{
$text = "<a href='".e_SIGNUP."'>".LAN_LOGIN_11."</a>";
$text .= "&nbsp;&nbsp;&nbsp;<a href='".e_BASE."fpw.php'>".LAN_LOGIN_12."</a>";
return $text;
}
else
{
return '&nbsp;'; // In case no registration system enabled
}
}
}
?>

View File

@@ -4,12 +4,12 @@
if (!defined('e107_INIT')) { exit; }
// ##### LOGIN HEADER TABLE -----------------------------------------------------------------------
if(!isset($LOGIN_TABLE_HEADER))
if(!isset($LOGIN_TABLE_HEADER)) //FIXME - use {LOGO} .
{
$LOGIN_TABLE_HEADER .= "
<div style='width:100%;text-align:center; margin-left: auto;margin-right: auto'><br />
<div style='text-align:center;width:70%;margin-left: auto;margin-right: auto'>
".(file_exists(THEME."images/login_logo.png") ? "<img src='".THEME_ABS."images/login_logo.png' alt='' />\n" : "<img src='".e_IMAGE."logo.png' alt='' />\n" );
{LOGO=login}";
}
// ##### LOGIN TABLE -----------------------------------------------------------------------------
@@ -52,7 +52,9 @@ if(!isset($LOGIN_TABLE))
<td class='forumheader3' rowspan='".($LOGIN_TABLE_SECIMG_SECIMG ? 3 : 2)."' style='width:20%; vertical-align: middle; margin-left: auto; margin-right: auto; text-align: center;'>".(file_exists(THEME."images/password.png") ? "<img src='".THEME_ABS."images/password.png' alt='' />\n" : "<img src='".e_IMAGE."generic/password.png' alt='' />\n" )."</td>\n</tr>\n
<tr>\n<td class='forumheader3'>".LAN_LOGIN_2."</td>\n<td class='forumheader3'>{LOGIN_TABLE_PASSWORD}
</td>\n</tr>\n";
if($LOGIN_TABLE_SECIMG_SECIMG)
if(LOGIN_CAPTCHA)
{
$LOGIN_TABLE .= "<tr><td class='forumheader3'>{LOGIN_TABLE_SECIMG_LAN}</td>\n<td class='forumheader3'>{LOGIN_TABLE_SECIMG_HIDDEN} {LOGIN_TABLE_SECIMG_SECIMG} {LOGIN_TABLE_SECIMG_TEXTBOC}</td>\n</tr>\n";
}
@@ -66,10 +68,10 @@ if(!isset($LOGIN_TABLE))
if(!isset($LOGIN_TABLE_FOOTER))
{
$LOGIN_TABLE_FOOTER = "
<div style='width:70%;margin-right:auto;margin-left:auto'>
<div style='margin-bottom:100px; width:70%;margin-right:auto;margin-left:auto'>
<div style='text-align:center'><br />
{LOGIN_TABLE_FOOTER_USERREG}
&nbsp;&nbsp;&nbsp;<a href='".e_BASE."fpw.php'>".LAN_LOGIN_12."</a>
</div>
</div>
</div>
@@ -78,4 +80,25 @@ if(!isset($LOGIN_TABLE_FOOTER))
// ##### ------------------------------------------------------------------------------------------
// Starter for v2. - Bootstrap
$LOGIN_TEMPLATE['xxxxx'] = '
<h2 class="form-signin-heading">Please sign in</h2>
<input type="text" class="input-block-level" placeholder="Email address">
<input type="password" class="input-block-level" placeholder="Password">
<label class="checkbox">
<input type="checkbox" value="remember-me"> Remember me
</label>
<button class="btn btn-large btn-primary" type="submit">Sign in</button>
';
?>