| 1 | Index: wp-admin/edit-form-advanced.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-admin/edit-form-advanced.php (revision 6574) |
|---|
| 4 | +++ wp-admin/edit-form-advanced.php (working copy) |
|---|
| 5 | @@ -17,7 +17,7 @@ |
|---|
| 6 | <div class="wrap"> |
|---|
| 7 | <?php |
|---|
| 8 | |
|---|
| 9 | -if (0 == $post_ID) { |
|---|
| 10 | +if (! isset($post_ID) || 0 == $post_ID) { |
|---|
| 11 | $form_action = 'post'; |
|---|
| 12 | $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post() |
|---|
| 13 | $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />"; |
|---|
| 14 | @@ -33,9 +33,9 @@ |
|---|
| 15 | |
|---|
| 16 | $form_prevstatus = '<input type="hidden" name="prev_status" value="' . attribute_escape( $post->post_status ) . '" />'; |
|---|
| 17 | |
|---|
| 18 | -$form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. attribute_escape( str_replace("\n", ' ', $post->to_ping) ) .'" />'; |
|---|
| 19 | +$form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. ((isset($post->to_ping)) ? attribute_escape( str_replace("\n", ' ', $post->to_ping) ) : '').'" />'; |
|---|
| 20 | |
|---|
| 21 | -if ('' != $post->pinged) { |
|---|
| 22 | +if (isset($post->pinged) && '' != $post->pinged) { |
|---|
| 23 | $pings = '<p>'. __('Already pinged:') . '</p><ul>'; |
|---|
| 24 | $already_pinged = explode("\n", trim($post->pinged)); |
|---|
| 25 | foreach ($already_pinged as $pinged_url) { |
|---|
| 26 | @@ -53,7 +53,7 @@ |
|---|
| 27 | <input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" /> |
|---|
| 28 | <input type="hidden" id="hiddenaction" name="action" value="<?php echo $form_action ?>" /> |
|---|
| 29 | <input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" /> |
|---|
| 30 | -<input type="hidden" name="post_author" value="<?php echo attribute_escape( $post->post_author ); ?>" /> |
|---|
| 31 | +<input type="hidden" name="post_author" value="<?php echo ( (isset($post->post_author)) ? attribute_escape( $post->post_author ) : ''); ?>" /> |
|---|
| 32 | <input type="hidden" id="post_type" name="post_type" value="post" /> |
|---|
| 33 | |
|---|
| 34 | <?php echo $form_extra ?> |
|---|
| 35 | @@ -82,9 +82,9 @@ |
|---|
| 36 | <?php echo $form_prevstatus ?> |
|---|
| 37 | |
|---|
| 38 | <p class="submit"> |
|---|
| 39 | -<?php if ( 'publish' == $post->post_status ) { ?> |
|---|
| 40 | +<?php if ( isset($post->post_status) && 'publish' == $post->post_status ) { ?> |
|---|
| 41 | <a href="<?php echo clean_url(get_permalink($post->ID)); ?>" class="view-link" target="_blank"><?php _e('View »'); ?></a> |
|---|
| 42 | -<?php } elseif ( 'edit' == $action ) { ?> |
|---|
| 43 | +<?php } elseif ( isset($action) && 'edit' == $action ) { ?> |
|---|
| 44 | <a href="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" class="view-link" target="_blank"><?php _e('Preview »'); ?></a> |
|---|
| 45 | <?php } ?> |
|---|
| 46 | <span id="autosave"></span> |
|---|
| 47 | @@ -104,7 +104,7 @@ |
|---|
| 48 | <input name="referredby" type="hidden" id="referredby" value="<?php |
|---|
| 49 | if ( !empty($_REQUEST['popupurl']) ) |
|---|
| 50 | echo clean_url(stripslashes($_REQUEST['popupurl'])); |
|---|
| 51 | -else if ( url_to_postid(wp_get_referer()) == $post_ID ) |
|---|
| 52 | +else if ( isset($post_ID) && url_to_postid(wp_get_referer()) == $post_ID ) |
|---|
| 53 | echo 'redo'; |
|---|
| 54 | else |
|---|
| 55 | echo clean_url(stripslashes(wp_get_referer())); |
|---|
| 56 | @@ -113,7 +113,7 @@ |
|---|
| 57 | <div id="tagsdiv" class="postbox"> |
|---|
| 58 | <h3><?php _e('Tags'); ?></h3> |
|---|
| 59 | <div class="inside"> |
|---|
| 60 | -<p id="jaxtag"><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post_ID ); ?>" /></p> |
|---|
| 61 | +<p id="jaxtag"><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( (isset($post_ID)) ? $post_ID : null ); ?>" /></p> |
|---|
| 62 | <p id="tagchecklist"></p> |
|---|
| 63 | </div> |
|---|
| 64 | </div> |
|---|
| 65 | @@ -191,14 +191,14 @@ |
|---|
| 66 | <div id="passworddiv" class="postbox"> |
|---|
| 67 | <h3><?php _e('Post Password') ?></h3> |
|---|
| 68 | <div class="inside"> |
|---|
| 69 | -<input name="post_password" type="text" size="13" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /> |
|---|
| 70 | +<input name="post_password" type="text" size="13" id="post_password" value="<?php echo (! empty($post->post_password) ) ? attribute_escape( $post->post_password ) : ''; ?>" /> |
|---|
| 71 | </div> |
|---|
| 72 | </div> |
|---|
| 73 | |
|---|
| 74 | <div id="slugdiv" class="postbox"> |
|---|
| 75 | <h3><?php _e('Post Slug') ?></h3> |
|---|
| 76 | <div class="inside"> |
|---|
| 77 | -<input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" /> |
|---|
| 78 | +<input name="post_name" type="text" size="13" id="post_name" value="<?php echo ( ! empty($post->post_name) ) ? attribute_escape( $post->post_name ) : ''; ?>" /> |
|---|
| 79 | </div> |
|---|
| 80 | </div> |
|---|
| 81 | |
|---|
| 82 | @@ -217,13 +217,13 @@ |
|---|
| 83 | <?php if ( current_user_can('edit_posts') ) : ?> |
|---|
| 84 | <div id="posttimestampdiv" class="postbox"> |
|---|
| 85 | <h3><?php _e('Post Timestamp'); ?></h3> |
|---|
| 86 | -<div class="inside"><?php touch_time(($action == 'edit')); ?></div> |
|---|
| 87 | +<div class="inside"><?php touch_time( ( ! empty($action) && $action == 'edit' ) ? true : false ); ?></div> |
|---|
| 88 | </div> |
|---|
| 89 | <?php endif; ?> |
|---|
| 90 | |
|---|
| 91 | <?php |
|---|
| 92 | $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM |
|---|
| 93 | -if ( $post->post_author && !in_array($post->post_author, $authors) ) |
|---|
| 94 | +if ( ! empty($post->post_author) && !in_array($post->post_author, $authors) ) |
|---|
| 95 | $authors[] = $post->post_author; |
|---|
| 96 | if ( $authors && count( $authors ) > 1 ) : |
|---|
| 97 | ?> |
|---|
| 98 | @@ -239,7 +239,7 @@ |
|---|
| 99 | |
|---|
| 100 | </div> |
|---|
| 101 | |
|---|
| 102 | -<?php if ('edit' == $action) : $delete_nonce = wp_create_nonce( 'delete-post_' . $post_ID ); ?> |
|---|
| 103 | +<?php if (! empty($action) && 'edit' == $action) : $delete_nonce = wp_create_nonce( 'delete-post_' . $post_ID ); ?> |
|---|
| 104 | <input name="deletepost" class="button delete" type="submit" id="deletepost" tabindex="10" value="<?php echo ( 'draft' == $post->post_status ) ? __('Delete this draft') : __('Delete this post'); ?>" <?php echo "onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""; ?> /> |
|---|
| 105 | <?php endif; ?> |
|---|
| 106 | |
|---|