This works, by saving the last line of the specified page (by default called WikiPatches/AnnoyingQuote) in the specified file (by default /home/httpd/wiki/motd). This is then read and inserted in the page if the tag :MOTD: is found.
The following patch is for UseMod 0.92. -- KevinTaylor
31d30
<
49c48
< $UserGotoBar $MOTDPattern $MOTDFile $MOTDPage);
---
> $UserGotoBar);
123,124d121
< $MOTDFile = '/home/httpd/wiki/motd';
< $MOTDPage = 'AnnoyingQuote';
238d234
< $MOTDPattern = ":MOTD:";
1228d1223
< s/$MOTDPattern/&StoreMOTD($1)/geo;
1464,1477d1458
< sub StoreMOTD {
< my ($val) = @_;
<
< open MOTD, $MOTDFile or return "<small><em>ERROR: Cannot open motd file.</em></small>";
<
< my $line = <MOTD>;
< close MOTD;
< if ($line eq "")
< {
< return "<small><em>None.</em></small>";
< }
< return "<small><em>$line</em></small>";
< }
<
3320,3324d3300
<
< if ($id =~ m/^$MOTDPage$/)
< {
< &saveMotd($Text{'text'});
< }
4063,4080c4039
<
< sub saveMotd
< {
< my ($text) = @_;
<
< unless (open MOTD, ">$MOTDFile")
< {
< return undef;
< }
<
< if ($text =~ m/\n(.*?)$/)
< {
< # Save text between last \n and end of page
< print MOTD $1;
< }
<
< close MOTD;
< }
---
> #END_OF_OTHER_CODE
Actaully, if you add in the line:
$text =~ s/[\n\r]*$//mg;before the m// line in saveMotd, then it gobbles up empty lines at the end of the page too.