This is needed for NT installations.
$daysago = &GetParam("rcdays", 0) if ($daysago == 0);
--- 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>";