Changeset 11010
- Timestamp:
- 04/20/2009 11:14:37 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/press-this.php
r10856 r11010 11 11 header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset')); 12 12 13 if ( ! current_user_can('edit_posts') ) wp_die( __( 'Cheatin’ uh?' ) ); 13 if ( ! current_user_can('edit_posts') ) 14 wp_die( __( 'Cheatin’ uh?' ) ); 14 15 15 16 /** … … 42 43 // define some basic variables 43 44 $quick['post_status'] = 'draft'; // set as draft first 44 $quick['post_category'] = $_REQUEST['post_category'];45 $quick['tax_input'] = $_REQUEST['tax_input'];46 $quick['post_title'] = $_REQUEST['title'];45 $quick['post_category'] = isset($_REQUEST['post_category']) ? $_REQUEST['post_category'] : null; 46 $quick['tax_input'] = isset($_REQUEST['tax_input']) ? $_REQUEST['tax_input'] : ''; 47 $quick['post_title'] = isset($_REQUEST['title']) ? $_REQUEST['title'] : ''; 47 48 $quick['post_content'] = ''; 48 49 49 50 // insert the post with nothing in it, to get an ID 50 51 $post_ID = wp_insert_post($quick, true); 51 $content = $_REQUEST['content']; 52 53 if( $_REQUEST['photo_src'] && current_user_can('upload_files') ) 52 $content = isset($_REQUEST['content']) ? $_REQUEST['content'] : ''; 53 54 $upload = false; 55 if( !empty($_REQUEST['photo_src']) && current_user_can('upload_files') ) 54 56 foreach( (array) $_REQUEST['photo_src'] as $key => $image) 55 57 // see if files exist in content - we don't want to upload non-used selected files. 56 58 if( strpos($_REQUEST['content'], $image) !== false ) { 57 $upload = media_sideload_image($image, $post_ID, $_REQUEST['photo_description'][$key]); 59 $desc = isset($_REQUEST['photo_description'][$key]) ? $_REQUEST['photo_description'][$key] : ''; 60 $upload = media_sideload_image($image, $post_ID, $desc); 58 61 59 62 // Replace the POSTED content <img> with correct uploaded ones. Regex contains fix for Magic Quotes … … 80 83 81 84 // For submitted posts. 82 if ( 'post' == $_REQUEST['action'] ) {85 if ( isset($_REQUEST['action']) && 'post' == $_REQUEST['action'] ) { 83 86 check_admin_referer('press-this'); 84 87 $post_ID = press_it(); 85 88 $posted = $post_ID; 89 } else { 90 $post_ID = 0; 86 91 } 87 92 88 93 // Set Variables 89 $title = wp_specialchars(aposfix(stripslashes($_GET['t'])));90 $selection = trim( aposfix( stripslashes($_GET['s']) ) );94 $title = isset($_GET['t']) ? wp_specialchars(aposfix(stripslashes($_GET['t']))) : ''; 95 $selection = isset($_GET['s']) ? trim( aposfix( stripslashes($_GET['s']) ) ) : ''; 91 96 if ( ! empty($selection) ) { 92 97 $selection = preg_replace('/(\r?\n|\r)/', '</p><p>', $selection); 93 98 $selection = '<p>'.str_replace('<p></p>', '', $selection).'</p>'; 94 99 } 95 $url = clean_url($_GET['u']);96 $image = $_GET['i'];97 98 if ($_REQUEST['ajax']) {100 $url = isset($_GET['u']) ? clean_url($_GET['u']) : ''; 101 $image = isset($_GET['i']) ? $_GET['i'] : ''; 102 103 if ( !empty($_REQUEST['ajax']) ) { 99 104 switch ($_REQUEST['ajax']) { 100 105 case 'video': ?> … … 468 473 <div id="categories-all" class="ui-tabs-panel"> 469 474 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear"> 470 <?php wp_category_checklist($post ->ID, false, false, $popular_ids) ?>475 <?php wp_category_checklist($post_ID, false) ?> 471 476 </ul> 472 477 </div>
Note: See TracChangeset
for help on using the changeset viewer.