29 Commits

Author SHA1 Message Date
Markus Lude
073748c0ca some preparations for 1.0.3: bump version 2016-10-25 19:26:06 +02:00
Markus Lude
920c918c15 typo 2016-10-25 19:23:59 +02:00
Markus Lude
ff1a3762b1 fix WikiBugs/UrlEncoding
fix contributed by StefanTrcek
2016-10-25 19:23:16 +02:00
Markus Lude
2ae7b38813 small fix 2016-10-25 19:21:27 +02:00
Markus Lude
a1cb3d9d76 fixed bug introduced with WikiPatches/XssFix
was already mentioned by Cliff on WikiPatches/XssFixTalk, but missed it somehow
2016-10-25 19:20:06 +02:00
Markus Lude
13c4c7528c added more translation strings 2016-10-25 19:18:21 +02:00
Markus Lude
1f1718b165 fix WikiBugs/MiscTranslation
reported and fix contributed by JuanMtnezPineda (JuanmaMP)
2016-10-25 19:15:14 +02:00
Markus Lude
a70fe404f4 minor tweak 2016-10-25 19:12:59 +02:00
Markus Lude
36ec8e1315 fixed WikiBugs/EmptyTableElements
fix contributed by StefanTrcek
2016-10-25 19:12:10 +02:00
Markus Lude
bebaea5179 fixed WikiBugs/BacklinksMissesSomeFreeLinks
fix contributed by BrianHunter
2016-10-25 19:10:20 +02:00
Markus Lude
677f956db7 reformat different bug names 2016-10-25 19:02:20 +02:00
Markus Lude
e3aa55e96b fixed WikiBugs/AuthenicationFailedNoHeader 2016-10-25 19:01:15 +02:00
Markus Lude
295de1ea38 fixed WikiBugs/IntermapedGifNotInlinedForLink
reported by BrianHunter
2016-10-25 18:58:09 +02:00
Markus Lude
f01d6b2c1a reformat different bug names 2016-10-25 18:56:27 +02:00
Markus Lude
a8c2ccbcbb some preparations for 1.0.2: bump version 2016-10-25 18:50:53 +02:00
Markus Lude
157722644a sort names wiki-like 2016-10-25 18:46:35 +02:00
Markus Lude
2754314be7 fixed WikiBugs/CamelCaseImageUploadCausesProblemsWithDisplay
reported by Ke4roh
fix contributed by ?? with suggestion from DavidClaughton
2016-10-25 18:45:25 +02:00
Markus Lude
650eb5b738 fixed WikiBugs/ImageExtensionsCaseSensitive
aka WikiBugs/UppercaseImageUploadCausesProblemsWithDisplay
reported by TomGries and ??
2016-10-25 18:43:55 +02:00
Markus Lude
fccfe54614 fixed WikiBugs/UploadTranslation
fix contributed by UngarPeter
missed in 349ca3a4c8
2016-10-25 18:39:52 +02:00
Markus Lude
1aefd9bb64 cleanup last fix 2016-10-25 18:35:04 +02:00
Markus Lude
0208201b8d fixed WikiBugs/ActionLinksExistsZeroSubPage aka WikiBugs/RequestedLinks
fix from GyPark and (WikiPatches/RequestedLinks) MikeCastle
2016-10-25 18:30:35 +02:00
Markus Lude
c70790ca85 better use usemod.com mail address 2016-10-25 18:28:45 +02:00
Markus Lude
18d02d4c06 added WikiPatches/RobotsNoFollow
patch contributed by Trent with suggestion by UngarPeter
based on work by TomScanlan and maybe others
2016-10-25 18:27:09 +02:00
Markus Lude
7e6cb67e08 fixed WikiBugs/ClassWikifooterMissing reported by StefanTrcek
was already fixed in c321e01c70
(embed/footer changes)
2016-10-25 18:23:33 +02:00
Markus Lude
349ca3a4c8 fixed WikiBugs/UploadTranslation
fix contributed by UngarPeter
2016-10-25 18:20:21 +02:00
Markus Lude
6d9493aab7 fixed WikiBugs/VariableParseParasYieldsOddOutput reported by StefanTrcek
fix contributed by Trent, simplified
2016-10-25 18:14:59 +02:00
Markus Lude
51a349ea6e add CREDITS and Changelog, sadly forgot this in 1.0.1 2016-10-25 18:08:38 +02:00
Markus Lude
c321e01c70 fixed WikiBugs/ActionEqIndexAndEmbedEqOne reported by StefanTrcek
same problem with other actions and parameter embed
moved CSS class wikilinefooter (for <HR>) inside class wikifooter
2016-10-25 17:47:02 +02:00
Markus Lude
117643908a fixed range which looks wrong to me 2016-10-25 17:46:07 +02:00
6 changed files with 261 additions and 81 deletions

