From 579c1da7b59581ed05bdb46f84ea75268bcd92e8 Mon Sep 17 00:00:00 2001 From: garvinhicking Date: Sat, 25 Feb 2006 14:45:41 +0000 Subject: [PATCH] do not trackback media files --- include/functions_trackbacks.inc.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/include/functions_trackbacks.inc.php b/include/functions_trackbacks.inc.php index 8f2d4de..c14081b 100644 --- a/include/functions_trackbacks.inc.php +++ b/include/functions_trackbacks.inc.php @@ -191,6 +191,11 @@ global $serendipity; $parsed_loc = $u['scheme'] . '://' . $u['host'] . $port . $u['path']; + if (preg_match('@\.(jpe?g|aiff?|gif|png|pdf|doc|rtf|wave?|mp2|mp4|mpe?g3|mpe?g4|divx|xvid|bz2|mpe?g|avi|mp3|xl?|ppt|pps|xslt?|xsd|zip|tar|t?gz|swf|rm|ram?|exe|mov|qt|midi?|qcp|emf|wmf|snd|pmg|w?bmp|gcd|mms|ogg|ogm|rv|wmv|wma|jad|3g?|jar)$@i', $u['path'])) { + echo '
• ' . TRACKBACK_NO_DATA . '
'; + return; + } + require_once S9Y_PEAR_PATH . 'HTTP/Request.php'; $options = array('allowRedirects' => true, 'maxRedirects' => 5, 'method' => 'GET'); serendipity_plugin_api::hook_event('backend_http_request', $options, 'trackback_detect'); @@ -238,14 +243,14 @@ function add_trackback ($id, $title, $url, $name, $excerpt) { if (empty($title)) { $title = $url; } - + $comment = array( 'title' => $title, 'url' => $url, 'name' => $name, 'comment' => $excerpt ); - + $is_utf8 = strtolower(LANG_CHARSET) == 'utf-8'; if ($GLOBALS['tb_logging']) { @@ -272,7 +277,7 @@ function add_trackback ($id, $title, $url, $name, $excerpt) { } } } - + if ($GLOBALS['tb_logging']) { fwrite($fp, '[' . date('d.m.Y H:i') . '] TRACKBACK DATA: ' . print_r($comment, true) . '...' . "\n"); fwrite($fp, '[' . date('d.m.Y H:i') . '] TRACKBACK STORING...' . "\n"); -- 2.39.5