Index: links.install
===================================================================
--- links.install	(revision 8600)
+++ links.install	(revision 8651)
@@ -68,6 +68,22 @@
   return $ret;
 }
 
+function links_update_6104() {
+  $updates = array();
+  $sql = "SELECT lid, url, link_title FROM {links} WHERE url like 'node/%' ";
+  $result = db_query($sql);
+  if (db_error()) {
+    watchdog("error","links failed on query in links_update_6104()");
+    return -1;
+  }
+  while (is_array($row=db_fetch_array($result))) {
+      $sql = "UPDATE {links} SET link_title='' ";
+      $updates[] = update_sql($sql);
+    
+  }
+  return $updates;
+}
+
 /**
  * Install the initial schema.
  */
Index: links.inc
===================================================================
--- links.inc	(revision 8600)
+++ links.inc	(revision 8651)
@@ -167,6 +167,7 @@
  * very stripped down version of the URL itself as a suggested title.
  */
 function links_suggest_link_title($link_spec, $default="") {
+
   // We order the query by weight and then link title, excluding rows where title is empty.
   $sql = links_get_link_node_query_sql($link_spec, "weight,link_title", FALSE);
   $result = db_query_range($sql, 1, 1);
@@ -175,15 +176,25 @@
     return $default;
   }
   $row = db_fetch_array($result);
-  if (is_array($row) && !empty($row["link_title"])) {
-    return $row["link_title"];
-  }
+
   // At this point, we didn't find anything really good in the database.
   // If the caller specified a default, we'll go with that -- but if not,
   // we still have a few tricks up our sleeve (see below).
   if (! empty($default)) {
     return $default;
-  }
+  } 
+
+  if (is_array($row) && !empty($row["link_title"])) {
+    return $row["link_title"];
+  } 
+
+  // if link is internal link and link title is empty leave it blank
+  if(empty($row["link_title"]) && (links_is_external($link_spec) == FALSE) ) {  
+    $title = FALSE;
+    return $title;
+  } 
+
+  
   // Try mangling the URL to make something halfway friendly...
   $linkrec = links_get_link($link_spec);
   $url = is_array($linkrec) ? $linkrec["url"] : '';
@@ -1164,7 +1175,7 @@
  * is TRUE, returns only one record. $firstonly is provided as a convenience for
  * handling a "goto" URL pattern from the browser that specifies nid but not lid.
  * This is used, among other things, for legacy compatibility with weblink.module.
- */
+ 
 function links_load_links_for_node($nid, $module='links', $lid=0, $firstonly=FALSE, $indexedby = NULL) {
   $links = array();
   if ($lid) {
@@ -1201,8 +1212,75 @@
   }
   return $links;
 }
+*/
 
 /**
+* new function chnages required to related links title display
+*/
+function links_load_links_for_node($nid, $module='links', $lid=0, $firstonly=FALSE, $indexedby = NULL) {
+ 
+  $links = array();
+  if ($lid) {   
+    $sql = "SELECT l.lid, ln.nid, url, url_md5, weight, clicks, module, l.link_title AS link_link_title, ln.link_title AS node_link_title FROM {links_node} ln LEFT JOIN {links} l ON l.lid=ln.lid WHERE ln.nid=%d AND l.lid=%d";
+    if (! empty($module)) {
+      $sql .= " AND module='" . $module . "' ";
+    }
+    $sql .= " ORDER BY weight, l.link_title";
+    $result = db_query($sql, array($nid, $lid));
+  } else {   
+    $sql = "SELECT l.lid, ln.nid, url, url_md5, weight, clicks, module, l.link_title AS link_link_title, ln.link_title AS node_link_title FROM {links_node} ln LEFT JOIN {links} l ON l.lid=ln.lid WHERE ln.nid=%d";
+    if (! empty($module)) {
+      $sql .= " AND module='" . $module . "' ";
+    }
+    $sql .= " ORDER BY weight, l.link_title";
+   
+    $result = db_query($sql, array($nid));
+  }
+  if (db_error($result)) {
+    watchdog("links", "links database error on query: @sql", array('@sql'=>$sql), WATCHDOG_ERROR);
+  } else {
+    while ($row = db_fetch_array($result)) {
+      $row['link_title'] = trim($row['link_title']);
+      $row['link_title'] = trim(empty($row['node_link_title']) ? $row['link_link_title'] : $row['node_link_title']);
+
+      $int_dest_node = drupal_get_normal_path($row['url']);
+
+      // if link is external
+      $link_status_external = links_is_external($row['lid']);
+
+      // if link is internal link & link title is empty get destination node title as link title
+     // if( empty($row['link_title']) && ($link_status_external == FALSE) ) {
+ if( empty($row['link_title']) && ($link_status_external == FALSE) ) {
+        $int_dest_node = drupal_get_normal_path($row['url']);
+       
+        if(preg_match('/node\/[0-9]/',$int_dest_node)){             
+            $exp_dest_node = explode('/',$int_dest_node);
+            $exp_dest_nid = $exp_dest_node[1];
+            $sql_dest_node_title = "SELECT nid,title FROM {node} WHERE nid=%d";
+            $result_dest_node_title = db_query($sql_dest_node_title, array($exp_dest_nid));
+            $row_dest_node_title = db_fetch_array($result_dest_node_title);
+            $row['link_title'] = trim($row_dest_node_title['title']);
+        }
+        
+      }
+
+      if($indexedby){
+        $links[$row[$indexedby]] = $row;
+      } 
+      else {
+        $links[] = $row;
+      }        
+      if ($firstonly) {
+        break;
+      }
+    }
+    
+  }
+
+  return $links;
+}
+
+/**
  * Given a node ID and an optional link ID, goes to either the specified
  * link ID (with click credit to the appropriate {links_node} record) or
  * to the first [or only] link for the specified node, again with appropriate
Index: links_related.module
===================================================================
--- links_related.module	(revision 8600)
+++ links_related.module	(revision 8651)
@@ -346,7 +346,23 @@
  */
 function links_related_form_line($link=NULL) {
   $link = (array)$link;
+  // link title
+  $link_title = $link['link_title'];
 
+  // if link url is node/123..  make title empty 
+
+  if(preg_match('/node\/[0-9]/',$link['url'])) {
+    $destination_node = explode('/',$link['url']);
+    $destination_node_id = $destination_node[1];
+    $sql_dest_node_title = "SELECT nid,title FROM {node} WHERE nid=%d";
+    $result_dest_node_title = db_query($sql_dest_node_title, array($destination_node_id));
+    $row_dest_node_title = db_fetch_array($result_dest_node_title);
+    if($link_title == $row_dest_node_title['title']) {
+      $link_title = '';
+    }
+
+  }        
+
   $entry['url'] = array(
     '#type' => 'textfield',
     '#default_value' => $link['url'],
@@ -355,7 +371,7 @@
 
   $entry['link_title'] = array(
     '#type' => 'textfield',
-    '#default_value' => $link['link_title'],
+    '#default_value' => $link_title,
     '#maxlength' => 255,
   );
 