21
CREDITS Normal file
View File

@@ -0,0 +1,21 @@
Users which contributed patches added to versions after 1.0:
* BrianHunter
* Christoph Berg (cb@df7cb.de)
* CliffordAdams
* DavidClaughton
* DavidWall
* GyPark
* JuanMtnezPineda
* MikeCastle
* RichardP
* Robin Rowe (rower@movieeditor.com)
* StefanTrcek
* TomScanlan
* Trent
* UngarPeter
If I've forgotten someone, please leave a note on UseMod:MarkusLude or
send mail to usemod@usemod.com.

62
Changelog Normal file
View File

@@ -0,0 +1,62 @@
Changes for bugfix release 1.0.3 (September 12, 2007):
* fixed bug IntermapedGifNotInlinedForLink
* fixed bug AuthenicationFailedNoHeader
* fixed bug BacklinksMissesSomeFreeLinks
fix contributed by BrianHunter
* fix bug EmptyTableElements
fix contributed by StefanTrcek
* fix bug MiscTranslation
fix contributed by JuanMtnezPineda
* added more translation strings
* DoRC: when using rcidonly text was quoted too much
noticed by CliffordAdams (bug was introduced with XssFix in 1.0.1)
* fix bug UrlEncoding
fix contributed by StefanTrcek
Changes for bugfix release 1.0.2 (August 26, 2007):
* added CREDITS and Changelog (forgot them in 1.0.1)
* make .zip distribution for Windows users again (forgot it for 1.0.1)
* fixed range in SplitUrlPunct()
* fixed bug ActionEqIndexAndEmbedEqOne
same problem with other actions and parameter embed
* moved CSS class wikilinefooter (for <hr>) inside class wikifooter
* fixed bug ClassWikifooterMissing
* fixed bug VariableParseParasYieldsOddOutput
fix contributed by Trent, simplified
* fixed bug UploadTranslation
fix contributed by UngarPeter
* added patch RobotsNoFollow version D
contributed by Trent with suggestion by UngarPeter
based on work by TomScanlan
* fixed bug ActionLinksExistsZeroSubPage
aka bug RequestedLinks
based on fix by GyPark and MikeCastle
* fixed bug ImageExtensionsCaseSensitive
aka bug UppercaseImageUploadCausesProblemsWithDisplay
* added ico/tif/tiff to ImageExtensions
* fixed bug CamelCaseImageUploadCausesProblemsWithDisplay
with suggestion from DavidClaughton
Changes for bugfix release 1.0.1 (July 9, 2007):
* SECURITY: fix cross-site scripting vulnerability (CVE-2004-1397)
fix contributed by Christoph Berg (cb@df7cb.de)
* fixed bug PossibleToCreatePagesThatCanNotBeEdited
fix contributed by RichardP
* fixed bug FileUploadManglesFile
aka bug Win32BinaryUpload
aka bug UploadOnWindowsNeedsBinmode
fix contributed by Robin Rowe (rower@movieeditor.com) and DavidWall
* fixed bug CompareButtonFailsToDiff
aka bug DoHistory's_Form
fix contributed by BrianHunter and ??
* fixed bug BadHtml
* fixed bug AmpersandBug
fix contributed by UngarPeter
If I've forgotten something or someone, please leave a note on
UseMod:MarkusLude or send mail to usemod@usemod.com.

4
README
View File

@@ -1,5 +1,5 @@
README for UseModWiki 1.0
Last updated: August 1, 2003
README for UseModWiki 1.0.3
Last updated: September 12, 2007
Release notes:

2
config
View File

@@ -1,5 +1,5 @@
# == Configuration =======================================================
# Original version from UseModWiki 1.0.1
# Original version from UseModWiki 1.0.3
$CookieName = "Wiki"; # Name for this wiki (for multi-wiki sites)
$SiteName = "Wiki"; # Name of site (used for titles)

View File

