[Home]MarksAccumulatedBugFixes

UseModWiki | RecentChanges | Preferences

Description

I review all the bug fixes that I can find and add them into one patch. Not all of them I understand so some I leave out - waiting until they affect me and then I guess I will review it again. Obviously I owe a very special thanks to all the contributors of the patches. --MarkButler

1. Print Link List
2. Requested Links
3. Binmode for Upload
4. Compare Button Fails to Diff
5. Image Extensions Case Sensitive
6. Anchors In Free Link Bug Fix
7. Use Named Anchor In TOC
8. Easy Upload Url
9. Repair use of startform
10. Set a more sensible default for Recent changes
11. Fix for Mixed Lists
12. Fix for Edit Conflict
13. Patch for adding email links
14. Patch for Upload files in CamelCase

1. Print Link List

A fix for PrintLinkList Print Link List so that the links come out correctly. I can't remember where this one came from actually...

2. Requested Links

Fix from here: WikiPatches/RequestedLinks

3. Binmode for Upload

Fix from here: WikiBugs/UploadOnWindowsNeedsBinmode

This is needed for NT installations.

4. Compare Button Fails to Diff

This comes from here: WikiBugs/CompareButtonFailsToDiff

5. Image Extensions Case Sensitive

This comes from here: WikiBugs/ImageExtensionsCaseSensitive

6. Anchors In Free Link Bug Fix

This comes from here: WikiPatches/AnchorsInFreeLinkBugFix

7. Use Named Anchor In TOC

This comes from here: WikiPatches/UseNamedAnchorInTOC

8. Easy Upload Url

This comes from here: WikiPatches/EasyUploadUrl

9. Repair use of startform

$q->startform() adds a CR at the end - addes extra blank line in MSIE replace the function with an explicit header.

10. Set a more sensible default for Recent changes

This should not be zero days as the default.
$daysago = &GetParam("rcdays", 0)  if ($daysago == 0);

11. Fix for Mixed Lists

This comes form here: WikiBugs/MixedList

12. Fix for Edit Conflict

This comes form here: EditConflict Edit Conflict Screen : When using revision number, top Textbox does not show the last saved text by previous author but shows the text of the revision number. When top Textbox shows the last edited text, we will see the last changed content with our current editing text.

13. Patch for adding email links

This comes from here: WikiPatches/AutoMailto OK so this is a patch and not a fix, but it seems the easiest place to add it.

14. Patch for Upload files in CamelCase

The patch here did not work for me: WikiBugs/CamelCaseImageUploadCausesProblemsWithDisplay. So I just moved the upload replacement next to the Early Rules.


Comment


The Mod

--- wiki.1.0.0.pl	Thu Sep 12 10:53:14 2002
+++ wikipatch.MarksAccumulatedBugFixes.pl	Fri Jan 30 15:23:50 2004
@@ -53,7 +53,7 @@
   @IsbnNames @IsbnPre @IsbnPost $EmailFile $FavIcon $RssDays $UserHeader
   $UserBody $StartUID $ParseParas $AuthorFooter $UseUpload $AllUpload
   $UploadDir $UploadUrl $LimitFileUrl $MaintTrimRc $SearchButton 
-  $EditNameLink $UseMetaWiki @ImageSites $BracketImg );
+  $EditNameLink $UseMetaWiki @ImageSites $BracketImg $UseNumberedAnchor);
 # Note: $NotifyDefault is kept because it was a config variable in 0.90
 # Other global variables:
 use vars qw(%Page %Section %Text %InterSite %SaveUrl %SaveNumUrl
@@ -175,6 +175,8 @@
 $EditNameLink = 0;      # 1 = edit links use name (CSS), 0 = '?' links
 $UseMetaWiki  = 0;      # 1 = add MetaWiki search links, 0 = no MW links
 $BracketImg   = 1;      # 1 = [url url.gif] becomes image link, 0 = no img
+$UseNumberedAnchor = 1;	# 1 = use numbered anchor in NumberedHeadings, 
+                        # 0 = cook anchor by canonicalizing text
 
 # Names of sites.  (The first entry is used for the number link.)
 @IsbnNames = ('bn.com', 'amazon.com', 'search');
@@ -301,9 +303,17 @@
       $AnyLetter = "[-,.()' _0-9A-Za-z]";
     }
   }
-  $FreeLinkPattern = "($AnyLetter+)";
+  $FreeLinkPattern = "($AnyLetter+";
   if ($UseSubpage) {
-    $FreeLinkPattern = "((?:(?:$AnyLetter+)?\\/)?$AnyLetter+)";
+    $FreeLinkPattern = "((?:(?:$AnyLetter+)?\\/)?$AnyLetter+";
+  }
+  if ($NamedAnchors)
+  {
+    $FreeLinkPattern .= "(?:#(?:\\w+))?)";
+  }
+  else
+  {
+    $FreeLinkPattern .= ")";
   }
   $FreeLinkPattern .= $QDelim;
   # Url-style links are delimited by one of:
