Source for file _functions_trackback.php
Documentation is available at _functions_trackback.php
* b2evolution - {@link http://b2evolution.net/}
* Released under GNU GPL License - {@link http://b2evolution.net/about/license.html}
* @copyright (c)2003-2005 by Francois PLANQUE - {@link http://fplanque.net/}
* @author This file built upon code from original b2 - http://cafelog.com/
if( !defined('DB_USER') ) die( 'Please, do not access this page directly.' );
function trackbacks( $post_trackbacks, $content, $post_title, $post_ID )
echo
"<div class=\"panelinfo\">\n";
echo
"<h3>", T_('Sending trackbacks...'), "</h3>\n";
if(empty($post_trackbacks))
echo
"<p>", T_('No trackback to be sent.'), "</p>\n";
echo
"<p>", T_('Excerpt to be sent:'), " $excerpt</p>\n";
$trackback_urls =
split('( )+', $post_trackbacks,10); // fplanque: ;
foreach($trackback_urls as $tb_url)
if( empty( $tb_url ) ) continue;
trackback($tb_url, $post_title, $excerpt, $post_ID);
echo
"<p>", T_('Trackbacks done.'), "</p>\n";
* sending Trackback to single URL:
* TODO: add autodiscovery
echo
"<p>", T_('Sending trackback to:'), " $trackback_url ...\n";
$Item =
$ItemCache->get_by_ID( $ID );
// dis is the trackback stuff to be sent:
$query_string =
"title=$title&url=$url&blog_name=$blog_name&excerpt=$excerpt";
// echo "url:$trackback_url<br>$sending:$query_string<br />";
if (strstr($trackback_url, '?'))
$trackback_url .=
"&".
$query_string;;
$fp =
fopen($trackback_url, 'r');
$result =
fread($fp, 4096);
$debug_file = 'trackback.log';
$fp = fopen($debug_file, 'a');
fwrite($fp, "\n*****\nTrackback URL query:\n\n$trackback_url\n\nResponse:\n\n");
$port = isset
($trackback_url['port']) ?
$trackback_url['port'] :
80;
$http_request =
'POST '.
$trackback_url['path'].
" HTTP/1.0\r\n";
$http_request .=
'Host: '.
$trackback_url['host'].
"\r\n";
$http_request .=
'Content-Type: application/x-www-form-urlencoded'.
"\r\n";
$http_request .=
'Content-Length: '.
strlen($query_string).
"\r\n";
$http_request .=
$query_string;
$fs =
fsockopen($trackback_url['host'], $port);
fputs($fs, $http_request);
$result .=
fgets($fs, 4096);
$debug_file = 'trackback.log';
$fp = fopen($debug_file, 'a');
fwrite($fp, "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n$result");
fwrite($fp, @fgets($fs, 4096));
echo
"<br \>", T_('Response:'), " $result</p>\n";
echo
'<?xml version="1.0" encoding="iso-8859-1"?'.
">\n";
echo
"<error>$error</error>\n";
echo
"<message>$error_message</message>\n";
* @deprecated deprecated by {@link Item::trackback_url()}
if( $Settings->get('links_extrapath') )
$tb_url =
"$htsrv_url/trackback.php/$id";
$tb_url =
"$htsrv_url/trackback.php?tb_id=$id";
* @deprecated deprecated by {@link Item::feedback_link()}
if( $zero ==
'#' ) $zero =
T_('Trackback (0)');
if( $one ==
'#' ) $one =
T_('Trackback (1)');
if( $more ==
'#' ) $more =
T_('Trackbacks (%d)');
global $id, $tablecomments, $tb, $querycount, $cache_trackbacknumber, $use_cache;
} elseif ($number ==
1) {
* Displays link to the trackback page
* @deprecated deprecated by {@link Item::feedback_link()}
if( ($file ==
'') ||
($file ==
'/') )
* @deprecated deprecated by {@link Item::feedback_link()}
global $blog, $id, $b2trackbackpopupfile, $b2commentsjavascript;
if ($b2commentsjavascript) {
echo
'" onclick="b2open(this.href); return false"';
// if comments_popup_script() is not in the template, display simple comment link
echo
' class="'.
$CSSclass.
'"';
* This adds trackback autodiscovery information
* @deprecated deprecated by {@link Item::trackback_rdf()}
global $id, $blogfilename; // fplanque added: $blogfilename
// if (!stristr($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')) {
// fplanque WARNING: this isn't a very clean way to validate :/
// fplanque added: html comments (not perfect but better way of validating!)
echo
'<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" '.
"\n";
echo
' xmlns:dc="http://purl.org/dc/elements/1.1/"'.
"\n";
echo
' xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">'.
"\n";
echo
'<rdf:Description'.
"\n";