diff --git a/e107_admin/prefs.php b/e107_admin/prefs.php index 848e06ae2..d0151648f 100644 --- a/e107_admin/prefs.php +++ b/e107_admin/prefs.php @@ -1342,117 +1342,8 @@ $text .= " "; // =========== Registration Preferences. ================== -$text .= " -
- ".PRFLAN_28." - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- ".$frm->radio_switch('user_reg', $pref['user_reg'])." -
".PRFLAN_30."
-
- ".$frm->select_open('user_reg_veri'); - $veri_list = array(PRFLAN_152,PRFLAN_31,PRFLAN_153); - - foreach($veri_list as $v => $v_title) - { - $text .= $frm->option($v_title, $v, ($pref['user_reg_veri'] == $v)); - } - - $text .= " - -
".PRFLAN_154a."
-
".$frm->select_open('allowEmailLogin'); - // $login_list = array(PRFLAN_201,PRFLAN_202,PRFLAN_203); - $login_list = array( - 2 => PRFLAN_203, - 1 => PRFLAN_202, - 0 => PRFLAN_201 - ); - foreach($login_list as $l => $l_title) - { - $text .= $frm->option($l_title, $l, ($pref['allowEmailLogin'] == $l)); - } - - $text .= " -
- ".$frm->radio_switch('signup_remote_emailcheck', $pref['signup_remote_emailcheck'])." -
- ".$frm->radio_switch('disable_emailcheck', $pref['disable_emailcheck'])." -
- ".$frm->radio_switch('use_coppa', $pref['use_coppa'])." -
".PRFLAN_46." ".PRFLAN_94."
-
"; - - $memDisp = !vartrue($pref['membersonly_enabled']) ? "e-hideme" : ""; - - $text .= $frm->radio_switch('membersonly_enabled', $pref['membersonly_enabled'],'', '', 'class=e-expandit')." -
".PRFLAN_59."
-
". - $frm->textarea('membersonly_exceptions', $pref['membersonly_exceptions'], 3, 1, 'placeholder='.PRFLAN_206)." -
".PRFLAN_207."
-
-
- ".$frm->radio_switch('autologinpostsignup', $pref['autologinpostsignup'])." -
".PRFLAN_198."
-
- ".$frm->number('signup_maxip', $pref['signup_maxip'], 3)." -
".PRFLAN_78."
-
- ".pref_submit('registration')." -
- - "; - // Single/ Social Login / / copied from hybridAuth config.php so it's easy to add more. // Used Below. @@ -1530,8 +1421,6 @@ $social_logins = array ( ); -// Key registration -// TODO LAN $social_external = array( "Facebook" => "https://developers.facebook.com/apps", "Twitter" => "https://dev.twitter.com/apps/new", @@ -1543,12 +1432,216 @@ $social_external = array( ); $testUrl = SITEURL."?route=system/xup/test"; + +$elements = array(1=>'Register & Login', 2=> 'Login Only', 0=>LAN_DISABLED); + + +$text .= " +
+ ".PRFLAN_28." + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "; + + + $text .= " + + + + + + + + + + "; + + if(!is_array($pref['social_login'])) + { + $pref['social_login'] = array(); + } + + foreach($social_logins as $prov=>$val) + { + + $label = varset($social_external[$prov]) ? "".$prov."" : $prov; + $radio_label = strtolower($prov); + $text .= " + + + + + "; + } + + + + + + + + $text .= " + + + +
+ ".$frm->radio('user_reg', $elements, $pref['user_reg'])." +
".PRFLAN_30."
+
+ ".$frm->select_open('user_reg_veri'); + $veri_list = array(PRFLAN_152,PRFLAN_31,PRFLAN_153); + + foreach($veri_list as $v => $v_title) + { + $text .= $frm->option($v_title, $v, ($pref['user_reg_veri'] == $v)); + } + + $text .= " + +
".PRFLAN_154a."
+
".$frm->select_open('allowEmailLogin'); + // $login_list = array(PRFLAN_201,PRFLAN_202,PRFLAN_203); + $login_list = array( + 2 => PRFLAN_203, + 1 => PRFLAN_202, + 0 => PRFLAN_201 + ); + foreach($login_list as $l => $l_title) + { + $text .= $frm->option($l_title, $l, ($pref['allowEmailLogin'] == $l)); + } + + $text .= " +
+ ".$frm->radio_switch('signup_remote_emailcheck', $pref['signup_remote_emailcheck'])." +
+ ".$frm->radio_switch('disable_emailcheck', $pref['disable_emailcheck'])." +
+ ".$frm->radio_switch('use_coppa', $pref['use_coppa'])." +
".PRFLAN_46." ".PRFLAN_94."
+
"; + + $memDisp = !vartrue($pref['membersonly_enabled']) ? "e-hideme" : ""; + + $text .= $frm->radio_switch('membersonly_enabled', $pref['membersonly_enabled'],'', '', 'class=e-expandit')." +
".PRFLAN_59."
+
". + $frm->textarea('membersonly_exceptions', $pref['membersonly_exceptions'], 3, 1, 'placeholder='.PRFLAN_206)." +
".PRFLAN_207."
+
+
+ ".$frm->radio_switch('autologinpostsignup', $pref['autologinpostsignup'])." +
".PRFLAN_198."
+
+ ".$frm->number('signup_maxip', $pref['signup_maxip'], 3)." +
".PRFLAN_78."
+
+ + ".$frm->radio_switch('social_login_active', $pref['social_login_active'])." +
Allows users to signup/login with their social media accounts. When enabled, this option will still allow users to signup/login even if the core user registration system above is disabled.
+ +
Note: In most cases you will need to obtain an id and secret key from one of the providers. Click the blue links below to configure. +
You may test your configuration with the following URL: + ".$testUrl."
+ +
+ "; + foreach($val as $k=>$v) + { + switch ($k) { + case 'enabled': + $eopt = array('class'=>'e-expandit'); + $text .= $frm->radio_switch('social_login['.$prov.'][enabled]', vartrue($pref['social_login'][$prov]['enabled']),'','',$eopt); + break; + + case 'keys': + // $cls = vartrue($pref['single_login'][$prov]['keys'][$tk]) ? "class='e-hideme'" : ''; + $sty = vartrue($pref['social_login'][$prov]['keys'][vartrue($tk)]) ? "" : "e-hideme"; + $text .= "
"; + foreach($v as $tk=>$idk) + { + $eopt = array('placeholder'=> $tk, 'size'=>'xxlarge'); + $text .= "
".$frm->text('social_login['.$prov.'][keys]['.$tk.']', vartrue($pref['social_login'][$prov]['keys'][$tk]), 100, $eopt); + } + $text .= "
"; + + break; + + case 'scope': + $text .= $frm->hidden('social_login['.$prov.'][scope]','email'); + break; + + default: + + break; + } + } + + $text .= "
+ ".pref_submit('registration')." +
+ + "; + + +// Key registration +// TODO LAN + $text .= "
Social Options -
Note: This section requires further testing.
You may test with the following URL: - ".$testUrl."
+ @@ -1592,68 +1685,7 @@ $xurls = array( "; } - $text .= " - - - - - - - "; - - if(!is_array($pref['social_login'])) - { - $pref['social_login'] = array(); - } - - foreach($social_logins as $prov=>$val) - { - - $label = varset($social_external[$prov]) ? "".$prov."" : $prov; - $radio_label = strtolower($prov); - $text .= " - - - - - "; - } - + $text .= " diff --git a/e107_core/shortcodes/batch/signup_shortcodes.php b/e107_core/shortcodes/batch/signup_shortcodes.php index 79cd98e72..be45203d7 100755 --- a/e107_core/shortcodes/batch/signup_shortcodes.php +++ b/e107_core/shortcodes/batch/signup_shortcodes.php @@ -57,9 +57,12 @@ class signup_shortcodes extends e_shortcode } // TODO - template - function sc_signup_xup_login() + function sc_signup_xup_login($parm) { $pref = e107::getPref('social_login_active'); + $tp = e107::getParser(); + + $size = empty($parm['size']) ? '3x' : $parm['size']; if(!empty($pref)) { @@ -82,8 +85,9 @@ class signup_shortcodes extends e_shortcode } // 'signup' Creates a new XUP user if not found, otherwise it logs the person in. - $button = (defset('FONTAWESOME') === 4) ? "".$tp->toGlyph('fa-'.$ic, array('size'=>'3x'))."" : ""; - $text .= " ".$button." "; + + $button = (defset('FONTAWESOME') === 4) ? $tp->toGlyph('fa-'.$ic, array('size'=>$size)) : ""; + $text .= " ".$button." "; } //TODO different icon options. see: http://zocial.smcllns.com/ } @@ -94,14 +98,22 @@ class signup_shortcodes extends e_shortcode } // TODO - template - function sc_signup_xup_signup() + function sc_signup_xup_signup($parm) { $pref = e107::getPref('social_login_active'); $tp = e107::getParser(); if(!empty($pref)) { $text = ""; - $providers = e107::getPref('social_login'); + $providers = e107::pref('core', 'social_login'); + + $size = empty($parm['size']) ? '2x' : $parm['size']; + $class = empty($parm['class']) ? 'btn btn-primary' : $parm['class'] ; + + if($size == '2x') + { + $class .= ' btn-lg'; + } foreach($providers as $p=>$v) { @@ -115,9 +127,9 @@ class signup_shortcodes extends e_shortcode $ic = 'windows'; } - $button = (defset('FONTAWESOME') === 4) ? "".$tp->toGlyph('fa-'.$ic, array('size'=>'3x'))."" : ""; + $button = (defset('FONTAWESOME') === 4) ? "".$tp->toGlyph('fa-'.$ic, array('size'=>$size))."" : ""; - $text .= " ".$button." "; + $text .= " ".$button." "; } //TODO different icon options. see: http://zocial.smcllns.com/ } diff --git a/e107_languages/English/admin/lan_prefs.php b/e107_languages/English/admin/lan_prefs.php index 911fc7840..20afba70a 100644 --- a/e107_languages/English/admin/lan_prefs.php +++ b/e107_languages/English/admin/lan_prefs.php @@ -230,4 +230,6 @@ define("PRFLAN_223", "Completely Automated Public Turing test to tell Computers // define("PRFLAN_222", "Moderate Comments made by"); // define("PRFLAN_223", "Comments will require manual approval by an admin prior to being visible to other users"); +define("PRFLAN_224", "User registration system"); + ?> \ No newline at end of file diff --git a/e107_plugins/social/e_shortcode.php b/e107_plugins/social/e_shortcode.php index 552f249c9..99a961b02 100644 --- a/e107_plugins/social/e_shortcode.php +++ b/e107_plugins/social/e_shortcode.php @@ -63,7 +63,23 @@ class social_shortcodes extends e_shortcode } - + function sc_social_login($parm=null) + { + $pref = e107::pref('core', 'social_login_active'); + + if(empty($pref)) + { + return; + } + + $sc = e107::getScBatch('signup'); + $text .= "

