X-Git-Url: https://scripts.mit.edu/gitweb/autoinstallsdev/wordpress.git/blobdiff_plain/9e77185fafaf4e60e2b73821e0e4b9b1a11fb85f..3d39054f012aefe514b3f5509e32f09fc4feda44:/wp-admin/press-this.php diff --git a/wp-admin/press-this.php b/wp-admin/press-this.php index 5daa2f9b..e0a4c901 100644 --- a/wp-admin/press-this.php +++ b/wp-admin/press-this.php @@ -11,681 +11,19 @@ define('IFRAME_REQUEST' , true); /** WordPress Administration Bootstrap */ require_once( dirname( __FILE__ ) . '/admin.php' ); -header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset')); - -if ( ! current_user_can( 'edit_posts' ) || ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) - wp_die( __( 'Cheatin’ uh?' ) ); +if ( ! current_user_can( 'edit_posts' ) || ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) { + wp_die( + '
' . __( 'Sorry, you are not allowed to create posts as this user.' ) . '
', + 403 + ); +} /** - * Press It form handler. - * - * @since 2.6.0 - * - * @return int Post ID + * @global WP_Press_This $wp_press_this */ -function press_it() { - - $post = get_default_post_to_edit(); - $post = get_object_vars($post); - $post_ID = $post['ID'] = (int) $_POST['post_id']; - - if ( !current_user_can('edit_post', $post_ID) ) - wp_die(__('You are not allowed to edit this post.')); - - $post['post_category'] = isset($_POST['post_category']) ? $_POST['post_category'] : ''; - $post['tax_input'] = isset($_POST['tax_input']) ? $_POST['tax_input'] : ''; - $post['post_title'] = isset($_POST['title']) ? $_POST['title'] : ''; - $content = isset($_POST['content']) ? $_POST['content'] : ''; - - $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. - 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); - - // Replace the POSTED content', $selection); - $selection = '
' . str_replace('
', '', $selection) . ''; +if ( empty( $GLOBALS['wp_press_this'] ) ) { + include( ABSPATH . 'wp-admin/includes/class-wp-press-this.php' ); } -$url = isset($_GET['u']) ? esc_url($_GET['u']) : ''; -$image = isset($_GET['i']) ? $_GET['i'] : ''; - -if ( !empty($_REQUEST['ajax']) ) { - switch ($_REQUEST['ajax']) { - case 'video': ?> - - - - - -
-
-
-
-
-