ソースを参照

removed making search results highlighted -- messed up other parsing badly

Luke Ehresman 25 年 前
コミット
b7304a887c
5 ファイル変更20 行追加11 行削除
  1. 0 5
      functions/imap_messages.php
  2. 0 1
      functions/mime.php
  3. 2 0
      functions/strings.php
  4. 16 0
      functions/url_parser.php
  5. 2 5
      src/read_body.php

+ 0 - 5
functions/imap_messages.php

@@ -45,7 +45,6 @@
    }
 	 
    function sqimap_get_small_header ($imap_stream, $id, $sent) {
-      global $where, $what;
 
       fputs ($imap_stream, "a001 FETCH $id BODY.PEEK[HEADER.FIELDS (Date To From Cc Subject Message-Id X-Priority)]\r\n");
       $read = sqimap_read_data ($imap_stream, "a001", true, $response, $message);
@@ -78,10 +77,6 @@
          }
       }
 
-      if ($where == "SUBJECT") {
-         $subject = eregi_replace($what, "<b>\\0</b>", $subject);
-      }
-      
       $header = new small_header;
       if ($sent == true)
          $header->from = $to;

+ 0 - 1
functions/mime.php

@@ -454,7 +454,6 @@
          $body .= "</TD></TR><TR><TD BGCOLOR=\"$color[0]\">";
          $num = 0;
 
-         /** make this recurisve at some point **/
          $body .= formatAttachments ($message, $ent_num, $message->header->mailbox, $id);
          $body .= "</TD></TR></TABLE>";
       }

+ 2 - 0
functions/strings.php

@@ -114,6 +114,8 @@
    }
 
    function translateText($body, $wrap_at, $charset) {
+      global $where, $what; // from searching
+
       if (!isset($url_parser_php)) {
          include "../functions/url_parser.php";
       }

+ 16 - 0
functions/url_parser.php

@@ -11,6 +11,22 @@
    }
 
    function parseEmail ($body) {
+      global $color;
+      /*
+        This is here in case we ever decide to use highlighting of searched
+        text.  this does it for email addresses
+        
+      if ($what && ($where == "BODY" || $where == "TEXT")) {
+         eregi ("([a-z]|[0-9]|_|\.|-)+\@([a-z]|[0-9]|_|-)+(\.([a-z]|[0-9]|_|-)+)*", $body, $regs);
+         $oldaddr = $regs[0];
+         if ($oldaddr) {
+            $newaddr = eregi_replace ($what, "<b><font color=\"$color[2]\">$what</font></font></b>", $oldaddr);
+            $body = str_replace ($oldaddr, "<a href=\"../src/compose.php?send_to=$oldaddr\">$newaddr</a>", $body); 
+         }
+      } else { 
+         $body = eregi_replace ("([a-z]|[0-9]|_|\.|-)+\@([a-z]|[0-9]|_|-)+(\.([a-z]|[0-9]|_|-)+)*", "<a href=\"../src/compose.php?send_to=\\0\">\\0</a>", $body);
+      }
+      */
       $body = eregi_replace ("([a-z]|[0-9]|_|\.|-)+\@([a-z]|[0-9]|_|-)+(\.([a-z]|[0-9]|_|-)+)*", "<a href=\"../src/compose.php?send_to=\\0\">\\0</a>", $body);
       return $body;
    }

+ 2 - 5
src/read_body.php

@@ -317,13 +317,10 @@
    echo "<TABLE COLS=1 CELLSPACING=0 WIDTH=97% BORDER=0 ALIGN=CENTER CELLPADDING=0>\n";
 
    echo "   <TR><TD BGCOLOR=\"$color[4]\" WIDTH=100%>\n";
-   $body = formatBody($imapConnection, $message, $color, $wrap_at);
    echo "<BR>";
+   
+   $body = formatBody($imapConnection, $message, $color, $wrap_at);
 
-   $whatnew = str_replace(" ", "&nbsp;", $what);
-   if ($where == "BODY" || $where == "TEXT") {
-      $body = eregi_replace($whatnew, "<b><font color=\"$color[2]\">\\0</font></b>", $body);
-   }
    echo "$body";
 
    echo "   </TD></TR>\n";