# HG changeset patch # User Dan # Date 1189274539 14400 # Node ID fb31c951d3a27a989e2268063ade347e0a11e995 # Parent 0c5efda996bf5607057cf7149d982a53d2e5d86f Fixed some rather major bugs in the registration system, this will need a release followup diff -r 0c5efda996bf -r fb31c951d3a2 includes/clientside/static/misc.js --- a/includes/clientside/static/misc.js Fri Sep 07 16:25:16 2007 -0400 +++ b/includes/clientside/static/misc.js Sat Sep 08 14:02:19 2007 -0400 @@ -584,3 +584,14 @@ } } +/** + * Validates an e-mail address. + * @param string E-mail address + * @return bool + */ + +function validateEmail(email) +{ + return ( email.match(/^(?:[\w\d]+\.?)+@((?:(?:[\w\d]\-?)+\.)+\w{2,4}|localhost)$/) ) ? true : false; +} + diff -r 0c5efda996bf -r fb31c951d3a2 includes/functions.php --- a/includes/functions.php Fri Sep 07 16:25:16 2007 -0400 +++ b/includes/functions.php Sat Sep 08 14:02:19 2007 -0400 @@ -512,8 +512,12 @@ function grinding_halt($t, $p) { global $db, $session, $paths, $template, $plugins; // Common objects + + if ( !defined('scriptPath') ) + require( ENANO_ROOT . '/config.php' ); - $db->close(); + if ( is_object($db) ) + $db->close(); if ( ob_get_status() ) ob_end_clean(); @@ -2723,6 +2727,18 @@ // kill carriage returns $html = str_replace("\r", "", $html); + // Which tags to strip for JAVASCRIPT PROCESSING ONLY - you can change this if needed + $strip_tags = Array('enano:no-opt'); + $strip_tags = implode('|', $strip_tags); + + // Strip out the tags and replace with placeholders + preg_match_all("#<($strip_tags)(.*?)>(.*?)#is", $html, $matches); + $seed = md5(microtime() . mt_rand()); // Random value used for placeholders + for ($i = 0;$i < sizeof($matches[1]); $i++) + { + $html = str_replace($matches[0][$i], "{DONT_STRIP_ME_NAKED:$seed:$i}", $html); + } + // Optimize (but don't obfuscate) Javascript preg_match_all('/(.+?)<\/script>/is', $html, $jscript); @@ -2786,6 +2802,12 @@ $html = str_replace($jscript[0][$i], $replacement, $html); } + // Re-insert untouchable tags + for ($i = 0;$i < sizeof($matches[1]); $i++) + { + $html = str_replace("{DONT_STRIP_ME_NAKED:$seed:$i}", "<{$matches[1][$i]}{$matches[2][$i]}>{$matches[3][$i]}", $html); + } + // Which tags to strip - you can change this if needed $strip_tags = Array('pre', 'script', 'style', 'enano:no-opt'); $strip_tags = implode('|', $strip_tags); diff -r 0c5efda996bf -r fb31c951d3a2 includes/template.php --- a/includes/template.php Fri Sep 07 16:25:16 2007 -0400 +++ b/includes/template.php Sat Sep 08 14:02:19 2007 -0400 @@ -1629,7 +1629,7 @@ 'SIDEBAR_EXTRA'=>'', 'COPYRIGHT'=>'Enano and all of its code, graphics, and more code is copyright © 2006 Dan Fuhry.
This program is Free Software; see the file "GPL" included with this package for details.', 'TOOLBAR_EXTRAS'=>'', - 'REQUEST_URI'=>$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'], + 'REQUEST_URI'=>( isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '' ).$_SERVER['REQUEST_URI'], 'STYLE_LINK'=>$slink, 'LOGOUT_LINK'=>'', 'THEME_LINK'=>'', diff -r 0c5efda996bf -r fb31c951d3a2 plugins/SpecialUserFuncs.php --- a/plugins/SpecialUserFuncs.php Fri Sep 07 16:25:16 2007 -0400 +++ b/plugins/SpecialUserFuncs.php Sat Sep 08 14:02:19 2007 -0400 @@ -365,7 +365,7 @@ $s = $session->create_user($_POST['username'], $_POST['password'], $_POST['email'], $_POST['real_name'], $coppa); } } - if($s == 'success' && !isset($coppa)) + if($s == 'success' && !$coppa) { switch(getConfig('account_activation')) { @@ -512,108 +512,119 @@ echo ''; ?> - + validateForm(); + setTimeout('checkUsername();', 1000); + // ]]> + +