This file is indexed.

/usr/share/drupal6/modules/trackback/trackback.module is in drupal6-mod-trackback 1.2-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
<?php
// $Id: trackback.module,v 1.75.2.6 2009/05/05 14:50:59 thepanz Exp $

define('TRACKBACK_WITH_SPAM', module_exists('spam'));

if (TRACKBACK_WITH_SPAM) {
  module_load_include('inc', 'trackback', 'trackback.spam');
}

/**
 * Implementation of hook_help().
 */
function trackback_help($path, $arg) {
  if ($path == 'admin/help#trackback') {
    module_load_include('inc', 'trackback', 'trackback.admin');
    return _trackback_help($path, $arg);
  }
}

/**
 * Implementation of hook_theme()
 */
function trackback_theme() {
  return array(
    'trackback' => array(
      'arguments' => array('trackback' => NULL, 'links' => array())
    ),
    'trackbacks' => array(
      'arguments' => array('trackbacks' => NULL)
    ),
    'trackback_url' => array(
      'arguments' => array('url' => NULL)
    ),
    'trackback_admin_table' => array(
      'arguments' => array('form' => NULL)
    )
  );
}

function theme_trackback($trackback, $links = array()) {
  $output  = '<div class="trackback" id="trackback-'. $trackback->trid .'">'."\n";
  $output .= '<h3 class="title">'. l($trackback->subject, $trackback->url) .'</h3>'."\n";
  $output .= '<span class="submitted">'. t('from %sitename on @date', array('%sitename' => $trackback->name, '@date' => format_date($trackback->created))) .'</span>'."\n";
  $output .= '<div class="content">'. check_markup($trackback->excerpt) .'</div>'."\n";
  if ($links) {
    $output .= '<div class="links">'. theme('links', $links) .'</div>'."\n";
  }
  $output .= '</div>'."\n";
  return $output;
}

function theme_trackbacks($trackbacks) {
  $output = '<div id="trackbacks">'."\n";
  $output .= $trackbacks ."\n";
  $output .= '</div>'."\n";
  return $output;
}

function theme_trackback_url($url) {
  return '<div class="trackback-url">'. theme('box', t('Trackback URL for this post:'), $url) .'</div>';
}

/**
 * Invoke a hook_trackback() operation in all modules.
 *
 * @param &$trackback
 *   A trackback object.
 * @param $op
 *   A string containing the name of the trackback operation.
 * @return
 *   The returned value of the invoked hooks.
 */
function trackback_invoke_trackback(&$trackback, $op) {
  $return = array();
  foreach (module_implements('trackback') as $name) {
    $function = $name .'_trackback';
    $result = $function($trackback, $op);
    if (isset($result)) {
      if (is_array($result)) {
        $return = array_merge($return, $result);
      }
      else {
        $return[] = $result;
      }
    }
  }
  return $return;
}

function trackback_render($node) {
  $result = db_query('SELECT * FROM {trackback_received} WHERE nid=%d AND status=1 ORDER BY created DESC', $node->nid);
  if ($tb = db_fetch_object($result)) {
    $link = (user_access('administer trackbacks') || node_access('update', $node));
    $received = '';
    do {
      $received .= theme('trackback', $tb, $link ? module_invoke_all('link', 'trackback', $tb, FALSE) : array());
    } while ($tb = db_fetch_object($result));
    return theme('trackbacks', $received);
  }
}

/**
 * hook_form_alter() callback
 */
