Index: bb-admin/admin-functions.php
===================================================================
--- bb-admin/admin-functions.php	(revision 1381)
+++ bb-admin/admin-functions.php	(working copy)
@@ -119,7 +119,7 @@
 
 function bb_admin_add_submenu($display_name, $capability, $file_name, $parent = 'plugins.php')
 {
-	global $bb_menu, $bb_submenu;
+	global $bb_submenu;
 	if ($display_name && $capability && $file_name) {
 		$bb_submenu[$parent][] = array($display_name, $capability, $file_name);
 	}
@@ -620,7 +620,7 @@
 
 function bb_forum_form( $forum_id = 0 ) {
 	$forum_id = (int) $forum_id;
-	if ( $forum_id && !$forum = get_forum( $forum_id ) )
+	if ( $forum_id && !get_forum( $forum_id ) )
 		return;
 	$action = $forum_id ? 'update' : 'add';
 ?>
Index: bb-admin/class-install.php
===================================================================
--- bb-admin/class-install.php	(revision 1381)
+++ bb-admin/class-install.php	(working copy)
@@ -993,7 +993,7 @@
 		$config_lines = array();
 		
 		// Loop through the sample config and write lines to the new config file
-		foreach ($sample_config as $line_num => $line) {
+		foreach ($sample_config as $line) {
 			switch (substr($line,0,18)) {
 				case "define('BBDB_NAME'":
 					$config_lines[] = str_replace("'bbpress'", "'" . $data['bbdb_name']['value'] . "'", $line);
@@ -1325,7 +1325,7 @@
 		if ($data['keymaster_user_login']['value'] != sanitize_user($data['keymaster_user_login']['value'])) {
 			$this->strings[3]['form_errors']['keymaster_user_login'][] = 'userlogin';
 		}
-		$data['keymaster_user_login']['value'] == sanitize_user($data['keymaster_user_login']['value']);
+		$data['keymaster_user_login']['value'] = sanitize_user($data['keymaster_user_login']['value']);
 		
 		// bb_verify_email() needs this
 		require_once(BB_PATH . BB_INC . 'registration-functions.php');
@@ -1523,7 +1523,7 @@
 					$config_lines = array();
 					
 					// Loop through the sample config and write lines to the new config file
-					foreach ($config as $line_num => $line) {
+					foreach ($config as $line) {
 						if (substr($line,0,18) == "define('BB_SECRET_") {
 							$config_lines[] = str_replace("'" . BB_SECRET_KEY . "'", "'" . $data2['wp_secret_key']['value'] . "'", $line);
 						} else {
Index: bb-admin/content-forums.php
===================================================================
--- bb-admin/content-forums.php	(revision 1381)
+++ bb-admin/content-forums.php	(working copy)
@@ -38,7 +38,7 @@
 <?php break; case 'delete' : ?>
 <div class="ays narrow">
 	<p><big><?php printf(__('Are you sure you want to delete the "<strong>%s</strong>" forum?'), $deleted_forum->forum_name); ?></big></p>
-	<p>This forum contains</p>
+	<p><?php _e('This forum contains:'); ?></p>
 	<ul>
 		<li><?php printf(__ngettext('%d topic', '%d topics', $deleted_forum->topics), $deleted_forum->topics); ?></li>
 		<li><?php printf(__ngettext('%d post', '%d posts', $deleted_forum->posts), $deleted_forum->posts); ?></li>
Index: bb-admin/content-posts.php
===================================================================
--- bb-admin/content-posts.php	(revision 1381)
+++ bb-admin/content-posts.php	(working copy)
@@ -26,12 +26,8 @@
 $h2_author = $h2_author ? ' ' . sprintf( __('by %s')                    , wp_specialchars( get_user_name( $h2_author ) ) ) : '';
 
 $stati = array( 0 => __('Normal') . ' ', 1 => __('Deleted') . ' ', 'all' => '' );
+$h2_noun = ( 'all' == $h2_status ) ?  __('Posts') : sprintf( __( '%1$sposts'), $stati[$h2_status], $topic_open[$h2_open] );
 
-if ( 'all' == $h2_status )
-	$h2_noun = __('Posts');
-else
-	$h2_noun = sprintf( __( '%1$sposts'), $stati[$h2_status], $topic_open[$h2_open] );
-
 printf( __( '%1$s%2$s%3$s%4$s%5$s' ), $h2_noun, $h2_search, $h2_forum, $h2_tag, $h2_author );
 
 ?></h2>
Index: bb-admin/export.php
===================================================================
--- bb-admin/export.php	(revision 1381)
+++ bb-admin/export.php	(working copy)
@@ -221,7 +221,7 @@
 
 function bb_export_topic_tags( $r, $topic_id ) {
 	global $topic_tag_cache;
-	if ( !$topic = get_topic( $topic_id ) )
+	if ( !get_topic( $topic_id ) )
 		return;
 
 	if ( !$tags = bb_get_topic_tags( $topic_id ) )
@@ -238,7 +238,7 @@
 
 function bb_export_topic_posts( $r, $topic_id ) {
 	global $bb_post_cache;
-	if ( !$topic = get_topic( $topic_id ) )
+	if ( !get_topic( $topic_id ) )
 		return;
 
 	$r .= "\n";
@@ -271,7 +271,7 @@
 				echo bb_export_user( $user->ID );
 			$bb_user_cache = array(); // For the sake of memory
 		}
-		unset($users, $user_ids, $user_id, $page);
+		unset($users, $user, $page);
 	}
 
 	if (BB_EXPORT_LEVEL & BB_EXPORT_FORUMS) {
Index: bb-admin/upgrade-functions.php
===================================================================
--- bb-admin/upgrade-functions.php	(revision 1381)
+++ bb-admin/upgrade-functions.php	(working copy)
@@ -428,7 +428,7 @@
 	global $bbdb;
 
 	$bbdb->hide_errors();
-	if ( !$ids = $bbdb->get_var("SELECT forum_slug FROM $bbdb->forums ORDER BY forum_order ASC LIMIT 1" ) )
+	if ( !$bbdb->get_var("SELECT forum_slug FROM $bbdb->forums ORDER BY forum_order ASC LIMIT 1" ) )
 		return; // Wait till after dbDelta
 	$bbdb->show_errors();
 
Index: bb-includes/class-bb-taxonomy.php
===================================================================
--- bb-includes/class-bb-taxonomy.php	(revision 1381)
+++ bb-includes/class-bb-taxonomy.php	(working copy)
@@ -169,7 +169,7 @@
 		else if ( 'all_with_object_id' == $fields )
 			$select_this = 't.*, tt.*, tr.object_id';
 
-		$query = "SELECT $select_this FROM {$this->db->terms} AS t INNER JOIN {$this->db->term_taxonomy} AS tt ON tt.term_id = t.term_id INNER JOIN {$this->db->term_relationships} AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tr.object_id IN ($object_ids)$usr_sql ORDER BY $orderby $order";
+		$query = "SELECT $select_this FROM {$this->db->terms} AS t INNER JOIN {$this->db->term_taxonomy} AS tt ON tt.term_id = t.term_id INNER JOIN {$this->db->term_relationships} AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tr.object_id IN ($object_ids) {$user_sql} ORDER BY $orderby $order";
 
 		if ( 'all' == $fields || 'all_with_object_id' == $fields ) {
 			$terms = $this->db->get_results($query);
Index: bb-includes/functions.php
===================================================================
--- bb-includes/functions.php	(revision 1381)
+++ bb-includes/functions.php	(working copy)
@@ -52,7 +52,7 @@
 		foreach ( $_leaves as $leaf ) // Attach orphans to root
 			$branch[$leaf->forum_id] = true;
 		$_leaves = false;
-		return $tree = empty($branch) ? false : $branch;
+		return (empty($branch) ? false : $branch);
 	}
 
 	return $branch ? $branch : true;
Index: bb-includes/l10n.php
===================================================================
--- bb-includes/l10n.php	(revision 1381)
+++ bb-includes/l10n.php	(working copy)
@@ -66,8 +66,6 @@
 }
 
 function load_default_textdomain() {
-	global $l10n;
-
 	$locale = get_locale();
 	$mofile = BB_LANG_DIR . "$locale.mo";
 
Index: bb-includes/locale.php
===================================================================
--- bb-includes/locale.php	(revision 1381)
+++ bb-includes/locale.php	(working copy)
@@ -112,8 +112,8 @@
 
 	function _load_locale_data() {
 		$locale = get_locale();
-		$locale_file = BB_PATH . "bb-includes/languages/$locale.php";
-		if ( !file_exists($locale_file) )
+		$locale_file = BB_LANG_DIR. $locale . '.php';
+		if ( !is_file($locale_file) )
 			return;
 
 		include($locale_file);
Index: bb-includes/pluggable.php
===================================================================
--- bb-includes/pluggable.php	(revision 1381)
+++ bb-includes/pluggable.php	(working copy)
@@ -81,7 +81,6 @@
 
 if ( !function_exists('bb_login') ) :
 function bb_login( $login, $password, $remember = false ) {
-	global $wp_auth_object;
 	if ( $user = bb_check_login( $login, $password ) ) {
 		wp_set_auth_cookie( $user->ID, $remember );
 		do_action('bb_user_login', (int) $user->ID );
Index: bb-includes/registration-functions.php
===================================================================
--- bb-includes/registration-functions.php	(revision 1381)
+++ bb-includes/registration-functions.php	(working copy)
@@ -18,7 +18,7 @@
 	if (ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.
 		'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.
 		'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email)) {
-		if ( $check_domain && function_exists('checkdnsrr') ) {
+		if ( function_exists('checkdnsrr') ) {
 			list (, $domain)  = explode('@', $email);
 			if ( checkdnsrr($domain . '.', 'MX') || checkdnsrr($domain . '.', 'A') ) {
 				$r = $email;
@@ -162,7 +162,6 @@
  * @return bool
  */
 function bb_send_pass( $user, $pass ) {
-	global $bbdb;
 	if ( !$user = bb_get_user( $user ) )
 		return false;
 
Index: bb-includes/template-functions.php
===================================================================
--- bb-includes/template-functions.php	(revision 1381)
+++ bb-includes/template-functions.php	(working copy)
@@ -128,7 +128,7 @@
 }
 
 function post_form( $h2 = '' ) {
-	global $bb, $page, $topic, $forum;
+	global $page, $topic, $forum;
 	$add = topic_pages_add();
 	if ( empty($h2) && false !== $h2 ) {
 		if ( is_topic() )
@@ -169,7 +169,7 @@
 }
 
 function edit_form() {
-	global $bb_post, $topic_title;
+	global $bb_post;
 	echo "<form class='postform edit-form' method='post' action='" . bb_get_option('uri')  . "bb-edit.php'>\n";
 	echo "<fieldset>\n";
 	bb_load_template( 'edit-form.php', array('topic_title') );
@@ -684,7 +684,7 @@
 	if ( !is_array($bb_forums_loop->elements) )
 		return false;
 
-	if ( $r = $bb_forums_loop->step() ) {
+	if ( $bb_forums_loop->step() ) {
 		$GLOBALS['forum'] =& $bb_forums_loop->elements[key($bb_forums_loop->elements)]; // Globalize the current forum object
 	} else {
 		$bb_forums_loop->reinstate();
@@ -795,7 +795,7 @@
 }
 
 function topic_posts( $id = 0 ) {
-	echo apply_filters( 'topic_posts', get_topic_posts( $id = 0 ), get_topic_id( $id ) );
+	echo apply_filters( 'topic_posts', get_topic_posts( $id ), get_topic_id( $id ) );
 }
 
 function get_topic_posts( $id = 0 ) {
@@ -892,7 +892,6 @@
 }
 
 function get_page_number_links($page, $total) {
-	$r = '';
 	$args = array();
 	$uri = $_SERVER['REQUEST_URI'];
 	if ( bb_get_option('mod_rewrite') ) {
@@ -1958,7 +1957,7 @@
 
 	extract($args, EXTR_SKIP);
 
-	if ( !$forums = bb_forums( $args ) )
+	if ( !bb_forums( $args ) )
 		return;
 
 	global $forum_id, $forum;
Index: bb-plugins/akismet.php
===================================================================
--- bb-plugins/akismet.php	(revision 1381)
+++ bb-plugins/akismet.php	(working copy)
@@ -79,7 +79,7 @@
 $bb_ksd_user_agent = 'bbPress/' . bb_get_option( 'version' ) . ' | bbAkismet/'. bb_get_option( 'version' );
 
 function bb_akismet_verify_key( $key ) {
-	global $bb_ksd_pre_post_status, $bb_ksd_api_host, $bb_ksd_api_port;
+	global $bb_ksd_api_port;
 	$blog = urlencode( bb_get_option('uri') );
 	$response = bb_ksd_http_post("key=$key&blog=$blog", 'rest.akismet.com', '/1.1/verify-key', $bb_ksd_api_port);
 	if ( 'valid' == $response[1] )
@@ -268,7 +268,7 @@
 }
 
 function bb_ksd_admin_page() {
-	global $bb_current_submenu, $bb_posts, $page;
+	global $bb_posts, $page;
 	if ( !bb_akismet_verify_key( bb_get_option( 'akismet_key' ) ) ) : ?>
 <div class="error"><p><?php printf(__('The API key you have specified is invalid.  Please double check the <strong>Akismet Key</strong> set in <a href="%s">Akismet configuration</a>.  If you don\'t have an API key yet, you can get one at <a href="%s">WordPress.com</a>.'), 'admin-base.php?plugin=bb_ksd_configuration_page', 'http://wordpress.com/api-keys/'); ?></p></div>
 <?php	endif;
Index: bb-plugins/bozo.php
===================================================================
--- bb-plugins/bozo.php	(revision 1381)
+++ bb-plugins/bozo.php	(working copy)
@@ -36,7 +36,7 @@
 	$limit = (int) bb_get_option('page_topics');
 	if ( 1 < $page )
 		$limit = ($limit * ($page - 1)) . ", $limit";
-	$bozo_mkey = $bbdb->prefix . 'bozo_topics';
+
 	$bb_last_countable_query = "SELECT user_id FROM $bbdb->usermeta WHERE meta_key='is_bozo' AND meta_value='1' ORDER BY umeta_id DESC LIMIT $limit";
 	if ( $ids = (array) $bbdb->get_col( $bb_last_countable_query ) )
 		bb_cache_users( $ids );
@@ -103,7 +103,7 @@
 					unset($indices, $index, $old[$i]);
 				endif;
 			endforeach;
-			unset($topics, $t, $i, $counts, $posters, $bozos);
+			unset($topics, $i, $counts, $posters, $bozos);
 		endif;
 		if ( $old ) :
 			$old = join(',', array_map('intval', array_flip($old)));
@@ -233,7 +233,7 @@
 			$user->bozo_topics[$topic_id] = 1;
 		else
 			$user->bozo_topics = array($topic_id => 1);
-		bb_update_usermeta( $uid, $bbdb->prefix . 'bozo_topics', $user->bozo_topics );
+		bb_update_usermeta( $user_id, $bbdb->prefix . 'bozo_topics', $user->bozo_topics );
 	}
 }
 
@@ -254,12 +254,11 @@
 		
 		if ( --$user->bozo_topics[$topic_id] < 1 )
 			unset($user->bozo_topics[$topic_id]);
-		bb_update_usermeta( $uid, $bbdb->prefix . 'bozo_topics', $user->bozo_topics );
+		bb_update_usermeta( $user_id, $bbdb->prefix . 'bozo_topics', $user->bozo_topics );
 	}
 }
 
 function bb_bozo_profile_admin_keys( $a ) {
-	global $user;
 	$a['is_bozo'] = array(
 		0,							// Required
 		__('This user is a bozo'),	// Label
