]> git.mjollnir.org Git - s9y.git/commitdiff
do not trackback media files
authorgarvinhicking <garvinhicking>
Sat, 25 Feb 2006 14:45:41 +0000 (14:45 +0000)
committergarvinhicking <garvinhicking>
Sat, 25 Feb 2006 14:45:41 +0000 (14:45 +0000)
include/functions_trackbacks.inc.php

index 8f2d4dedae0b2e69704e0434cd4156e465063c77..c14081b14ccf663fe91b2ba8a0eae63983df61ee 100644 (file)
@@ -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 '<div>&#8226; ' . TRACKBACK_NO_DATA . '</div>';
+        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");