function trackback_form_alter(&$form, $form_state, $form_id) {
  
  // Add settings for node_type edit form
  if ($form_id == 'node_type_form' && isset($form['identity']['type'])) {
    $form['workflow']['trackback'] = array(
      '#type' => 'radios',
      '#title' => t('Trackbacks'),
      '#options' => array(t('Disabled'), t('Enabled')),
      '#default_value' => _trackback_node_type($form['#node_type']->type),
      '#description' => t('Enable trackbacks for this node type.')
    );
  }
  // Add trackback settings on node creation/edit form
  else if (isset($form['type']) && $form['type']['#value'] .'_node_form' == $form_id) {
    $node = $form['#node'];
    if (_trackback_node_type($node->type)) {
      $form['trackback'] = array(
        '#type' => 'fieldset',
        '#title' => t('Trackbacks'),
        '#collapsible' => TRUE,
        '#collapsed' => !isset($node->trackback_urls),
      );
      
      if (user_access('change node trackback setting')) {
        $form['trackback']['can_receive'] = array(
          '#type' => 'checkbox',
          '#title' => t('Allow Trackbacks'),
          '#default_value' => isset($node->can_receive) ? $node->can_receive : 1,
          '#description' => t('Allow other posts to send trackbacks to this content.')
        );
      }
      else {
        $form['trackback']['can_receive'] = array(
          '#type' => 'value',
          '#value' => isset($node->can_receive) ? $node->can_receive : 1,
        );
      }
      
      $form['trackback']['trackback_urls'] = array(
        '#type' => 'textarea',
        '#title' => t('Send Trackbacks'),
        '#default_value' => isset($node->trackback_urls) ? $node->trackback_urls : '',
        '#cols' => 80,
        '#rows' => 4,
        '#description' => t('Enter one URL per line for each trackback you wish to send.'),
        '#wysiwyg' => FALSE,
      );

      // if there are any past successful trackbacks from this posting, add them to the node editing page.
      // if there are any past unsuccessful trackbacks from this posting, add checkmarks to enable resending them
      $past_successes_listing = array();
      $options = array();
      if (isset($node->nid)) {
        $result = db_query('SELECT url, successful FROM {trackback_sent} WHERE nid = %d', $node->nid);
        while ($url = db_fetch_object($result)) {
          if ($url->successful) {
            $past_successes_listing[] = $url->url;
          }
          else {
            $options[$url->url] = $url->url;
          }
        }
      }

      // add listing of successfully trackbacked URLs
      if (count($past_successes_listing)) {
        $form['trackback'][] = array(
          '#value' => theme('item_list', $past_successes_listing, t('Successful URLs'))
        );
        //t('These URLs have been successfuly pinged by this post.')
      }

      // add listing of unsuccessfully trackbacked URLs
      if (count($options)) {
        $form['trackback']['trackback_urls_to_retry'] = array(
          '#type' => 'checkboxes',
          '#title' => t('Unsuccessful URLs'),
          '#default_value' => array(),
          '#options' => $options,
          '#description' => t('Attempts to ping these URLs with this post have failed. Mark a check next to the trackback URLs you wish to retry for this post.')
        );
      }
    }
  }
}

function _trackback_get_url(&$node) {
  return url('trackback/'. $node->nid, array('absolute' => TRUE));
}

function trackback_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
  switch ($op) {
    case 'load':
      if (_trackback_node_type($node->type)) {
        $q = db_fetch_object(db_query('SELECT * FROM {trackback_node} WHERE nid=%d', $node->nid));
        return array('can_receive' => $q ? $q->can_receive : 1);
      }
      break;

    case 'view':
      if (isset($node->can_receive) && empty($node->in_preview)) {
        $node->content['trackback'] = array('#weight' => 12);
        if ($node->can_receive) {
          $url = url('node/'. $node->nid, array('absolute' => TRUE));
          $tb_url = _trackback_get_url($node);
          $autodetect = "\n<!--\n";
          $autodetect .= '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">'."\n";
          $autodetect .= '<rdf:Description rdf:about="'. $url .'" dc:identifier="'. $url .'" dc:title="'. strtr(check_plain($node->title), array('--' => '&mdash;')) .'" trackback:ping="'. $tb_url .'" />'."\n";
          $autodetect .= '</rdf:RDF>';
          $autodetect .= "\n-->\n";
          $node->content['trackback']['autodetect'] = array(
            '#value' => $autodetect,
            '#weight' => -2
          );
          if (!$teaser && variable_get('trackback_url_display', 'default') == 'default') {            
            $node->content['trackback']['url'] = array(
              '#value' => theme('trackback_url', $tb_url),
              '#weight' => -1
            );
          }
        }
        if (!$teaser && variable_get('trackback_view', 0) == 0) {
          $node->content['trackback']['received'] = array('#value' => trackback_render($node));
        }
      }
      break;

    case 'validate':
      if (!empty($node->trackback_urls)) {
        foreach (explode("\n", $node->trackback_urls) as $url) {
          $url = trim($url);
          if ($url && !_trackback_valid_url($url)) {
            form_set_error('trackback_urls', t('The trackback url %url is not a valid url.', array('%url' => $url)));
          }
        }
      }
      break;

    case 'insert':
    case 'update':
      if (_trackback_node_type($node->type)) {
        module_load_include('inc', 'trackback', 'trackback.ping');
        global $_trackback_ping_node;
        $_trackback_ping_node = drupal_clone($node);
        $cron = ($node->status && variable_get('trackback_auto_detection_enabled', 0) == 2);
        db_query("UPDATE {trackback_node} SET awaiting_cron=%d, can_receive=%d WHERE nid=%d", $cron, $node->can_receive, $node->nid);
        if (!db_affected_rows()) {
          db_query("INSERT INTO {trackback_node}(nid, awaiting_cron, can_receive) VALUES(%d, %d, %d)", $node->nid, $cron, $node->can_receive);
        }
      }
      break;

    case 'delete':
      if (TRACKBACK_WITH_SPAM) {
        db_query("DELETE FROM {spam_tracker} USING ({spam_tracker}, {trackback_received}) WHERE {spam_tracker}.source='trackback' AND {spam_tracker}.id={trackback_received}.trid AND {trackback_received}.nid=%d", $node->nid);
      }
      db_query("DELETE FROM {trackback_node} WHERE nid=%d", $node->nid);
      db_query("DELETE FROM {trackback_sent} WHERE nid=%d", $node->nid);
      db_query("DELETE FROM {trackback_received} WHERE nid=%d", $node->nid);
      break;
  }
}

