mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 12:20:44 +02:00
Fixed bootstrap layout for subscription/mailing list options on signup page and added additional validation checks.
This commit is contained in:
@@ -348,40 +348,37 @@ class signup_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
function sc_signup_userclass_subscribe()
|
function sc_signup_userclass_subscribe()
|
||||||
{
|
{
|
||||||
global $pref, $e_userclass, $USERCLASS_SUBSCRIBE_START, $USERCLASS_SUBSCRIBE_END, $signupData;
|
$pref = e107::pref('core');
|
||||||
$ret = "";
|
// global $pref, $USERCLASS_SUBSCRIBE_START, $USERCLASS_SUBSCRIBE_END, $signupData;
|
||||||
|
|
||||||
if($pref['signup_option_class'])
|
if(empty($pref['signup_option_class']))
|
||||||
{
|
{
|
||||||
if (!is_object($e_userclass))
|
return false;
|
||||||
{
|
|
||||||
require_once(e_HANDLER.'userclass_class.php');
|
|
||||||
$e_userclass = new user_class;
|
|
||||||
}
|
|
||||||
$ucList = $e_userclass->get_editable_classes(); // List of classes which this user can edit
|
|
||||||
$ret = '';
|
|
||||||
if(!$ucList) return;
|
|
||||||
|
|
||||||
/*
|
|
||||||
function show_signup_class($treename, $classnum, $current_value, $nest_level)
|
|
||||||
{
|
|
||||||
global $USERCLASS_SUBSCRIBE_ROW, $e_userclass, $tp;
|
|
||||||
$tmp = explode(',',$current_value);
|
|
||||||
$search = array('{USERCLASS_ID}', '{USERCLASS_NAME}', '{USERCLASS_DESCRIPTION}', '{USERCLASS_INDENT}', '{USERCLASS_CHECKED}');
|
|
||||||
$replace = array($classnum, $tp->toHTML($e_userclass->uc_get_classname($classnum), FALSE, 'defs'),
|
|
||||||
$tp->toHTML($e_userclass->uc_get_classdescription($classnum), FALSE, 'defs'), " style='text-indent:".(1.2*$nest_level)."em'",
|
|
||||||
( in_array($classnum, $tmp) ? " checked='checked'" : ''));
|
|
||||||
return str_replace($search, $replace, $USERCLASS_SUBSCRIBE_ROW);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
$ret = $USERCLASS_SUBSCRIBE_START;
|
|
||||||
$ret .= $e_userclass->vetted_tree('class',array($this,'show_signup_class'),varset($signupData['user_class'],''),'editable, no-excludes');
|
|
||||||
$ret .= $USERCLASS_SUBSCRIBE_END;
|
|
||||||
return $ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$uc = e107::getUserClass();
|
||||||
|
|
||||||
|
$ucList = $uc->get_editable_classes(e_UC_PUBLIC, true); // This is signup so display only 'editable by public' classes.
|
||||||
|
|
||||||
|
if(empty($ucList)) return false;
|
||||||
|
|
||||||
|
|
||||||
|
$text = '';
|
||||||
|
foreach($ucList as $classNum)
|
||||||
|
{
|
||||||
|
$text .= $this->show_signup_class($classNum, 1); // checked by default.
|
||||||
|
}
|
||||||
|
|
||||||
|
return $text;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// return $uc->vetted_tree('class', array($this,'show_signup_class'), varset($signupData['user_class'],''),'editable, no-excludes');
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_signup_class($treename, $classnum, $current_value, $nest_level)
|
private function show_signup_class( $classnum, $current_value='', $nest_level=0)
|
||||||
{
|
{
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$uc = e107::getUserClass();
|
$uc = e107::getUserClass();
|
||||||
@@ -390,7 +387,7 @@ class signup_shortcodes extends e_shortcode
|
|||||||
if(deftrue('BOOTSTRAP'))
|
if(deftrue('BOOTSTRAP'))
|
||||||
{
|
{
|
||||||
|
|
||||||
$text = "<div class='checkbox'>";
|
$text = "<div class='checkboxes'>";
|
||||||
$label = $tp->toHTML($uc->getName($classnum),false, 'defs');
|
$label = $tp->toHTML($uc->getName($classnum),false, 'defs');
|
||||||
$diz = $tp->toHTML($uc->getDescription($classnum),false,'defs');
|
$diz = $tp->toHTML($uc->getDescription($classnum),false,'defs');
|
||||||
$text .= $frm->checkbox('class[]', $classnum, $current_value, array('label'=>$label,'title'=> $diz, 'class'=>'e-tip'));
|
$text .= $frm->checkbox('class[]', $classnum, $current_value, array('label'=>$label,'title'=> $diz, 'class'=>'e-tip'));
|
||||||
|
@@ -181,6 +181,12 @@ $sc_style['SIGNUP_PASSWORD2']['pre'] = "<tr>
|
|||||||
$sc_style['SIGNUP_PASSWORD2']['post'] = "</td>
|
$sc_style['SIGNUP_PASSWORD2']['post'] = "</td>
|
||||||
</tr>";
|
</tr>";
|
||||||
|
|
||||||
|
$sc_style['SIGNUP_USERCLASS_SUBSCRIBE']['pre'] = "<tr>
|
||||||
|
<td class='forumheader3' style='width:30%;white-space:nowrap'>".LAN_SIGNUP_113."</td>
|
||||||
|
<td class='forumheader3' style='width:70%'>";
|
||||||
|
$sc_style['SIGNUP_USERCLASS_SUBSCRIBE']['post'] = "</td>
|
||||||
|
</tr>";
|
||||||
|
|
||||||
|
|
||||||
if(!defined($COPPA_TEMPLATE))
|
if(!defined($COPPA_TEMPLATE))
|
||||||
{
|
{
|
||||||
|
@@ -152,5 +152,5 @@ define("LAN_SIGNUP_110", "Your full name");
|
|||||||
define("LAN_SIGNUP_111", "Enter a URL to your image or choose an existing avatar.");
|
define("LAN_SIGNUP_111", "Enter a URL to your image or choose an existing avatar.");
|
||||||
define("LAN_SIGNUP_112", "You are currently logged in as Main Admin.");
|
define("LAN_SIGNUP_112", "You are currently logged in as Main Admin.");
|
||||||
|
|
||||||
|
define("LAN_SIGNUP_113", "Subscription(s)");
|
||||||
|
|
||||||
?>
|
|
15
signup.php
15
signup.php
@@ -636,6 +636,14 @@ if (isset($_POST['register']) && intval($pref['user_reg']) === 1)
|
|||||||
$_POST['password2'] = $_POST['password1'];
|
$_POST['password2'] = $_POST['password1'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// posted class subscription - check it's only from the public classes.
|
||||||
|
if(!empty($_POST['class']))
|
||||||
|
{
|
||||||
|
$publicClasses = e107::getUserClass()->get_editable_classes(e_UC_PUBLIC, true);
|
||||||
|
$_POST['class'] = array_intersect($publicClasses, $_POST['class']);
|
||||||
|
unset($publicClasses);
|
||||||
|
}
|
||||||
|
|
||||||
// Now validate everything
|
// Now validate everything
|
||||||
$allData = validatorClass::validateFields($_POST,$userMethods->userVettingInfo, TRUE); // Do basic validation
|
$allData = validatorClass::validateFields($_POST,$userMethods->userVettingInfo, TRUE); // Do basic validation
|
||||||
validatorClass::checkMandatory('user_name,user_loginname', $allData); // Check for missing fields (email done in userValidation() )
|
validatorClass::checkMandatory('user_name,user_loginname', $allData); // Check for missing fields (email done in userValidation() )
|
||||||
@@ -815,7 +823,12 @@ if (isset($_POST['register']) && intval($pref['user_reg']) === 1)
|
|||||||
|
|
||||||
// The user_class, user_perms, user_prefs, user_realm fields don't have default value,
|
// The user_class, user_perms, user_prefs, user_realm fields don't have default value,
|
||||||
// so we put apropriate ones, otherwise - broken DB Insert
|
// so we put apropriate ones, otherwise - broken DB Insert
|
||||||
$allData['data']['user_class'] = '';
|
|
||||||
|
if(empty($allData['data']['user_class']))
|
||||||
|
{
|
||||||
|
$allData['data']['user_class'] = '';
|
||||||
|
}
|
||||||
|
|
||||||
$allData['data']['user_perms'] = '';
|
$allData['data']['user_perms'] = '';
|
||||||
$allData['data']['user_prefs'] = '';
|
$allData['data']['user_prefs'] = '';
|
||||||
$allData['data']['user_realm'] = '';
|
$allData['data']['user_realm'] = '';
|
||||||
|
Reference in New Issue
Block a user