=== modified file 'sites/all/modules/smileys/smileys.module'
--- smileys.module	2010-04-11 00:34:25 +0000
+++ smileys.module	2011-04-20 21:27:41 +0000
@@ -1,6 +1,15 @@
 <?php
 // $Id: smileys.module,v 1.48.2.18 2010/04/07 16:38:51 Gurpartap Exp $
 
+/* According to 'Drupal common practice' the image URL output in node text should
+ * be a relative one. (This a.o. keeps image links consistent over both http and https).
+ * However, this can break image links in RSS feeds in Drupal 6. A solution for this is
+ * to make this module output absolute image URLs.
+ * (Another solution, if you want to make both https and RSS feeds work well,
+ * is to keep the below variable at FALSE and install the pathologic module.)
+ */
+define('SMILEYS_ABSOLUTE_URLS', FALSE);
+
 /**
  * Implementation of hook_help().
  */
@@ -205,10 +214,11 @@ function smileys_table() {
   $header = array(t('Smiley'), t('Acronyms'));
   $rows = array();
   $list = _smileys_list(1, " ORDER BY weight");
+  $base = (SMILEYS_ABSOLUTE_URLS ? $GLOBALS['base_url'] : '') . base_path();
   foreach ($list as $smiley) {
     $acronyms = explode(' ', $smiley->acronyms);
     $rows[] = array(
-      '<img src="'. check_url($GLOBALS['base_url'] .'/'. $smiley->image) .'" alt="'. $acronyms[0] .'" title="'. check_plain($smiley->description) .'" class="smiley-class" />',
+      '<img src="'. check_url($base . $smiley->image) . '" alt="' . $acronyms[0] . '" title="' . check_plain($smiley->description) . '" class="smiley-class" />',
       check_plain($smiley->acronyms)
     );
   }
@@ -275,17 +285,24 @@ function smileys_filter_process($text) {
       }
     }
     else if (!$ignore) {
+      $base = (SMILEYS_ABSOLUTE_URLS ? $GLOBALS['base_url'] : '') . base_path();
       foreach ($list as $smiley) {
         $acronyms = explode(" ", $smiley->acronyms);
         $alt = str_replace('\\', '\\\\', check_plain($smiley->description));
         foreach ($acronyms as $a) {
-          if ($smiley->standalone)
-            $chunk = eregi_replace("([ ,\.\?!:\(\)\r\n\<\>])". preg_quote($a) ."([ ,\.\?!:\(\)\r\n\<\>])", "\\1<img src=\"". check_url($GLOBALS['base_url'] .'/'. $smiley->image) ."\" title=\"". check_plain($alt) ."\" alt=\"". check_plain($alt) ."\" class=\"smiley-content\"/>\\2", $chunk);
-          else
-            $chunk = eregi_replace(preg_quote($a), '<img src="'. check_url($GLOBALS['base_url'] .'/'. $smiley->image) .'" title="'. check_plain($alt) .'" alt="'. check_plain($alt) .'" />', $chunk);
+          if ($smiley->standalone) {
+            // For a discussion on additional unicode white space as smiley
+            // boundaries see http://drupal.org/node/567290#comment-2047730.
+            // Conclusion: If Drupal requires >=PHP-5.1.0 reconsider using
+            // unicode PCRE like "\p{Zs}".
+            $chunk = preg_replace("/(?<=&nbsp;|\xC2\xA0|[ ,\.\?!:\(\)\r\n\<\>])". preg_quote($a) ."(?=&nbsp;|\xC2\xA0|[ ,\.\?!:\(\)\r\n\<\>])/i", '<img src="'. check_url($base . $smiley->image) .'" title="'. check_plain($alt) .'" alt="'. check_plain($alt) .'" class="smiley-content" />', $chunk);
+          }
+          else {
+            $chunk = preg_replace('/'. preg_quote($a) .'/i', '<img src="'. check_url($base . $smiley->image) .'" title="'. check_plain($alt) .'" alt="'. check_plain($alt) .'" class="smiley-content" />', $chunk);
+          }
         }
       }
-    }  
+    }
     $output .=  $chunk;
   }
   return $output;