function trackback_link($type, $node = NULL, $teaser = FALSE) {
  $links = array();
  switch ($type) {
    case 'node':
      if (isset($node->can_receive)) {
        if (variable_get('trackback_url_display', 'default') == 'links' ||
          (!$teaser && variable_get('trackback_url_display', 'default') == 'links-full') ||
          ($teaser && variable_get('trackback_url_display', 'default') == 'links-teaser')) {
          $links['trackback-url'] = array(
            'title' => t('Trackback URL'),
            'href' => _trackback_get_url($node),
            'attributes' => array('title' => t('Trackback URL for "%nodetitle"', array('%nodetitle' => $node->title))),
          );
        }
        if ($teaser && variable_get('trackback_links_count_display', 1) == 1) {
          $count = db_result(db_query("SELECT count(*) FROM {trackback_received} WHERE nid=%d AND status=1", $node->nid));
          if ($count) {
            $links['trackback_trackbacks'] = array(
              'title' => format_plural($count, '1 trackback', '@count trackbacks'),
              'href' => _trackback_path($node),
            );
            // Don't display fragment if trackbacks are displayed on a separate page
            if (variable_get('trackback_view', 0) != 1)
              $links['trackback_trackbacks']['fragment'] = 'trackbacks';
          }
        }
      }   
      break;

    case 'trackback':
      if (!$teaser) {
        $links['trackback_edit'] = array(
          'title' => t('edit'),
          'href' => 'trackback/edit/'. $node->trid
        );
      }
      $links['trackback_delete'] = array(
        'title' => t('delete'),
        'href' => 'trackback/delete/'. $node->trid
      );
      if (TRACKBACK_WITH_SPAM) {
        $links += _trackback_spam_link($node);
      }
      break;
  }
  return $links;
}

/**
 * hook_menu() callback
 */
function trackback_menu() {
  $items['admin/content/trackback'] = array(
    'title' => 'Trackbacks',
    'description' => 'List and edit site trackbacks and the trackback moderation queue.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('trackback_admin_overview'),
    'access arguments' => array('administer trackbacks'),
    'file' => 'trackback.admin.inc'
  );

  // Tabs:
  $items['admin/content/trackback/list'] = array(
    'title' => 'List',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10
  );

  // Subtabs:
  $items['admin/content/trackback/list/new'] = array(
    'title' => 'Published trackbacks',
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10
  );
  $items['admin/content/trackback/list/approval'] = array(
    'title' => 'Approval queue',
    'page arguments' => array('trackback_admin_overview', 'approval'),
    'access arguments' => array('administer trackbacks'),
    'type' => MENU_LOCAL_TASK
  );
  $items['admin/content/trackback/list/spam'] = array(
    'title' => 'Spam',
    'page arguments' => array('trackback_admin_overview', 'spam'),
    'access callback' => '_trackback_spam_access',
    'weight' => 10,
    'type' => MENU_LOCAL_TASK
  );
  $items['admin/content/trackback/settings'] = array(
    'title' => 'Settings',
    'page arguments' => array('trackback_configure'),
    'access arguments' => array('administer trackbacks'),
    'weight' => 10,
    'type' => MENU_LOCAL_TASK
  );

  // Other stuff:
  $items['trackback/%node'] = array(
    'title' => 'Trackbacks',
    'page callback' => 'trackback_page',
    'page arguments' => array(1),
    'access callback' => '_trackback_access',
    'access arguments' => array('receive', 1),
    'type' => MENU_CALLBACK,
    'file' => 'trackback.ping.inc'
  );
  $items['trackback/edit/%trackback'] = array(
    'title' => 'Moderate trackback',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('trackback_edit', 2),
    'access callback' => '_trackback_access',
    'access arguments' => array('edit', NULL, 2),
    'type' => MENU_CALLBACK,
    'file' => 'trackback.admin.inc'
  );
  $items['trackback/delete/%trackback'] = array(
    'title' => 'Delete trackback',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('trackback_delete', 2),
    'access callback' => '_trackback_access',
    'access arguments' => array('edit', NULL, 2),
    'type' => MENU_CALLBACK,
    'file' => 'trackback.admin.inc'
  );
  $items['node/%node/trackback'] = array(
    'title' => 'Trackbacks',
    'page callback' => 'trackback_view_page',
    'page arguments' => array(1),
    'access callback' => '_trackback_access',
    'access arguments' => array('page', 1),
    'weight' => 2,
    'type' => MENU_LOCAL_TASK
  );
  return $items;
}

