22 Commits

Author SHA1 Message Date
Markus Lude
932fa71cb5 some preparations for 1.0.4: bump version 2016-10-25 19:43:21 +02:00
Markus Lude
e9341a3ee5 GetPageLockLink, GetAdminBar: move function to allow defered compilation again.
This was already broken in 1.0, possibly since addition of the AdminBar code.
missed in 027da87d33
2016-10-25 19:41:18 +02:00
Markus Lude
4364cd7da3 updated barnesandnoble.com search URL
noted by Oddmuse:FletcherPenny on Oddmuse:Comments_on_Usemod_Markup_Extension
2016-10-25 19:38:50 +02:00
Markus Lude
d71565c85b GetRc, GetRcRss, GetRssRcLine, EmailNotify: added some missing ScriptLinkChar()
instead of "?"
2016-10-25 19:37:25 +02:00
Markus Lude
1275491365 fixed bug: make GotoBars at top and bottom look the same on the edit page
the one at the top was lacking the main page when editing subpages
2016-10-25 19:35:52 +02:00
Markus Lude
027da87d33 GetPageLockLink, GetAdminBar: move function to allow defered compilation again.
This was already broken in 1.0, possibly since addition of the AdminBar code.
2016-10-25 19:34:28 +02:00
Markus Lude
730799f93d QuoteHtml: move function to allow defered compilation again.
This was broken with WikiPatches/XssFix (adding QuoteHtml to Ts/Tss calls)
2016-10-25 19:33:11 +02:00
Markus Lude
54bb8f0f22 fixed WikiBugs/NoDisplayFooterInActionLink
reported and fix contributed by JuanMtnezPineda (JuanmaMP)
2016-10-25 19:31:56 +02:00
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
6 changed files with 218 additions and 120 deletions

View File

@@ -7,9 +7,11 @@ Users which contributed patches added to versions after 1.0:
* DavidClaughton
* DavidWall
* GyPark
* JuanMtnezPineda
* MikeCastle
* RichardP
* Robin Rowe (rower@movieeditor.com)
* StefanTrcek
* TomScanlan
* Trent
* UngarPeter

View File

@@ -1,4 +1,30 @@
Changes for bugfix release 1.0.4 (December 1, 2007):
* fixed bug NoDisplayFooterInActionLink
fix contributed by JuanMtnezPineda
* QuoteHtml, GetPageLockLink, GetAdminBar: move function to allow defered
compilation again
* fixed bug: make GotoBars at top and bottom look the same on the edit page
* added some missing ScriptLinkChar() instead of "?"
* updated barnesandnoble.com search URL
Changes for bugfix release 1.0.3 (September 12, 2007):
* fixed bug IntermapedGifNotInlinedForLink
* fixed bug AuthenicationFailedNoHeader
* fixed bug BacklinksMissesSomeFreeLinks
fix contributed by BrianHunter
* fixed bug EmptyTableElements
fix contributed by StefanTrcek
* fixed 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)
* fixed 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)
@@ -15,10 +41,11 @@ Changes for bugfix release 1.0.2 (August 26, 2007):
* added patch RobotsNoFollow version D
contributed by Trent with suggestion by UngarPeter
based on work by TomScanlan
* fixed bug ActionLinksExistsZeroSubPage aka RequestedLinks
* fixed bug ActionLinksExistsZeroSubPage
aka bug RequestedLinks
based on fix by GyPark and MikeCastle
* fixed bug ImageExtensionsCaseSensitive aka
UppercaseImageUploadCausesProblemsWithDisplay
* fixed bug ImageExtensionsCaseSensitive
aka bug UppercaseImageUploadCausesProblemsWithDisplay
* added ico/tif/tiff to ImageExtensions
* fixed bug CamelCaseImageUploadCausesProblemsWithDisplay
with suggestion from DavidClaughton
@@ -29,10 +56,12 @@ Changes for bugfix release 1.0.1 (July 9, 2007):
fix contributed by Christoph Berg (cb@df7cb.de)
* fixed bug PossibleToCreatePagesThatCanNotBeEdited
fix contributed by RichardP
* fixed bug FileUploadManglesFile aka Win32BinaryUpload aka
UploadOnWindowsNeedsBinmode
* fixed bug FileUploadManglesFile
aka bug Win32BinaryUpload
aka bug UploadOnWindowsNeedsBinmode
fix contributed by Robin Rowe (rower@movieeditor.com) and DavidWall
* fixed bug CompareButtonFailsToDiff aka DoHistory's_Form
* fixed bug CompareButtonFailsToDiff
aka bug DoHistory's_Form
fix contributed by BrianHunter and ??
* fixed bug BadHtml
* fixed bug AmpersandBug