Sign in with:

"; + $text .= $sc->sc_signup_xup_login($parm); + $text .= " +

"; + + return $text; + } diff --git a/e107_themes/bootstrap3/theme_shortcodes.php b/e107_themes/bootstrap3/theme_shortcodes.php index a85b66391..4a0569136 100644 --- a/e107_themes/bootstrap3/theme_shortcodes.php +++ b/e107_themes/bootstrap3/theme_shortcodes.php @@ -24,24 +24,40 @@ class theme_shortcodes extends e_shortcode $tp = e107::getParser(); require_once(e_PLUGIN."login_menu/login_menu_shortcodes.php"); + + $userReg = defset('USER_REGISTRATION'); if(!USERID) // Logged Out. { $text = ' "; - return $tp->parseTemplate($text, false, $login_menu_shortcodes); + return $tp->parseTemplate($text, true, $login_menu_shortcodes); } diff --git a/login.php b/login.php index b849b2302..30e3a039f 100644 --- a/login.php +++ b/login.php @@ -20,7 +20,7 @@ require_once("class2.php"); include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE); -if ((USER || e_LOGIN != e_SELF) && 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' ) // Disable page if user logged in, or some custom e_LOGIN value is used. { header('location:'.e_BASE.'index.php'); exit(); diff --git a/signup.php b/signup.php index 75c04aea7..2cb66eddb 100644 --- a/signup.php +++ b/signup.php @@ -268,6 +268,7 @@ if($signup_imagecode) if ((USER || ($pref['user_reg'] != 1) || (vartrue($pref['auth_method'],'e107') != 'e107')) && !getperms('0')) { header('location: '.e_HTTP.'index.php'); + } if(getperms('0')) // allow main admin to view signup page for design/testing. @@ -277,7 +278,7 @@ if(getperms('0')) // allow main admin to view signup page for design/testing. $adminMsg = LAN_SIGNUP_112; - if($pref['user_reg'] != 1) + if($pref['user_reg'] !== 1) { $adminMsg .= "
User registration is currently disabled"; } @@ -381,7 +382,7 @@ if (e_QUERY) // Initial signup (registration) //---------------------------------------- -if (isset($_POST['register']) && $pref['user_reg'] == 1) +if (isset($_POST['register']) && $pref['user_reg'] === 1) { e107::getCache()->clear("online_menu_totals");
Social Logins
- ".$frm->radio_switch('social_login_active', $pref['social_login_active'])." -
- "; - foreach($val as $k=>$v) - { - switch ($k) { - case 'enabled': - $eopt = array('class'=>'e-expandit'); - $text .= $frm->radio_switch('social_login['.$prov.'][enabled]', vartrue($pref['social_login'][$prov]['enabled']),'','',$eopt); - break; - - case 'keys': - // $cls = vartrue($pref['single_login'][$prov]['keys'][$tk]) ? "class='e-hideme'" : ''; - $sty = vartrue($pref['social_login'][$prov]['keys'][vartrue($tk)]) ? "" : "e-hideme"; - $text .= "
"; - foreach($v as $tk=>$idk) - { - $eopt = array('placeholder'=> $tk); - $text .= "
".$frm->text('social_login['.$prov.'][keys]['.$tk.']', vartrue($pref['social_login'][$prov]['keys'][$tk]), 100, $eopt); - } - $text .= "
"; - - break; - - case 'scope': - $text .= $frm->hidden('social_login['.$prov.'][scope]','email'); - break; - - default: - - break; - } - } - - $text .= "