diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2005-09-27 09:09:04 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2005-09-27 09:09:04 +0000 |
commit | 41c844d0db6d3f793b563ea69ab624a5a5cb5b1c (patch) | |
tree | 72d2d3ea4e82e0e48dca226704b80149284417cd | |
parent | 5184cda2b0c48d5f901381956348336b55d235d6 (diff) | |
download | wordpress-mu-41c844d0db6d3f793b563ea69ab624a5a5cb5b1c.tar.gz wordpress-mu-41c844d0db6d3f793b563ea69ab624a5a5cb5b1c.tar.xz wordpress-mu-41c844d0db6d3f793b563ea69ab624a5a5cb5b1c.zip |
WP Merge, Andy's new upload code, REQUIRES upgrading of db!
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@374 7be80a69-a1ef-0310-a953-fb0f7c49ff36
-rw-r--r-- | wp-inst/wp-admin/admin-functions.php | 52 | ||||
-rw-r--r-- | wp-inst/wp-admin/edit-form-advanced.php | 7 | ||||
-rw-r--r-- | wp-inst/wp-admin/upgrade-schema.php | 1 | ||||
-rw-r--r-- | wp-inst/wp-admin/upload.php | 246 | ||||
-rw-r--r-- | wp-inst/wp-admin/wp-admin.css | 10 | ||||
-rw-r--r-- | wp-inst/wp-content/themes/default/functions.php | 2 | ||||
-rw-r--r-- | wp-inst/wp-includes/functions-post.php | 122 | ||||
-rw-r--r-- | wp-inst/wp-includes/functions.php | 1 |
8 files changed, 191 insertions, 250 deletions
diff --git a/wp-inst/wp-admin/admin-functions.php b/wp-inst/wp-admin/admin-functions.php index f648f5e..55e4ea1 100644 --- a/wp-inst/wp-admin/admin-functions.php +++ b/wp-inst/wp-admin/admin-functions.php @@ -60,9 +60,21 @@ function write_post() { $post_ID = wp_insert_post($_POST); add_meta($post_ID); + // Reunite any orphaned subposts with their parent + if ( $_POST['temp_ID'] ) + relocate_children($_POST['temp_ID'], $post_ID); + return $post_ID; } +// Move child posts to a new parent +function relocate_children($old_ID, $new_ID) { + global $wpdb; + $old_ID = (int) $old_ID; + $new_ID = (int) $new_ID; + return $wpdb->query("UPDATE $wpdb->posts SET post_parent = $new_ID WHERE post_parent = $old_ID"); +} + // Update an existing post with values provided in $_POST. function edit_post() { global $user_ID; @@ -1742,6 +1754,46 @@ function current_theme_info() { return $ct; } +// Returns an array containing the current upload directory's path and url, or an error message. +function wp_upload_dir() { + if ( defined('UPLOADS') ) + $dir = UPLOADS; + else + $dir = 'wp-content/uploads'; + + $path = ABSPATH . $dir; + + // Make sure we have an uploads dir + if ( ! file_exists( $path ) ) { + if ( ! mkdir( $path ) ) + return array('error' => "Unable to create directory $path. Is its parent directory writable by the server?"); + @ chmod( ABSPATH . $path, 0774 ); + } + + // Generate the yearly and monthly dirs + $time = current_time( 'mysql' ); + $y = substr( $time, 0, 4 ); + $m = substr( $time, 5, 2 ); + $pathy = "$path/$y"; + $pathym = "$path/$y/$m"; + + // Make sure we have a yearly dir + if ( ! file_exists( $pathy ) ) { + if ( ! mkdir( $pathy ) ) + return array('error' => "Unable to create directory $pathy. Is $path writable?"); + @ chmod( $pathy, 0774 ); + } + + // Make sure we have a monthly dir + if ( ! file_exists( $pathym ) ) { + if ( ! mkdir( $pathym ) ) + return array('error' => "Unable to create directory $pathym. Is $pathy writable?"); + @ chmod( $pathym, 0774 ); + } + + $uploads = array('path' => $pathym, 'url' => get_bloginfo('home') . "/$dir/$y/$m", 'error' => false); + return apply_filters('upload_dir', $uploads); +} function AJAX_search_box( $get_url, $search_field = 'newvalue', $search_results_field = 'searchresults' ) { ?> <script language="JavaScript"> diff --git a/wp-inst/wp-admin/edit-form-advanced.php b/wp-inst/wp-admin/edit-form-advanced.php index 289d30c..cb6041c 100644 --- a/wp-inst/wp-admin/edit-form-advanced.php +++ b/wp-inst/wp-admin/edit-form-advanced.php @@ -17,6 +17,8 @@ $messages[3] = __('Custom field deleted.'); if (0 == $post_ID) { $form_action = 'post'; + $temp_ID = -1 * time(); + $form_extra = "<input type='hidden' name='temp_ID' value='$temp_ID' />"; } else { $form_action = 'editpost'; $form_extra = "<input type='hidden' name='post_ID' value='$post_ID' />"; @@ -175,6 +177,11 @@ if ('publish' != $post_status || 0 == $post_ID) { <div id="advancedstuff" class="dbx-group" > +<fieldset id="imageuploading" class="dbx-box"> +<h3 class="dbx-handle"><?php _e('Image Uploading') ?></h3> +<div class="dbx-content"><iframe src="image-uploading.php?action=view&post=<?php echo 0 == $post_ID ? $temp_ID : $post_ID; ?>" id="imageup"></iframe></div> +</fieldset> + <fieldset id="postexcerpt" class="dbx-box"> <h3 class="dbx-handle"><?php _e('Optional Excerpt') ?></h3> <div class="dbx-content"><textarea rows="1" cols="40" name="excerpt" tabindex="7" id="excerpt"><?php echo $post->post_excerpt ?></textarea></div> diff --git a/wp-inst/wp-admin/upgrade-schema.php b/wp-inst/wp-admin/upgrade-schema.php index 5c55396..f68eca2 100644 --- a/wp-inst/wp-admin/upgrade-schema.php +++ b/wp-inst/wp-admin/upgrade-schema.php @@ -119,6 +119,7 @@ CREATE TABLE $wpdb->posts ( post_parent bigint(20) NOT NULL default '0', guid varchar(255) NOT NULL default '', menu_order int(11) NOT NULL default '0', + post_type varchar(100) NOT NULL, PRIMARY KEY (ID), KEY post_name (post_name) ); diff --git a/wp-inst/wp-admin/upload.php b/wp-inst/wp-admin/upload.php deleted file mode 100644 index 86d1c09..0000000 --- a/wp-inst/wp-admin/upload.php +++ /dev/null @@ -1,246 +0,0 @@ -<?php -require_once('admin.php'); - -$title = 'Upload Image or File'; - -require_once('admin-header.php'); - -if (!get_settings('use_fileupload')) //Checks if file upload is enabled in the config - die (__("The admin disabled this function")); - -if ( ! current_user_can('upload_files') ) - die (__("You are not allowed to upload files")); - -$allowed_types = get_site_option( 'upload_filetypes' ) == false ? 'jpg jpeg png gif' : get_site_option( 'upload_filetypes' ); -$allowed_types = explode(' ', $allowed_types ); - -if ($_POST['submit']) { - $action = 'upload'; -} else { - $action = ''; -} - -if (!is_writable(get_settings('fileupload_realpath'))) - $action = 'not-writable'; -$action = apply_filters('fileupload_init',$action); -?> - -<div class="wrap"> - -<?php -switch ($action) { -case 'not-writable': -?> -<p><?php printf(__("It doesn't look like you can use the file upload feature at this time because the directory you have specified (<code>%s</code>) doesn't appear to be writable by WordPress. Check the permissions on the directory and for typos."), get_settings('fileupload_realpath')) ?></p> - -<?php -break; -case '': - foreach ($allowed_types as $type) { - $type_tags[] = "<code>$type</code>"; - } - $i = implode(', ', $type_tags); -?> -<p><?php printf(__('You can upload files with the extension %1$s as long as they are no larger than %2$s <abbr title="Kilobytes">KB</abbr>.'), $i, get_site_option('fileupload_maxk', 300), 'options-misc.php') ?></p> - <form action="upload.php" method="post" enctype="multipart/form-data"> - <p> - <label for="img1"><?php _e('File:') ?></label> - <br /> - <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo get_site_option('fileupload_maxk', 300 ) * 1024 ?>" /> - <input type="file" name="img1" id="img1" size="35" class="uploadform" /></p> - <p> - <label for="imgdesc"><?php _e('Description:') ?></label><br /> - <input type="text" name="imgdesc" id="imgdesc" size="30" class="uploadform" /> - </p> - - <p><?php _e('Create a thumbnail?') ?></p> - <p> - <label for="thumbsize_no"> - <input type="radio" name="thumbsize" value="none" checked="checked" id="thumbsize_no" /> - <?php _e('No thanks') ?></label> - <br /> - <label for="thumbsize_small"> -<input type="radio" name="thumbsize" value="small" id="thumbsize_small" /> -<?php _e('Small (200px largest side)') ?></label> - <br /> - <label for="thumbsize_large"> -<input type="radio" name="thumbsize" value="large" id="thumbsize_large" /> -<?php _e('Large (400px largest side)') ?></label> - <br /> - <label for="thumbsize_custom"> - <input type="radio" name="thumbsize" value="custom" id="thumbsize_custom" /> -<?php _e('Custom size') ?></label> - : - <input type="text" name="imgthumbsizecustom" size="4" /> - <?php _e('px (largest side)') ?> </p> - <p><input type="submit" name="submit" value="<?php _e('Upload File') ?>" /></p> - </form> -</div><?php -break; -case 'upload': - - $imgalt = basename( (isset($_POST['imgalt'])) ? $_POST['imgalt'] : '' ); - - $img1_name = (strlen($imgalt)) ? $imgalt : basename( $_FILES['img1']['name'] ); - $img1_name = preg_replace('/[^a-z0-9_.]/i', '', $img1_name); - $img1_size = $_POST['img1_size'] ? intval($_POST['img1_size']) : intval($_FILES['img1']['size']); - - $img1_type = (strlen($imgalt)) ? $_POST['img1_type'] : $_FILES['img1']['type']; - $imgdesc = htmlentities2($_POST['imgdesc']); - - $pi = pathinfo($img1_name); - $imgtype = strtolower($pi['extension']); - - if (in_array($imgtype, $allowed_types) == false) - die(sprintf(__('File %1$s of type %2$s is not allowed.') , $img1_name, $imgtype)); - - if (strlen($imgalt)) { - $pathtofile = get_settings('fileupload_realpath')."/".$imgalt; - $img1 = $_POST['img1']; - } else { - $pathtofile = get_settings('fileupload_realpath')."/".$img1_name; - $img1 = $_FILES['img1']['tmp_name']; - } - // do_action rather than apply_filters - becuase there's nothing we can change at this point - do_action('fileupload_pre',array('filename'=>$pathtofile, 'filesize'=>$img1_size, 'fullpath'=>$pathtofile)); - - // makes sure not to upload duplicates, rename duplicates - $i = 1; - $pathtofile2 = $pathtofile; - $tmppathtofile = $pathtofile2; - $img2_name = $img1_name; - - while ( file_exists($pathtofile2) ) { - $pos = strpos( strtolower($tmppathtofile), '.' . trim($imgtype) ); - $pathtofile_start = substr($tmppathtofile, 0, $pos); - $pathtofile2 = $pathtofile_start.'_'.zeroise($i++, 2).'.'.trim($imgtype); - $img2_name = explode('/', $pathtofile2); - $img2_name = $img2_name[count($img2_name)-1]; - } - - if (file_exists($pathtofile) && !strlen($imgalt)) { - $i = explode(' ', get_settings('fileupload_allowedtypes')); - $i = implode(', ',array_slice($i, 1, count($i)-2)); - $moved = move_uploaded_file($img1, $pathtofile2); - // if move_uploaded_file() fails, try copy() - if (!$moved) { - $moved = copy($img1, $pathtofile2); - } - if (!$moved) { - die(sprintf(__("Couldn't upload your file to %s."), $pathtofile2)); - } else { - chmod($pathtofile2, 0666); - @unlink($img1); - } - - // - - // duplicate-renaming function contributed by Gary Lawrence Murphy - ?> - <p><strong><?php __('Duplicate File?') ?></strong></p> - <p><b><em><?php printf(__("The filename '%s' already exists!"), $img1_name); ?></em></b></p> - <p><?php _e('Overwrite or rename:') ?></p> - <form action="upload.php" method="post" enctype="multipart/form-data"> - <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo get_settings('fileupload_maxk') *1024 ?>" /> - <input type="hidden" name="img1_type" value="<?php echo $img1_type;?>" /> - <input type="hidden" name="img1_name" value="<?php echo $img2_name;?>" /> - <input type="hidden" name="img1_size" value="<?php echo $img1_size;?>" /> - <input type="hidden" name="img1" value="<?php echo $pathtofile2;?>" /> - <input type="hidden" name="thumbsize" value="<?php echo $_REQUEST['thumbsize'];?>" /> - <input type="hidden" name="imgthumbsizecustom" value="<?php echo $_REQUEST['imgthumbsizecustom'];?>" /> - <?php _e('Alternate name:') ?><br /><input type="text" name="imgalt" size="30" class="uploadform" value="<?php echo $img2_name;?>" /><br /> - <br /> - <?php _e('Description:') ?><br /><input type="text" name="imgdesc" size="30" class="uploadform" value="<?php echo $imgdesc;?>" /> - <br /> - <input type="submit" name="submit" value="<?php _e('Rename') ?>" class="search" /> - </form> - - <p><?php _e( 'Overwrite the original file:' ) ?></p> - <form action="upload.php" method="post" enctype="multipart/form-data"> - <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo get_settings('fileupload_maxk') *1024 ?>" /> - <input type="hidden" name="img1_type" value="<?php echo $img1_type;?>" /> - <input type="hidden" name="img1_name" value="<?php echo $img2_name;?>" /> - <input type="hidden" name="img1_size" value="<?php echo $img1_size;?>" /> - <input type="hidden" name="img1" value="<?php echo $pathtofile2;?>" /> - <input type="hidden" name="thumbsize" value="<?php echo $_REQUEST['thumbsize'];?>" /> - <input type="hidden" name="imgthumbsizecustom" value="<?php echo $_REQUEST['imgthumbsizecustom'];?>" /> - <input type="hidden" name="imgalt" value="<?php echo $img1_name;?>" /> - <input type="hidden" name="imgdesc" value="<?php echo $imgdesc;?>" /> - <input type="submit" name="submit" value="<?php _e('Overwrite') ?>" class="search" /> - </form> - </div> - <?php - - require('admin-footer.php'); - die(); - - } - - if (!strlen($imgalt)) { - @$moved = move_uploaded_file($img1, $pathtofile); //Path to your images directory, chmod the dir to 777 - // move_uploaded_file() can fail if open_basedir in PHP.INI doesn't - // include your tmp directory. Try copy instead? - if(!$moved) { - $moved = copy($img1, $pathtofile); - } - // Still couldn't get it. Give up. - if (!$moved) { - die(sprintf(__("Couldn't upload your file to %s."), $pathtofile)); - } else { - chmod($pathtofile, 0666); - @unlink($img1); - } - - } else { - rename($img1, $pathtofile) - or die(sprintf(__("Couldn't upload your file to %s."), $pathtofile)); - } - - if($_POST['thumbsize'] != 'none' ) { - if($_POST['thumbsize'] == 'small') { - $max_side = 200; - } - elseif($_POST['thumbsize'] == 'large') { - $max_side = 400; - } - elseif($_POST['thumbsize'] == 'custom') { - $max_side = intval($_POST['imgthumbsizecustom']); - } - - $result = wp_create_thumbnail($pathtofile, $max_side, NULL); - if($result != 1) { - print $result; - } - } - -// Defined as a filter - because we might want to change the name -$img1_name = apply_filters('fileupload_post',$img1_name); -if ( ereg('image/',$img1_type) ) - $piece_of_code = "<img src='" . get_settings('fileupload_url') ."/$img1_name' alt='$imgdesc' />"; -else - $piece_of_code = "<a href='". get_settings('fileupload_url') . "/$img1_name' title='$imgdesc'>$imgdesc</a>"; - -$piece_of_code = htmlspecialchars( $piece_of_code ); -?> - -<h3><?php _e('File uploaded!') ?></h3> -<p><?php printf(__("Your file <code>%s</code> was uploaded successfully!"), $img1_name); ?></p> -<p><?php _e('Here’s the code to display it:') ?></p> -<p><code><?php echo $piece_of_code; ?></code> -</p> -<p><strong><?php _e('Image Details') ?></strong>: <br /> -<?php _e('Name:'); ?> -<?php echo $img1_name; ?> -<br /> -<?php _e('Size:') ?> -<?php echo round($img1_size / 1024, 2); ?> <?php _e('<abbr title="Kilobyte">KB</abbr>') ?><br /> -<?php _e('Type:') ?> -<?php echo $img1_type; ?> -</p> -</div> -<p><a href="upload.php"><?php _e('Upload another') ?></a></p> -<?php -break; -} -include('admin-footer.php'); -?> diff --git a/wp-inst/wp-admin/wp-admin.css b/wp-inst/wp-admin/wp-admin.css index df6f34e..895e12d 100644 --- a/wp-inst/wp-admin/wp-admin.css +++ b/wp-inst/wp-admin/wp-admin.css @@ -148,7 +148,7 @@ p, li, dl, dd, dt { line-height: 130%; } -textarea, input, select { +textarea, input, select, iframe#imageup { background: #f4f4f4; border: 1px solid #b2b2b2; color: #000; @@ -157,6 +157,14 @@ textarea, input, select { padding: 3px; } +iframe#imageup { + margin: 0px; + padding: 0px; + border: 1px solid #ccc; + height: 13em; + width: 98%; +} + .alignleft { float: left } diff --git a/wp-inst/wp-content/themes/default/functions.php b/wp-inst/wp-content/themes/default/functions.php index c624bef..a02b24b 100644 --- a/wp-inst/wp-content/themes/default/functions.php +++ b/wp-inst/wp-content/themes/default/functions.php @@ -87,7 +87,7 @@ function kubrick_add_theme_page() { if ( preg_match('/[0-9A-F]{6}|[0-9A-F]{3}/i', $_REQUEST['njuppercolor'], $uc) && preg_match('/[0-9A-F]{6}|[0-9A-F]{3}/i', $_REQUEST['njlowercolor'], $lc) ) {
$uc = ( strlen($uc[0]) == 3 ) ? $uc[0]{0}.$uc[0]{0}.$uc[0]{1}.$uc[0]{1}.$uc[0]{2}.$uc[0]{2} : $uc[0];
$lc = ( strlen($lc[0]) == 3 ) ? $lc[0]{0}.$lc[0]{0}.$lc[0]{1}.$lc[0]{1}.$lc[0]{2}.$lc[0]{2} : $lc[0];
- update_option('kubrick_header_image', "header-img.php?upper=$uc&lower=$lc");
+ update_option('kubrick_header_image', "header-img.php?upper=$uc&lower=$lc");
}
if ( isset($_REQUEST['toggledisplay']) ) {
diff --git a/wp-inst/wp-includes/functions-post.php b/wp-inst/wp-includes/functions-post.php index 47ba7ed..e752481 100644 --- a/wp-inst/wp-includes/functions-post.php +++ b/wp-inst/wp-includes/functions-post.php @@ -128,9 +128,9 @@ function wp_insert_post($postarr = array()) { } else { $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, menu_order) + (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, menu_order, post_type) VALUES - ('$post_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_date', '$post_date_gmt', '$post_parent', '$menu_order')"; + ('$post_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_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_type')"; } $result = $wpdb->query($postquery); @@ -185,6 +185,124 @@ function wp_insert_post($postarr = array()) { return $post_ID; } +function wp_attach_object($object, $post_parent = 0) { + global $wpdb, $user_ID; + + // Export array as variables + extract($object); + + // Get the basics. + $post_content = apply_filters('content_save_pre', $post_content); + $post_excerpt = apply_filters('excerpt_save_pre', $post_excerpt); + $post_title = apply_filters('title_save_pre', $post_title); + $post_category = apply_filters('category_save_pre', $post_category); + $post_name = apply_filters('name_save_pre', $post_name); + $comment_status = apply_filters('comment_status_pre', $comment_status); + $ping_status = apply_filters('ping_status_pre', $ping_status); + $post_type = apply_filters('post_type_pre', $post_type); + + // Make sure we set a valid category + if (0 == count($post_category) || !is_array($post_category)) { + $post_category = array(get_option('default_category')); + } + $post_cat = $post_category[0]; + + if ( empty($post_author) ) + $post_author = $user_ID; + + $post_status = 'object'; + + // Get the post ID. + if ( $update ) { + $post_ID = $ID; + } else { + $id_result = $wpdb->get_row("SHOW TABLE STATUS LIKE '$wpdb->posts'"); + $post_ID = $id_result->Auto_increment; + } + + // Create a valid post name. + if ( empty($post_name) ) { + $post_name = sanitize_title($post_title, $post_ID); + } else { + $post_name = sanitize_title($post_name, $post_ID); + } + + if (empty($post_date)) + $post_date = current_time('mysql'); + if (empty($post_date_gmt)) + $post_date_gmt = current_time('mysql', 1); + + if ( empty($comment_status) ) { + if ( $update ) + $comment_status = 'closed'; + else + $comment_status = get_settings('default_comment_status'); + } + if ( empty($ping_status) ) + $ping_status = get_settings('default_ping_status'); + if ( empty($post_pingback) ) + $post_pingback = get_option('default_pingback_flag'); + + if ( isset($to_ping) ) + $to_ping = preg_replace('|\s+|', "\n", $to_ping); + else + $to_ping = ''; + + $post_parent = (int) $post_parent; + + if ( isset($menu_order) ) + $menu_order = (int) $menu_order; + else + $menu_order = 0; + + if ( !isset($post_password) ) + $post_password = ''; + + if ($update) { + $postquery = + "UPDATE $wpdb->posts SET + post_author = '$post_author', + post_date = '$post_date', + post_date_gmt = '$post_date_gmt', + post_content = '$post_content', + post_title = '$post_title', + post_excerpt = '$post_excerpt', + post_status = '$post_status', + comment_status = '$comment_status', + ping_status = '$ping_status', + post_password = '$post_password', + post_name = '$post_name', + to_ping = '$to_ping', + post_modified = '$post_date', + post_modified_gmt = '$post_date_gmt', + post_parent = '$post_parent', + menu_order = '$menu_order', + post_type = '$post_type', + guid = '$guid' + WHERE ID = $post_ID"; + } else { + $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, menu_order, post_type, guid) + VALUES + ('$post_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_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_type', '$guid')"; + } + + $result = $wpdb->query($postquery); + + wp_set_post_cats('', $post_ID, $post_category); + + clean_post_cache($post_ID); + + if ( $update) { + do_action('edit_object', $post_ID); + } else { + do_action('attach_object', $post_ID); + } + + return $post_ID; +} + function wp_get_single_post($postid = 0, $mode = OBJECT) { global $wpdb; diff --git a/wp-inst/wp-includes/functions.php b/wp-inst/wp-includes/functions.php index 67def63..c557406 100644 --- a/wp-inst/wp-includes/functions.php +++ b/wp-inst/wp-includes/functions.php @@ -790,6 +790,7 @@ function trackback($trackback_url, $title, $excerpt, $ID) { */ @fclose($fs); + $tb_url = addslashes( $tb_url ); $wpdb->query("UPDATE $wpdb->posts SET pinged = CONCAT(pinged, '\n', '$tb_url') WHERE ID = '$ID'"); $wpdb->query("UPDATE $wpdb->posts SET to_ping = REPLACE(to_ping, '$tb_url', '') WHERE ID = '$ID'"); return $result; |