From 6452ec1bbc7369fe757bb0cc9108fe3ce4087e43 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 1 Mar 2006 07:08:04 +0000 Subject: [PATCH] What's up front? #2515 git-svn-id: http://svn.automattic.com/wordpress/trunk@3581 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/options-reading.php | 34 ++++++++++++++++++++++++++++++++-- wp-admin/upgrade-functions.php | 2 +- wp-admin/upgrade-schema.php | 1 + wp-includes/classes.php | 30 +++++++++++++++++++++++------- wp-includes/version.php | 2 +- 5 files changed, 58 insertions(+), 11 deletions(-) diff --git a/wp-admin/options-reading.php b/wp-admin/options-reading.php index f63606fd3..d0dced01f 100644 --- a/wp-admin/options-reading.php +++ b/wp-admin/options-reading.php @@ -9,7 +9,37 @@ include('admin-header.php');

-
+ + + +
+ + + + + + +
+

+ +

+

+ +

+

+
+ +

+
+
+ +
@@ -55,7 +85,7 @@ include('admin-header.php');

- +

diff --git a/wp-admin/upgrade-functions.php b/wp-admin/upgrade-functions.php index 3a75f29e8..71390ed62 100644 --- a/wp-admin/upgrade-functions.php +++ b/wp-admin/upgrade-functions.php @@ -34,7 +34,7 @@ function upgrade_all() { if ( $wp_current_db_version < 3308 ) upgrade_160(); - if ( $wp_current_db_version < 3570 ) + if ( $wp_current_db_version < 3582 ) upgrade_210(); $wp_rewrite->flush_rules(); diff --git a/wp-admin/upgrade-schema.php b/wp-admin/upgrade-schema.php index e52ae0c08..65c626755 100644 --- a/wp-admin/upgrade-schema.php +++ b/wp-admin/upgrade-schema.php @@ -242,6 +242,7 @@ function populate_options() { // 2.1 add_option('blog_public', 1); add_option('default_link_category', 2); + add_option('show_on_front', 'posts'); // Delete unused options $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog'); diff --git a/wp-includes/classes.php b/wp-includes/classes.php index adb0b92ae..d777f9555 100644 --- a/wp-includes/classes.php +++ b/wp-includes/classes.php @@ -293,6 +293,12 @@ class WP_Query { $q['what_to_show'] = 'posts'; } + if ( $this->is_home && ( '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']; @@ -363,12 +369,17 @@ class WP_Query { $reqpage = $reqpage->ID; else $reqpage = 0; - $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; + $this->is_home = true; + } 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'], '/'); @@ -397,8 +408,13 @@ class WP_Query { 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; + $this->is_home = true; + } else { + $q['p'] = $q['page_id']; + $where = ' AND ID = '.$q['page_id']; + } } // If a search pattern is specified, load the posts that match diff --git a/wp-includes/version.php b/wp-includes/version.php index f9bd898fb..7430ed79e 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -3,6 +3,6 @@ // This just holds the version number, in a separate file so we can bump it without cluttering the SVN $wp_version = '2.1-alpha1'; -$wp_db_version = 3570; +$wp_db_version = 3582; ?> \ No newline at end of file