--- relatedlinks.module.orig 2008-05-09 01:23:59.000000000 -0500 +++ relatedlinks.module 2008-11-22 17:02:39.000000000 -0600 @@ -780,13 +780,36 @@ $url_cache = array(); foreach ($links as $link) { - if (!in_array($link['url'], $url_cache)) { + // kjh: don't load mailto urls + if (!in_array($link['url'], $url_cache) + && !preg_match('/^mailto:/i', $link['url'])) { if (empty($link['title'])) { // URLs without a title display the URL. $link['title'] = $link['url']; } + $url_cache[] = $link['url']; - $urls[] = ''. check_plain($link['title']) .''; + + // kjh: use some ideas from remove_nonviewable_menu_items to remove + // related links that we don't have permission to view + if (preg_match('|^/|', $link['url'])) { + $path = substr($link['url'], 1); + $normal_path = drupal_get_normal_path($path); + + //echo "
path: $path, normal_path: " 
+	  //    . drupal_get_normal_path($path)."
"; + if (substr($normal_path, 0, 5) == 'node/') { + if(is_numeric(substr($normal_path, 5))) { + $nid = substr($normal_path, 5); + $node = node_load($nid); + if (node_access("view", $node)) { + // User can view this node. + $urls[] = '' + . check_plain($link['title']) .''; + } + } + } + } } } @@ -920,7 +943,9 @@ // Check URLs for duplicates. foreach ($url_matches as $index => $url) { $url = rtrim($url, '/ '); - if (!in_array($url, $urls)) { + if (!in_array($url, $urls) + /* kjh: filter out links */ + /*&& (preg_match("/^