forked from codeberg/usemod.usemod
Compare commits
55 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31361f5c2d | ||
|
|
d50a72c86d | ||
|
|
c0bb6e62c1 | ||
|
|
a5eb14d28e | ||
|
|
32a13c5e8b | ||
|
|
33bef450e8 | ||
|
|
39995d1c0c | ||
|
|
d521f7011d | ||
|
|
c64c3ff54c | ||
|
|
8429294b5c | ||
|
|
21c98985bc | ||
|
|
8814048cfc | ||
|
|
26037dd0dd | ||
|
|
49cec5752d | ||
|
|
78a833233c | ||
|
|
d9a7c35fe7 | ||
|
|
c846f805fb | ||
|
|
20c51dd9ff | ||
|
|
932fa71cb5 | ||
|
|
e9341a3ee5 | ||
|
|
4364cd7da3 | ||
|
|
d71565c85b | ||
|
|
1275491365 | ||
|
|
027da87d33 | ||
|
|
730799f93d | ||
|
|
54bb8f0f22 | ||
|
|
073748c0ca | ||
|
|
920c918c15 | ||
|
|
ff1a3762b1 | ||
|
|
2ae7b38813 | ||
|
|
a1cb3d9d76 | ||
|
|
13c4c7528c | ||
|
|
1f1718b165 | ||
|
|
a70fe404f4 | ||
|
|
36ec8e1315 | ||
|
|
bebaea5179 | ||
|
|
677f956db7 | ||
|
|
e3aa55e96b | ||
|
|
295de1ea38 | ||
|
|
f01d6b2c1a | ||
|
|
a8c2ccbcbb | ||
|
|
157722644a | ||
|
|
2754314be7 | ||
|
|
650eb5b738 | ||
|
|
fccfe54614 | ||
|
|
1aefd9bb64 | ||
|
|
0208201b8d | ||
|
|
c70790ca85 | ||
|
|
18d02d4c06 | ||
|
|
7e6cb67e08 | ||
|
|
349ca3a4c8 | ||
|
|
6d9493aab7 | ||
|
|
51a349ea6e | ||
|
|
c321e01c70 | ||
|
|
117643908a |
22
CREDITS
Normal file
22
CREDITS
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
Users which contributed patches added to versions after 1.0:
|
||||
|
||||
* BrianHunter
|
||||
* Christoph Berg (cb@df7cb.de)
|
||||
* CliffordAdams
|
||||
* DavidClaughton
|
||||
* DavidWall
|
||||
* GunnarH
|
||||
* 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.
|
||||
|
||||
88
Changelog
Normal file
88
Changelog
Normal file
@@ -0,0 +1,88 @@
|
||||
|
||||
Changes for bugfix release 1.0.5 (August 28, 2009):
|
||||
|
||||
* added patch RssLinkInHeader (but only for normal pages)
|
||||
contributed by UngarPeter
|
||||
* added patch DoPageLockMinorTweak
|
||||
contributed by JuanMtnezPineda
|
||||
* Allow "0" as page name if FreeLinks are allowed
|
||||
* fixed bug NumericDatesNeedZeroPadding
|
||||
fix contributed by GunnarH
|
||||
* fixed bug ExtraBRAtDoBackLinks
|
||||
fix contributed by JuanMtnezPineda
|
||||
* fixed bug TTatDoEditBanned
|
||||
fix contributed by JuanMtnezPineda
|
||||
* fixed bug NonEnglishRSS
|
||||
fixes contributed by GunnarH
|
||||
|
||||
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)
|
||||
* 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
4
README
@@ -1,5 +1,5 @@
|
||||
README for UseModWiki 1.0
|
||||
Last updated: August 1, 2003
|
||||
README for UseModWiki 1.0.5
|
||||
Last updated: August 28, 2009
|
||||
|
||||
Release notes:
|
||||
|
||||
|
||||
6
config
6
config
@@ -1,5 +1,5 @@
|
||||
# == Configuration =======================================================
|
||||
# Original version from UseModWiki 1.0.1
|
||||
# Original version from UseModWiki 1.0.5
|
||||
|
||||
$CookieName = "Wiki"; # Name for this wiki (for multi-wiki sites)
|
||||
$SiteName = "Wiki"; # Name of site (used for titles)
|
||||
@@ -96,7 +96,7 @@ $MaskHosts = 0; # 1 = mask hosts/IPs, 0 = no masking
|
||||
$LockCrash = 0; # 1 = crash if lock stuck, 0 = auto clear locks
|
||||
$HistoryEdit = 0; # 1 = edit links on history page, 0 = no edit links
|
||||
$OldThinLine = 0; # 1 = old ==== thick line, 0 = ------ for thick line
|
||||
$NumberDates = 0; # 1 = 2003-6-17 dates, 0 = June 17, 2003 dates
|
||||
$NumberDates = 0; # 1 = 2003-06-17 dates, 0 = June 17, 2003 dates
|
||||
$ParseParas = 0; # 1 = new paragraph markup, 0 = old markup
|
||||
$AuthorFooter = 1; # 1 = show last author in footer, 0 = do not show
|
||||
$AllUpload = 0; # 1 = anyone can upload, 0 = only editor/admins
|
||||
@@ -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 '')
|
||||
|
||||
@@ -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!
|
||||
@@ -431,13 +449,17 @@ This operation is restricted to site editors only...
|
||||
|
||||
This operation is restricted to administrators only...
|
||||
|
||||
Set or Remove global edit lock
|
||||
Set global edit lock
|
||||
|
||||
Remove global edit lock
|
||||
|
||||
Edit lock created.
|
||||
|
||||
Edit lock removed.
|
||||
|
||||
Set or Remove page edit lock
|
||||
Set page edit lock
|
||||
|
||||
Remove page edit lock
|
||||
|
||||
Missing page id to lock/unlock...
|
||||
|
||||
@@ -445,36 +467,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.
|
||||
@@ -487,6 +527,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:
|
||||
|
||||
412
wiki.pl
412
wiki.pl
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/perl
|
||||
# UseModWiki version 1.0.1 (July 9, 2007)
|
||||
# UseModWiki version 1.0.5 (August 28, 2009)
|
||||
# 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
|
||||
@@ -165,7 +165,7 @@ $MaskHosts = 0; # 1 = mask hosts/IPs, 0 = no masking
|
||||
$LockCrash = 0; # 1 = crash if lock stuck, 0 = auto clear locks
|
||||
$HistoryEdit = 0; # 1 = edit links on history page, 0 = no edit links
|
||||
$OldThinLine = 0; # 1 = old ==== thick line, 0 = ------ for thick line
|
||||
$NumberDates = 0; # 1 = 2003-6-17 dates, 0 = June 17, 2003 dates
|
||||
$NumberDates = 0; # 1 = 2003-06-17 dates, 0 = June 17, 2003 dates
|
||||
$ParseParas = 0; # 1 = new paragraph markup, 0 = old markup
|
||||
$AuthorFooter = 1; # 1 = show last author in footer, 0 = do not show
|
||||
$AllUpload = 0; # 1 = anyone can upload, 0 = only editor/admins
|
||||
@@ -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 '')
|
||||
@@ -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";
|
||||
@@ -394,6 +394,16 @@ sub Tss {
|
||||
return $text;
|
||||
}
|
||||
|
||||
sub QuoteHtml {
|
||||
my ($html) = @_;
|
||||
|
||||
$html =~ s/&/&/g;
|
||||
$html =~ s/</</g;
|
||||
$html =~ s/>/>/g;
|
||||
$html =~ s/&([#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';
|
||||
@@ -463,7 +473,7 @@ sub DoBrowseRequest {
|
||||
return 1;
|
||||
}
|
||||
$id = &GetParam('keywords', '');
|
||||
if ($id) { # Just script?PageName
|
||||
if ($id ne '') { # Just script?PageName
|
||||
if ($FreeLinks && (!-f &GetPageFile($id))) {
|
||||
$id = &FreeToNormal($id);
|
||||
}
|
||||
@@ -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>";
|
||||
@@ -576,15 +586,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 +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) {
|
||||
@@ -742,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 = ();
|
||||
@@ -768,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}++;
|
||||
@@ -810,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
|
||||
@@ -885,7 +893,7 @@ sub GetRcRss {
|
||||
my $ChannelAbout = &QuoteHtml($FullUrl . &ScriptLinkChar()
|
||||
. $ENV{QUERY_STRING});
|
||||
$rssHeader = <<RSS ;
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<?xml version="1.0" encoding="@{[$HttpCharset or 'ISO-8859-1']}"?>
|
||||
<rdf:RDF
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://purl.org/rss/1.0/"
|
||||
@@ -894,7 +902,7 @@ sub GetRcRss {
|
||||
>
|
||||
<channel rdf:about="$ChannelAbout">
|
||||
<title>${\(&QuoteHtml($SiteName))}</title>
|
||||
<link>${\($QuotedFullUrl . &QuoteHtml("?$RCName"))}</link>
|
||||
<link>${\($QuotedFullUrl . &ScriptLinkChar() . &QuoteHtml(&UriEscape($RCName)))}</link>
|
||||
<description>${\(&QuoteHtml($SiteDescription))}</description>
|
||||
<wiki:interwiki>
|
||||
<rdf:Description link="$QuotedFullUrl">
|
||||
@@ -922,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 = &UriEscape($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.
|
||||
@@ -939,7 +948,7 @@ sub GetRssRcLine{
|
||||
$host = &QuoteHtml($host);
|
||||
if ($userName) {
|
||||
$author = &QuoteHtml($userName);
|
||||
$authorLink = "link=\"$QuotedFullUrl?$author\"";
|
||||
$authorLink = 'link="' . $QuotedFullUrl . &ScriptLinkChar() . &UriEscape($author) . '"';
|
||||
} else {
|
||||
$author = $host;
|
||||
}
|
||||
@@ -951,11 +960,12 @@ sub GetRssRcLine{
|
||||
$date = sprintf("%4d-%02d-%02dT%02d:%02d:%02d+%02d:00",
|
||||
$year, $mon+1, $mday, $hour, $min, $sec, $TimeZoneOffset/(60*60));
|
||||
$pagename = &QuoteHtml($pagename);
|
||||
$pagename =~ tr/_/ /;
|
||||
# Write it out longhand
|
||||
$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>
|
||||
@@ -965,16 +975,16 @@ 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);
|
||||
}
|
||||
|
||||
sub DoRss {
|
||||
print "Content-type: text/xml\n\n";
|
||||
print "Content-type: text/xml", $HttpCharset ? "; charset=$HttpCharset" : "", "\n\n";
|
||||
&DoRc(0);
|
||||
}
|
||||
|
||||
@@ -990,7 +1000,7 @@ sub DoHistory {
|
||||
my ($id) = @_;
|
||||
my ($html, $canEdit, $row, $newText);
|
||||
|
||||
print &GetHeader('', Ts('History of %s', $id), '') . '<br>';
|
||||
print &GetHeader('', Ts('History of %s', $id), '');
|
||||
&OpenPage($id);
|
||||
&OpenDefaultText();
|
||||
$newText = $Text{'text'};
|
||||
@@ -1286,7 +1296,7 @@ sub GetHistoryLink {
|
||||
}
|
||||
|
||||
sub GetHeader {
|
||||
my ($id, $title, $oldId) = @_;
|
||||
my ($id, $title, $oldId, $backlinks) = @_;
|
||||
my $header = "";
|
||||
my $logoImage = "";
|
||||
my $result = "";
|
||||
@@ -1297,13 +1307,13 @@ sub GetHeader {
|
||||
if ($FreeLinks) {
|
||||
$title =~ s/_/ /g; # Display as spaces
|
||||
}
|
||||
$result .= &GetHtmlHeader("$SiteName: $title");
|
||||
$result .= &GetHtmlHeader("$SiteName: $title", $id);
|
||||
return $result if ($embed);
|
||||
|
||||
$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";
|
||||
@@ -1312,7 +1322,7 @@ sub GetHeader {
|
||||
}
|
||||
$header = &ScriptLink($HomePage, "<$logoImage>");
|
||||
}
|
||||
if ($id ne '') {
|
||||
if (($id ne '') and $backlinks) {
|
||||
$result .= $q->h1($header . &GetBackLinksSearchLink($id));
|
||||
} else {
|
||||
$result .= $q->h1($header . $title);
|
||||
@@ -1348,7 +1358,7 @@ sub GetHttpHeader {
|
||||
}
|
||||
|
||||
sub GetHtmlHeader {
|
||||
my ($title) = @_;
|
||||
my ($title, $id) = @_;
|
||||
my ($dtd, $html, $bodyExtra, $stylesheet);
|
||||
|
||||
$html = '';
|
||||
@@ -1364,9 +1374,19 @@ 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);
|
||||
}
|
||||
unless ($action) {
|
||||
$html .= qq(<link rel="alternate" title="$SiteName RSS" href=")
|
||||
. $ScriptName . &ScriptLinkChar() . &UriEscape("action=rss&days=$RssDays")
|
||||
. qq(" type="application/rss+xml">\n);
|
||||
}
|
||||
$stylesheet = &GetParam('stylesheet', $StyleSheet);
|
||||
$stylesheet = $StyleSheet if ($stylesheet eq '');
|
||||
$stylesheet = '' if ($stylesheet eq '*'); # Allow removing override
|
||||
@@ -1393,6 +1413,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 +1477,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 '') {
|
||||
@@ -1500,6 +1521,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);
|
||||
|
||||
@@ -1587,7 +1641,7 @@ sub WikiToHTML {
|
||||
s/\<pre\>((.|\n)*?)\<\/pre\>/&StorePre($1, "pre")/ige;
|
||||
$pageText =~
|
||||
s/\<code\>((.|\n)*?)\<\/code\>/&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 +1712,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 +1724,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 +1750,15 @@ sub CommonMarkup {
|
||||
return $_;
|
||||
}
|
||||
|
||||
sub EmptyCellsToNbsp {
|
||||
my ($row) = @_;
|
||||
|
||||
$row =~ s/(?<=\|\|)\s+(?=\|\|)/ /g;
|
||||
$row =~ s/^\s+(?=\|\|)/ /;
|
||||
$row =~ s/(?<=\|\|)\s+$/ /;
|
||||
return $row;
|
||||
}
|
||||
|
||||
sub WikiLinesToHtml {
|
||||
my ($pageText) = @_;
|
||||
my ($pageHtml, @htmlStack, $code, $codeAttributes, $depth, $oldCode);
|
||||
@@ -1723,7 +1786,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;
|
||||
@@ -1790,21 +1853,11 @@ sub EvalLocalRules {
|
||||
|
||||
sub UriEscape {
|
||||
my ($uri) = @_;
|
||||
$uri =~ s/([\x00-\x1f\x7f-\xff])/sprintf("%%%02X", ord($1))/ge;
|
||||
$uri =~ s/([^\w\-.!~*'()\/\&=#])/sprintf("%%%02X", ord($1))/ge;
|
||||
$uri =~ s/\&/\&/g;
|
||||
return $uri;
|
||||
}
|
||||
|
||||
sub QuoteHtml {
|
||||
my ($html) = @_;
|
||||
|
||||
$html =~ s/&/&/g;
|
||||
$html =~ s/</</g;
|
||||
$html =~ s/>/>/g;
|
||||
$html =~ s/&([#a-zA-Z0-9]+);/&$1;/g; # Allow character references
|
||||
return $html;
|
||||
}
|
||||
|
||||
sub ParseParagraph {
|
||||
my ($text) = @_;
|
||||
|
||||
@@ -1954,7 +2007,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 +2022,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 +2145,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]+)$//;
|
||||
@@ -2992,7 +3048,7 @@ sub CalcDay {
|
||||
$ts += $TimeZoneOffset;
|
||||
my ($sec, $min, $hour, $mday, $mon, $year) = localtime($ts);
|
||||
if ($NumberDates) {
|
||||
return ($year + 1900) . '-' . ($mon+1) . '-' . $mday;
|
||||
return sprintf("%d-%02d-%02d", $year+1900, $mon+1, $mday);
|
||||
}
|
||||
return ("January", "February", "March", "April", "May", "June",
|
||||
"July", "August", "September", "October", "November",
|
||||
@@ -3009,15 +3065,15 @@ sub CalcTime {
|
||||
if (($TimeZoneOffset == 0) && ($ScriptTZ ne "")) {
|
||||
$mytz = " " . $ScriptTZ;
|
||||
}
|
||||
$ampm = "";
|
||||
if ($UseAmPm) {
|
||||
$ampm = " am";
|
||||
if ($hour > 11) {
|
||||
$ampm = " pm";
|
||||
$hour = $hour - 12;
|
||||
}
|
||||
$hour = 12 if ($hour == 0);
|
||||
unless ($UseAmPm) {
|
||||
return sprintf("%02d:%02d$mytz", $hour, $min);
|
||||
}
|
||||
$ampm = " am";
|
||||
if ($hour > 11) {
|
||||
$ampm = " pm";
|
||||
$hour = $hour - 12;
|
||||
}
|
||||
$hour = 12 if ($hour == 0);
|
||||
$min = "0" . $min if ($min<10);
|
||||
return $hour . ":" . $min . $ampm . $mytz;
|
||||
}
|
||||
@@ -3195,7 +3251,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>";
|
||||
@@ -3230,7 +3286,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) . " "
|
||||
@@ -3298,9 +3354,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 +3365,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 +3399,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 +3477,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,8 +3508,7 @@ sub DoUpdatePrefs {
|
||||
# All link bar settings should be updated before printing the header
|
||||
&UpdatePrefCheckbox("toplinkbar");
|
||||
&UpdatePrefCheckbox("linkrandom");
|
||||
print &GetHeader('',T('Saving Preferences'), '');
|
||||
print '<br>';
|
||||
print &GetHeader('', T('Saving Preferences'), '');
|
||||
if ($UserID < 1001) {
|
||||
print '<b>',
|
||||
Ts('Invalid UserID %s, preferences not saved.', $UserID), '</b>';
|
||||
@@ -3607,7 +3667,6 @@ sub UpdatePrefNumber {
|
||||
|
||||
sub DoIndex {
|
||||
print &GetHeader('', T('Index of all pages'), '');
|
||||
print '<br>';
|
||||
&PrintPageList(&AllPagesList());
|
||||
print &GetCommonFooter();
|
||||
}
|
||||
@@ -3640,9 +3699,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 +3735,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();
|
||||
}
|
||||
|
||||
@@ -3731,7 +3797,6 @@ sub DoSearch {
|
||||
return;
|
||||
}
|
||||
print &GetHeader('', &QuoteHtml(Ts('Search for: %s', $string)), '');
|
||||
print '<br>';
|
||||
&PrintPageList(&SearchTitleAndBody($string));
|
||||
print &GetCommonFooter();
|
||||
}
|
||||
@@ -3740,7 +3805,6 @@ sub DoBackLinks {
|
||||
my ($string) = @_;
|
||||
|
||||
print &GetHeader('', &QuoteHtml(Ts('Backlinks for: %s', $string)), '');
|
||||
print '<br>';
|
||||
# At this time the backlinks are mostly a renamed search.
|
||||
# An initial attempt to match links only failed on subpages and free links.
|
||||
# Escape some possibly problematic characters:
|
||||
@@ -3761,10 +3825,10 @@ sub PrintPageList {
|
||||
|
||||
sub DoLinks {
|
||||
print &GetHeader('', &QuoteHtml(T('Full Link List')), '');
|
||||
print "<hr><pre>\n\n\n\n\n"; # Extra lines to get below the logo
|
||||
print "<pre>\n\n\n\n\n"; # Extra lines to get below the logo
|
||||
&PrintLinkList(&GetFullLinkList());
|
||||
print "</pre>\n";
|
||||
print &GetMinimumFooter();
|
||||
print &GetCommonFooter();
|
||||
}
|
||||
|
||||
sub PrintLinkList {
|
||||
@@ -3808,7 +3872,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 +3897,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;
|
||||
@@ -4087,6 +4158,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 = "";
|
||||
@@ -4105,7 +4177,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
|
||||
@@ -4124,11 +4196,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4252,7 +4332,6 @@ sub ProcessVetos {
|
||||
sub DoMaintain {
|
||||
my ($name, $fname, $data, $message, $status);
|
||||
print &GetHeader('', T('Maintenance on all pages'), '');
|
||||
print "<br>";
|
||||
$fname = "$DataDir/maintain";
|
||||
if (!&UserIsAdmin()) {
|
||||
if ((-f $fname) && ((-M $fname) < 0.5)) {
|
||||
@@ -4341,9 +4420,9 @@ sub DoMaintainRc {
|
||||
return if (!&UserIsAdminOrError());
|
||||
&RequestLock() or die(T('Could not get lock for RC maintenance'));
|
||||
if (&TrimRc()) {
|
||||
print '<br>' . T('RC maintenance done.') . '<br>';
|
||||
print T('RC maintenance done.') . '<br>';
|
||||
} else {
|
||||
print '<br>' . T('RC maintenance not done.') . '<br>';
|
||||
print T('RC maintenance not done.') . '<br>';
|
||||
}
|
||||
&ReleaseLock();
|
||||
print &GetCommonFooter();
|
||||
@@ -4368,12 +4447,17 @@ sub UserIsAdminOrError {
|
||||
}
|
||||
|
||||
sub DoEditLock {
|
||||
my ($fname);
|
||||
my ($set, $fname);
|
||||
|
||||
print &GetHeader('', T('Set or Remove global edit lock'), '');
|
||||
$set = &GetParam("set", 1) ? 1 : 0;
|
||||
if ($set) {
|
||||
print &GetHeader('', T('Set global edit lock'), '');
|
||||
} else {
|
||||
print &GetHeader('', T('Remove global edit lock'), '');
|
||||
}
|
||||
return if (!&UserIsAdminOrError());
|
||||
$fname = "$DataDir/noedit";
|
||||
if (&GetParam("set", 1)) {
|
||||
if ($set) {
|
||||
&WriteStringToFile($fname, "editing locked.");
|
||||
} else {
|
||||
unlink($fname);
|
||||
@@ -4387,9 +4471,14 @@ sub DoEditLock {
|
||||
}
|
||||
|
||||
sub DoPageLock {
|
||||
my ($fname, $id);
|
||||
my ($set, $fname, $id);
|
||||
|
||||
print &GetHeader('', T('Set or Remove page edit lock'), '');
|
||||
$set = &GetParam("set", 1) ? 1 : 0;
|
||||
if ($set) {
|
||||
print &GetHeader('', T('Set page edit lock'), '');
|
||||
} else {
|
||||
print &GetHeader('', T('Remove page edit lock'), '');
|
||||
}
|
||||
# Consider allowing page lock/unlock at editor level?
|
||||
return if (!&UserIsAdminOrError());
|
||||
$id = &GetParam("id", "");
|
||||
@@ -4399,7 +4488,7 @@ sub DoPageLock {
|
||||
}
|
||||
return if (!&ValidIdOrDie($id)); # Consider nicer error?
|
||||
$fname = &GetLockedPageFile($id);
|
||||
if (&GetParam("set", 1)) {
|
||||
if ($set) {
|
||||
&WriteStringToFile($fname, "editing locked.");
|
||||
} else {
|
||||
unlink($fname);
|
||||
@@ -4415,7 +4504,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);
|
||||
@@ -4427,43 +4516,47 @@ sub DoEditBanned {
|
||||
"a hostname). <b>Note:</b> To test the ban on yourself, you must ",
|
||||
"give up your admin access (remove password in Preferences).";
|
||||
print "<p>Example:<br>",
|
||||
"# blocks hosts ending with .foocorp.com<br>",
|
||||
"\\.foocorp\\.com\$<br>",
|
||||
"# blocks exact IP address<br>",
|
||||
"^123\\.21\\.3\\.9\$<br>",
|
||||
"# blocks whole 123.21.3.* IP network<br>",
|
||||
"^123\\.21\\.3\\.\\d+\$<p>";
|
||||
"<tt># blocks hosts ending with .foocorp.com</tt><br>",
|
||||
"<tt>\\.foocorp\\.com\$</tt><br>",
|
||||
"<tt># blocks exact IP address</tt><br>",
|
||||
"<tt>^123\\.21\\.3\\.9\$</tt><br>",
|
||||
"<tt># blocks whole 123.21.3.* IP network</tt><br>",
|
||||
"<tt>^123\\.21\\.3\\.\\d+\$</tt><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 +4580,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 +4646,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 +4658,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 +4681,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 +4718,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 +4855,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 +4911,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,52 +4949,19 @@ 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.5</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);
|
||||
@@ -4896,7 +4969,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 +4999,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 +5025,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();
|
||||
|
||||
Reference in New Issue
Block a user