Index: wp-includes/classes.php
===================================================================
--- wp-includes/classes.php	(revision 3571)
+++ wp-includes/classes.php	(working copy)
@@ -293,6 +293,14 @@
 			$q['what_to_show'] = 'posts';
 		}
 
+		if ( $this->is_home ) {	
+			if ( 'page' == get_option('show_on_front') && get_option('page_on_front') ) {
+				$this->is_page = true;
+				$this->is_home = false;
+				$q['page_id'] = get_option('page_on_front');
+			}
+		}
+
 		if (isset($q['page'])) {
 			$q['page'] = trim($q['page'], '/');
 			$q['page'] = (int) $q['page'];
@@ -359,12 +367,16 @@
 			$where .= " AND post_name = '" . $q['name'] . "'";
 		} else if ('' != $q['pagename']) {
 			$reqpage = get_page_by_path($q['pagename']);
-			$q['pagename'] = str_replace('%2F', '/', urlencode(urldecode($q['pagename'])));
-			$page_paths = '/' . trim($q['pagename'], '/');
-			$q['pagename'] = sanitize_title(basename($page_paths));
-			$q['name'] = $q['pagename'];
-
-			$where .= " AND (ID = '$reqpage')";
+			
+			if  ( ('page' == get_option('show_on_front') ) && ( $reqpage == get_option('page_for_posts') ) ) {
+				$this->is_page = false;	
+			} else {
+				$q['pagename'] = str_replace('%2F', '/', urlencode(urldecode($q['pagename'])));
+				$page_paths = '/' . trim($q['pagename'], '/');
+				$q['pagename'] = sanitize_title(basename($page_paths));
+				$q['name'] = $q['pagename'];
+				$where .= " AND (ID = '$reqpage')";
+			}
 		} elseif ('' != $q['attachment']) {
 			$q['attachment'] = str_replace('%2F', '/', urlencode(urldecode($q['attachment'])));
 			$attach_paths = '/' . trim($q['attachment'], '/');
@@ -393,8 +405,12 @@
 
 		if (($q['page_id'] != '') && (intval($q['page_id']) != 0)) {
 			$q['page_id'] = intval($q['page_id']);
-			$q['p'] = $q['page_id'];
-			$where = ' AND ID = '.$q['page_id'];
+			if  ( ('page' == get_option('show_on_front') ) && ( $q['page_id'] == get_option('page_for_posts') ) ) {
+				$this->is_page = false;	
+			} else {
+				$q['p'] = $q['page_id'];
+				$where = ' AND ID = '.$q['page_id'];
+			}
 		}
 
 		// If a search pattern is specified, load the posts that match
Index: wp-admin/options-reading.php
===================================================================
--- wp-admin/options-reading.php	(revision 3571)
+++ wp-admin/options-reading.php	(working copy)
@@ -9,8 +9,33 @@
 
 <div class="wrap"> 
 <h2><?php _e('Reading Options') ?></h2> 
-<form name="form1" method="post" action="options.php"> 
+<form name="form1" method="post" action="options.php">
+
 <fieldset class="options"> 
+<legend><?php _e('Front Page') ?></legend> 
+<table width="100%" cellspacing="2" cellpadding="5" class="editform"> 
+<tr valign="top"> 
+<th width="33%" scope="row"></th> 
+<td>
+<p>
+	<label>
+		<input name="show_on_front" type="radio" value="posts" class="tog" <?php checked('posts', get_option('show_on_front')); ?> /> 
+<?php _e('Show the latest posts on the front page'); ?>
+   </label>
+</p>
+<p>
+	<label>
+		<input name="show_on_front" type="radio" value="page" class="tog" <?php checked('page', get_option('show_on_front')); ?> /> 
+		<?php printf(__('Show %s on the front page'), wp_dropdown_pages("name=page_on_front&echo=0&selected=" . get_option('page_on_front'))); ?><br />
+		<?php printf(__('Show the latest posts on %s'), wp_dropdown_pages("name=page_for_posts&echo=0&selected=" . get_option('page_for_posts'))); ?>
+   </label>
+</p>
+</td> 
+</tr> 
+</table> 
+</fieldset>
+
+<fieldset class="options"> 
 <legend><?php _e('Blog Pages') ?></legend> 
 <table width="100%" cellspacing="2" cellpadding="5" class="editform"> 
 <tr valign="top"> 
@@ -55,7 +80,7 @@
 </p>
 <p class="submit">
 <input type="hidden" name="action" value="update" /> 
-<input type="hidden" name="page_options" value="posts_per_page,what_to_show,posts_per_rss,rss_use_excerpt,blog_charset,gzipcompression" /> 
+<input type="hidden" name="page_options" value="posts_per_page,what_to_show,posts_per_rss,rss_use_excerpt,blog_charset,gzipcompression,show_on_front,page_on_front,page_for_posts" /> 
 <input type="submit" name="Submit" value="<?php _e('Update Options &raquo;') ?>" /> 
 </p> 
 </form> 

