X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/8f374b7233bc2815ccc387e448d208c5434eb961..9e77185fafaf4e60e2b73821e0e4b9b1a11fb85f:/wp-admin/press-this.php diff --git a/wp-admin/press-this.php b/wp-admin/press-this.php index facae8a8..5daa2f9b 100644 --- a/wp-admin/press-this.php +++ b/wp-admin/press-this.php @@ -9,18 +9,16 @@ define('IFRAME_REQUEST' , true); /** WordPress Administration Bootstrap */ -require_once('./admin.php'); +require_once( dirname( __FILE__ ) . '/admin.php' ); header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset')); -if ( ! current_user_can('edit_posts') ) +if ( ! current_user_can( 'edit_posts' ) || ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) wp_die( __( 'Cheatin’ uh?' ) ); /** * Press It form handler. * - * @package WordPress - * @subpackage Press_This * @since 2.6.0 * * @return int Post ID @@ -42,7 +40,7 @@ function press_it() { $upload = false; if ( !empty($_POST['photo_src']) && current_user_can('upload_files') ) { foreach( (array) $_POST['photo_src'] as $key => $image) { - // see if files exist in content - we don't want to upload non-used selected files. + // See if files exist in content - we don't want to upload non-used selected files. if ( strpos($_POST['content'], htmlspecialchars($image)) !== false ) { $desc = isset($_POST['photo_description'][$key]) ? $_POST['photo_description'][$key] : ''; $upload = media_sideload_image($image, $post_ID, $desc); @@ -53,7 +51,7 @@ function press_it() { } } } - // set the post_content and status + // Set the post_content and status. $post['post_content'] = $content; if ( isset( $_POST['publish'] ) && current_user_can( 'publish_posts' ) ) $post['post_status'] = 'publish'; @@ -62,12 +60,12 @@ function press_it() { else $post['post_status'] = 'draft'; - // error handling for media_sideload + // Error handling for media_sideload. if ( is_wp_error($upload) ) { wp_delete_post($post_ID); wp_die($upload); } else { - // Post formats + // Post formats. if ( isset( $_POST['post_format'] ) ) { if ( current_theme_supports( 'post-formats', $_POST['post_format'] ) ) set_post_format( $post_ID, $_POST['post_format'] ); @@ -91,11 +89,11 @@ if ( isset($_REQUEST['action']) && 'post' == $_REQUEST['action'] ) { } // Set Variables -$title = isset( $_GET['t'] ) ? trim( strip_tags( html_entity_decode( stripslashes( $_GET['t'] ) , ENT_QUOTES) ) ) : ''; +$title = isset( $_GET['t'] ) ? trim( strip_tags( html_entity_decode( wp_unslash( $_GET['t'] ) , ENT_QUOTES) ) ) : ''; $selection = ''; if ( !empty($_GET['s']) ) { - $selection = str_replace(''', "'", stripslashes($_GET['s'])); + $selection = str_replace(''', "'", wp_unslash($_GET['s'])); $selection = trim( htmlspecialchars( html_entity_decode($selection, ENT_QUOTES) ) ); } @@ -110,7 +108,7 @@ $image = isset($_GET['i']) ? $_GET['i'] : ''; if ( !empty($_REQUEST['ajax']) ) { switch ($_REQUEST['ajax']) { case 'video': ?> - @@ -439,7 +475,7 @@ var photostorage = false; $admin_body_class = ( is_rtl() ) ? 'rtl' : ''; $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) ); ?> - +
@@ -467,7 +503,7 @@ $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( echo '

'; submit_button( __( 'Submit for Review' ), 'primary', 'review', false ); } ?> - +

@@ -561,7 +597,6 @@ $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace(