1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 14:46:56 +02:00

Fix for login/signup message on comment form. Allow login page to load if social signup is active.

This commit is contained in:
Cameron
2016-03-13 17:57:51 -07:00
parent e972053cd3
commit 8d13c27638
7 changed files with 125 additions and 19 deletions

View File

@@ -14,10 +14,13 @@ if (!defined('e107_INIT')) { exit; }
class login_shortcodes extends e_shortcode
{
var $secImg = false;
protected $userReg = false; // user registration pref.
function __construct()
{
$pref = e107::getPref();
$this->userReg = intval($pref['user_reg']);
$this->secImg = ($pref['logcode'] && extension_loaded("gd")) ? true : false;
}
@@ -31,11 +34,22 @@ class login_shortcodes extends e_shortcode
function sc_login_table_loginmessage($parm='')
{
return LOGINMESSAGE;
if(empty($this->userReg))
{
return null;
}
return LOGINMESSAGE;
}
function sc_login_table_username($parm='') //FIXME use $frm
{
if(empty($this->userReg))
{
return null;
}
$pref = e107::getPref();
$allowEmailLogin = varset($pref['allowEmailLogin'],0);
$ulabel = array(LAN_LOGIN_1,LAN_LOGIN_28,LAN_LOGIN_29);
@@ -47,6 +61,11 @@ class login_shortcodes extends e_shortcode
function sc_login_table_password($parm='') //FIXME use $frm
{
if(empty($this->userReg))
{
return null;
}
$pref = e107::getPref();
$text = "<input class='tbox form-control input-block-level' type='password' name='userpass' id='userpass' size='40' maxlength='100' placeholder=\"".LAN_LOGIN_2."\" />";
@@ -59,6 +78,11 @@ class login_shortcodes extends e_shortcode
function sc_login_table_secimg_lan($parm='')
{
if(empty($this->userReg))
{
return null;
}
if(!$this->secImg){ return; }
return e107::getSecureImg()->renderLabel();
// return LAN_LOGIN_13;
@@ -73,6 +97,11 @@ class login_shortcodes extends e_shortcode
function sc_login_table_secimg_secimg($parm='')
{
if(empty($this->userReg))
{
return null;
}
if(!$this->secImg){ return; }
return e107::getSecureImg()->renderImage();
// return e107::getSecureImg()->r_image();
@@ -80,6 +109,11 @@ class login_shortcodes extends e_shortcode
function sc_login_table_secimg_textboc($parm='')
{
if(empty($this->userReg))
{
return null;
}
if(!$this->secImg){ return; }
return e107::getSecureImg()->renderInput();
// return "<input class='tbox' type='text' name='code_verify' size='15' maxlength='20' />";
@@ -87,24 +121,43 @@ class login_shortcodes extends e_shortcode
function sc_login_table_autologin($parm='')//FIXME use $frm
{
if(empty($this->userReg))
{
return null;
}
return "<input type='checkbox' name='autologin' value='1' />";
}
function sc_login_table_autologin_lan($parm='')
{
if(empty($this->userReg))
{
return null;
}
return LAN_LOGIN_8;
}
function sc_login_table_rememberme($parm=null)
{
if(empty($this->userReg))
{
return null;
}
return e107::getForm()->checkbox('autologin',1,false,LAN_LOGIN_8);
}
function sc_login_table_submit($parm="") //FIXME use $frm
{
if(empty($this->userReg))
{
return null;
}
$class = ($parm == 'large') ? "btn-large btn-lg" : "";
return "<input class='btn btn-primary ".$class." button' type='submit' name='userlogin' value=\"".LAN_LOGIN_9."\" />";
}
@@ -112,18 +165,17 @@ class login_shortcodes extends e_shortcode
function sc_login_table_footer_userreg($parm='')
{
$pref = e107::getPref();
//$pref = e107::getPref();
if(empty($this->userReg))
{
return null;
}
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
}
$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;
}

View File

@@ -112,8 +112,9 @@ $LOGIN_WRAPPER['page']['LOGIN_TABLE_SUBMIT'] = "<div class='form-group'>{---}</d
$LOGIN_WRAPPER['page']['LOGIN_TABLE_FOOTER_USERREG'] = "<div class='form-group'>{---}</div>";
$LOGIN_TEMPLATE['page']['body'] .= '
{LOGIN_TABLE_USERNAME}
{LOGIN_TABLE_USERNAME}
{LOGIN_TABLE_PASSWORD}
{SOCIAL_LOGIN: size=3x}
{LOGIN_TABLE_SECIMG_SECIMG} {LOGIN_TABLE_SECIMG_TEXTBOC}
{LOGIN_TABLE_REMEMBERME}
{LOGIN_TABLE_SUBMIT=large}

View File

@@ -325,8 +325,46 @@ class comment
}
else
{ // Comment entry not allowed - point to signup link
$text = "<br /><div style='text-align:center'><b>".COMLAN_6." <a href='".e_SIGNUP."'>".COMLAN_321."</a> ".COMLAN_322."</b></div>";
$userReg = intval(e107::pref('core','user_reg'));
$socialLogin = e107::pref('core','social_login_active');
$text = "<div class='comments-form-login'>";
$srch = array("[","]");
if(!empty($userReg) || !empty($socialLogin))
{
$COMLAN_500 = COMLAN_500; // Please [sign in] to leave a comment.
$repl = array("<a href='".e_LOGIN."'>","</a>");
$text .= "<div>".str_replace($srch,$repl,$COMLAN_500)."</div>";
if(!empty($socialLogin))
{
$text .= $tp->parseTemplate("{SOCIAL_LOGIN}",true);
// $text .= "<br />";
}
}
if($userReg === 1)
{
$COMLAN_501 = COMLAN_501; // If you are not yet registered, you may [click here to register].
$repl = array("<a href='".e_SIGNUP."'>","</a>");
$text .= "<div>".str_replace($srch,$repl,$COMLAN_501)."</div>";
}
$text .= "</div>";
// $text = "<br /><div style='text-align:center'><b>".COMLAN_6." <a href='".e_SIGNUP."'>".COMLAN_321."</a> ".COMLAN_322."</b></div>";
}
if ($return)
{
return $text;

View File

@@ -79,4 +79,11 @@ define("COMLAN_TYPE_6", "bugtrack");
define("COMLAN_TYPE_7", "ideas");
define("COMLAN_TYPE_8", "userprofile");
define("COMLAN_TYPE_PAGE", "Content"); // Really custom page, but use a 'non-technical' description
define("COMLAN_500", "Please [sign in] to leave a comment.");
define("COMLAN_501", "If you are not yet registered, you may [click here to register].");
?>

View File

@@ -130,7 +130,14 @@ class social_shortcodes extends e_shortcode
}
$sc = e107::getScBatch('signup');
$text = "<p>Sign in with:</p>";
$text = '';
if(!empty($parm['label']))
{
$text .= "<p>Sign in with:</p>";
}
$text .= $sc->sc_signup_xup_login($parm);
$text .= "
<div class='clearfix'></div><hr class='clearfix' />";

View File

@@ -108,7 +108,7 @@ class theme_shortcodes extends e_shortcode
<a class="dropdown-toggle" href="#" data-toggle="dropdown">'.LAN_LOGINMENU_51.' <strong class="caret"></strong></a>
<div class="dropdown-menu col-sm-12" style="min-width:250px; padding: 15px; padding-bottom: 0px;">
{SOCIAL_LOGIN: size=2x}
{SOCIAL_LOGIN: size=2x&label=1}
'; // Sign In
}
else

View File

@@ -19,7 +19,8 @@
require_once("class2.php");
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.
if ((USER || e_LOGIN != e_SELF || (empty($pref['user_reg']) && empty($pref['social_login_active']))) && e_QUERY !== 'preview' && !getperms('0') ) // Disable page if user logged in, or some custom e_LOGIN value is used.
{
$prev = e107::getRedirect()->getPreviousUrl();