From 540922d25ce5c11616eec9a0ce2aba054cca79f3 Mon Sep 17 00:00:00 2001 From: Cameron Date: Tue, 10 Feb 2015 19:47:45 -0800 Subject: [PATCH] Fixes #881 - Signup permission check issue. Corrected signup-text styling and signature styling. --- .../shortcodes/batch/signup_shortcodes.php | 29 ++++++++++--------- e107_handlers/form_handler.php | 23 +++++++++++---- e107_web/css/e107.css | 4 +-- signup.php | 28 ++++++++++++++---- 4 files changed, 56 insertions(+), 28 deletions(-) diff --git a/e107_core/shortcodes/batch/signup_shortcodes.php b/e107_core/shortcodes/batch/signup_shortcodes.php index be45203d7..280d2d04d 100755 --- a/e107_core/shortcodes/batch/signup_shortcodes.php +++ b/e107_core/shortcodes/batch/signup_shortcodes.php @@ -142,26 +142,31 @@ class signup_shortcodes extends e_shortcode function sc_signup_form_open() { - global $rs; return "
".e107::getForm()->token()."
"; - return $rs->form_open("post", e_SELF, "signupform"); } function sc_signup_signup_text() { - // global $SIGNUP_TEXT; $pref = e107::getPref(); $tp = e107::getParser(); - if($pref['signup_text']) + if(!empty($pref['signup_text'])) { - return $tp->toHTML($pref['signup_text'], TRUE, 'parse_sc,defs'); + return "
".$tp->toHTML($pref['signup_text'], TRUE, 'parse_sc,defs')."
"; } + + /* + elseif($pref['user_reg_veri']) { - return $SIGNUP_TEXT." "; + // $SIGNUP_TEXT = LAN_SIGNUP_80." ".LAN_SIGNUP_29."

". + // LAN_SIGNUP_30."
". + // LAN_SIGNUP_85; + // return $SIGNUP_TEXT." "; } + */ + } @@ -387,16 +392,12 @@ class signup_shortcodes extends e_shortcode function sc_signup_signature() { - global $pref, $SIGNUP_SIGNATURE_START, $SIGNUP_SIGNATURE_END; - if($pref['signup_option_signature']) + $sigActive = e107::pref('core','signup_option_signature'); + + if($sigActive) { $frm = e107::getForm(); - return $frm->bbarea('signature', $sig, 'signature','helpb','small'); - // require_once(e_HANDLER."ren_help.php"); - $SIGNUP_SIGNATURE_START = str_replace("{REN_HELP}", $area, $SIGNUP_SIGNATURE_START); - $SIGNUP_SIGNATURE_END = str_replace("{REN_HELP}", $area, $SIGNUP_SIGNATURE_END); - $sig = ($_POST['signature'] ? $_POST['signature'] : $signature); - return $SIGNUP_SIGNATURE_START.$sig.$SIGNUP_SIGNATURE_END; + return $frm->bbarea('signature', $sig, 'signature','helpb', 'tiny'); } } diff --git a/e107_handlers/form_handler.php b/e107_handlers/form_handler.php index 8182da3e0..e403e1ace 100644 --- a/e107_handlers/form_handler.php +++ b/e107_handlers/form_handler.php @@ -1169,7 +1169,7 @@ class e_form if(vartrue($options['size']) && !is_numeric($options['size'])) { - $options['class'] .= " input-".$options['size']; + $options['class'] .= " form-control input-".$options['size']; unset($options['size']); // don't include in html 'size='. } elseif(!vartrue($options['noresize'])) @@ -1187,16 +1187,28 @@ class e_form /** * Bbcode Area. Name, value, template, media-Cat, size, options array eg. counter * IMPORTANT: $$mediaCat is also used is the media-manager category identifier + * @param $name + * @param $value + * @param $template + * @param $mediaCat _common + * @param $size : small | medium | large + * @param $options array(); */ function bbarea($name, $value, $template = '', $mediaCat='_common', $size = 'large', $options = array()) { if(is_string($options)) parse_str($options, $options); //size - large|medium|small //width should be explicit set by current admin theme - $size = 'input-large'; + // $size = 'input-large'; switch($size) { + case 'tiny': + $rows = '3'; + // $height = "style='height:250px'"; // inline required for wysiwyg + break; + + case 'small': $rows = '7'; $height = "style='height:250px'"; // inline required for wysiwyg @@ -1218,7 +1230,7 @@ class e_form } // auto-height support - $options['class'] = 'tbox bbarea '.($size ? ' '.$size : '').' e-wysiwyg e-autoheight'; + $options['class'] = 'tbox bbarea '.($size ? ' '.$size : '').' e-wysiwyg e-autoheight form-control'; $bbbar = ''; @@ -1227,10 +1239,9 @@ class e_form $counter = vartrue($options['counter'],false); - $ret = " -
+ $ret = "
\n"; - + $ret .= e107::getBB()->renderButtons($template,$help_tagid); $ret .= $this->textarea($name, $value, $rows, 70, $options, $counter); // higher thank 70 will break some layouts. diff --git a/e107_web/css/e107.css b/e107_web/css/e107.css index 72393ae30..a62cf3b45 100644 --- a/e107_web/css/e107.css +++ b/e107_web/css/e107.css @@ -108,9 +108,9 @@ a.cpage-np.current { text-decoration: none; } /* message text (overall) */ .warning { color: #FF6600 } .success { color: green; } -.error { color: #FF0000 } +.error { color: #A94442; } .info {} -.required { color:red } +.required { color:#A94442; } /******** Tooltip info */ .e-info {} diff --git a/signup.php b/signup.php index 2cb66eddb..fce1b11ba 100644 --- a/signup.php +++ b/signup.php @@ -265,7 +265,7 @@ if($signup_imagecode) } */ -if ((USER || ($pref['user_reg'] != 1) || (vartrue($pref['auth_method'],'e107') != 'e107')) && !getperms('0')) +if ((USER || (intval($pref['user_reg']) !== 1) || (vartrue($pref['auth_method'],'e107') != 'e107')) && !getperms('0')) { header('location: '.e_HTTP.'index.php'); @@ -278,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(intval($pref['user_reg']) !== 1) { $adminMsg .= "
User registration is currently disabled"; } @@ -380,9 +380,8 @@ if (e_QUERY) //---------------------------------------- // Initial signup (registration) -//---------------------------------------- -if (isset($_POST['register']) && $pref['user_reg'] === 1) +if (isset($_POST['register']) && intval($pref['user_reg']) === 1) { e107::getCache()->clear("online_menu_totals"); @@ -513,12 +512,29 @@ if (isset($_POST['register']) && $pref['user_reg'] === 1) $temp[] = validatorClass::makeErrorList($eufVals,'USER_ERR_','%n - %t: %v', '
'); } - message_handler('P_ALERT', implode('
', $temp)); + + if(deftrue('BOOTSTRAP')) + { + e107::getMessage()->addError(implode('
', $temp)); + } + else + { + message_handler('P_ALERT', implode('
', $temp)); + } + } } // End of data validation else { - message_handler('P_ALERT', implode('
', $extraErrors)); // Workaround for image-code errors. + if(deftrue('BOOTSTRAP')) + { + e107::getMessage()->addError(implode('
', $temp)); + } + else + { + message_handler('P_ALERT', implode('
', $extraErrors)); // Workaround for image-code errors. + } + }