8,9d7
<     case 'admin/system/modules/trackback':
<       return t("Trackback can be attached to any node and is treated like comments for all intent and purpose.");
13,24d10
< function trackback_settings() {
<     $output = "";
< 
<     $array_moderate = array(0 => t("No"), 1 => t("Yes"));
<     $output .= form_radios(t("Display Trackback only after approval"), "trackback_moderation", variable_get("trackback_moderation", 0), $array_moderate, t("If yes, all trackback must be moderated before it can be seen by others."));
< 
<     $array_moderate = array(0 => t("No"), 1 => t("Yes"));
<     $output .= form_radios(t("Trackback autodiscovery"), "trackback_autodiscovery", variable_get("trackback_autodiscovery", 1), $array_moderate, t("If yes, any external links will be extracted and the appropriate sites will be sent a Trackback ping. Take note it might slowdown your posting esp. if there is a lot of external links."));
< 
<     return $output;
< }
< 
37,86c23,28
<   $node->toping = ""; # Start from scratch
< 
<   $tb_urls = $node->tb_url;
<   if (variable_get("trackback_autodiscovery",1)) {
<     $text = $node->body; 
<     if ($node->type == 'blog')
<       $text .= " ".$node->extended." ".$node->excerpt;
<     preg_match_all("|http://[\w\.\-\+\&\+\=\/\#\%]+|",$text,$murl);
<     $links = array_unique($murl[0]);
<     foreach ($links as $url) {
<       $result = drupal_http($url);
<       $result->data = preg_replace("/[\n\r]/"," ",$result->data);
<       $tb = preg_replace("/.*<rdf\:RDF.*trackback\:ping\=\"([^\"]+)\".*<\/rdf\:RDF>.*/","\\1",$result->data);
<       $tb_urls .= " ".$tb;
<     }
<   }
< 
<   $urls = preg_split("/\s+/",$tb_urls);
<   foreach($urls as $url) {
<     # No need to ping empty URL
<     if (strlen($url)<=0) continue;
< 
<     # Do not ping those already ping'ed unless explicitly specified 
<     if (strstr($node->pinged,$url) && !strstr($node->tb_url,$url)) continue;
< 
<     $result = drupal_http(
<         $url,
<         $headers = array("Content-Type" => "application/x-www-form-urlencoded"),
<         "POST",
<         implode("&", $str)
<     );
< 
<     if (strlen(trim($result->error))>0) {
<       drupal_set_message("Error! Unable to send Trackback ping to ".$url);
<       if (!strstr($node->toping,$url))
<         $node->toping .= "\n".$url; $node->toping = trim($node->toping);
<     } else {
<       drupal_set_message("Success! Trackback ping send to ".$url);
<       if (!strstr($node->pinged,$url))
<         $node->pinged .= "\n".$url; $node->pinged = trim($node->pinged);
<     }
<   }
< 
<   $c = db_result(
<     db_query("SELECT COUNT(nid) FROM {tb} WHERE nid = %d", $node->nid));
< 
<   if ($c>0) 
<       trackback_update($node);
<   else 
<       trackback_insert($node);
---
>   return drupal_http(
>     $node->tb_url,
>     $headers = array("Content-Type" => "application/x-www-form-urlencoded"),
>     "POST",
>     implode("&", $str)
>   );
101,103d42
<     $anon = serialize(array(
<             'anon_name' => trim(strip_tags($trackback->name)),
<             'anon_url' => trim(strip_tags($trackback->url))));
106,107c45,46
<     db_query("INSERT INTO comments (cid, nid, pid, uid, subject, comment, hostname, timestamp, status, score, anon, thread) VALUES (%d, %d, %d, %d, '%s', '%s', '%s', %d, %d, %d, '%s', '%s')",
<              $cid, $node->nid, 0, 0, $subject, $comment, getenv("REMOTE_ADDR"), time(), variable_get("trackback_moderation", 0), 0, $anon, $thread);
---
>     db_query("INSERT INTO comments (cid, nid, pid, uid, subject, comment, hostname, timestamp, status, score, users, thread) VALUES (%d, %d, %d, %d, '%s', '%s', '%s', %d, %d, %d, '%s', '%d/')",
>              $cid, $node->nid, 0, 0, $subject, $comment, getenv("REMOTE_ADDR"), time(), 0, 0, '', $thread);
127,158c66,72
<     global $base_url;
< 
<     if (arg(1) == "url" && is_numeric(arg(2)) 
<         && $node = node_load(array("nid" => arg(2)))) {
<         $output = t("<p>The Trackback URL for node is:<br/><blockquote>url</blockquote></p>",
<                     array("node" => l("'$node->title'","node/view/$node->nid"),
<                           "url" => l($base_url . "/" . url("trackback/$node->nid"),
<                             "trackback/$node->nid")));
< 
<         if (user_access("administer nodes")) {
<           $node = trackback_load_node($node);
<           $urls = preg_split("/\s+/",$node->pinged);
<           $head = 0;
<           foreach ($urls as $url) {
<             if (strlen(trim($url))<=0) continue;
<             if ($head == 0) {
<               $output .=  "<p>".
<                 t("Trackback pings have been sent to the following URLs:");
<               $head = 1;
<             }
<             $output .= "<li>$url</li>\n";
<           }
<           if ($head) $output .= "</p>";
<         }
< 
<         print theme('page', $output, t("Trackback URL"));
<     } elseif (is_numeric(arg(1)) && $node = node_load(array("nid" => arg(1)))) {
<         header("Content-Type: text/xml");
<         print trackback_receive($node);
<     } else {
<         drupal_goto();
<     }
---
>   if (is_numeric(arg(1)) && $node = node_load(array("nid" => arg(1)))) {
>     header("Content-Type: text/xml");
>     print trackback_receive($node);
>   }
>   else {
>     drupal_goto();
>   }
162d75
<   $node = trackback_load_node($node);
165,166c78
<       $node->tb_url = $node->toping;
<       return form_textarea(t("Trackback URL"), "tb_url", $node->tb_url, 70, 3, t("Enter URLs to send the trackback to."));
---
>       return form_textfield(t("Trackback URL"), "tb_url", $node->tb_url, 40, 255, t("Enter a URL to send the trackback to."));
169,170c81
<       if ($node->nid 
<         && ($node->tb_url || variable_get("trackback_autodiscovery",1)))
---
>       if ($node->tb_url && $node->nid) {
171a83
>       }
175,200d86
< function trackback_insert($node) {
<   db_query("INSERT INTO tb (pinged, toping, nid) VALUES ('%s', '%s', %d)",
<     $node->pinged, $node->toping, $node->nid);
< }
< 
< function trackback_update($node) {
<   db_query("UPDATE {tb} SET pinged = '%s', toping = '%s' WHERE nid = %d",
<     $node->pinged, $node->toping, $node->nid);
< }
< 
< function trackback_delete(&$node) {
<   db_query("DELETE FROM {tb} WHERE nid = %d", $node->nid);
< }
< 
< function trackback_load($node) {
<   return db_fetch_object(db_query("SELECT pinged, toping FROM {tb} WHERE nid = %d", $node->nid));
< }
< 
< function trackback_load_node($node) {
<   if ($result = trackback_load($node)) {
<     foreach ($result as $key => $value)
<       $node->$key = $value;
<   }
<   return $node;
< }
< 
202d87
<   global $base_url;
207c92
<     $link = l(t("trackback url"), "trackback/url/$node->nid");
---
>     $link = l(t("trackback url"), "trackback/$node->nid");
209,210c94,95
<       $url = $base_url . "/" . url("node/view/$node->nid");
<       $tb_url = $base_url . "/" . url("trackback/$node->nid");
---
>       $url = url("node/view/$node->nid");
>       $tb_url = url("trackback/$node->nid");
339c224
< ?>
---
> ?>
