summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-07-20 10:09:34 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2006-07-20 10:09:34 +0000
commit729b7ecbd4789deca6689f136a4243a3be01d9b9 (patch)
tree15507027b2f4700572accea01d91d7a0419f242f
parentb6808ac36fb6b84c8ece869e097a74c8d8b67222 (diff)
downloadwordpress-mu-729b7ecbd4789deca6689f136a4243a3be01d9b9.tar.gz
wordpress-mu-729b7ecbd4789deca6689f136a4243a3be01d9b9.tar.xz
wordpress-mu-729b7ecbd4789deca6689f136a4243a3be01d9b9.zip
WP Merge
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@693 7be80a69-a1ef-0310-a953-fb0f7c49ff36
-rw-r--r--wp-admin/admin-db.php3
-rw-r--r--wp-admin/categories.php9
-rw-r--r--wp-includes/query.php7
3 files changed, 16 insertions, 3 deletions
diff --git a/wp-admin/admin-db.php b/wp-admin/admin-db.php
index 6cd63dd..2b1327b 100644
--- a/wp-admin/admin-db.php
+++ b/wp-admin/admin-db.php
@@ -84,6 +84,9 @@ function wp_insert_category($catarr) {
extract($catarr);
+ if( trim( $cat_name ) == '' )
+ return 0;
+
$cat_ID = (int) $cat_ID;
// Are we updating or creating?
diff --git a/wp-admin/categories.php b/wp-admin/categories.php
index 87e5e20..2e3e559 100644
--- a/wp-admin/categories.php
+++ b/wp-admin/categories.php
@@ -15,9 +15,11 @@ case 'addcat':
if ( !current_user_can('manage_categories') )
wp_die(__('Cheatin&#8217; uh?'));
- wp_insert_category($_POST);
-
- wp_redirect('categories.php?message=1#addcat');
+ if( wp_insert_category($_POST ) ) {
+ wp_redirect('categories.php?message=1#addcat');
+ } else {
+ wp_redirect('categories.php?message=4#addcat');
+ }
break;
case 'delete':
@@ -71,6 +73,7 @@ require_once ('admin-header.php');
$messages[1] = __('Category added.');
$messages[2] = __('Category deleted.');
$messages[3] = __('Category updated.');
+$messages[4] = __('Category not added.');
?>
<?php if (isset($_GET['message'])) : ?>
diff --git a/wp-includes/query.php b/wp-includes/query.php
index d42aa9e..f160173 100644
--- a/wp-includes/query.php
+++ b/wp-includes/query.php
@@ -279,6 +279,7 @@ class WP_Query {
var $is_admin = false;
var $is_attachment = false;
var $is_robots = false;
+ var $is_posts_page = false;
function init_query_flags() {
$this->is_single = false;
@@ -300,6 +301,7 @@ class WP_Query {
$this->is_admin = false;
$this->is_attachment = false;
$this->is_robots = false;
+ $this->is_posts_page = false;
}
function init () {
@@ -627,6 +629,7 @@ class WP_Query {
if ( ('page' == get_option('show_on_front') ) && ( $reqpage == get_option('page_for_posts') ) ) {
$this->is_page = false;
$this->is_home = true;
+ $this->is_posts_page = true;
} else {
$q['pagename'] = str_replace('%2F', '/', urlencode(urldecode($q['pagename'])));
$page_paths = '/' . trim($q['pagename'], '/');
@@ -665,6 +668,7 @@ class WP_Query {
if ( ('page' == get_option('show_on_front') ) && ( $q['page_id'] == get_option('page_for_posts') ) ) {
$this->is_page = false;
$this->is_home = true;
+ $this->is_posts_page = true;
} else {
$q['p'] = $q['page_id'];
$where = ' AND ID = '.$q['page_id'];
@@ -1018,6 +1022,9 @@ class WP_Query {
$category = &get_category($cat);
$this->queried_object = &$category;
$this->queried_object_id = $cat;
+ } else if ($this->is_posts_page) {
+ $this->queried_object = & get_page(get_option('page_for_posts'));
+ $this->queried_object_id = $this->queried_object->ID;
} else if ($this->is_single) {
$this->queried_object = $this->post;
$this->queried_object_id = $this->post->ID;