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

Login page template/shortcode fixes.

This commit is contained in:
Cameron
2016-02-29 15:13:32 -08:00
parent 8c0680a18a
commit b4c4352080
7 changed files with 69 additions and 73 deletions

View File

@@ -95,16 +95,22 @@ class login_shortcodes extends e_shortcode
{ {
return LAN_LOGIN_8; return LAN_LOGIN_8;
} }
function sc_login_table_rememberme($parm=null)
{
return e107::getForm()->checkbox('autologin',1,false,LAN_LOGIN_8);
}
function sc_login_table_submit($parm="") //FIXME use $frm function sc_login_table_submit($parm="") //FIXME use $frm
{ {
$class = ($parm == 'large') ? "btn-large" : ""; $class = ($parm == 'large') ? "btn-large btn-lg" : "";
return "<input class='btn btn-primary ".$class." button' type='submit' name='userlogin' value=\"".LAN_LOGIN_9."\" />"; return "<input class='btn btn-primary ".$class." button' type='submit' name='userlogin' value=\"".LAN_LOGIN_9."\" />";
} }
function sc_login_table_footer_userreg() function sc_login_table_footer_userreg($parm='')
{ {
$pref = e107::getPref(); $pref = e107::getPref();

View File

@@ -2,7 +2,7 @@
// $Id$ // $Id$
if (!defined('e107_INIT')) { exit; } if (!defined('e107_INIT')) { exit; }
/*
// ##### LOGIN HEADER TABLE ----------------------------------------------------------------------- // ##### LOGIN HEADER TABLE -----------------------------------------------------------------------
if(!isset($LOGIN_TABLE_HEADER)) //FIXME - use {LOGO} . if(!isset($LOGIN_TABLE_HEADER)) //FIXME - use {LOGO} .
{ {
@@ -77,14 +77,14 @@ if(!isset($LOGIN_TABLE_FOOTER))
</div> </div>
</div>"; </div>";
} }
// ##### ------------------------------------------------------------------------------------------ // ##### ------------------------------------------------------------------------------------------*/
// Starter for v2. - Bootstrap // Starter for v2. - Bootstrap
$LOGIN_TEMPLATE['page']['header'] = " $LOGIN_TEMPLATE['page']['header'] = "
<div id='login-template'> <div id='login-template'>
<div class='center' style='padding:50px; margin-left:auto; margin-right: auto'> <div class='center'>
{LOGO=login} {LOGO=login}
</div>"; </div>";
@@ -102,24 +102,27 @@ $LOGIN_TEMPLATE['page']['body'] = '
{ {
$LOGIN_TEMPLATE['page']['body'] .= "<span>"; $LOGIN_TEMPLATE['page']['body'] .= "<span>";
} }
$LOGIN_WRAPPER['page']['LOGIN_TABLE_USERNAME'] = "<div class='form-group'>{---}</div>";
$LOGIN_WRAPPER['page']['LOGIN_TABLE_PASSWORD'] = "<div class='form-group'>{---}</div>";
$LOGIN_WRAPPER['page']['LOGIN_TABLE_SECIMG_SECIMG'] = "<div class='form-group'>{---}</div>";
$LOGIN_WRAPPER['page']['LOGIN_TABLE_SECIMG_TEXTBOC'] = "<div class='form-group'>{---}</div>";
$LOGIN_WRAPPER['page']['LOGIN_TABLE_REMEMBERME'] = "<div class='form-group checkbox'>{---}</div>";
$LOGIN_WRAPPER['page']['LOGIN_TABLE_SUBMIT'] = "<div class='form-group'>{---}</div>";
$LOGIN_WRAPPER['page']['LOGIN_TABLE_FOOTER_USERREG'] = "<div class='form-group'>{---}</div>";
$LOGIN_TEMPLATE['page']['body'] .= ' $LOGIN_TEMPLATE['page']['body'] .= '
{LOGIN_TABLE_USERNAME} {LOGIN_TABLE_USERNAME}
{LOGIN_TABLE_PASSWORD} {LOGIN_TABLE_PASSWORD}
{LOGIN_TABLE_SECIMG_SECIMG} {LOGIN_TABLE_SECIMG_TEXTBOC} {LOGIN_TABLE_SECIMG_SECIMG} {LOGIN_TABLE_SECIMG_TEXTBOC}
</span> {LOGIN_TABLE_REMEMBERME}
<label class="checkbox">
{LOGIN_TABLE_AUTOLOGIN} {LOGIN_TABLE_AUTOLOGIN_LAN}
</label>
{LOGIN_TABLE_SUBMIT=large} {LOGIN_TABLE_SUBMIT=large}
'; ';
$LOGIN_TEMPLATE['page']['footer'] = " $LOGIN_TEMPLATE['page']['footer'] = "
<div style='margin-bottom:100px; 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 /> <div style='text-align:center'>{LOGIN_TABLE_FOOTER_USERREG}</div>
{LOGIN_TABLE_FOOTER_USERREG}
</div>
</div> </div>
</div>"; </div>";

View File

@@ -828,13 +828,18 @@ class e_parse extends e_parser
* @param object $eVars - XXX more info needed. * @param object $eVars - XXX more info needed.
* @return string * @return string
*/ */
function parseTemplate($text, $parseSCFiles = TRUE, $extraCodes = null, $eVars = null) function parseTemplate($text, $parseSCFiles = true, $extraCodes = null, $eVars = null)
{ {
if(!empty($extraCodes) && $this->isSimpleParse($extraCodes)) // support for a combined simple and standard template parse. - (eg. used by signup email template.) if(!empty($extraCodes) && $this->isSimpleParse($extraCodes)) // support for a combined simple and standard template parse. - (eg. used by signup email template.)
{ {
$text = $this->simpleParse($text, $extraCodes, false); $text = $this->simpleParse($text, $extraCodes, false);
} }
if(!is_bool($parseSCFiles))
{
trigger_error("\$parseSCFiles in parseTemplate() was given incorrect data");
}
return e107::getScParser()->parseCodes($text, $parseSCFiles, $extraCodes, $eVars); return e107::getScParser()->parseCodes($text, $parseSCFiles, $extraCodes, $eVars);
} }

View File

@@ -748,6 +748,8 @@ class e_parse_shortcode
if (is_object($extraCodes)) if (is_object($extraCodes))
{ {
$this->addedCodes = &$extraCodes; $this->addedCodes = &$extraCodes;
@@ -1302,6 +1304,8 @@ class e_shortcode
* Sets wrapper id (to be retrieved from the registry while parsing) * Sets wrapper id (to be retrieved from the registry while parsing)
* Example e107::getScBatch('contact')->wrapper('contact/form'); * Example e107::getScBatch('contact')->wrapper('contact/form');
* which results in using the $CONTACT_WRAPPER['form'] wrapper in the parsing phase * which results in using the $CONTACT_WRAPPER['form'] wrapper in the parsing phase
* Template cannot be loaded via include, only by getTemplate or getCoreTemplate
* e107::getScBatch() must be used also.
*/ */
public function wrapper($id = null) public function wrapper($id = null)
{ {

View File

@@ -119,6 +119,9 @@ img.featurebox { border-radius: 5px }
.tab-pane { padding-top:15px } .tab-pane { padding-top:15px }
#login-template { max-width: 330px; margin-right: auto; margin-left: auto; }
#login-template h2.caption { text-align:center; font-size:120%; opacity:0.8 }
#login-template .logo { padding-top:50px; margin-left:auto; margin-right: auto }
/* CUSTOM Responsive Styles */ /* CUSTOM Responsive Styles */

View File

@@ -18,4 +18,7 @@ a.btn { }
{ margin-top: 0; background: transparent none no-repeat scroll 0 50%; font-size:150% } { margin-top: 0; background: transparent none no-repeat scroll 0 50%; font-size:150% }
mark { text-decoration: underline; color:#FF0000; font-weight:bold; } /* .searchhighlight */ mark { text-decoration: underline; color:#FF0000; font-weight:bold; } /* .searchhighlight */
.list-unstyled { list-style: outside none none; } .list-unstyled { list-style: outside none none; }
#login-template { width:60%; max-width:350px; margin-right:auto;margin-left:auto; }
div.form-group { padding-top: 5px }

View File

@@ -20,16 +20,13 @@
require_once("class2.php"); require_once("class2.php");
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE); include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE);
if ((USER || e_LOGIN != e_SELF || empty($pref['user_reg']) ) && e_QUERY !== 'preview' ) // Disable page if user logged in, or some custom e_LOGIN value is used. if ((USER || e_LOGIN != e_SELF || empty($pref['user_reg']) ) && e_QUERY !== 'preview' && !getperms('0') ) // Disable page if user logged in, or some custom e_LOGIN value is used.
{ {
e107::redirect(); e107::redirect();
exit(); exit();
} }
define('e_IFRAME',true); define('e_IFRAME',true);
//$HEADER = '';
//$FOOTER=''; // Avoids strange displays when debug enabled! (But doesn't completely maintain XHTML formatting)
require_once(HEADERF); require_once(HEADERF);
$use_imagecode = ($pref['logcode'] && extension_loaded("gd")); $use_imagecode = ($pref['logcode'] && extension_loaded("gd"));
@@ -47,53 +44,37 @@ if (!USER || getperms('0'))
require_once(e_HANDLER.'form_handler.php'); // required for BC require_once(e_HANDLER.'form_handler.php'); // required for BC
$rs = new form; // required for BC $rs = new form; // required for BC
if (empty($LOGIN_TABLE))
// $text = "";
// $allowEmailLogin = varset($pref['allowEmailLogin'],0);
// $ulabel = array(LAN_LOGIN_1,LAN_LOGIN_28,LAN_LOGIN_29);
// $LOGIN_USERNAME_LABEL = $ulabel[$allowEmailLogin];
// $LOGIN_TABLE_LOGINMESSAGE = LOGINMESSAGE;
// $LOGIN_TABLE_USERNAME = "<input class='tbox' type='text' name='username' id='username' size='40' maxlength='100' />";
// $LOGIN_TABLE_PASSWORD = "<input class='tbox' type='password' name='userpass' id='userpass' size='40' maxlength='100' />";
// if (!USER && e107::getSession()->is('challenge') && varset($pref['password_CHAP'],0))
// {
// $LOGIN_TABLE_PASSWORD .= "<input type='hidden' name='hashchallenge' id='hashchallenge' value='".e107::getSession()->get('challenge')."' />\n\n";
// }
// if ($use_imagecode)
// {
// $LOGIN_TABLE_SECIMG_LAN = LAN_LOGIN_13;
// $LOGIN_TABLE_SECIMG_HIDDEN = "<input type='hidden' name='rand_num' value='".$sec_img->random_number."' />";
// $LOGIN_TABLE_SECIMG_SECIMG = $sec_img->r_image();
// $LOGIN_TABLE_SECIMG_TEXTBOC = "<input class='tbox' type='text' name='code_verify' size='15' maxlength='20' />";
// }
// $LOGIN_TABLE_AUTOLOGIN = "<input type='checkbox' name='autologin' value='1' />";
// $LOGIN_TABLE_AUTOLOGIN_LAN = LAN_LOGIN_8;
// $LOGIN_TABLE_SUBMIT = "<input class='btn btn-primary button' type='submit' name='userlogin' value=\"".LAN_LOGIN_9."\" />";
if (!isset($LOGIN_TABLE) || !$LOGIN_TABLE)
{ {
if (file_exists(THEME.'templates/login_template.php')) //v2.x path
if(deftrue('BOOTSTRAP'))
{ {
require_once(THEME.'templates/login_template.php'); $LOGIN_TEMPLATE = e107::getCoreTemplate('login');
} }
elseif (file_exists(THEME.'login_template.php')) else // BC Stuff.
{ {
require_once(THEME.'login_template.php');
} if (file_exists(THEME.'templates/login_template.php')) //v2.x path
else {
{ require_once(THEME.'templates/login_template.php');
require_once(e_CORE."templates/login_template.php"); }
elseif (file_exists(THEME.'login_template.php'))
{
require_once(THEME.'login_template.php');
}
else
{
$LOGIN_TEMPLATE = e107::getCoreTemplate('login');
}
} }
} }
$sc = e107::getScBatch('login'); $sc = e107::getScBatch('login');
$sc->wrapper('login/page');
if((deftrue('BOOTSTRAP')) && isset($LOGIN_TEMPLATE['page']))
if(!empty($LOGIN_TEMPLATE['page']))
{ {
$LOGIN_TABLE_HEADER = $LOGIN_TEMPLATE['page']['header']; $LOGIN_TABLE_HEADER = $LOGIN_TEMPLATE['page']['header'];
$LOGIN_TABLE = "<form class='form-signin' method='post' action='".e_SELF."' onsubmit='hashLoginPassword(this)' >".$LOGIN_TEMPLATE['page']['body']."</form>"; $LOGIN_TABLE = "<form class='form-signin' method='post' action='".e_SELF."' onsubmit='hashLoginPassword(this)' >".$LOGIN_TEMPLATE['page']['body']."</form>";
@@ -102,31 +83,22 @@ if (!USER || getperms('0'))
$text = $tp->parseTemplate($LOGIN_TABLE,true, $sc); $text = $tp->parseTemplate($LOGIN_TABLE,true, $sc);
// $text = preg_replace("/\{(.*?)\}/e", 'varset($\1,"\1")', $LOGIN_TABLE);
if(getperms('0')) if(getperms('0'))
{ {
echo "<div class='alert alert-block alert-error alert-danger center'> You are currently logged in.</div>"; echo "<div class='alert alert-block alert-error alert-danger center'> You are currently logged in.</div>";
} }
// echo preg_replace("/\{(.*?)\}/e", 'varset($\1,"\1")', $LOGIN_TABLE_HEADER);
$login_message = SITENAME; // $login_message = LAN_LOGIN_3." | ".SITENAME; $login_message = SITENAME; // $login_message = LAN_LOGIN_3." | ".SITENAME;
echo LOGINMESSAGE; echo LOGINMESSAGE;
echo $tp->parseTemplate($LOGIN_TABLE_HEADER, $sc); echo $tp->parseTemplate($LOGIN_TABLE_HEADER,true, $sc);
$ns->tablerender($login_message, $text, 'login_page'); $ns->tablerender($login_message, $text, 'login_page');
echo $tp->parseTemplate($LOGIN_TABLE_FOOTER, $sc); echo $tp->parseTemplate($LOGIN_TABLE_FOOTER, true, $sc);
// echo preg_replace("/\{([^ ]*?)\}/e", 'varset($\1,"\1")', $LOGIN_TABLE_FOOTER);
} }
require_once(FOOTERF); require_once(FOOTERF);
exit; exit;
//echo "</body></html>";
// $sql->db_Close();
?> ?>