4
README
View File

@@ -1,5 +1,5 @@
README for UseModWiki 1.0.2
Last updated: August 26, 2007
README for UseModWiki 1.0.4
Last updated: December 1, 2007
Release notes:

4
config
View File

@@ -1,5 +1,5 @@
# == Configuration =======================================================
# Original version from UseModWiki 1.0.2
# Original version from UseModWiki 1.0.4
$CookieName = "Wiki"; # Name for this wiki (for multi-wiki sites)
$SiteName = "Wiki"; # Name of site (used for titles)
@@ -110,7 +110,7 @@ $BracketImg = 1; # 1 = [url url.gif] becomes image link, 0 = no img
# Names of sites. (The first entry is used for the number link.)
@IsbnNames = ('bn.com', 'amazon.com', 'search');
# Full URL of each site before the ISBN
@IsbnPre = ('http://shop.barnesandnoble.com/bookSearch/isbnInquiry.asp?isbn=',
@IsbnPre = ('http://search.barnesandnoble.com/booksearch/isbninquiry.asp?isbn=',
'http://www.amazon.com/exec/obidos/ISBN=',
'http://www.pricescan.com/books/BookDetail.asp?isbn=');
# Rest of URL of each site after the ISBN (usually '')

View File

@@ -91,6 +91,24 @@ Database is stored in temporary directory %s
Config file error:
Administration
Unlock page
Lock page
Delete this page
Edit Banned List
Run Maintenance
Edit/Rename pages
Unlock site
Lock site
Search:
Go!
@@ -445,36 +463,54 @@ 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
Administration
Empty command list or error.
Unlock page
Finished command list.
Lock page
Could not open %s log file:
Delete this page
Error was:
Edit Banned List
Delete-Page: page %1 is invalid, error is: %2
Run Maintenance
Rename-Text: old page %1 is invalid, error is: %2
Edit/Rename pages
Rename-Text: new page %1 is invalid, error is: %2
Unlock site
Rename: old page %1 is invalid, error is: %2
Lock site
Rename: new page %1 is invalid, error is: %2
Confirm Delete %s
Rename: new page %s already exists--not renamed.
Rename: old page %s does not exist--nothing done.
Displaying Wiki Version
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.

227
wiki.pl
View File

@@ -1,5 +1,5 @@
#!/usr/bin/perl
# UseModWiki version 1.0.2 (August 26, 2007)
# UseModWiki version 1.0.4 (December 1, 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
@@ -179,7 +179,7 @@ $BracketImg = 1; # 1 = [url url.gif] becomes image link, 0 = no img
# Names of sites. (The first entry is used for the number link.)
@IsbnNames = ('bn.com', 'amazon.com', 'search');
# Full URL of each site before the ISBN
@IsbnPre = ('http://shop.barnesandnoble.com/bookSearch/isbnInquiry.asp?isbn=',
@IsbnPre = ('http://search.barnesandnoble.com/booksearch/isbninquiry.asp?isbn=',
'http://www.amazon.com/exec/obidos/ISBN=',
'http://www.pricescan.com/books/BookDetail.asp?isbn=');
# Rest of URL of each site after the ISBN (usually '')
@@ -394,6 +394,16 @@ sub Tss {
return $text;
}
sub QuoteHtml {
my ($html) = @_;
$html =~ s/&/&amp;/g;
$html =~ s/</&lt;/g;
$html =~ s/>/&gt;/g;
$html =~ s/&amp;([#a-zA-Z0-9]+);/&$1;/g; # Allow character references
return $html;
}
# == Normal page-browsing and RecentChanges code =======================
$BrowseCode = ""; # Comment next line to always compile (slower)
#$BrowseCode = <<'#END_OF_BROWSE_CODE';
@@ -545,7 +555,7 @@ sub BrowsePage {
}
$MainPage = $id;
$MainPage =~ s|/.*||; # Only the main page name (remove subpage)
$fullHtml = &GetHeader($id, &QuoteHtml($id), $oldId);
$fullHtml = &GetHeader($id, &QuoteHtml($id), $oldId, 1);
if ($revision ne '') {
if (($revision eq $Page{'revision'}) || ($goodRevision ne '')) {
$fullHtml .= '<b>' . Ts('Showing revision %s', $revision) . "</b><br>";
@@ -684,7 +694,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) {
@@ -739,7 +749,7 @@ sub GetRc {
my ($showedit, $link, $all, $idOnly, $headItem, $item);
my ($ts, $pagename, $summary, $isEdit, $host, $kind, $extraTemp);
my ($rcchangehist, $tEdit, $tChanges, $tDiff);
my ($headList, $historyPrefix, $diffPrefix);
my ($headList, $pagePrefix, $historyPrefix, $diffPrefix);
my %extra = ();
my %changetime = ();
my %pagecount = ();
@@ -765,8 +775,9 @@ sub GetRc {
$tEdit = T('(edit)');
$tDiff = T('(diff)');
$tChanges = T('changes');
$diffPrefix = $QuotedFullUrl . &QuoteHtml("?action=browse\&diff=4\&id=");
$historyPrefix = $QuotedFullUrl . &QuoteHtml("?action=history\&id=");
$pagePrefix = $QuotedFullUrl . &ScriptLinkChar();
$diffPrefix = $pagePrefix . &QuoteHtml("action=browse&diff=4&id=");
$historyPrefix = $pagePrefix . &QuoteHtml("action=history&id=");
foreach $rcline (@outrc) {
($ts, $pagename) = split(/$FS3/, $rcline);
$pagecount{$pagename}++;
@@ -807,7 +818,7 @@ sub GetRc {
($headItem, $item) = &GetRssRcLine($pagename, $ts, $host,
$extra{'name'}, $extra{'id'}, $summary, $isEdit,
$pagecount{$pagename}, $extra{'revision'},
$diffPrefix, $historyPrefix);
$diffPrefix, $historyPrefix, $pagePrefix);
$headList .= $headItem;
$result .= $item;
} else { # HTML
@@ -891,7 +902,7 @@ sub GetRcRss {
>
<channel rdf:about="$ChannelAbout">
<title>${\(&QuoteHtml($SiteName))}</title>
<link>${\($QuotedFullUrl . &QuoteHtml("?$RCName"))}</link>
<link>${\($QuotedFullUrl . &ScriptLinkChar() . &QuoteHtml("$RCName"))}</link>
<description>${\(&QuoteHtml($SiteDescription))}</description>
<wiki:interwiki>
<rdf:Description link="$QuotedFullUrl">
@@ -919,14 +930,15 @@ RSS
}
sub GetRssRcLine{
my ($pagename, $timestamp, $host, $userName, $userID, $summary,
$isEdit, $pagecount, $revision, $diffPrefix, $historyPrefix) = @_;
my ($itemID, $description, $authorLink, $author, $status,
my ($pagename, $timestamp, $host, $userName, $userID, $summary, $isEdit,
$pagecount, $revision, $diffPrefix, $historyPrefix, $pagePrefix) = @_;
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.
@@ -936,7 +948,7 @@ sub GetRssRcLine{
$host = &QuoteHtml($host);
if ($userName) {
$author = &QuoteHtml($userName);
$authorLink = "link=\"$QuotedFullUrl?$author\"";
$authorLink = 'link="' . $QuotedFullUrl . &ScriptLinkChar() . $author . '"';
} else {
$author = $host;
}
@@ -952,7 +964,7 @@ sub GetRssRcLine{
$item = <<RSS ;
<item rdf:about="$itemID">
<title>$pagename</title>
<link>$QuotedFullUrl?$pagename</link>
<link>$pagePrefix$pagenameEsc</link>
<description>$description</description>
<dc:date>$date</dc:date>
<dc:contributor>
@@ -962,9 +974,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);
@@ -1283,7 +1295,7 @@ sub GetHistoryLink {
}
sub GetHeader {
my ($id, $title, $oldId) = @_;
my ($id, $title, $oldId, $backlinks) = @_;
my $header = "";
my $logoImage = "";
my $result = "";
@@ -1300,7 +1312,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";
@@ -1309,7 +1321,7 @@ sub GetHeader {
}
$header = &ScriptLink($HomePage, "<$logoImage>");
}
if ($id ne '') {
if ($id and $backlinks) {
$result .= $q->h1($header . &GetBackLinksSearchLink($id));
} else {
$result .= $q->h1($header . $title);
@@ -1503,6 +1515,39 @@ sub GetGotoBar {
return $bartext;
}
# Admin bar contributed by ElMoro (with some changes)
sub GetPageLockLink {
my ($id, $status, $name) = @_;
if ($FreeLinks) {
$id = &FreeToNormal($id);
}
return &ScriptLink("action=pagelock&set=$status&id=$id", $name);
}
sub GetAdminBar {
my ($id) = @_;
my ($result);
$result = T('Administration') . ': ';
if (-f &GetLockedPageFile($id)) {
$result .= &GetPageLockLink($id, 0, T('Unlock page'));
}
else {
$result .= &GetPageLockLink($id, 1, T('Lock page'));
}
$result .= " | " . &GetDeleteLink($id, T('Delete this page'), 0);
$result .= " | " . &ScriptLink("action=editbanned", T("Edit Banned List"));
$result .= " | " . &ScriptLink("action=maintain", T("Run Maintenance"));
$result .= " | " . &ScriptLink("action=editlinks", T("Edit/Rename pages"));
if (-f "$DataDir/noedit") {
$result .= " | " . &ScriptLink("action=editlock&set=0", T("Unlock site"));
} else {
$result .= " | " . &ScriptLink("action=editlock&set=1", T("Lock site"));
}
return $result;
}
sub GetSearchForm {
my ($result);
@@ -1699,6 +1744,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);
@@ -1726,7 +1780,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;
@@ -1798,16 +1852,6 @@ sub UriEscape {
return $uri;
}
sub QuoteHtml {
my ($html) = @_;
$html =~ s/&/&amp;/g;
$html =~ s/</&lt;/g;
$html =~ s/>/&gt;/g;
$html =~ s/&amp;([#a-zA-Z0-9]+);/&$1;/g; # Allow character references
return $html;
}
sub ParseParagraph {
my ($text) = @_;
@@ -1972,6 +2016,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\">";
@@ -3198,7 +3245,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>";
@@ -3233,7 +3280,7 @@ sub DoEdit {
}
$editRows = &GetParam("editrows", 20);
$editCols = &GetParam("editcols", 65);
print &GetHeader('', &QuoteHtml($header), '');
print &GetHeader($id, &QuoteHtml($header), '');
if ($revision ne '') {
print "\n<b>"
. Ts('Editing old revision %s.', $revision) . " "
@@ -3346,7 +3393,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";
@@ -3455,7 +3502,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>',
@@ -3779,7 +3826,7 @@ sub DoLinks {
print "<hr><pre>\n\n\n\n\n"; # Extra lines to get below the logo
&PrintLinkList(&GetFullLinkList());
print "</pre>\n";
print &GetMinimumFooter();
print &GetCommonFooter();
}
sub PrintLinkList {
@@ -4109,6 +4156,7 @@ sub EmailNotify {
close(EMAIL);
my $home_url = $q->url();
my $page_url = $home_url . &ScriptLinkChar() . &UriEscape($id);
my $pref_url = $home_url . &ScriptLinkChar() . "action=editprefs";
my $editors_summary = $q->param("summary");
if (($editors_summary eq "*") or ($editors_summary eq "")){
$editors_summary = "";
@@ -4127,7 +4175,7 @@ sub EmailNotify {
so only do that if you mean to.
To remove yourself from this list, visit
${home_url}?action=editprefs .)
$pref_url .)
END_MAIL_CONTENT
my $subject = "The $id page at $SiteName has been changed.";
# I'm setting the "reply-to" field to be the same as the "to:" field
@@ -4146,11 +4194,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);
}
}
}
}
@@ -4437,7 +4493,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);
@@ -4470,26 +4526,26 @@ sub DoEditBanned {
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 {
@@ -4579,7 +4635,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 {
@@ -4591,10 +4647,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();
}
@@ -4614,8 +4670,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;
}
@@ -4649,7 +4707,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);
@@ -4785,12 +4844,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;
@@ -4839,22 +4900,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
@@ -4873,52 +4938,19 @@ sub RenamePage {
}
sub DoShowVersion {
print &GetHeader("", "Displaying Wiki Version", "");
print "<p>UseModWiki version 1.0.2</p>\n";
print &GetHeader('', T('Displaying Wiki Version'), '');
print "<p>UseModWiki version 1.0.4</p>\n";
print &GetCommonFooter();
}
# Admin bar contributed by ElMoro (with some changes)
sub GetPageLockLink {
my ($id, $status, $name) = @_;
if ($FreeLinks) {
$id = &FreeToNormal($id);
}
return &ScriptLink("action=pagelock&set=$status&id=$id", $name);
}
sub GetAdminBar {
my ($id) = @_;
my ($result);
$result = T('Administration') . ': ';
if (-f &GetLockedPageFile($id)) {
$result .= &GetPageLockLink($id, 0, T('Unlock page'));
}
else {
$result .= &GetPageLockLink($id, 1, T('Lock page'));
}
$result .= " | " . &GetDeleteLink($id, T('Delete this page'), 0);
$result .= " | " . &ScriptLink("action=editbanned", T("Edit Banned List"));
$result .= " | " . &ScriptLink("action=maintain", T("Run Maintenance"));
$result .= " | " . &ScriptLink("action=editlinks", T("Edit/Rename pages"));
if (-f "$DataDir/noedit") {
$result .= " | " . &ScriptLink("action=editlock&set=0", T("Unlock site"));
} else {
$result .= " | " . &ScriptLink("action=editlock&set=1", T("Lock site"));
}
return $result;
}
# Thanks to Phillip Riley for original code
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);
@@ -4926,7 +4958,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);