--- spam_filter_url.module	2012-01-04 11:10:04.413063479 +0100
+++ spam_filter_url.neu.module	2012-01-04 11:49:29.612062800 +0100
@@ -10,14 +10,20 @@
 
 function spam_filter_url_spamapi($op, $type = NULL, $content = array(), $fields = array(), $extra = NULL) {
   // Don't both with this hook unless the filter is actually enabled.
-
   switch ($op) {
     case 'filter':
-      if (!module_invoke('spam', 'filter_enabled', 'spam_filter_url', $type, $content, $fields, $extra)) return;
-      return spam_filter_url_spam_filter($content, $type, $fields, $extra);
+      if (!module_invoke('spam', 'filter_enabled', 'spam_filter_url', $type, $content, $fields, $extra)) {
+		return;
+	}
+	else {
+      		return spam_filter_url_spam_filter($content, $type, $fields, $extra);
+	}
+	break;
 
     case 'filter_module':
-      return 'spam_filter_url';
+	db_query("INSERT INTO {test} (test) VALUES('3')");
+    	return 'spam_filter_url';
+	break;
 
     case 'filter_info':
       return array(
@@ -44,72 +50,81 @@ function spam_filter_url_spamapi($op, $t
       spam_filter_url_update($spam_filter_urls, ($op == 'mark_as_spam' ? TRUE : FALSE), $type, $extra['id']);
       break;
   }
+
 }
 
 function _spam_filter_url_extract($content, $type, $fields, $extra = array()) {
   static $spam_filter_urls = array();
+
   $id = spam_invoke_module($type, 'content_id', $content, $extra);
 
   if (is_object($content)) {
-    $content = (array)$content;
+	$content = (array)$content;
+	
+	if (!isset($spam_filter_urls["$type-$id"])) {
+		$string = '';
+		if (isset($fields['main']) && is_array($fields['main'])) {
+			foreach ($fields['main'] as $field) {
+				$string .= $content["$field"] .' ';
+			}
+		}
+		if (isset($fields['other']) && is_array($fields['other'])) {
+			foreach ($fields['other'] as $field) {
+				$string .= $content["$field"] .' ';
+			}
+		}
+		
+		$URI = "(http://|https://|ftp://|mailto:|smb://|afp://|file://|gopher://|news://|ssl://|sslv2://|sslv3://|tls://|tcp://|udp://)";
+		
+		preg_match_all('('.$URI.'([a-zA-Z0-9@:%_+*~#?&=.,/;-]*[a-zA-Z0-9@:%_+*~#&=/;-]))', $string, $matches_absolute);
+		preg_match_all('([^'.$URI.']www\.([a-zA-Z0-9@:%_+*~#?&=.,/;-]*[a-zA-Z0-9@:%_+*~#&=/;-]))', $string, $matches_www);
+	
+		$matches = array_merge($matches_absolute[2], $matches_www[0]);
+				
+		$u = array();
+		foreach ($matches as $spam_filter_url) {
+		
+			$spam_filter_url = preg_replace("'$URI'", '', $spam_filter_url);
+			// get full domain (ie www.sample.com)
+			preg_match("/^()?([^\/\"\']+)/i", $spam_filter_url, $domain);
+			// get root domain (ie sample.com)
+			preg_match("/[^\.\/]+\.[^\.\/]+$/", $domain[2], $root);
+			
+			$spam_filter_url = htmlspecialchars(drupal_strtolower($root[0]));
+			_spam_filter_url_count($spam_filter_url);
+			$u[] = $spam_filter_url;
+		}
+		$spam_filter_urls["$type-$id"] = $u;
+	}
+	
+	return $spam_filter_urls["$type-$id"];
   }
-
-  if (!isset($spam_filter_urls["$type-$id"])) {
-    $string = '';
-    if (isset($fields['main']) && is_array($fields['main'])) {
-      foreach ($fields['main'] as $field) {
-        $string .= $content["$field"] .' ';
-      }
-    }
-    if (isset($fields['other']) && is_array($fields['other'])) {
-      foreach ($fields['other'] as $field) {
-        $string .= $content["$field"] .' ';
-      }
-    }
-
-    $URI = "(http://|https://|ftp://|mailto:|smb://|afp://|file://|gopher://|news://|ssl://|sslv2://|sslv3://|tls://|tcp://|udp://)";
-    // Find all urls in content. Code based on _filter_url().
-    // Match absolute URLs.
-    preg_match_all("`(<p>|<li>|<br\s*/?>|[ \n\r\t\(])($URI([a-zA-Z0-9@:%_+*~#?&=.,/;-]*[a-zA-Z0-9@:%_+*~#&=/;-]))([.,?!]*?)(?=(</p>|</li>|<br\s*/?>|[ \n\r\t\)]))`i", $string, $matches_absolute);
-    // Match e-mail addresses.
-    preg_match_all("`(<p>|<li>|<br\s*/?>|[ \n\r\t\(])([A-Za-z0-9._-]+@[A-Za-z0-9._+-]+\.[A-Za-z]{2,4})([.,?!]*?)(?=(</p>|</li>|<br\s*/?>|[ \n\r\t\)]))`i", $string, $matches_email);
-    // Match www domains/addresses.
-    preg_match_all("`(<p>|<li>|[ \n\r\t\(])(www\.[a-zA-Z0-9@:%_+*~#?&=.,/;-]*[a-zA-Z0-9@:%_+~#\&=/;-])([.,?!]*?)(?=(</p>|</li>|<br\s*/?>|[ \n\r\t\)]))`i", $string, $matches_www);
-    $matches = array_merge($matches_absolute[2], $matches_email[2], $matches_www[2]);
-    $u = array();
-    foreach ($matches as $spam_filter_url) {
-      $spam_filter_url = preg_replace("'$URI'", '', $spam_filter_url);
-      // get full domain (ie www.sample.com)
-      preg_match("/^()?([^\/\"\']+)/i", $spam_filter_url, $domain);
-      // get root domain (ie sample.com)
-      preg_match("/[^\.\/]+\.[^\.\/]+$/", $domain[2], $root);
-      $spam_filter_url = htmlspecialchars(drupal_strtolower($root[0]));
-      _spam_filter_url_count($spam_filter_url);
-      $u[] = $spam_filter_url;
-    }
-    $spam_filter_urls["$type-$id"] = $u;
+  else {
+	return $spam_filter_urls;
   }
-
-  return $spam_filter_urls["$type-$id"];
 }
 
 /**
  * Search for known spam urls in content.
  */
 function spam_filter_url_spam_filter($content, $type, $fields, $extra = array(), $filter_test = FALSE) {
-  $action = array();
+ 
+ $action = array();
 
   $id = spam_invoke_module($type, 'content_id', $content, $extra);
   $spam = FALSE;
 
+
   $spam_filter_urls = _spam_filter_url_extract($content, $type, $fields, $extra);
-  
+
   $probability = variable_get('spam_filter_url_probability', 99);
 
   if (is_array($spam_filter_urls) && !empty($spam_filter_urls)) {
+
     $count = _spam_filter_url_count();
 
     $limit = variable_get('spam_filter_url_limit_total', 10);
+
     if ($limit > -1 && $count['total'] > $limit) {
       spam_log(SPAM_VERBOSE, 'spam_filter_url_spam_filter', t('total urls(@total) > spam_filter_url_limit_total(@limit)', array('@total' => $count['total'], '@limit' => variable_get('spam_filter_url_limit_total', 10))), $type, $id);
       $action['spam_filter_url'][] = array(
