diff -r fcc494e02baf -r 15dbbe7e7674 plugins/SpecialUserFuncs.php --- a/plugins/SpecialUserFuncs.php Mon Aug 11 21:35:26 2008 -0400 +++ b/plugins/SpecialUserFuncs.php Mon Aug 11 21:43:04 2008 -0400 @@ -121,6 +121,9 @@ global $__login_status; global $lang; + require_once( ENANO_ROOT . '/includes/diffiehellman.php' ); + global $dh_supported, $_math; + $pubkey = $session->rijndael_genkey(); $challenge = $session->dss_rand(); @@ -180,9 +183,6 @@ } // 1.1.3: generate diffie hellman key - require_once( ENANO_ROOT . '/includes/diffiehellman.php' ); - global $dh_supported, $_math; - $response['dh_supported'] = $dh_supported; if ( $dh_supported ) { @@ -375,6 +375,14 @@ echo ' '; } + else if ( $level > USER_LEVEL_MEMBER && !strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') && $dh_supported ) + { + echo '
' . $lang->get('user_login_dh_notice') . '
'; + echo '' . $lang->get('user_reg_err_disabled_body_adminblurb', array( 'reg_link' => makeUrl($paths->page, 'IWannaPlayToo&coppa=no', true) )) . '
' : ''; die_friendly($lang->get('user_reg_err_disabled_title'), '' . $lang->get('user_reg_err_disabled_body') . '
' . $s); } + // are we locked out from logging in? if so, also lock out registration + if ( getConfig('lockout_policy') === 'lockout' ) + { + $ip = $db->escape($_SERVER['REMOTE_ADDR']); + $threshold = time() - ( 60 * intval(getConfig('lockout_duration')) ); + $limit = intval(getConfig('lockout_threshold')); + $q = $db->sql_query('SELECT * FROM ' . table_prefix . "lockout WHERE timestamp >= $threshold ORDER BY timestamp DESC;"); + if ( !$q ) + $db->_die(); + if ( $db->numrows() >= $limit ) + { + $row = $db->fetchrow(); + $db->free_result(); + $time_rem = intval(getConfig('lockout_duration')) - round((time() - $row['timestamp']) / 60); + die_friendly($lang->get('user_reg_err_disabled_title'), '' . $lang->get('user_reg_err_locked_out', array('time' => $time_rem)) . '
'); + } + $db->free_result(); + } if ( $session->user_level < USER_LEVEL_ADMIN && $session->user_logged_in ) { $paths->main_page(); @@ -1782,15 +1806,6 @@ '; - // formatter parameters - $formatter = new MemberlistFormatter(); - $formatters = array( - 'username' => array($formatter, 'username'), - 'user_level' => array($formatter, 'user_level'), - 'email' => array($formatter, 'email'), - 'reg_time' => array($formatter, 'reg_time') - ); - // User search if ( isset($_GET['finduser']) ) { @@ -1855,14 +1870,28 @@ } // main selector - $q = $db->sql_unbuffered_query('SELECT u.user_id, u.username, u.reg_time, u.email, u.user_level, u.reg_time, x.email_public FROM '.table_prefix.'users AS u + $pgsql_additional_group_by = ( ENANO_DBLAYER == 'PGSQL' ) ? ', u.username, u.reg_time, u.email, u.user_level, u.user_has_avatar, u.avatar_type, x.email_public' : ''; + $q = $db->sql_unbuffered_query('SELECT \'\' AS infobit, u.user_id, u.username, u.reg_time, u.email, u.user_level, u.user_has_avatar, u.avatar_type, x.email_public, COUNT(c.comment_id) AS num_comments FROM '.table_prefix.'users AS u LEFT JOIN '.table_prefix.'users_extra AS x ON ( u.user_id = x.user_id ) + LEFT JOIN ' . table_prefix . 'comments AS c + ON ( u.user_id = c.user_id ) WHERE ' . $username_where . ' AND u.username != \'Anonymous\' + GROUP BY u.user_id' . $pgsql_additional_group_by . ' ORDER BY ' . $sort_sqllet . ' ' . $target_order . ';'); if ( !$q ) $db->_die(); + // formatter parameters + $formatter = new MemberlistFormatter(); + $formatters = array( + 'username' => array($formatter, 'username'), + 'user_level' => array($formatter, 'user_level'), + 'email' => array($formatter, 'email'), + 'reg_time' => array($formatter, 'reg_time'), + 'infobit' => array($formatter, 'infobit') + ); + $html = paginate( $q, // MySQL result resource '