Make WordPress Core


Ignore:
Timestamp:
12/16/2004 02:57:05 AM (19 years ago)
Author:
saxmatt
Message:

Comments refactoring and cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-trackback.php

    r1940 r1964  
    11<?php
     2require_once( dirname(__FILE__) . '/wp-config.php' );
    23
    3 function add_magic_quotes($array) {
    4     foreach ($array as $k => $v) {
    5         if (is_array($v)) {
    6             $array[$k] = add_magic_quotes($v);
    7         } else {
    8             $array[$k] = addslashes($v);
    9         }
    10     }
    11     return $array;
    12 }
    13 
    14 if (!get_magic_quotes_gpc()) {
    15     $_GET    = add_magic_quotes($_GET);
    16     $_POST   = add_magic_quotes($_POST);
    17     $_COOKIE = add_magic_quotes($_COOKIE);
    18 }
    19 
    20 if (empty($doing_trackback)) {
    21     $doing_trackback = true;
    22     require('wp-blog-header.php');
     4if ( empty($doing_trackback) ) {
     5    $doing_trackback = true;
     6    require_once('wp-blog-header.php');
    237}
    248
     
    4226// trackback is done by a POST
    4327$request_array = 'HTTP_POST_VARS';
     28
    4429if (!$tb_id) {
    4530    $tb_id = explode('/', $_SERVER['REQUEST_URI']);
    4631    $tb_id = intval($tb_id[count($tb_id)-1]);
    4732}
    48 $tb_url = $_POST['url'];
    49 $title = $_POST['title'];
    50 $excerpt = $_POST['excerpt'];
     33
     34$tb_url    = $_POST['url'];
     35$title     = $_POST['title'];
     36$excerpt   = $_POST['excerpt'];
    5137$blog_name = $_POST['blog_name'];
    52 $charset = $_POST['charset'];
     38$charset   = $_POST['charset'];
    5339
    5440if ($charset)
     
    5743    $charset = 'auto';
    5844
    59 if ( function_exists('mb_convert_encoding') ) {
    60     $title = mb_convert_encoding($title, get_settings('blog_charset'), $charset);
    61     $excerpt = mb_convert_encoding($excerpt, get_settings('blog_charset'), $charset);
     45if ( function_exists('mb_convert_encoding') ) { // For international trackbacks
     46    $title     = mb_convert_encoding($title, get_settings('blog_charset'), $charset);
     47    $excerpt   = mb_convert_encoding($excerpt, get_settings('blog_charset'), $charset);
    6248    $blog_name = mb_convert_encoding($blog_name, get_settings('blog_charset'), $charset);
    6349}
     
    6652    $tb_id = $posts[0]->ID;
    6753
    68 if ( !$tb_id)
     54if ( !$tb_id )
    6955    trackback_response(1, 'I really need an ID for this to work.');
    7056
     
    8066    $pingstatus = $wpdb->get_var("SELECT ping_status FROM $wpdb->posts WHERE ID = $tb_id");
    8167
    82     if ('closed' == $pingstatus)
     68    if ('open' != $pingstatus)
    8369        trackback_response(1, 'Sorry, trackbacks are closed for this item.');
    8470
     
    8773    $excerpt = strip_tags($excerpt);
    8874    $excerpt = (strlen($excerpt) > 255) ? substr($excerpt, 0, 252) . '...' : $excerpt;
    89     $blog_name = wp_specialchars($blog_name);
    90     $blog_name = (strlen($blog_name) > 250) ? substr($blog_name, 0, 250) . '...' : $blog_name;
    9175
    9276    $comment_post_ID = $tb_id;
Note: See TracChangeset for help on using the changeset viewer.