Index: trunk/CHANGELOG
===================================================================
--- trunk/CHANGELOG	(revision 848)
+++ trunk/CHANGELOG	(revision 849)
@@ -10,10 +10,12 @@
 # = Bugfix
 ! = Update/Change
 
-------------------------------------- 2.7.1 -------------------------------------
-22-Jun-2008 Thomas Hornik
-# fixed issue with captcha (mt_rand() instead of rand())
-# fixed bug in search (link to http://.../search/index.php performs a search with string 'unset')
+------------------------------------- 2.7.1 -------------------------------------
+28-June-2008 Christian Sommer
+!	class and id attributes in mailto links are no longer ignored by the output filter
+22-Jun-2008 Thomas Hornik
+#	fixed issue with captcha (mt_rand() instead of rand())
+#	fixed bug in search (link to http://.../search/index.php performs a search with string 'unset')
 22-June-2008 Christian Sommer
 !	added output of block number to section admin if no block name is specified
 21-June-2008 Christian Sommer
Index: trunk/wb/modules/output_filter/filter-routines.php
===================================================================
--- trunk/wb/modules/output_filter/filter-routines.php	(revision 848)
+++ trunk/wb/modules/output_filter/filter-routines.php	(revision 849)
@@ -74,12 +74,12 @@
 		
 		// check if mailto mail addresses needs to be filtered
 		if($filter_settings['mailto_filter'] == '1') {
-			$output_filter_mode = $output_filter_mode + 2;														// 0|2
+			$output_filter_mode = $output_filter_mode + 2;								// 0|2
 						
 			// check if Javascript mailto encryption is enabled (call register_frontend_functions in the template)
 			$search = '<script type="text/javascript" src="' .WB_URL .'/modules/output_filter/js/mdcr.js"></script>';
 			if(strpos($content, $search) !== false) { 
-				$output_filter_mode = $output_filter_mode + 4;													// 0|4
+				$output_filter_mode = $output_filter_mode + 4;							// 0|4
 			}
 		}
 		
@@ -95,10 +95,10 @@
 		/*
 		Sub 1:\b(<a.[^<]*href\s*?=\s*?"\s*?mailto\s*?:\s*?)			-->	"<a id="yyy" class="xxx" href = " mailto :" ignoring white spaces
 		Sub 2:([A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4})			-->	the email address in the mailto: part of the mail link
-		Sub 3:([^"]*?)"																					--> possible ?Subject&cc... stuff attached to the mail address
-		Sub 4:([^>]*>)																					--> all class or id statements after the mailto but before closing ..>
-		Sub 5:(.*?)</a>\b																				--> the mailto text; all characters between >xxxxx</a>
-		Sub 6:|\b([A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4})\b	--> email addresses which may appear in the text (require word boundaries)
+		Sub 3:([^"]*?)"												--> possible ?Subject&cc... stuff attached to the mail address
+		Sub 4:([^>]*>)												--> all class or id statements after the mailto but before closing ..>
+		Sub 5:(.*?)</a>\b											--> the mailto text; all characters between >xxxxx</a>
+		Sub 6:|\b([A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4})\b		--> email addresses which may appear in the text (require word boundaries)
 		*/
 			
 		// find all email addresses embedded in the content and filter them using a callback function
@@ -154,7 +154,13 @@
 			// check if Javascript encryption routine is enabled
 			if(in_array(OUTPUT_FILTER_MODE, array(6,7))) {
 				/** USE JAVASCRIPT ENCRYPTION FOR MAILTO LINKS **/
-
+				
+				// extract possible class and id attribute from ahref link
+				preg_match('/class\s*?=\s*?("|\')(.*?)\1/ix', $match[0], $class_attr);
+				$class_attr = empty($class_attr) ? '' : 'class="' . $class_attr[2] . '" ';
+				preg_match('/id\s*?=\s*?("|\')(.*?)\1/ix', $match[0], $id_attr);
+				$id_attr = empty($id_attr) ? '' : 'id="' . $id_attr[2] . '" ';
+				
 				// preprocess mailto link parts for further usage
 				$search = array('@', '.', '_', '-'); $replace = array('F', 'Z', 'X', 'K');
 				$email_address = str_replace($search, $replace, strtolower($match[2]));
@@ -165,11 +171,11 @@
 				$shift = mt_rand(1, 25);
 				
 				// encrypt the email using an adapted Caesar cipher
-		  	$encrypted_email = "";
+		  		$encrypted_email = "";
 				for($i = strlen($email_address) -1; $i > -1; $i--) {
 					if(preg_match('#[FZXK0-9]#', $email_address[$i], $characters)) {
 						$encrypted_email .= $email_address[$i];
-					} else {
+					} else {	
 						$encrypted_email .= chr((ord($email_address[$i]) -97 + $shift) % 26 + 97);
 					}
 				}
@@ -176,7 +182,7 @@
 				$encrypted_email .= chr($shift + 97);
 
 				// build the encrypted Javascript mailto link
-				$mailto_link  = "<a href=\"javascript:mdcr('$encrypted_email','$email_subject')\">" .$match[5] ."</a>";
+				$mailto_link  = "<a {$class_attr}{$id_attr}href=\"javascript:mdcr('$encrypted_email','$email_subject')\">" .$match[5] ."</a>";
 				
 				return $mailto_link;	
 
