Index: wp-includes/capabilities.php
===================================================================
--- wp-includes/capabilities.php	(revision 4613)
+++ wp-includes/capabilities.php	(working copy)
@@ -454,6 +454,19 @@
 	return call_user_func_array(array(&$current_user, 'has_cap'), $args);
 }
 
+// Capability checker for any user
+function user_can($user, $capability) {
+	$user = new WP_User($user);
+
+	if ( empty($user) )
+		return false;
+
+	$args = array_slice(func_get_args(), 2);
+	$args = array_merge(array($capability), $args);
+
+	return call_user_func_array(array(&$user, 'has_cap'), $args);
+}
+
 // Convenience wrappers around $wp_roles.
 function get_role($role) {
 	global $wp_roles;
Index: wp-includes/kses.php
===================================================================
--- wp-includes/kses.php	(revision 4613)
+++ wp-includes/kses.php	(working copy)
@@ -547,11 +547,15 @@
 	remove_filter('content_filtered_save_pre', 'wp_filter_post_kses');
 }
 
-function kses_init() {
+function kses_init($filtered = null) {
 	kses_remove_filters();
 
-	if (current_user_can('unfiltered_html') == false)
+	if ( isset($filtered) && $filtered == false )
+		return;
+	if ( isset($filtered) && $filtered == true )
 		kses_init_filters();
+	if ( current_user_can('unfiltered_html') == false )
+		kses_init_filters();
 }
 
 add_action('init', 'kses_init');
Index: wp-admin/import/livejournal.php
===================================================================
--- wp-admin/import/livejournal.php	(revision 4613)
+++ wp-admin/import/livejournal.php	(working copy)
@@ -69,6 +69,11 @@
 				printf(__('Post <i>%s</i> already exists.'), stripslashes($post_title));
 			} else {
 				printf(__('Importing post <i>%s</i>...'), stripslashes($post_title));
+
+				// Set up kses filters appropriate for the author's caps
+				$filtered = ! user_can($post_author, 'unfiltered_html');
+				kses_init($filtered);
+
 				$postdata = compact('post_author', 'post_date', 'post_content', 'post_title', 'post_status');
 				$post_id = wp_insert_post($postdata);
 				if (!$post_id) {
@@ -82,6 +87,9 @@
 			$comments = $comments[1];
 
 			if ( $comments ) {
+				// Always filter imported comments.
+				kses_init(true);
+
 				$comment_post_ID = $post_id;
 				$num_comments = 0;
 				foreach ($comments as $comment) {
Index: wp-admin/import/dotclear.php
===================================================================
--- wp-admin/import/dotclear.php	(revision 4613)
+++ wp-admin/import/dotclear.php	(working copy)
@@ -366,6 +366,10 @@
 
 				// Import Post data into WordPress
 
+				// Set up kses filters appropriate for the author's caps
+				$filtered = ! user_can($authorid, 'unfiltered_html');
+				kses_init($filtered);
+
 				if($pinfo = post_exists($Title,$post_content))
 				{
 					$ret_id = wp_insert_post(array(
@@ -427,6 +431,9 @@
 		$dccm2wpcm = array();
 		$postarr = get_option('dcposts2wpposts');
 
+		// Always filter imported comments.
+		kses_init(true);
+
 		// Magic Mojo
 		if(is_array($comments))
 		{
Index: wp-admin/import/mt.php
===================================================================
--- wp-admin/import/mt.php	(revision 4613)
+++ wp-admin/import/mt.php	(working copy)
@@ -287,6 +287,10 @@
 
 					$post_author = $this->checkauthor($post_author); //just so that if a post already exists, new users are not created by checkauthor
 
+					// Set up kses filters appropriate for the author's caps
+					$filtered = ! user_can($post_author, 'unfiltered_html');
+					kses_init($filtered);
+
 					$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'comment_status', 'ping_status', 'post_modified', 'post_modified_gmt');
 					$post_id = wp_insert_post($postdata);
 					// Add categories.
@@ -301,6 +305,10 @@
 				// Now for comments
 				$comments = explode("-----\nCOMMENT:", $comments[0]);
 				$num_comments = 0;
+
+				// Always filter imported comments.
+				kses_init(true);
+
 				foreach ($comments as $comment) {
 					if ('' != trim($comment)) {
 						// Author
Index: wp-admin/import/blogger.php
===================================================================
--- wp-admin/import/blogger.php	(revision 4613)
+++ wp-admin/import/blogger.php	(working copy)
@@ -498,9 +498,17 @@
 				if ( count($post_array) ) {
 					krsort($post_array);
 					foreach($post_array as $post) {
-						if ( ! $comment_post_ID = $post['ID'] )
+						if ( isset($post['post']) ) {
+							$filtered = ! user_can($post['post']['post_author'], 'unfiltered_html');
+							kses_init($filtered);
 							$comment_post_ID = wp_insert_post($post['post']);
+						} else {
+							$comment_post_ID = $post['ID'];
+						}
 						if ( $post['comments'] ) {
+							// Always filter imported comments.
+							kses_init(true);
+
 							foreach ( $post['comments'] as $comment ) {
 								$comment['comment_post_ID'] = $comment_post_ID;
 								wp_insert_comment($comment);
Index: wp-admin/import/blogware.php
===================================================================
--- wp-admin/import/blogware.php	(revision 4613)
+++ wp-admin/import/blogware.php	(working copy)
@@ -90,6 +90,9 @@
 			} else {
 				printf(__('Importing post <i>%s</i>...'), stripslashes($post_title));
 				$postdata = compact('post_author', 'post_date', 'post_content', 'post_title', 'post_status');
+				// Set up kses filters appropriate for the author's caps
+				$filtered = ! user_can($post_author, 'unfiltered_html');
+				kses_init($filtered);
 				$post_id = wp_insert_post($postdata);
 				if (!$post_id) {
 					_e("Couldn't get post ID");
@@ -104,6 +107,9 @@
 			$comments = $comments[1];
 
 			if ( $comments ) {
+				// Always filter imported comments.
+				kses_init(true);
+
 				$comment_post_ID = $post_id;
 				$num_comments = 0;
 				foreach ($comments as $comment) {
Index: wp-admin/import/textpattern.php
===================================================================
--- wp-admin/import/textpattern.php	(revision 4613)
+++ wp-admin/import/textpattern.php	(working copy)
@@ -300,6 +300,10 @@
 
 				// Import Post data into WordPress
 
+				// Set up kses filters appropriate for the author's caps
+				$filtered = ! user_can($authorid, 'unfiltered_html');
+				kses_init($filtered);
+
 				if($pinfo = post_exists($Title,$Body))
 				{
 					$ret_id = wp_insert_post(array(
@@ -358,6 +362,9 @@
 		$txpcm2wpcm = array();
 		$postarr = get_option('txpposts2wpposts');
 
+		// Always filter imported comments.
+		kses_init(true);
+
 		// Magic Mojo
 		if(is_array($comments))
 		{
Index: wp-admin/import/greymatter.php
===================================================================
--- wp-admin/import/greymatter.php	(revision 4613)
+++ wp-admin/import/greymatter.php	(working copy)
@@ -228,12 +228,19 @@
 					$post_author = $user_id;
 				}
 			
+				// Set up kses filters appropriate for the author's caps
+				$filtered = ! user_can($post_author, 'unfiltered_html');
+				kses_init($filtered);
+
 				$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'comment_status', 'ping_status', 'post_modified', 'post_modified_gmt');
 				$post_ID = wp_insert_post($postdata);
 			}
 
 			$c=count($entry);
 			if ($c>4) {
+				// Always filter imported comments.
+				kses_init(true);
+
 				$numAddedComments = 0;
 				$numComments = 0;
 				for ($j=4;$j<$c;$j++) {
Index: wp-admin/import/rss.php
===================================================================
--- wp-admin/import/rss.php	(revision 4613)
+++ wp-admin/import/rss.php	(working copy)
@@ -109,6 +109,9 @@
 			if ($post_id = post_exists($post_title, $post_content, $post_date)) {
 				_e('Post already imported');
 			} else {
+				// Set up kses filters appropriate for the author's caps
+				$filtered = ! user_can($post_author, 'unfiltered_html');
+				kses_init($filtered);
 				$post_id = wp_insert_post($post);
 				if (!$post_id) {
 					_e("Couldn't get post ID");
Index: wp-admin/import/wordpress.php
===================================================================
--- wp-admin/import/wordpress.php	(revision 4613)
+++ wp-admin/import/wordpress.php	(working copy)
@@ -251,6 +251,10 @@
 
 				$post_author = $this->checkauthor($post_author); //just so that if a post already exists, new users are not created by checkauthor
 
+				// Set up kses filters appropriate for the author's caps
+				$filtered = ! user_can($post_author, 'unfiltered_html');
+				kses_init($filtered);
+
 				$postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_excerpt', 'post_status', 'comment_status', 'ping_status', 'post_modified', 'post_modified_gmt', 'guid', 'post_parent', 'post_type');
 				$comment_post_ID = $post_id = wp_insert_post($postdata);
 				// Add categories.
@@ -263,6 +267,10 @@
 				preg_match_all('|<wp:comment>(.*?)</wp:comment>|is', $post, $comments);
 				$comments = $comments[1];
 				$num_comments = 0;
+
+				// Always filter imported comments.
+				kses_init(true);
+
 				if ( $comments) { foreach ($comments as $comment) {
 					$comment_author       = $this->get_tag( $comment, 'wp:comment_author');
 					$comment_author_email = $this->get_tag( $comment, 'wp:comment_author_email');