/**
 * hook_perm() callback
 */
function trackback_perm() {
  return array(
    'administer trackbacks',
    'change node trackback setting',
  );
}

function _trackback_access($op, $node, $trackback = NULL) {
  switch ($op) {
    case 'page':
      return isset($node->can_receive) && variable_get('trackback_view', 0) == 1 && node_access('view', $node) && db_result(db_query('SELECT count(*) FROM {trackback_received} WHERE nid=%d AND status=1', $node->nid));
    case 'edit':
      if (user_access('administer trackbacks')) {
        return TRUE;
      }
      if (empty($node) && !empty($trackback->nid)) {
        $node = node_load($trackback->nid);
      }
      return node_access('update', $node);
    case 'receive':
      return !empty($node->can_receive) && node_access('view', $node);
  }
}

function _trackback_spam_access() {
  return TRACKBACK_WITH_SPAM && user_access('administer trackbacks');
}

function trackback_load($trid) {
  return db_fetch_object(db_query('SELECT * FROM {trackback_received} WHERE trid=%d', $trid));
}

function trackback_view_page($node) {
  drupal_set_title(check_plain($node->title));
  return trackback_render($node);
}

/**
 * hook_cron() callback
 */
function trackback_cron() {
  // query for all nodes where
  $result = db_query('SELECT t.nid, n.status FROM {trackback_node} t INNER JOIN {node} n ON t.nid = n.nid WHERE t.awaiting_cron = 1');

  while ($node = db_fetch_object($result)) {
    // First things first, let's unset the 'awaiting_cron' bit in the {trackback_node} table.
    db_query('UPDATE {trackback_node} SET awaiting_cron = 0 WHERE nid = %d', $node->nid);
    if ($node->status) {
      module_load_include('inc', 'trackback', 'trackback.ping');
      $node = node_load($node->nid);
      _trackback_ping($node, trackback_urls_via_nodebody($node));
    }
  }
}

/**
 * hook_block() callback
 */