@@ -317,7 +327,7 @@
                   . "prospero|telnet|gopher";
   $UrlProtocols .= '|file'  if ($NetworkFile || !$LimitFileUrl);
   $UrlPattern = "((?:(?:$UrlProtocols):[^\\]\\s\"<>$FS]+)$QDelim)";
-  $ImageExtensions = "(gif|jpg|png|bmp|jpeg)";
+  $ImageExtensions = "(?i)(gif|jpg|png|bmp|jpeg)";
   $RFCPattern = "RFC\\s?(\\d+)";
   $ISBNPattern = "ISBN:?([0-9- xX]{10,})";
   $UploadPattern = "upload:([^\\]\\s\"<>$FS]+)$QDelim";
@@ -620,7 +630,7 @@
     }
   } else {
     $daysago = &GetParam("days", 0);
-    $daysago = &GetParam("rcdays", 0)  if ($daysago == 0);
+    $daysago = &GetParam("rcdays", 10)  if ($daysago == 0);
     if ($daysago) {
       $starttime = $Now - ((24*60*60)*$daysago);
       if ($showHTML) {
@@ -632,6 +642,7 @@
       # Ts('Updates in the last %s days', '');
     }
   }
+  print '<div class=wikitext>';
   if ($starttime == 0) {
     if (0 == $rcType) {
       $starttime = $Now - ((24*60*60)*$RssDays);
@@ -728,6 +739,7 @@
   if ($showHTML) {
     print '<p>' . Ts('Page generated %s', &TimeToText($Now)), "<br>\n";
   }
+  print '</div>';
 }
 
 sub GetRc {
@@ -996,7 +1008,7 @@
       <form action='$ScriptName' METHOD='GET'>
           <input type='hidden' name='action' value='browse'/>
           <input type='hidden' name='diff' value='1'/>
-          <input type='hidden' name='id' value='$id'/>
+          <input type='hidden' name='id' value="$id"/>
       <table border='0' width='100%'><tr>
 EOF
   }
@@ -1157,6 +1169,7 @@
 sub GetPageOrEditAnchoredLink {
   my ($id, $anchor, $name) = @_;
   my (@temp, $exists);
+  my $NamedFreeLink = 0;
 
   if ($name eq "") {
     $name = $id;
@@ -1164,6 +1177,10 @@
       $name =~ s/_/ /g;
     }
   }
+  else
+  {
+    $NamedFreeLink = 1;
+  }
   $id =~ s|^/|$MainPage/|;
   if ($FreeLinks) {
     $id = &FreeToNormal($id);
@@ -1179,7 +1196,7 @@
   }
   if ($exists) {
     $id = "$id#$anchor"  if $anchor;
-    $name = "$name#$anchor"  if $anchor && $NamedAnchors != 2;
+    $name = "$name#$anchor"  if $anchor && $NamedAnchors != 2 && !$NamedFreeLink;
     return &GetPageLinkText($id, $name);
   }
   if ($FreeLinks && !$EditNameLink) {
@@ -1196,7 +1213,8 @@
 
 sub GetPageOrEditLink {
     my ($id, $name) = @_;
-    return &GetPageOrEditAnchoredLink($id, "", $name);
+    my ($link, $anchor) = split( /#/, $id, 2);
+    return &GetPageOrEditAnchoredLink($link, $anchor, $name);
 }
 
 sub GetBackLinksSearchLink {
@@ -1365,7 +1383,7 @@
   $stylesheet = $StyleSheet  if ($stylesheet eq '');
   $stylesheet = ''  if ($stylesheet eq '*');  # Allow removing override
   if ($stylesheet ne '') {
-    $html .= qq(<LINK REL="stylesheet" HREF="$stylesheet">\n);
+    $html .= qq(<LINK REL="stylesheet" HREF="$stylesheet" TYPE="text/css">\n);
   }
   $html .= $UserHeader;
   $bodyExtra = '';
@@ -1465,8 +1483,7 @@
 }
 
 sub GetFormStart {
-  return $q->startform("POST", "$ScriptName",
-                       "application/x-www-form-urlencoded");
+  return "<form NAME='WikiForm' METHOD='POST' ACTION='$ScriptName' ENCTYPE='application/x-www-form-urlencoded'>";
 }
 
 sub GetGotoBar {
@@ -1611,6 +1628,9 @@
     if ($EarlyRules ne '') {
       $_ = &EvalLocalRules($EarlyRules, $_, !$useImage);
     }
+    if ($UseUpload) {
+      s/$UploadPattern/&StoreUpload($1)/geo;
+    }
     s/\[\#(\w+)\]/&StoreHref(" name=\"$1\"")/ge if $NamedAnchors;
     if ($HtmlTags) {
       my ($t);
@@ -1661,9 +1681,6 @@
     }
     s/\b$RFCPattern/&StoreRFC($1)/geo;
     s/\b$ISBNPattern/&StoreISBN($1)/geo;
-    if ($UseUpload) {
-      s/$UploadPattern/&StoreUpload($1)/geo;
-    }
     if ($ThinLine) {
       if ($OldThinLine) {  # Backwards compatible, conflicts with headers
         s/====+/<hr noshade class=wikiline size=2>/g;
@@ -1674,6 +1691,7 @@
     } else {
       s/----+/<hr class=wikiline>/g;
     }
+    s/([A-z0-9-_]+(?:\.[A-z0-9-_]+)*\@[A-z0-9-_]+(?:\.[A-z0-9-_]+)*(?:\.[A-z]{2,})+)/<a href="mailto:$1">$1<\/a>/g;
   }
   if ($doLines) { # 0 = no line-oriented, 1 or 2 = do line-oriented
     # The quote markup patterns avoid overlapping tags (with 5 quotes)
@@ -1736,7 +1754,7 @@
       if (@htmlStack) {  # Non-empty stack
         $oldCode = pop(@htmlStack);
         if ($oldCode ne $code) {
-          $pageHtml .= "</$oldCode><$code>\n";
+          $pageHtml .= "</$oldCode><$code>\n" unless($oldCode=~/OL|UL/ && $code =~ /UL|OL/); # Treat lists equal
         }
         push(@htmlStack, $code);
       }
@@ -1939,7 +1957,7 @@
   my ($url) = @_;
   my ($site, $imagePrefixes);
 
-  $imagePrefixes = 'http:|https:|ftp:';
+  $imagePrefixes = 'http:|https:|ftp:|/|../|./';
   $imagePrefixes .= '|file:'  if (!$LimitFileUrl);
   return 0  unless ($url =~ /^($imagePrefixes).+\.$ImageExtensions$/);
   return 0  if ($url =~ /"/);      # No HTML-breaking quotes allowed
@@ -2116,12 +2134,15 @@
     $text =~ s/\<a\s[^\>]*?\>\?\<\/a\>//si; # No such page syntax
     $text =~ s/\<a\s[^\>]*?\>(.*?)\<\/a\>/$1/si;
     # Cook anchor by canonicalizing $text.
-    $anchor = $text;
-    $anchor =~ s/\<.*?\>//g; 
-    $anchor =~ s/\W/_/g;   
-    $anchor =~ s/__+/_/g;
-    $anchor =~ s/^_//;
-    $anchor =~ s/_$//;
+    if (!$UseNumberedAnchor)
+    {
+        $anchor = $text;
+        $anchor =~ s/\<.*?\>//g; 
+        $anchor =~ s/\W/_/g;   
+        $anchor =~ s/__+/_/g;
+        $anchor =~ s/^_//;
+        $anchor =~ s/_$//;
+    }
     # Last ditch effort
     $anchor = '_' . (join '_', @HeadingNumbers) unless $anchor;
     $TableOfContents .= $number . &ScriptLink("$OpenPageName#$anchor",$text)
@@ -3740,10 +3761,12 @@
   my $pagename;
 
   print "<h2>", Ts('%s pages found:', ($#_ + 1)), "</h2>\n";
+  print '<div class=wikitext>';
   foreach $pagename (@_) {
     print ".... "  if ($pagename =~ m|/|);
     print &GetPageLink($pagename), "<br>\n";
   }
+  print '</div>';
 }
 
 sub DoLinks {
@@ -3777,9 +3800,9 @@
         if ($pgExists{$page}) {
           $link = &GetPageLink($page);
         } else {
-          $link = $page;
+          #$link = $page;
           if ($editlink) {
-            $link .= &GetEditLink($page, "?");
+            $link .= &GetEditLink($page, $page, 1);
           }
         }
       }
@@ -3821,6 +3844,9 @@
     }
     @links = &GetPageLinks($name, $pagelink, $interlink, $urllink);
     foreach $link (@links) {
+      if ( $link =~ /^\// ) {
+        $link = (split('/',$name))[0].$link;
+      }
       $seen{$link}++;
       if (($unique > 0) && ($seen{$link} != 1)) {
         next;
@@ -4930,6 +4956,7 @@
   $filename =~ s/.*[\/\\](.*)/$1/;  # Only name after last \ or /
   $uploadFilehandle = $q->upload('file');
   open UPLOADFILE, ">$UploadDir$filename";
+  binmode UPLOADFILE;
   while (<$uploadFilehandle>) { print UPLOADFILE; }
   close UPLOADFILE;
   print T('The wiki link to your file is:') . "\n<br><BR>";

UseModWiki | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited May 13, 2004 11:20 am by 62.213.86.109 (diff)
Search: