9 Commits

Author SHA1 Message Date
Aki Goto
25aa740c2a fix for using with FastCGI servers 2022-09-22 11:14:33 +09:00
Markus Lude
14c06ba45d some preparations for 1.2.1: bump version 2017-12-01 08:25:46 +01:00
Markus Lude
f008b5c0fd cleanup generated HTML code on history page
in DoHistory():
remove unneccessary <tr>

in GetHistoryLine():
close <td>
2017-11-18 01:30:09 +01:00
Markus Lude
ba421c2d6a RSS: fall back to LogoUrl for RssLogoUrl 2017-11-18 00:42:01 +01:00
Markus Lude
291d474327 fix EditHash
in DoPost():
actually check the hash
2017-11-16 08:12:10 +01:00
Markus Lude
4a7553ced4 in GetFooterText():
dont call GetMinimumFooter(), no nested Footer functions
use end_html instead
2017-11-15 19:24:19 +01:00
Markus Lude
acf20ddadd * put <hr> class wikilinerc inside of div for class wikirc 2017-11-15 19:19:12 +01:00
Markus Lude
21ebc21f8e closing div for class wikibody was missing at some places
added </div>
2017-11-15 08:40:39 +01:00
Markus Lude
1d521cdc40 use GetIP() at all relevant places 2017-11-05 21:16:56 +01:00
3 changed files with 44 additions and 14 deletions

View File

@@ -1,4 +1,11 @@
Changes for bugfix release 1.2.1 (December 01, 2017):
* closing div for class wikibody was missing at some places, added
* put <hr> class wikilinerc inside of div for class wikirc
* fix EditHash
* RSS: fall back to LogoUrl for RssLogoUrl
* cleanup generated HTML code on history page
Changes for release 1.2.0 (November 05, 2017): Changes for release 1.2.0 (November 05, 2017):
* switch DTD to HTML 4.0.1 Transitional * switch DTD to HTML 4.0.1 Transitional
* cleanup generated HTML code * cleanup generated HTML code

2
config
View File

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

49
wiki.pl
View File

@@ -1,5 +1,5 @@
#!/usr/bin/perl -wT #!/usr/bin/perl -wT
# UseModWiki version 1.2.0 (November 05, 2017) # UseModWiki version 1.2.1 (December 01, 2017)
# Copyright (C) 2000-2003 Clifford A. Adams <caadams@usemod.com> # Copyright (C) 2000-2003 Clifford A. Adams <caadams@usemod.com>
# Copyright (C) 2002-2003 Sunir Shah <sunir@sunir.org> # Copyright (C) 2002-2003 Sunir Shah <sunir@sunir.org>
# with some changes from Markus Lude <markus.lude@gmx.de> # with some changes from Markus Lude <markus.lude@gmx.de>
@@ -424,7 +424,7 @@ sub InitRequest {
} else { } else {
$CGI::DISABLE_UPLOADS = 1; # no uploads $CGI::DISABLE_UPLOADS = 1; # no uploads
} }
$q = new CGI; $q ||= new CGI;
# Fix some issues with editing UTF8 pages (if charset specified) # Fix some issues with editing UTF8 pages (if charset specified)
if ($HttpCharset ne '') { if ($HttpCharset ne '') {
$q->charset($HttpCharset); $q->charset($HttpCharset);
@@ -591,8 +591,8 @@ sub BrowsePage {
$fullHtml .= "</div>\n"; $fullHtml .= "</div>\n";
if (($id eq $RCName) || (T($RCName) eq $id) || (T($id) eq $RCName)) { if (($id eq $RCName) || (T($RCName) eq $id) || (T($id) eq $RCName)) {
print $fullHtml; print $fullHtml;
print qq(<hr class="wikilinerc">\n);
print '<div class="wikirc">'; print '<div class="wikirc">';
print qq(<hr class="wikilinerc">\n);
&DoRc(1); &DoRc(1);
print "</div>\n"; print "</div>\n";
print &GetFooterText($id, $goodRevision); print &GetFooterText($id, $goodRevision);
@@ -919,6 +919,15 @@ sub GetRcRss {
RSS RSS
($headList, $items) = &GetRc(0, @_); ($headList, $items) = &GetRc(0, @_);
$rssHeader .= $headList; $rssHeader .= $headList;
if (! $RssLogoUrl) {
$RssLogoUrl = $FullUrl;
if ($LogoUrl =~ /^\//) {
$RssLogoUrl =~ s/^(http:\/\/[^\/]*)(\/.*)$/$1/;
$RssLogoUrl .= $LogoUrl;
} else {
$RssLogoUrl = $LogoUrl;
}
}
return <<RSS ; return <<RSS ;
$rssHeader $rssHeader
</rdf:Seq> </rdf:Seq>
@@ -1020,7 +1029,7 @@ sub DoHistory {
<input type="hidden" name="action" value="browse"> <input type="hidden" name="action" value="browse">
<input type="hidden" name="diff" value="1"> <input type="hidden" name="diff" value="1">
<input type="hidden" name="id" value="$id"> <input type="hidden" name="id" value="$id">
<table border="0" width="100%"><tr> <table border="0" width="100%">
EOF EOF
} }
$html = &GetHistoryLine($id, $Page{'text_default'}, $canEdit, $row++); $html = &GetHistoryLine($id, $Page{'text_default'}, $canEdit, $row++);
@@ -1102,7 +1111,7 @@ sub GetHistoryLine {
$summary = &QuoteHtml($summary); # Thanks Sunir! :-) $summary = &QuoteHtml($summary); # Thanks Sunir! :-)
$html .= "<b>[$summary]</b> "; $html .= "<b>[$summary]</b> ";
} }
$html .= $UseDiff ? "</tr>\n" : "<br>\n"; $html .= $UseDiff ? "</td></tr>\n" : "<br>\n";
return $html; return $html;
} }
@@ -1483,7 +1492,7 @@ sub GetFooterText {
$result .= T($FooterNote); $result .= T($FooterNote);
} }
$result .= "</div>\n"; $result .= "</div>\n";
$result .= &GetMinimumFooter(); $result .= $q->end_html;
return $result; return $result;
} }
@@ -1615,6 +1624,7 @@ sub GetRedirectPage {
} }
$html .= "\n<p>"; $html .= "\n<p>";
$html .= Ts('Follow the %s link to continue.', $nameLink); $html .= Ts('Follow the %s link to continue.', $nameLink);
$html .= "</div>\n"; # end wikibody
$html .= &GetMinimumFooter(); $html .= &GetMinimumFooter();
} }
return $html; return $html;
@@ -2435,7 +2445,7 @@ sub OpenNewSection {
$Section{'revision'} = 0; # Number of edited times $Section{'revision'} = 0; # Number of edited times
$Section{'tscreate'} = $Now; # Set once at creation $Section{'tscreate'} = $Now; # Set once at creation
$Section{'ts'} = $Now; # Updated every edit $Section{'ts'} = $Now; # Updated every edit
$Section{'ip'} = $ENV{REMOTE_ADDR}; $Section{'ip'} = GetIP();
$Section{'host'} = ''; # Updated only for real edits (can be slow) $Section{'host'} = ''; # Updated only for real edits (can be slow)
$Section{'id'} = $UserID; $Section{'id'} = $UserID;
$Section{'username'} = &GetParam("username", ""); $Section{'username'} = &GetParam("username", "");
@@ -2540,7 +2550,7 @@ sub SaveSection {
$Section{'revision'} += 1; # Number of edited times $Section{'revision'} += 1; # Number of edited times
$Section{'ts'} = $Now; # Updated every edit $Section{'ts'} = $Now; # Updated every edit
$Section{'ip'} = $ENV{REMOTE_ADDR}; $Section{'ip'} = GetIP();
$Section{'id'} = $UserID; $Section{'id'} = $UserID;
$Section{'username'} = &GetParam("username", ""); $Section{'username'} = &GetParam("username", "");
$Section{'data'} = $data; $Section{'data'} = $data;
@@ -2820,7 +2830,7 @@ sub UserIsBanned {
($status, $data) = &ReadFile("$DataDir/banlist"); ($status, $data) = &ReadFile("$DataDir/banlist");
return 0 if (!$status); # No file exists, so no ban return 0 if (!$status); # No file exists, so no ban
$data =~ s/\r//g; $data =~ s/\r//g;
$ip = $ENV{'REMOTE_ADDR'}; $ip = GetIP();
$host = &GetRemoteHost(0); $host = &GetRemoteHost(0);
foreach (split(/\n/, $data)) { foreach (split(/\n/, $data)) {
next if ((/^\s*$/) || (/^#/)); # Skip empty, spaces, or comments next if ((/^\s*$/) || (/^#/)); # Skip empty, spaces, or comments
@@ -3169,7 +3179,7 @@ sub GetHiddenValue {
} }
sub GetIP { sub GetIP {
return $ENV{REMOTE_ADDR}; return $ENV{REMOTE_ADDR} || '127.0.0.1';
} }
sub GetRemoteHost { sub GetRemoteHost {
@@ -3612,6 +3622,7 @@ sub DoEditPrefs {
print '<br>', $q->submit(-name=>'Save', -value=>T('Save')), "\n"; print '<br>', $q->submit(-name=>'Save', -value=>T('Save')), "\n";
print $q->end_form; print $q->end_form;
print "</div>\n"; print "</div>\n";
print "</div>\n"; # end wikibody
if (!&GetParam('embed', $EmbedWiki)) { if (!&GetParam('embed', $EmbedWiki)) {
print '<div class="wikifooter">'; print '<div class="wikifooter">';
print qq(<hr class="wikilinefooter">\n); print qq(<hr class="wikilinefooter">\n);
@@ -3819,7 +3830,7 @@ sub DoNewLogin {
# The cookie will be transmitted in the next header # The cookie will be transmitted in the next header
%UserData = %UserCookie; %UserData = %UserCookie;
$UserData{'createtime'} = $Now; $UserData{'createtime'} = $Now;
$UserData{'createip'} = $ENV{REMOTE_ADDR}; $UserData{'createip'} = GetIP();
&SaveUserData(); &SaveUserData();
} }
@@ -3835,6 +3846,7 @@ sub DoEnterLogin {
-size=>15, -maxlength=>50); -size=>15, -maxlength=>50);
print '<br>', $q->submit(-name=>'Login', -value=>T('Login')), "\n"; print '<br>', $q->submit(-name=>'Login', -value=>T('Login')), "\n";
print $q->end_form; print $q->end_form;
print "</div>\n"; # end wikibody
if (!&GetParam('embed', $EmbedWiki)) { if (!&GetParam('embed', $EmbedWiki)) {
print '<div class="wikifooter">'; print '<div class="wikifooter">';
print qq(<hr class="wikilinefooter">\n); print qq(<hr class="wikilinefooter">\n);
@@ -3869,6 +3881,7 @@ sub DoLogin {
} else { } else {
print Ts('Login for user ID %s failed.', $unsafe_uid); print Ts('Login for user ID %s failed.', $unsafe_uid);
} }
print "</div>\n"; # end wikibody
if (!&GetParam('embed', $EmbedWiki)) { if (!&GetParam('embed', $EmbedWiki)) {
print '<div class="wikifooter">'; print '<div class="wikifooter">';
print qq(<hr class="wikilinefooter">\n); print qq(<hr class="wikilinefooter">\n);
@@ -4112,7 +4125,7 @@ sub DoPost {
my $oldconflict = &GetParam("oldconflict", ""); my $oldconflict = &GetParam("oldconflict", "");
my $isEdit = 0; my $isEdit = 0;
my $editTime = $Now; my $editTime = $Now;
my $authorAddr = $ENV{REMOTE_ADDR}; my $authorAddr = GetIP();
if ($FreeLinks) { if ($FreeLinks) {
$unsafe_id = &FreeToNormal($unsafe_id); $unsafe_id = &FreeToNormal($unsafe_id);
@@ -4190,6 +4203,14 @@ sub DoPost {
&DoEdit($id, 0, $pgtime, $string, 1); &DoEdit($id, 0, $pgtime, $string, 1);
return; return;
} }
if ($UseEditHash) {
my $p_hash = &GetParam("hash", "");
if (!&CheckHash("edit", $p_hash, $id, $pgtime)) {
&ReleaseLock();
&DoEdit($id, 0, $pgtime, $string, 1);
return;
}
}
$user = &GetParam("username", ""); $user = &GetParam("username", "");
# If the person doing editing chooses, send out email notification # If the person doing editing chooses, send out email notification
if ($EmailNotify) { if ($EmailNotify) {
@@ -4669,6 +4690,7 @@ sub DoEditBanned {
print &GetTextArea('banlist', $banList, 12, 50); print &GetTextArea('banlist', $banList, 12, 50);
print "<br>", $q->submit(-name=>'Save'), "\n"; print "<br>", $q->submit(-name=>'Save'), "\n";
print $q->end_form; print $q->end_form;
print "</div>\n"; # end wikibody
if (!&GetParam('embed', $EmbedWiki)) { if (!&GetParam('embed', $EmbedWiki)) {
print '<div class="wikifooter">'; print '<div class="wikifooter">';
print qq(<hr class="wikilinefooter">\n); print qq(<hr class="wikilinefooter">\n);
@@ -4725,6 +4747,7 @@ sub DoEditLinks {
-label=>"Substitute text for rename"); -label=>"Substitute text for rename");
print "<br>", $q->submit(-name=>'Edit'), "\n"; print "<br>", $q->submit(-name=>'Edit'), "\n";
print $q->end_form; print $q->end_form;
print "</div>\n"; # end wikibody
if (!&GetParam('embed', $EmbedWiki)) { if (!&GetParam('embed', $EmbedWiki)) {
print '<div class="wikifooter">'; print '<div class="wikifooter">';
print qq(<hr class="wikilinefooter">\n); print qq(<hr class="wikilinefooter">\n);
@@ -5097,7 +5120,7 @@ sub RenamePage {
sub DoShowVersion { sub DoShowVersion {
print &GetHeader('', T('Displaying Wiki Version'), ''); print &GetHeader('', T('Displaying Wiki Version'), '');
print "<p>UseModWiki version 1.2.0</p>\n"; print "<p>UseModWiki version 1.2.1</p>\n";
print &GetCommonFooter(); print &GetCommonFooter();
} }