function trackback_block($op = 'list', $delta = 0, $edit = array()) {
  if ($op == 'list') {
    $blocks[0]['info'] = t('Recent trackbacks');
    if (variable_get('trackback_view', 0) == 2) {
      $blocks[1]['info'] = t('Trackbacks');
      $blocks[1]['cache'] = BLOCK_CACHE_PER_PAGE | BLOCK_CACHE_PER_ROLE;
    }
    return $blocks;
  }

  switch ($delta) {
    case 0:
      switch ($op) {
        case 'configure':
          $form['trackback_display_number'] = array(
            '#type' => 'select',
            '#title' => t('Number of trackbacks to display'),
            '#default_value' => variable_get('trackback_display_number', 10),
            '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)),
            '#description' => t('How many trackbacks are displayed in the recent trackbacks block')
          );
          return $form;
          break;

        case 'save':
          variable_set('trackback_display_number', $edit['trackback_display_number']);
          break;

        case 'view':
          $result = db_query_range('SELECT * FROM {trackback_received} WHERE status=1 ORDER BY created DESC', 0, variable_get('trackback_display_number', 10));
          $items = array();
          while ($tb = db_fetch_object($result)) {
            $items[] = _trackback_path($tb, truncate_utf8($tb->subject, 128, FALSE, TRUE)) .'<br />'. t('%time ago', array('%time' => format_interval(time() - $tb->created)));
          }
          $block['subject'] = t('Recent trackbacks');
          $block['content'] = theme('item_list', $items);
          return $block;
          break;
      }
      break;
    case 1:
      switch ($op) {
        case 'configure':
          $form['trackback_block' . $delta . '_display_url'] = array(
            '#type' => 'checkbox',
            '#title' => t('Display Trackback-URL in block'),
            '#default_value' => variable_get('trackback_block' . $delta . '_display_url', 0),
          );
          return $form;
          break;
          
        case 'save':
          variable_set('trackback_block' . $delta . '_display_url', $edit['trackback_block' . $delta . '_display_url']);
          break;
        
        case 'view':
          if (variable_get('trackback_view', 0) == 2 && arg(0) == 'node' && is_numeric(arg(1)) && is_null(arg(2))) {
            $node = node_load(arg(1));
            if (isset($node->can_receive) && node_access('view', $node)) {
              $block['content'] = trackback_render($node);
              if (variable_get('trackback_block' . $delta . '_display_url', 0) == 1) {
                $attributes = array(
                  'class' => 'trackback-url',
                  'title' => t('Trackback URL for "%nodetitle"', array('%nodetitle' => $node->title))
                );  
                $block['content'] .= l(t('Trackback URL'), _trackback_get_url($node), array('attributes' => $attributes));
              }
            }
            $block['subject'] = t('Trackbacks');
            return $block;
          }
          break;
      }
      break;
  }
}

function _trackback_valid_url($url) {
  $uc = '[a-z0-9;/?:@&=+$,_.!~*\'()%-]';
  return preg_match('`^(http|https)://'. $uc .'+(#'. $uc .'*)?$`i', $url);
}

/**
 * Code that adds configurability for trackback features by node type
 */
function _trackback_node_type($type) {
  static $types = array('story', 'forum', 'blog');
  return variable_get('trackback_'. $type, in_array($type, $types) ? 1 : 0);
}

function _trackback_path($obj, $text = NULL, $opt = array()) {
  static $prefix;

  if (!isset($prefix)) {
    $prefix = variable_get('trackback_view', 0) == 1 ? '/trackback' : '';
  }
  if (!isset($text)) {
    return 'node/'. $obj->nid . $prefix;
  }
  if ($obj->status) {
    $opt += array('fragment' => 'trackback-'. $obj->trid);
    return l($text, 'node/'. $obj->nid . $prefix, $opt);
  }
  return l($text, 'trackback/edit/'. $obj->trid, $opt);
}

function _trackback_build_content($node, $teaser = FALSE) {
  unset($node->can_receive);
  return node_build_content($node, $teaser);
}

function _trackback_operation($action, $trackback, $clear = TRUE) {
  if (is_numeric($trackback)) {
    $trackback = trackback_load($trackback);
  }
  if ($trackback) {
    switch ($action) {
      case 'publish':
        db_query('UPDATE {trackback_received} SET status=1 WHERE trid=%d', $trackback->trid);
        $trackback->status = 1;
        trackback_invoke_trackback($trackback, $action);
        watchdog('trackback', 'Published trackback %subject.', array('%subject' => $trackback->subject), WATCHDOG_NOTICE, _trackback_path($trackback, t('view')));
        break;

      case 'unpublish':
        db_query('UPDATE {trackback_received} SET status=0 WHERE trid=%d', $trackback->trid);
        $trackback->status = 0;
        trackback_invoke_trackback($trackback, $action);
        watchdog('trackback', 'Unpublished trackback %subject.', array('%subject' => $trackback->subject), WATCHDOG_NOTICE, _trackback_path($trackback, t('view')));
        break;

      case 'delete':
        db_query('DELETE FROM {trackback_received} WHERE trid=%d', $trackback->trid);
        trackback_invoke_trackback($trackback, $action);
        watchdog('trackback', 'Deleted trackback %subject. The trackback was posted to !link.', array('%subject' => $trackback->subject, '!link' => l(url('node/'. $trackback->nid, array('absolute' => TRUE)), 'node/'. $trackback->nid)));
        break;

      default:
        $action($trackback);
        break;
    }
    if ($clear) {
      cache_clear_all();
    }
  }
  return $trackback;
}