@@ -445,10 +445,48 @@ Lock for %s created.
Lock for %s removed.
Editing Banned list
Updating Banned list
Empty banned list or error.
Resubmit with at least one space character to remove.
Removed banned list
Updated banned list
Editing Links
UpdateLinksList could not get main lock
Updating Links
Empty command list or error.
Finished command list.
Could not open %s log file:
Error was:
Delete-Page: page %1 is invalid, error is: %2
Rename-Text: old page %1 is invalid, error is: %2
Rename-Text: new page %1 is invalid, error is: %2
Rename: old page %1 is invalid, error is: %2
Rename: new page %1 is invalid, error is: %2
Rename: new page %s already exists--not renamed.
Rename: old page %s does not exist--nothing done.
Displaying Wiki Version
Administration
Unlock page
@@ -467,14 +505,12 @@ Unlock site
Lock site
Confirm Delete %s
Delete %s
Confirm deletion of %s by following this link:
Confirm Delete
Delete %s
%s can not be deleted.
%s can not be deleted because it is locked.
@@ -487,6 +523,8 @@ The current upload size limit is %s.
Change the %s variable to increase this limit.
File to Upload:
Upload Finished
The wiki link to your file is:

209
wiki.pl
View File

@@ -1,5 +1,5 @@
#!/usr/bin/perl
# UseModWiki version 1.0.1 (July 9, 2007)
# UseModWiki version 1.0.3 (September 12, 2007)
# Copyright (C) 2000-2003 Clifford A. Adams <caadams@usemod.com>
# Copyright (C) 2002-2003 Sunir Shah <sunir@sunir.org>
# Based on the GPLed AtisWiki 0.3 (C) 1998 Markus Denker
@@ -317,7 +317,7 @@ sub InitLinkPatterns {
. "prospero|telnet|gopher";
$UrlProtocols .= '|file' if ($NetworkFile || !$LimitFileUrl);
$UrlPattern = "((?:(?:$UrlProtocols):[^\\]\\s\"<>$FS]+)$QDelim)";
$ImageExtensions = "(gif|jpg|png|bmp|jpeg)";
$ImageExtensions = "(gif|jpg|png|bmp|jpeg|ico|tiff?)";
$RFCPattern = "RFC\\s?(\\d+)";
$ISBNPattern = "ISBN:?([0-9- xX]{10,})";
$UploadPattern = "upload:([^\\]\\s\"<>$FS]+)$QDelim";
@@ -576,15 +576,12 @@ sub BrowsePage {
$fullHtml .= '<div class=wikitext>';
$fullHtml .= &WikiToHTML($Text{'text'});
$fullHtml .= '</div>';
if (!&GetParam('embed', $EmbedWiki)) {
$fullHtml .= "<hr class=wikilinefooter>\n";
}
if (($id eq $RCName) || (T($RCName) eq $id) || (T($id) eq $RCName)) {
print $fullHtml;
print "<hr class=wikilinerc>\n";
print '<div class=wikirc>';
&DoRc(1);
print '</div>';
print "<hr class=wikilinefooter>\n" if (!&GetParam('embed', $EmbedWiki));
print &GetFooterText($id, $goodRevision);
return;
}
@@ -687,7 +684,7 @@ sub DoRc {
$idOnly = &GetParam("rcidonly", "");
if ($idOnly && $showHTML) {
print '<b>(' . Ts('for %s only', &ScriptLink($idOnly, $idOnly))
print '<b>(' . Ts('for %s only', &ScriptLink($idOnly, &QuoteHtml($idOnly)), 1)
. ')</b><br>';
}
if ($showHTML) {
@@ -924,12 +921,13 @@ RSS
sub GetRssRcLine{
my ($pagename, $timestamp, $host, $userName, $userID, $summary,
$isEdit, $pagecount, $revision, $diffPrefix, $historyPrefix) = @_;
my ($itemID, $description, $authorLink, $author, $status,
my ($pagenameEsc, $itemID, $description, $authorLink, $author, $status,
$importance, $date, $item, $headItem);
$pagenameEsc = CGI::escape($pagename);
# Add to list of items in the <channel/>
$itemID = $FullUrl . &ScriptLinkChar()
. &GetOldPageParameters('browse', $pagename, $revision);
. &GetOldPageParameters('browse', $pagenameEsc, $revision);
$itemID = &QuoteHtml($itemID);
$headItem = " <rdf:li rdf:resource=\"$itemID\"/>\n";
# Add to list of items proper.
@@ -955,7 +953,7 @@ sub GetRssRcLine{
$item = <<RSS ;
<item rdf:about="$itemID">
<title>$pagename</title>
<link>$QuotedFullUrl?$pagename</link>
<link>$QuotedFullUrl?$pagenameEsc</link>
<description>$description</description>
<dc:date>$date</dc:date>
<dc:contributor>
@@ -965,9 +963,9 @@ sub GetRssRcLine{
</dc:contributor>
<wiki:status>$status</wiki:status>
<wiki:importance>$importance</wiki:importance>
<wiki:diff>$diffPrefix$pagename</wiki:diff>
<wiki:diff>$diffPrefix$pagenameEsc</wiki:diff>
<wiki:version>$revision</wiki:version>
<wiki:history>$historyPrefix$pagename</wiki:history>
<wiki:history>$historyPrefix$pagenameEsc</wiki:history>
</item>
RSS
return ($headItem, $item);
@@ -1303,7 +1301,7 @@ sub GetHeader {
$result .= '<div class=wikiheader>';
if ($oldId ne '') {
$result .= $q->h3('(' . Ts('redirected from %s',
&GetEditLink($oldId, $oldId), 1) . ')');
&GetEditLink($oldId, &QuoteHtml($oldId)), 1) . ')');
}
if ((!$embed) && ($LogoUrl ne "")) {
$logoImage = "img src=\"$LogoUrl\" alt=\"$altText\" border=0";
@@ -1364,6 +1362,11 @@ sub GetHtmlHeader {
$keywords =~ s/([a-z])([A-Z])/$1, $2/g;
$html .= "<META NAME='KEYWORDS' CONTENT='$keywords'/>\n" if $keywords;
}
# we don't want robots indexing our history or other admin pages
my $action = lc(&GetParam('action', ''));
unless (!$action or $action eq "rc" or $action eq "index") {
$html .= "<META NAME='robots' CONTENT='noindex,nofollow'>\n";
}
if ($SiteBase ne "") {
$html .= qq(<BASE HREF="$SiteBase">\n);
}
@@ -1393,6 +1396,7 @@ sub GetFooterText {
return $q->end_html;
}
$result = '<div class=wikifooter>';
$result .= "<hr class=wikilinefooter>\n";
$result .= &GetFormStart();
$result .= &GetGotoBar($id);
if (&UserCanEdit($id, 0)) {
@@ -1456,7 +1460,7 @@ sub GetFooterText {
sub GetCommonFooter {
my ($html);
$html = '<hr class=wikilinefooter>' . '<div class=wikifooter>'
$html = '<div class=wikifooter>' . '<hr class=wikilinefooter>'
. &GetFormStart() . &GetGotoBar('')
. &GetSearchForm() . $q->endform;
if ($FooterNote ne '') {
@@ -1587,7 +1591,7 @@ sub WikiToHTML {
s/\&lt;pre\&gt;((.|\n)*?)\&lt;\/pre\&gt;/&StorePre($1, "pre")/ige;
$pageText =~
s/\&lt;code\&gt;((.|\n)*?)\&lt;\/code\&gt;/&StorePre($1, "code")/ige;
$pageText =~ s/((.|\n)+?\n)\s*\n/&ParseParagraph($1)/geo;
$pageText =~ s/((.|\n)+?\n)\s*(\n|$)/&ParseParagraph($1)/geo;
$pageText =~ s/(.*)<\/p>(.+)$/$1.&ParseParagraph($2)/seo;
} else {
$pageText = &CommonMarkup($pageText, 1, 0); # Multi-line markup
@@ -1658,6 +1662,9 @@ sub CommonMarkup {
s/\[$InterLinkPattern\]/&StoreBracketInterPage($1, "", 0)/geo;
s/\b$UrlPattern/&StoreUrl($1, $useImage)/geo;
s/\b$InterLinkPattern/&StoreInterPage($1, $useImage)/geo;
if ($UseUpload) {
s/$UploadPattern/&StoreUpload($1)/geo;
}
if ($WikiLinks) {
s/$AnchoredLinkPattern/&StoreRaw(&GetPageOrEditAnchoredLink($1,
$2, ""))/geo if $NamedAnchors;
@@ -1667,9 +1674,6 @@ sub CommonMarkup {
}
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;
@@ -1696,6 +1700,15 @@ sub CommonMarkup {
return $_;
}
sub EmptyCellsToNbsp {
my ($row) = @_;
$row =~ s/(?<=\|\|)\s+(?=\|\|)/&nbsp;/g;
$row =~ s/^\s+(?=\|\|)/&nbsp;/;
$row =~ s/(?<=\|\|)\s+$/&nbsp;/;
return $row;
}
sub WikiLinesToHtml {
my ($pageText) = @_;
my ($pageHtml, @htmlStack, $code, $codeAttributes, $depth, $oldCode);
@@ -1723,7 +1736,7 @@ sub WikiLinesToHtml {
} elsif ($TableSyntax &&
s/^((\|\|)+)(.*)\|\|\s*$/"<TR VALIGN='CENTER' "
. "ALIGN='CENTER'><TD colspan='"
. (length($1)\/2) . "'>$3<\/TD><\/TR>\n"/e) {
. (length($1)\/2) . "'>" . EmptyCellsToNbsp($3) . "<\/TD><\/TR>\n"/e) {
$code = 'TABLE';
$codeAttributes = "BORDER='1'";
$TableMode = 1;
@@ -1954,7 +1967,7 @@ sub ImageAllowed {
$imagePrefixes = 'http:|https:|ftp:';
$imagePrefixes .= '|file:' if (!$LimitFileUrl);
return 0 unless ($url =~ /^($imagePrefixes).+\.$ImageExtensions$/);
return 0 unless ($url =~ /^($imagePrefixes).+\.$ImageExtensions$/i);
return 0 if ($url =~ /"/); # No HTML-breaking quotes allowed
return 1 if (@ImageSites < 1); # Most common case: () means all allowed
return 0 if ($ImageSites[0] eq 'none'); # Special case: none allowed
@@ -1969,6 +1982,9 @@ sub StoreBracketUrl {
if ($text eq "") {
$text = &GetBracketUrlIndex($url);
} elsif ($text =~ /^$InterLinkPattern$/) {
my @interlink = split(/:/, $text, 2);
$text = &GetSiteUrl($interlink[0]) . $interlink[1];
}
if ($BracketImg && $useImage && &ImageAllowed($text)) {
$text = "<img src=\"$text\">";
@@ -2089,7 +2105,7 @@ sub SplitUrlPunct {
$punct = "";
if ($NewFS) {
($punct) = ($url =~ /([^a-zA-Z0-9\/\x80-\xff]+)$/);
$url =~ s/([^a-zA-Z0-9\/\xc0-\xff]+)$//;
$url =~ s/([^a-zA-Z0-9\/\x80-\xff]+)$//;
} else {
($punct) = ($url =~ /([^a-zA-Z0-9\/\xc0-\xff]+)$/);
$url =~ s/([^a-zA-Z0-9\/\xc0-\xff]+)$//;
@@ -3195,7 +3211,7 @@ sub DoEdit {
$id = &FreeToNormal($id); # Take care of users like Markus Lude :-)
}
if (!&UserCanEdit($id, 1)) {
print &GetHeader("", T('Editing Denied'), "");
print &GetHeader('', T('Editing Denied'), '');
if (&UserIsBanned()) {
print T('Editing not allowed: user, ip, or network is blocked.');
print "<p>";
@@ -3298,9 +3314,9 @@ sub DoEdit {
&GetTextArea('newtext', $newText, $editRows, $editCols),
"<p>\n";
}
print "<hr class=wikilinefooter>\n";
if ($preview) {
print '<div class=wikipreview>';
print "<hr class=wikilinepreview>\n";
print "<h2>", T('Preview:'), "</h2>\n";
if ($isConflict) {
print "<b>",
@@ -3309,15 +3325,18 @@ sub DoEdit {
}
$MainPage = $id;
$MainPage =~ s|/.*||; # Only the main page name (remove subpage)
print &WikiToHTML($oldText) . "<hr class=wikilinefooter>\n";
print &WikiToHTML($oldText) . "<hr class=wikilinepreview>\n";
print "<h2>", T('Preview only, not yet saved'), "</h2>\n";
print '</div>';
}
print '<div class=wikifooter>';
print &GetHistoryLink($id, T('View other revisions')) . "<br>\n";
print &GetGotoBar($id);
print '</div>';
print $q->endform;
if (!&GetParam('embed', $EmbedWiki)) {
print '<div class=wikifooter>';
print "<hr class=wikilinefooter>\n";
print &GetHistoryLink($id, T('View other revisions')) . "<br>\n";
print &GetGotoBar($id);
print '</div>';
}
print &GetMinimumFooter();
}
@@ -3340,7 +3359,7 @@ sub DoEditPrefs {
$recentName = $RCName;
$recentName =~ s/_/ /g;
&DoNewLogin() if ($UserID < 400);
print &GetHeader('', T('Editing Preferences'), "");
print &GetHeader('', T('Editing Preferences'), '');
print '<div class=wikipref>';
print &GetFormStart();
print GetHiddenValue("edit_prefs", 1), "\n";
@@ -3418,10 +3437,12 @@ sub DoEditPrefs {
print '<br>', $q->submit(-name=>'Save', -value=>T('Save')), "\n";
print $q->endform;
print '</div>';
print "<hr class=wikilinefooter>\n";
print '<div class=wikifooter>';
print &GetGotoBar('');
print '</div>';
if (!&GetParam('embed', $EmbedWiki)) {
print '<div class=wikifooter>';
print "<hr class=wikilinefooter>\n";
print &GetGotoBar('');
print '</div>';
}
print &GetMinimumFooter();
}
@@ -3447,7 +3468,7 @@ sub DoUpdatePrefs {
# All link bar settings should be updated before printing the header
&UpdatePrefCheckbox("toplinkbar");
&UpdatePrefCheckbox("linkrandom");
print &GetHeader('',T('Saving Preferences'), '');
print &GetHeader('', T('Saving Preferences'), '');
print '<br>';
if ($UserID < 1001) {
print '<b>',
@@ -3640,9 +3661,13 @@ sub DoEnterLogin {
$q->password_field(-name=>'p_password', -value=>'',
-size=>15, -maxlength=>50);
print '<br>', $q->submit(-name=>'Login', -value=>T('Login')), "\n";
print "<hr class=wikilinefooter>\n";
print &GetGotoBar('');
print $q->endform;
if (!&GetParam('embed', $EmbedWiki)) {
print '<div class=wikifooter>';
print "<hr class=wikilinefooter>\n";
print &GetGotoBar('');
print '</div>';
}
print &GetMinimumFooter();
}
@@ -3672,9 +3697,12 @@ sub DoLogin {
} else {
print Ts('Login for user ID %s failed.', $uid);
}
print "<hr class=wikilinefooter>\n";
print &GetGotoBar('');
print $q->endform;
if (!&GetParam('embed', $EmbedWiki)) {
print '<div class=wikifooter>';
print "<hr class=wikilinefooter>\n";
print &GetGotoBar('');
print '</div>';
}
print &GetMinimumFooter();
}
@@ -3808,7 +3836,7 @@ sub PrintLinkList {
sub GetFullLinkList {
my ($name, $unique, $sort, $exists, $empty, $link, $search);
my ($pagelink, $interlink, $urllink);
my (@found, @links, @newlinks, @pglist, %pgExists, %seen);
my (@found, @links, @newlinks, @pglist, %pgExists, %seen, $main);
$unique = &GetParam("unique", 1);
$sort = &GetParam("sort", 1);
@@ -3833,7 +3861,14 @@ sub GetFullLinkList {
%seen = ();
}
@links = &GetPageLinks($name, $pagelink, $interlink, $urllink);
if ($UseSubpage) {
$main = $name;
$main =~ s/\/.*//;
}
foreach $link (@links) {
if ($UseSubpage && ($link =~ /^\//)) {
$link = $main . $link;
}
$seen{$link}++;
if (($unique > 0) && ($seen{$link} != 1)) {
next;
@@ -4124,11 +4159,19 @@ sub SearchTitleAndBody {
&OpenDefaultText();
if (($Text{'text'} =~ /$string/i) || ($name =~ /$string/i)) {
push(@found, $name);
} elsif ($FreeLinks && ($name =~ m/_/)) {
$freeName = $name;
$freeName =~ s/_/ /g;
if ($freeName =~ /$string/i) {
push(@found, $name);
} elsif ($FreeLinks) {
if ($name =~ m/_/) {
$freeName = $name;
$freeName =~ s/_/ /g;
if ($freeName =~ /$string/i) {
push(@found, $name);
}
} elsif ($string =~ m/ /) {
$freeName = $string;
$freeName =~ s/ /_/g;
if ($Text{'text'} =~ /$freeName/i) {
push(@found, $name);
}
}
}
}
@@ -4415,7 +4458,7 @@ sub DoPageLock {
sub DoEditBanned {
my ($banList, $status);
print &GetHeader("", "Editing Banned list", "");
print &GetHeader('', T('Editing Banned list'), '');
return if (!&UserIsAdminOrError());
($status, $banList) = &ReadFile("$DataDir/banlist");
$banList = "" if (!$status);
@@ -4435,35 +4478,39 @@ sub DoEditBanned {
"^123\\.21\\.3\\.\\d+\$<p>";
print &GetTextArea('banlist', $banList, 12, 50);
print "<br>", $q->submit(-name=>'Save'), "\n";
print "<hr class=wikilinefooter>\n";
print &GetGotoBar("");
print $q->endform;
if (!&GetParam('embed', $EmbedWiki)) {
print '<div class=wikifooter>';
print "<hr class=wikilinefooter>\n";
print &GetGotoBar('');
print '</div>';
}
print &GetMinimumFooter();
}
sub DoUpdateBanned {
my ($newList, $fname);
print &GetHeader("", "Updating Banned list", "");
print &GetHeader('', T('Updating Banned list'), '');
return if (!&UserIsAdminOrError());
$fname = "$DataDir/banlist";
$newList = &GetParam("banlist", "#Empty file");
if ($newList eq "") {
print "<p>Empty banned list or error.";
print "<p>Resubmit with at least one space character to remove.";
print "<p>", T('Empty banned list or error.');
print "<p>", T('Resubmit with at least one space character to remove.');
} elsif ($newList =~ /^\s*$/s) {
unlink($fname);
print "<p>Removed banned list";
print "<p>", T('Removed banned list');
} else {
&WriteStringToFile($fname, $newList);
print "<p>Updated banned list";
print "<p>", T('Updated banned list');
}
print &GetCommonFooter();
}
# ==== Editing/Deleting pages and links ====
sub DoEditLinks {
print &GetHeader("", "Editing Links", "");
print &GetHeader('', T('Editing Links'), '');
if ($AdminDelete) {
return if (!&UserIsAdminOrError());
} else {
@@ -4487,9 +4534,13 @@ sub DoEditLinks {
print $q->checkbox(-name=>"p_changetext", -override=>1, -checked=>1,
-label=>"Substitute text for rename");
print "<br>", $q->submit(-name=>'Edit'), "\n";
print "<hr class=wikilinefooter>\n";
print &GetGotoBar("");
print $q->endform;
if (!&GetParam('embed', $EmbedWiki)) {
print '<div class=wikifooter>';
print "<hr class=wikilinefooter>\n";
print &GetGotoBar('');
print '</div>';
}
print &GetMinimumFooter();
}
@@ -4549,7 +4600,7 @@ sub BuildLinkIndexPage {
sub DoUpdateLinks {
my ($commandList, $doRC, $doText);
print &GetHeader("", T('Updating Links'), "");
print &GetHeader('', T('Updating Links'), '');
if ($AdminDelete) {
return if (!&UserIsAdminOrError());
} else {
@@ -4561,10 +4612,10 @@ sub DoUpdateLinks {
$doText = &GetParam("p_changetext", "0");
$doText = 1 if ($doText eq "on");
if ($commandList eq "") {
print "<p>Empty command list or error.";
print "<p>", T('Empty command list or error.');
} else {
&UpdateLinksList($commandList, $doRC, $doText);
print "<p>Finished command list.";
print "<p>", T('Finished command list.');
}
print &GetCommonFooter();
}
@@ -4584,8 +4635,10 @@ sub EditRecentChangesFile {
($status, $fileData) = &ReadFile($fname);
if (!$status) {
# Save error text if needed.
$errorText = "<p><strong>Could not open $RCName log file:"
. "</strong> $fname<p>Error was:\n<pre>$!</pre>\n";
$errorText = "<p><strong>"
. Ts('Could not open %s log file:', $RCName)
. "</strong> $fname"
. "<p>" . T('Error was:') . "\n<pre>$!</pre>\n";
print $errorText if ($printError);
return;
}
@@ -4619,7 +4672,8 @@ sub DeletePage {
$page =~ s/\]+//;
$status = &ValidId($page);
if ($status ne "") {
print "Delete-Page: page $page is invalid, error is: $status<br>\n";
print Tss('Delete-Page: page %1 is invalid, error is: %2', $page, $status)
. "<br>\n";
return;
}
$fname = &GetPageFile($page);
@@ -4755,12 +4809,14 @@ sub RenameTextLinks {
$new =~ s/ /_/g;
$status = &ValidId($old);
if ($status ne "") {
print "Rename-Text: old page $old is invalid, error is: $status<br>\n";
print Tss('Rename-Text: old page %1 is invalid, error is: %2', $old, $status)
. "<br>\n";
return;
}
$status = &ValidId($new);
if ($status ne "") {
print "Rename-Text: new page $new is invalid, error is: $status<br>\n";
print Tss('Rename-Text: new page %1 is invalid, error is: %2', $new, $status)
. "<br>\n";
return;
}
$old =~ s/_/ /g;
@@ -4809,22 +4865,26 @@ sub RenamePage {
$new = &FreeToNormal($new);
$status = &ValidId($old);
if ($status ne "") {
print "Rename: old page $old is invalid, error is: $status<br>\n";
print Tss('Rename: old page %1 is invalid, error is: %2', $old, $status)
. "<br>\n";
return;
}
$status = &ValidId($new);
if ($status ne "") {
print "Rename: new page $new is invalid, error is: $status<br>\n";
print Tss('Rename: new page %1 is invalid, error is: %2', $new, $status)
. "<br>\n";
return;
}
$newfname = &GetPageFile($new);
if (-f $newfname) {
print "Rename: new page $new already exists--not renamed.<br>\n";
print Ts('Rename: new page %s already exists--not renamed.', $new)
. "<br>\n";
return;
}
$oldfname = &GetPageFile($old);
if (!(-f $oldfname)) {
print "Rename: old page $old does not exist--nothing done.<br>\n";
print Ts('Rename: old page %s does not exist--nothing done.', $old)
. "<br>\n";
return;
}
&CreatePageDir($PageDir, $new); # It might not exist yet
@@ -4843,8 +4903,8 @@ sub RenamePage {
}
sub DoShowVersion {
print &GetHeader("", "Displaying Wiki Version", "");
print "<p>UseModWiki version 1.0.1</p>\n";
print &GetHeader('', T('Displaying Wiki Version'), '');
print "<p>UseModWiki version 1.0.3</p>\n";
print &GetCommonFooter();
}
@@ -4886,9 +4946,9 @@ sub DoDeletePage {
my ($id) = @_;
return if (!&ValidIdOrDie($id));
print &GetHeader('', Ts('Delete %s', $id), '');
return if (!&UserIsAdminOrError());
if ($ConfirmDel && !&GetParam('confirm', 0)) {
print &GetHeader('', Ts('Confirm Delete %s', $id), '');
print '<p>';
print Ts('Confirm deletion of %s by following this link:', $id);
print '<br>' . &GetDeleteLink($id, T('Confirm Delete'), 1);
@@ -4896,7 +4956,6 @@ sub DoDeletePage {
print &GetCommonFooter();
return;
}
print &GetHeader('', Ts('Delete %s', $id), '');
print '<p>';
if ($id eq $HomePage) {
print Ts('%s can not be deleted.', $HomePage);
@@ -4927,8 +4986,8 @@ sub DoUpload {
print '<FORM METHOD="post" ACTION="' . $ScriptName
. '" ENCTYPE="multipart/form-data">';
print '<input type="hidden" name="upload" value="1" />';
print 'File to Upload: <INPUT TYPE="file" NAME="file"><br><BR>';
print '<INPUT TYPE="submit" NAME="Submit" VALUE="Upload">';
print T('File to Upload:'), ' <INPUT TYPE="file" NAME="file"><br><BR>';
print '<INPUT TYPE="submit" NAME="Submit" VALUE="', T('Upload'), '">';
print '</FORM>';
print &GetCommonFooter();
}
@@ -4953,7 +5012,7 @@ sub SaveUpload {
$printFilename = $filename;
$printFilename =~ s/ /\%20/g; # Replace spaces with escaped spaces
print "upload:" . $printFilename . "<BR><BR>\n";
if ($filename =~ /${ImageExtensions}$/) {
if ($filename =~ /$ImageExtensions$/i) {
print '<HR><img src="' . $UploadUrl . $filename . '">' . "\n";
}
print &GetCommonFooter();