From 749fd506e09c05a79868db9890794fb0264fe5ae Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 1 Mar 2019 20:01:40 -0800 Subject: [PATCH] Issue #3676 Missing "required" marker on signup --- .../shortcodes/batch/signup_shortcodes.php | 94 +++++++++++++------ e107_core/templates/signup_template.php | 74 ++------------- e107_handlers/e_parse_class.php | 2 +- signup.php | 2 +- 4 files changed, 77 insertions(+), 95 deletions(-) diff --git a/e107_core/shortcodes/batch/signup_shortcodes.php b/e107_core/shortcodes/batch/signup_shortcodes.php index ab441d5c4..0aeefe9cb 100755 --- a/e107_core/shortcodes/batch/signup_shortcodes.php +++ b/e107_core/shortcodes/batch/signup_shortcodes.php @@ -20,6 +20,8 @@ e107::coreLan('signup'); class signup_shortcodes extends e_shortcode { + + function sc_signup_coppa_form($parm) { @@ -455,7 +457,7 @@ class signup_shortcodes extends e_shortcode function sc_signup_extended_user_fields() { - global $usere, $tp, $SIGNUP_EXTENDED_USER_FIELDS, $EXTENDED_USER_FIELD_REQUIRED, $SIGNUP_EXTENDED_CAT; + global $usere, $tp, $SIGNUP_EXTENDED_USER_FIELDS, $SIGNUP_EXTENDED_CAT; $text = ""; $search = array( @@ -486,26 +488,31 @@ class signup_shortcodes extends e_shortcode { continue; } - - foreach($extList as $ext) - { - if($ext['user_extended_struct_required'] == 1 || $ext['user_extended_struct_required'] == 2) - { - if(!$done_heading && ($cat['user_extended_struct_id'] > 0)) - { // Add in a heading - $catName = $cat['user_extended_struct_text'] ? $cat['user_extended_struct_text'] : $cat['user_extended_struct_name']; - if(defined($catName)) $catName = constant($catName); - $text .= str_replace('{EXTENDED_CAT_TEXT}', $tp->toHTML($catName, FALSE, 'emotes_off,defs'), $SIGNUP_EXTENDED_CAT); - $done_heading = TRUE; - } - $replace = array( - $tp->toHTML(deftrue($ext['user_extended_struct_text'], $ext['user_extended_struct_text']), FALSE, 'emotes_off,defs'), - ($ext['user_extended_struct_required'] == 1 ? $EXTENDED_USER_FIELD_REQUIRED : ''), - $usere->user_extended_edit($ext, $_POST['ue']['user_'.$ext['user_extended_struct_name']]) - ); - $text .= str_replace($search, $replace, $SIGNUP_EXTENDED_USER_FIELDS); - } - } + + foreach($extList as $ext) + { + if($ext['user_extended_struct_required'] == 1 || $ext['user_extended_struct_required'] == 2) + { + if(!$done_heading && ($cat['user_extended_struct_id'] > 0)) + { // Add in a heading + $catName = $cat['user_extended_struct_text'] ? $cat['user_extended_struct_text'] : $cat['user_extended_struct_name']; + if(defined($catName)) + { + $catName = constant($catName); + } + $text .= str_replace('{EXTENDED_CAT_TEXT}', $tp->toHTML($catName, false, 'emotes_off,defs'), $SIGNUP_EXTENDED_CAT); + $done_heading = true; + } + + $replace = array( + $tp->toHTML(deftrue($ext['user_extended_struct_text'], $ext['user_extended_struct_text']), false, 'emotes_off,defs'), + ($ext['user_extended_struct_required'] == 1 ? $this->sc_signup_is_mandatory('true') : ''), + $usere->user_extended_edit($ext, $_POST['ue']['user_' . $ext['user_extended_struct_name']]) + ); + + $text .= str_replace($search, $replace, $SIGNUP_EXTENDED_USER_FIELDS); + } + } } return $text; } @@ -561,17 +568,46 @@ class signup_shortcodes extends e_shortcode } - function sc_signup_is_mandatory($parm='') + function sc_signup_is_mandatory($parm=null) { - global $pref; - if (isset($parm)) + $pref = e107::pref('core'); + + $mandatory = array( + 'realname' => 'signup_option_realname', + 'subscribe' => 'signup_option_class', + 'avatar' => 'signup_option_image', + 'signature' => 'signup_option_signature', + ); + + if((!empty($mandatory[$parm]) && (int) $pref[$mandatory[$parm]] === 2) || $parm === 'true' || ($parm === 'email' && empty($pref['disable_emailcheck']))) { - switch ($parm) - { - case 'email' : if (varset($pref['disable_emailcheck'],FALSE)) return ''; - } + return ""; } - return " *"; + + + + if(!empty($parm)) + { + switch($parm) + { + + + case 'email' : + if(varset($pref['disable_emailcheck'], false)) + { + return ''; + } + break; + + } + } + + // if((int) $val === 2) + { + // return "<"; + } + + //return ""; } diff --git a/e107_core/templates/signup_template.php b/e107_core/templates/signup_template.php index 751bcecb1..fc7c6fa81 100755 --- a/e107_core/templates/signup_template.php +++ b/e107_core/templates/signup_template.php @@ -17,12 +17,11 @@ if (!defined('e107_INIT')) { exit; } if (!defined("USER_WIDTH")){ define("USER_WIDTH", "width:100%"); } -define("REQUIRED_FIELD_MARKER", " *"); $sc_style['SIGNUP_DISPLAYNAME']['pre'] = " + .LAN_SIGNUP_89."{SIGNUP_IS_MANDATORY=true}
".LAN_SIGNUP_90." "; $sc_style['SIGNUP_DISPLAYNAME']['post'] = " @@ -32,51 +31,15 @@ $sc_style['SIGNUP_DISPLAYNAME']['post'] = " $sc_style['SIGNUP_REALNAME']['pre'] = " + .LAN_SIGNUP_91."{SIGNUP_IS_MANDATORY=realname} "; $sc_style['SIGNUP_REALNAME']['post'] = " "; -$sc_style['SIGNUP_IS_MANDATORY']['pre'] = ""; -$sc_style['SIGNUP_IS_MANDATORY']['post'] = ""; -if(!defined($USERCLASS_SUBSCRIBE_START)) -{ - $USERCLASS_SUBSCRIBE_START = " - - " - .LAN_USER_76." ".req($pref['signup_option_class'])."
- ".LAN_USER_73." - - - "; -} -/* -if(!defined($USERCLASS_SUBSCRIBE_ROW)) -{ - $USERCLASS_SUBSCRIBE_ROW = " - - - - "; -}*/ -if(!defined($USERCLASS_SUBSCRIBE_END)) -{ - $USERCLASS_SUBSCRIBE_END = " -
-
- -
-
- {USERCLASS_NAME}
- {USERCLASS_DESCRIPTION} -
- - "; -} if(!defined($SIGNUP_PASSWORD_LEN)) { @@ -98,28 +61,11 @@ if(!defined($SIGNUP_EXTENDED_USER_FIELDS)) "; } -if(!defined($EXTENDED_USER_FIELD_REQUIRED)) -{ - $EXTENDED_USER_FIELD_REQUIRED = " *"; -} -/* // DEPRECATED -$SIGNUP_SIGNATURE_START = " - - ".LAN_SIGNUP_93." ".req($pref['signup_option_signature'])." - -
-
{REN_HELP}
- -"; -*/ $sc_style['SIGNUP_SIGNATURE']['pre'] = " - + "; $sc_style['SIGNUP_SIGNATURE']['post'] = " @@ -128,7 +74,7 @@ $sc_style['SIGNUP_SIGNATURE']['post'] = " $sc_style['SIGNUP_IMAGES']['pre'] = " - + "; $sc_style['SIGNUP_IMAGES']['post'] = " @@ -136,7 +82,7 @@ $sc_style['SIGNUP_IMAGES']['post'] = " $sc_style['SIGNUP_IMAGECODE']['pre'] = " - + "; $sc_style['SIGNUP_IMAGECODE']['post'] = " @@ -144,7 +90,7 @@ $sc_style['SIGNUP_IMAGECODE']['post'] = " $sc_style['SIGNUP_LOGINNAME']['pre'] = " - + "; $sc_style['SIGNUP_LOGINNAME']['post'] = " @@ -160,7 +106,7 @@ $sc_style['SIGNUP_HIDE_EMAIL']['post'] = " $sc_style['SIGNUP_EMAIL_CONFIRM']['pre'] = " - + "; $sc_style['SIGNUP_EMAIL_CONFIRM']['post'] = " @@ -170,19 +116,19 @@ $sc_style['SIGNUP_XUP']['pre'] = "
"; $sc_style['SIGNUP_PASSWORD1']['pre'] = " - + "; $sc_style['SIGNUP_PASSWORD1']['post'] = " "; $sc_style['SIGNUP_PASSWORD2']['pre'] = " - + "; $sc_style['SIGNUP_PASSWORD2']['post'] = " "; $sc_style['SIGNUP_USERCLASS_SUBSCRIBE']['pre'] = " - + "; $sc_style['SIGNUP_USERCLASS_SUBSCRIBE']['post'] = " "; diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php index d9ffa1cd4..8d9927dee 100644 --- a/e107_handlers/e_parse_class.php +++ b/e107_handlers/e_parse_class.php @@ -540,7 +540,7 @@ class e_parse extends e_parser $data = strip_tags($data); // remove tags from cleaned html. $data = str_replace(array('[html]','[/html]'),'',$data); } - + // $data = html_entity_decode($data, ENT_QUOTES, 'utf-8'); // Prevent double-entities. Fix for [code] - see bb_code.php toDB(); } diff --git a/signup.php b/signup.php index 85e1af254..f6ad9677f 100644 --- a/signup.php +++ b/signup.php @@ -1084,7 +1084,7 @@ exit; // Function returns an image if a field is required. function req($field) { - return ($field == 2 ? REQUIRED_FIELD_MARKER : ""); + return ($field == 2 ? "" : ""); } //----------------------------------