Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Diff of /branches/2.5.4/cgi-bin/yabb2/Sources/Search.pm [r1087] .. [r1088] Maximize Restore

  Switch to side-by-side view

--- a/branches/2.5.4/cgi-bin/yabb2/Sources/Search.pm
+++ b/branches/2.5.4/cgi-bin/yabb2/Sources/Search.pm
@@ -1,6 +1,6 @@
 ###############################################################################
 # Search.pm                                                                   #
-# $Date: 2013-06-25 15:33:13 +0000 (Tue, 25 Jun 2013) $
+# $Date: 2013-07-12 15:49:28 +0000 (Fri, 12 Jul 2013) $
 ###############################################################################
 # YaBB: Yet another Bulletin Board                                            #
 # Open-Source Community Software for Webmasters                               #
@@ -14,7 +14,7 @@
 ###############################################################################
 our $VERSION = '2.5.4';
 
-$searchpmver = 'YaBB 2.5.4 $Revision: 1081 $';
+$searchpmver = 'YaBB 2.5.4 $Revision: 1088 $';
 if ( $action eq 'detailedversion' ) { return 1; }
 
 LoadLanguage('Search');
@@ -292,7 +292,6 @@
 
     $yytitle      = $search_txt{'183'};
     $yynavigation = qq~› $search_txt{'182'}~;
-    $yyjsstyle = 1;    
     template();
     return;
 }
@@ -563,8 +562,23 @@
                 ## Search for IP Address start
                 if ( $search_ip && !$msgfound && !$subfound ) {
                     $ipfound = 0;
-                    if ( $mip =~ /\b$search_ip/sm ) {
-                        $ipfound = '1';
+                    @mip = split / /sm, $mip;
+                    $mip = q~~;
+                    $mip_class = q~~;
+                    foreach (@mip) {
+                        if ( $_ =~ /\b$search_ip/sm ) {
+                            $ipfound = 1;
+                        }
+                        if ($ipLookup) {
+                            if ( $_ =~ /\b$search_ip/sm ) {
+                                $mip_class = ' highlight';
+                            }
+                            $mip .=
+qq~<a href="$scripturl?action=iplookup;ip=$_"><span class="small$mip_class">$_</span></a> ~;
+                        }
+          		else {
+                            $mip .= qq~<span class="small$mip_class">$_</span> ~;
+                        }
                     }
                 }
                 ## Search for IP Address end
@@ -625,7 +639,7 @@
         $message = Censor($message);
         $msub    = Censor($msub);
 
-        Highlight( \$msub, \$message, \$mip, \@search, $case );
+        Highlight( \$msub, \$message, \@search, $case );
 
         ToChars( $catname{$board} );
         ToChars( $boardname{$board} );
@@ -1062,7 +1076,7 @@
 }
 
 sub Highlight {
-    my ( $msub, $message, $mip, $search, $case ) = @_;
+    my ( $msub, $message, $search, $case ) = @_;
     my $i = 0;
     my @HTMLtags;
     my $HTMLtag = 'HTML';
@@ -1075,61 +1089,22 @@
     foreach my $tmp ( @{$search} ) {
         if ($case) {
             if ( $searchtype == 4 ) {
-                ${$msub} =~ s/(\Q$tmp\E)/<span class="highlight">$1<\/span>/gsm;
-                ${$message} =~
-                  s/(\Q$tmp\E)/<span class="highlight">$1<\/span>/gsm;
-                if ($ipLookup) {
-                    ${$mip} =~
-s/(\Q$tmp\E)/<span class="highlight"><a href="$scripturl?action=iplookup;ip=$1"><span class="small">$1<\/span><\/a><\/span>/gsm;
-                }
-                else {
-                    ${$mip} =~
-                      s/(\Q$tmp\E)/<span class="highlight">$1<\/span>/gsm;
-                }
+                ${$msub}    =~ s/(\Q$tmp\E)/<span class="highlight">$1<\/span>/gsm;
+                ${$message} =~ s/(\Q$tmp\E)/<span class="highlight">$1<\/span>/gsm;
             }
             else {
-                ${$msub} =~
-s/(^|\W|_)(\Q$tmp\E)(?=$|\W|_)/$1<span class="highlight">$2<\/span>$3/gsm;
-                ${$message} =~
-s/(^|\W|_)(\Q$tmp\E)(?=$|\W|_)/$1<span class="highlight">$2<\/span>$3/gsm;
-                if ($ipLookup) {
-                    ${$mip} =~
-s/(^|\W|_)(\Q$tmp\E)(?=$|\W|_)/$1<span class="highlight"><a href="$scripturl?action=iplookup;ip=$2"><span class="small">$2<\/span><\/a><\/span>$3/gsm;
-                }
-                else {
-                    ${$mip} =~
-s/(^|\W|_)(\Q$tmp\E)(?=$|\W|_)/$1<span class="highlight">$2<\/span>$3/gsm;
-                }
+                ${$msub}    =~ s/(^|\W|_)(\Q$tmp\E)(?=$|\W|_)/$1<span class="highlight">$2<\/span>$3/gsm;
+                ${$message} =~ s/(^|\W|_)(\Q$tmp\E)(?=$|\W|_)/$1<span class="highlight">$2<\/span>$3/gsm;
             }
         }
         else {
             if ( $searchtype == 4 ) {
-                ${$msub} =~
-                  s/(\Q$tmp\E)/<span class="highlight">$1<\/span>/igsm;
-                ${$message} =~
-                  s/(\Q$tmp\E)/<span class="highlight">$1<\/span>/igsm;
-                if ($ipLookup) {
-                    ${$mip} =~
-s/(\Q$tmp\E)/<span class="highlight"><a href="$scripturl?action=iplookup;ip=$1"><span class="small">$1<\/span><\/a><\/span>/gsm;
-                }
-                else {
-                    ${$mip} =~
-                      s/(\Q$tmp\E)/<span class="highlight">$1<\/span>/gsm;
-                }
+                ${$msub}    =~ s/(\Q$tmp\E)/<span class="highlight">$1<\/span>/igsm;
+                ${$message} =~ s/(\Q$tmp\E)/<span class="highlight">$1<\/span>/igsm;
             }
             else {
-                ${$msub} =~
-s/(^|\W|_)(\Q$tmp\E)(?=$|\W|_)/$1<span class="highlight">$2<\/span>$3/igsm;
-                ${$message} =~
-s/(^|\W|_)(\Q$tmp\E)(?=$|\W|_)/$1<span class="highlight">$2<\/span>$3/igsm;
-                if ($ipLookup) {
-                    ${$mip} =~
-s/(^|\W|_)(\Q$tmp\E)(?=$|\W|_)/$1<span class="highlight"><a href="$scripturl?action=iplookup;ip=$2"><span class="small">$2<\/span><\/a><\/span>$3/igsm;
-                }
-                else {
-                    ${$mip} =~
-s/(^|\W|_)(\Q$tmp\E)(?=$|\W|_)/$1<span class="highlight">$2<\/span>$3/igsm;
-                }
+                ${$msub}    =~ s/(^|\W|_)(\Q$tmp\E)(?=$|\W|_)/$1<span class="highlight">$2<\/span>$3/igsm;
+                ${$message} =~ s/(^|\W|_)(\Q$tmp\E)(?=$|\W|_)/$1<span class="highlight">$2<\/span>$3/igsm;
             }
         }
     }