fix for bug #328: better/sane way to get before using it as a fallback for post_name

git-svn-id: http://svn.automattic.com/wordpress/trunk@1813 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
michelvaldrighi 2004-10-18 15:58:06 +00:00
parent 9f62c48cf9
commit 33203610c8

View File

@ -44,8 +44,6 @@ case 'post':
die('You are not allowed to create posts or drafts on this blog.');
}
$post_ID = $wpdb->get_var("SELECT MAX(ID) FROM $wpdb->posts") + 1;
$post_pingback = intval($_POST['post_pingback']);
$content = apply_filters('content_save_pre', $_POST['content']);
$content = format_to_post($content);
@ -73,13 +71,6 @@ case 'post':
$ping_status = get_option('default_ping_status');
$post_password = $_POST['post_password'];
if ( empty($post_name) ) {
if ( !empty($post_title) )
$post_name = sanitize_title($post_title, $post_ID);
} else {
$post_name = sanitize_title($post_name, $post_ID);
}
$trackback = $_POST['trackback_url'];
$trackback = preg_replace('|\s+|', "\n", $trackback);
@ -108,6 +99,16 @@ case 'post':
if ('' != $_POST['advanced']) $post_status = 'draft';
if ('' != $_POST['savepage']) $post_status = 'static';
$id_result = $wpdb->get_row("SHOW TABLE STATUS LIKE '$wpdb->posts'");
$post_ID = $id_result->Auto_increment;
if ( empty($post_name) ) {
if ( !empty($post_title) )
$post_name = sanitize_title($post_title, $post_ID);
} else {
$post_name = sanitize_title($post_name, $post_ID);
}
$postquery ="INSERT INTO $wpdb->posts
(ID, post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, post_modified, post_modified_gmt, post_parent)
VALUES