The problem is that by default the test-data/config file contains
$ScriptName = 'http://localhost/wiki.pl' but morbo serves the site at
http://127.0.0.1:8080. We therefore append a new $ScriptName
assignment if the correct one doesn't exist. The alternative is
tricky because of the /wiki.pl prefix; fixing that would require a lot
more code, I suspect.
DuckDuckGo search doesn't use the www subdomain anymore.
The raw recent changes returns the bogus hash (four octal digits)
instead of Anonymous before maintenance anonymises the entry.
When serving recent changes, we know the username and host of the
person making the edit. We use GetAuthorLink to show either the name
linked to the username, or "Anonymous", or a colour coded bogus hash
of their host (that's the four octal digits, hopefully colourized by
your CSS).
When serving raw changes, we used to serve just the username or
"Anonymous". In order to help use cases such as the Gemini wiki
running on gemini://alexschroeder.ch:1965 which consumes raw changes
to present a view that is compatible with Gemini Wiki, we'd like those
bogus hashes as well. This comit does that by splitting ColorCode into
Code and ColorCode such that we can use Code when serving raw changes.
Up to now it was assumed that the raw wiki text would not be written
as Gemtext, but increasingly that is not the case. This commit adds
handling of Gemtext links.
gemini_link now handles URLs and is used for all links in
serve_gemini_page.
Paragraph splits now happen at the beginning of list items and when
line breaks are requested. It's not great but what else are you going
to do?
Handle image links.
Handle HTML tags (by ignoring them).
Raw pages served as text/plain instead of text/markdown.
Makefile now also has a gemini target to start up a gemini wiki. It
also calls openssl to generate keys if necessary.
gemini-server.pl now also has log messages in the various functions
serving content, instead of having some of them in the main function.
The footer is printed in a separate function.
Fixed sorting. Added \r to some of the links. Allow loading
gemini-server.pl as a library. Don't force the display of ten links in
the main menu unless we actually have as many day pages. Change URL
for minor recent changes.
Fixed [URL text] and [[in-reply-to:URL|text]] patterns: don't pass an
URL to gemini_link!
Some log output when writing files. Don't double-decode UTF-8 when
writing text pages.
Render pages ending in '.txt' as raw text. No folding of robots.txt!
Fix two confusing calls to UrlEncode at the end: when serving Gemini
pages and raw text pages, don't URL-encode the page names, use
FreeToNormal to get valid page ids!
Fiddle with the block parsing... Perhaps the single /\n\* / match is
unnecessary? Let's wait for a case where this is wrong. Basically that
would be a paragraph followed immediately by a list item
* like this
I don't think people write it like this when writing for the wiki.
Support the special case <journal search tag:foo> for tag pages.
Fix handling of newlines for blocks that are just links and the like.
No longer wrap paragraphs. In fact, unwrap paragraphs and list items
because that's what the specification says: Each line is to be wrapped
separately.
Allow single line/paragraph comments. This requires the QuestionAsker
extension and supports the questions and answers.
Support in-reply-to links. Support Markdown links.
Sort pages and their comments correctly even if not day pages.
Fix URL-encoding of $id whenever a URL is printed (for redirection
using 30 and 31, for example), and fix normal form (underscores
instead of spaces for $id).
Do not URL-escape the slash.
Reorganize the main menu and add a 'New page' link.
Change the tag format from $id/tag to tag/$id.
Change the naming so that "text page" is now a "raw page" served via
raw/$id.
Only allow editing of raw pages.
Improve transformation of wiki raw text to Gemini format. Handle tags
with alternate text and images.
Add a footer to Gemini format pages.
When editing existing pages, always make it a minor edit. That matches
how I use the wiki as a blog. It might not be correct for a wiki used
as an encyclopedia.
Handle spaces in $id.
Simplify code. Fix display of email list: URL decoding email addresses
and printing the email addresses in the list. Fix the feedback message
after unsubscribing somebody from all pages.
scripts/webmention.pl now extracts the author of FROM
modules/webmention.pl now is less complicated about skipping
webmention endpoint advertising and it tries to use the author and
link advertised from the incoming webmention page
And the tests were amended.
Sadly, I would have thought that the correct solution is the
following, at the end, once we have $server:
$server->cgi_init(
sub {
require CGI;
CGI::initialize_globals();
CGI->import(qw(-utf8));
});
This is based on the documentation of HTTP::Server::Simple::CGI, and
skimming its source code, and the documentation of the use pragma, and
the pseudo code in its documentation. The workaround of setting
$CGI::PARAM_UTF8 directly is based on reading the CGI.pm source code.
This is definitely a hack.
check_answer_v2 requires an answer or it throws the error "To check
answer, the user response token must be provided". That causes all the
tests to fail. Thus, if no answer is provided, we return 0 (false).
The v1 API has been deprecated, so this changeset switches to using the
v2 API as exposed by the Captch::reCAPTCHA module.
The main changes are to switch to the _v2 methods for get_html and
check_answer, plus necessary changes to the check_answer parameters to
make the code compatible with the new form field naming.
The benefit is that this allows us to use the CSS rule that allows the
browser to hyphenate words:
body { hyphens: auto }
This required a number of changes.
wiki.pl
- new option, $CurrentLanguage
- GetHtmlHeader adds lang attribute to body
- PrintAllPages adds lang attribute to div
- PrintPageContent adds lang attribute to div
- PageHtml adds div with lang attribute
- GetLanguages sorts languages by occurences
- GetLanguage is new and returns the first language of GetLanguages
Modules that had to be changed because they refer to the divs that
have now been changed:
- crossbar.pl
Tests that had to be changed:
- atom.t
- crossbar.t
- hr.t
- languages.t
- portrait-support.t
- rss.t
This makes it easy to quickly deploy the wiki standalone using
Mojolicious. It reloads automatically when any of the relevant files
are changed. This might be easier to work with than a local webserver
installation.
The test didn't specify a host explicitly. On my systems, that meant
"localhost" sometimes ended up being "127.0.0.1" or "::1" but for
Alexine it ended up being "::ffff:127.0.0.1". Let's hope that
explicitly setting "127.0.0.1" fixes all of this.
Frank Betten noted about the old code "$Now - Modified($fname) < 0.5"
that the "left-hand side is in seconds, right-hand side in days".
This was fixed by replacing 0.5 with 12 * 60 * 60.
Also change the HTTP status messages from the pingback-server for
easier debugging. After all, the message text can be whatever we want.
In order to know which of code 400 errors we ran into, use different
messages for each.
Frank Betten reported that after installing the module for Permanent
Anchors the parameter permanentanchors has no effect and there's no
checkbox on the index page. The reason is that Permanent Anchors used
to add to @IndexOptions upon loading (InitModules), but commit
15263102 had moved the setting of @IndexOptions into InitVariables,
thus overwriting any changes made during InitModules. In order to have
an effect, @IndexOptions has to be modified via @MyInitVariables. All
of this is necessary because @IndexOptions uses translated strings and
these are themselves loaded via modules so setting @IndexOptions at
InitModules time can be too early. This was fixed with commit deec99c,
necessitating all these follow-up changes.
On Journal pages, add the classes h-feed for the entire feed, h-entry
for a single page, entry-title for the header, and entry-content for
the page content.
The old code assumed that a kept revision for the last major revision
would always exist. But if you just create a page using a minor edit, it
still gets shown, triggering a call to die. This fixes it.
NewPermanentAnchorsDeletePage called DeletePermanentAnchors which
ended with ReleaseLockDir and that is wrong if a lock exists: it’ll
return the value in %Locks which is going to be 1. Thus, with this
module installed, pages would get deleted, but maintenance would still
print: "X not deleted: 1". We fix this by return the empty string from
NewPermanentAnchorsDeletePage.
If this is a minor edit, let's keep everything as it is, but show the
date of the last major change, if possible. This is important for
blogs that get added to a Planet. A minor change doesn't mean that the
page needs to go to the front of the Planet.
BannedRegexps needs to check for BannedContent before it does
anything. BannedContent checks the URLs, and so BannedRegexps wants to
check everything except for the URLs. The order is important: the old
code used to remove the URLs before handing the text to BannedContent,
so it never found a thing. Changing the order fixed this.
Although I must say, the more I see of Div Foo, the less I like it. I
can't wrap a div around the <titles ...> rule and so now I use the
following on the All_Modules page:
<list>
<titles ...>
This introduces an empty div before the div I care about and the CSS
then does .foo_list + .journal etc.
If a page was created by just minor edits, then it is visible in a
journal. We shouldn't skip it from the journal RSS. Furthermore:
what's the point in showing the text from the last major version? Show
the latest version!
This works without changes to journal-rss.pl itself. All we do is make
sure that RcSelfAction, RcPreviousAction, and RcLastAction don't get
the action (rc vs. rss) from their arguments but determine it by
looking at the script parameters. Since journal-rss simply uses the
journal action, this will then get picked up correctly.
Make sure the gopher server reads the config file and skips surge
protection if $SurgeProtection is set to 0. The tests do this. If we
don't do this, tests start failing after a while.
Instead of calling DoSurgeProtection as part of process_request and
faking username and overwriting ReportError, I've moved the essential
code to allow_deny_hook which seems to be the place dedicated to this
sort of code. Sadly, push(@{$self->{server}->{deny}}, $peeraddr) seems
to have no effect. When the next request comes around, the deny list
is empty again. I guess we would have to persist this somehow. For
now, we're simply using allow_deny_hook and that seems to be just as
well.
Move search up in the list of actions so that it takes precedence over
match if both parameters are provided and add matching to the Filtered
function so that it is taken into account when searching.
We want to avoid turning & into & when printing a menu, so we don't
want to call NormalToFree because it callse QuoteHtml. Replaced all
calls with normal_to_free which only translates underscores to spaces.
Two changes: First, when moving entries from rc.log to oldrc.log, make
sure we use the string "Anonymous" for the host instead of translating
it. Second, when printing the author link using GetAuthorLink, don't
call ColorCode for anonymous authors if the IP number has been replaced
by the string "Anonymous". In this case, just return "Anonymous".
Otherwise we're getting the color code of the string "Anonymous" which
is confusing.
Removing IP number ("host") from page files and keep files. The IP
numbers remain in the RC file. GetAuthor and GetAuthorLink now take
username as a first argument and host as an optional second argument.
Sorry for the incompatible change.
As discussed in issue #38 of VF-1 and on the #gopherproject channel,
newer software does not double leading periods and does send final
periods, so this commit simplifies the code and no longer does that,
either. https://github.com/solderpunk/VF-1/issues/38
Also other improvements, hopefully. There are still problems regarding
feedback. When uploading a file twice in succession, for example, the
second call produces no output until a few seconds have passed.
echo -e "Alex/image/png/write/file\t"`wc -c < test.png` \
| cat - test.png | nc localhost 7070
echo -e "Alex/image/png/write/file\t"`wc -c < test.png` \
| cat - test.png | nc localhost 7070
I really have no idea why this is. The log output is correct but
printing to the stream just doesn't work anymore. Has it been closed
in the mean time?
When uploading big files, they get sent in chunks we therefore have to
detect the end of the file being sent. A final period on a line by
itself ("\n.\n") will have to do -- even for binary uploads.
We're now printing (useless) host and port data on info lines as well,
just because these lines might otherwise not get parsed correctly by
clients. It's a useless waste of bandwidth, though.
The search fields at the top were shortened such that they all fit on
one line when all of them are shown (set %Languages and $MatchingPages
to show them all), on a terminal 80 characters wide, using a text
browser like Lynx or w3m.
Sometimes I write things like 5./month and that would have
triggered (?<=\P{Word})\/ so I decided to switch that the more
demanding (?<=\s)\/. In order to have italic items start table cells,
however, \G(?<=[|[:space:]])\/ instead.
Trying a different solution. The existing solution only worked for
relative paths in $DataDir. Now we check whether $DataDir starts with /
or ./ and only prepend a ./ if it does not.
This is why all the tests requiring t/test.pl had to be changed.
Similarly, the main script loads config and modules using the same
mechanism and paths had to be similarly qualified: prepending './'.
There was a bug where showing the non-existing comment page for an
existing page: BrowseResolvedPage used to return BrowsePage($id,
GetParam('raw', 0), undef, '404 NOT FOUND') and we wanted to change
this to a 200 response and so we returned BrowsePage($resolved,
GetParam('raw', 0)); -- but that is wrong because in this situation
$id is defined and $resolved is not! This commit fixes the problem.
If $CommentsPattern is a regular expression that matches without
setting $1, we want to avoid the “Use of uninitialized value $1 in
hash element” warning.
You can get the content via the parameters POSTDATA and PUTDATA. For
other methods, however, this doesn't work and you still need to read
STDIN. One such method is PROPFIND.
A user on #oddmuse asked what would be the easiest way to have
different css styles on different pages. Turns out the easiest way is
to write a module.
Not sure if it will break html in some yet unknown edge cases, but for
most things this should work just fine.
greenfive++
Long story short: it was testing for string “rollback” which is now part
of the warning message. Just making it a bit more specific resolves the
problem.
This also catches the URL for Weakish Jiang's GPL v2 and a GPL with no
URL (implying the version with a snail mail address).
This is tes should close issue #4 on GitHub.
Stefan Kamphausen provided a reason for liking the deprecated cal3
extension: he likes cal3 because it also displays the next and
previous month as opposed to calendar.pl which only displays the
current month.
This commit allows users to get the same behaviour by setting
$CalendarOnEveryPage to values greater than 1: 1 shows the current
month on every page, but 2 shows the previous and the current month on
every page, and 3 shows the previous, the current and the next month
on every page.
The last test has been failing for Alexine and we have contacted the
maintainer of the Net::Whois::Parser package. Until we hear back, I'm
going to skip this test.
There were some files that did not offer "or (at your option) any later
version" in their license and these had to be left alone. This should
solve the incorrect FSF address issue #4 on GitHub.
There were some modules that did not offer "or (at your option) any
later version" in their license and these had to be left alone.
This should solve the incorrect FSF address issue #4 on GitHub.
Encoding of namespace and page name under Mojolicious is not OK and I
don't know why. I added some tests that try to at least prove that the
workaround in the config file is OK.
This reverts commit 1ee235c949.
Sadly, I discovered that my websites no longer correctly displayed pages
containing characters such as the EN DASH. Reverting this commit seems
to solve the problem.
When testing it on my system, perl -c claims ban-contributors.pl is
good and perl -cT claims ban-contributors.pl bad because it can no
longer find Net/Whois/Parser.pm in @INC even though it's right there
as /home/alex/perl5/lib/perl5/Net/Whois/Parser.pm -- apparently taint
checking changes @INC.
<http://perldoc.perl.org/perlsec.html#Taint-mode-and-%40INC>.
On a new server with Debian Jessie (8), Apache 2.4, Perl 5.25.1 and CGI
4.28 I'm getting double-decoded namespaces. An Umlaut will thus turn
into an undisplayable character (a questionmark in a black diamond).
Decoding of path_info was necessary on my old server with Debian
Wheezy (7), Apache 2.2, Perl 5.14.2 and CGI 3.52.
If you're still in the unfortunate situation, you can copy the old
implementation of NamespacesInitVariables into your config file.
On a new server with Debian Jessie (8), Apache 2.4, Perl 5.25.1 and
CGI 4.28 I'm getting double-decoded page names. An Umlaut will thus
turn into an undisplayable character (a questionmark in a black
diamond). Decoding of path_info was necessary on my old server with
Debian Wheezy (7), Apache 2.2, Perl 5.14.2 and CGI 3.52.
If you're still in the unfortunate situation, you can copy the old
implementation of GetId into your config file:
sub GetId {
my $id = UnquoteHtml(GetParam('id', GetParam('title', ''))); # id=x or title=x -> x
if (not $id and $q->keywords) {
$id = decode_utf8(join('_', $q->keywords)); # script?p+q -> p_q
}
if ($UsePathInfo and $q->path_info) {
my @path = map { decode_utf8($_) } split(/\//, $q->path_info);
$id ||= pop(@path); # script/p/q -> q
foreach my $p (@path) {
SetParam($p, 1); # script/p/q -> p=1
}
}
return $id;
}
There is a target in our Makefile to make a new release. This stores a
tarball with the appropriate release information in
https://oddmuse.org/releases. tarballs.pl offers an interface to serve
these files, or their individual member files, with a naive cache of
50 elements.
This is a Mojolicious application and is available here:
https://odddmuse.org/download
As we derive a lot of filenames from strings in UTF-8 encoded files, we
need to make sure that any filename that might might be set by a user –
including all the filenames containing a directory deriving from
$DataDir – are passed through utf8::encode. That is, every character
gets replaced with a sequence of one or more characters that represent
the individual bytes of the character and the UTF8 flag is turned off.
In other words, -d $DataDir might not work if $DataDir contains a UTF-8
encoded string. The solution is to use the following replacements:
-f $name IsFile($name)
-e $name IsFile($name)
-d $name IsDir($name)
(stat($name))[9] Modified($name)
-M $name $Now - Modified($name)
-z $name ZeroSize($name)
unlink $name Unlink($name)
mkdir $name CreateDir($name)
rmdir $name RemoveDir($name)
(Using IsFile for -e is probably not ideal?)
If you don’t, and Oddmuse gets used with Mojolicious, and you use the
Namespaces Extension, and a namespace contains non-ASCII characters such
as ä, ö, or ü, these characters will end up as part of $DataDir and
trigger the problem.
I also wonder whether we should be using some other Perl library.
All occurence of tuns into
-f $name IsFile($name)
-e $name IsFile($name)
-d $name IsDir($name)
(stat($name))[9] Modified($name)
-M $name $Now - Modified($name)
unlink $name Unlink($name)
mkdir $name CreateDir($name)
rmdir $name RemoveDir($name)
This change is incomplete. All the modules also need to be changed.
The benefit of this change is that t/mojolicious-namespaces.t passes.
If you're accept-language settings included something for which no file
exists (such as "de-ch"), then the test for the file would
succeed (testing for the existence of "$LoadLanguageDir/") even though
no actual file will be loaded. This is fixed. Also: implemented actual
testing.
It seems like it is operating on url-encoded strings, so all we have to
do is to decode it. This, however, does not mean that we should print
decoded strings. ‘href’ attribute still has to be encoded (or so it seems).
The old code would only call the the function provided
if pagination indicated that it was OK to do so. Thus,
only the first ten pages got replaced. This has been
fixed and tests have been added.
If previous commit had some failing tests then Alexine will announce that on
the wiki. When the problem is solved we probably don't want to see scary
messages in Recent Changes, so next successful commit should be announced (it
should not be a minor edit).
Everything on oddmuse.org now redirects to https, which means that every wiki
that is using default style sheet requires two requests to get the css file.
It seems like oddtrans does not pick up the strings with double quotes?
It's weird, but it does not matter anyway, because we will switch to gettext
sooner or later.
Otherwise we will get odd number of elements if the last string has no
translation (it seems like perl trims last empty lines).
Also: strictures and formatting
By using 「--state=slow,save」 we can probably crunch all tests faster (better
wallclock time). Some tests are taking a lot of time simply because of the
delays (sleeping), so it makes sense to start these tests earlier.
This file has to be regenerated periodically, Alexine will do that.
Also, these long one-liners have to be separated into scripts.
I am deleting this file because I'm not willing to update it.
This is a general revision of the current file, and a massive upgrade
from the last date (2002). Some sentences have been formalized and
have been clarified, including corrections, completing the total of the
translation.
It seems like $ShowEdits feature was half broken (not all occurances were
actually defaulted to its value). In the last commit I did the same mistake
with $ShowAll. This is now fixed.
Also, for completeness, I decided to add $ShowRollbacks as well.
Sometimes you might want to “List all changes” and “Include minor
changes” by default. We can already change the default value of the
latter by using $ShowEdits variable, but another one was unsettable from
the config file. Now we have $ShowAll variable.
This string was not used correctly. T('Internal Page: ' . $resolved)
means that the string is concatenated with $resolved and then it will be
translated. This means that the translation will never be found. The
correct usage is as follows: Ts('Internal Page: %s', $resolved). The
translation string has therefore been changed to 'Internal Page: %s' and
the translation files have been fixed accordingly.
This used to be string with a trailing whitespace, but actual use was
wrong: T('Return to ' . NormalToFree($id)) – this concatenates the page
name and then attempts to translate the result, which never works. The
correct usage is Ts('Return to %s', NormalToFree($id)).
An error in the Makefile treated all *.pl files in the translations
directory as translation files -- including these other files which are
not regular translation files.
Removed the @font-face rules that downloaded Noticia Text and Symbola
from the net. This was slowing down access from old mobile phones.
Instead, I'm now using a font-family of "Palatino Linotype", "Book
Antiqua", Palatino, serif.
search.t: Using braces without escaping them in regular expressions
trigges a warning. wiki.pl will now quotemeta the replacement string
when highlighting changes.
upgrade-files.t: Only remove the old UseMod directory if it actually
exists in order to fix some warnings.
wiki.pl: only reading the log file when open actually succeeded in order
to fix some warnings.
When running tests with four jobs on a laptop with just two cores, load
is heavy and some tests may fail. Trying to make them more robust...
- big-brother.t
- captcha.t
Currently the config file and modules are supposed to be in $DataDir,
which does make any sense from security point of view. Files with code
should not be in directories that are writable by www-data.
Previously you had to use a wrapper script to work around that. Now we
provide special variables.
Please note that oddmuse will sometimes cache data by using Storable.
Such cache is saved to the disk and then read back when required. This,
however, is an insecure operation given that there is a risk that the
file will be manipulated from www-data in a malicious way.
Changes to oddtrans make sure that lines starting with # are comments
and will be stripped when the translation file is read. When writing new
translation files, comments are added to indicate which files are being
processed right now. This will help translators figure out where the
texts originated from. Note that every key appears only once, so
translations will be missing in the section for later files if they
appeared in earlier sections.
Recreated new-utf8.pl in order to illustrate the new format.
Previously if some user cancelled his request (simply by pressing Stop button
in his browser), then the script will receive a TERM signal or the like.
This means that some locks could be left behind, which required someone
to unlock the wiki manually (by using Unlock Wiki action).
Now we remove these locks automatically!
However, some tasks might want to handle such situations gracefully. That's why
%LockCleaners hash was added. Use lock name as the key and put a coderef as a
value. If SIGTERM (or a bunch of other signals) is received, then it will run
this code, which, supposedly, cleans all of the stuff after it. Private Wiki
Extension was changed according to that, so you can see it in action.
Also, tests added!
RollbackPossible needs to handle the situation where $KeepDays == 0.
DoRollback used to examine all the pages where rollback was
possible (using $KeepDays) but in order to avoid the special case where
$KeepDays == 0, we can also examine all the pages changed after the
target timestamp $to.
Once again, bitten by Perl. We used to print a cache "if ($Page{blocks}
and $Page{flags} and GetParam('cache', $UseCache) > 0)" -- but if we
have exactly one clean block, then flags will be "0" which is false. So
now we're testing for defined $Page{flags}.
There was a huge discussion with a lot of tension:
https://oddmuse.org/wiki/Revolutionary_Changes#ForgiveAndForget
And also the comments:
https://oddmuse.org/wiki/Comments_on_Revolutionary_Changes#ForgiveAndForget
But in the end, it is safer to have a history which is not broken.
Don't get it wrong, ForgiveAndForget is still a good thing, it's just not what
we should do *by default*.
If your wiki does benefit from ForgiveAndForget, then add this to your config:
$KeepDays = 14;
Although this change solves a couple of important problems, it does not address
new ones that arise because of no ForgiveAndForget. Namely it does not
resolve the problem of deleting stuff when you *really* have to do it. For
example, [[DMCA Extension]] (or similarly named extension with the same
purpose) should be developed. These problems existed for a long time, because
people were using “$KeepDays = 0” a lot. It is just that we started to accept
wikis with no ForgiveAndForget more thoroughly.
In other words, this commit is just part of the bigger change.
Why don't we set it to 5 years? Because then it will be a time bomb that will
be triggered unexpectedly. We should have a more predictable default value.
Modules are not loaded recursively, so we are free to use any directory inside
$ModuleDir. It is also where translations are located in the git repo.
Also, %library was renamed to %TranslationsLibrary (which is now "our"). This
is required for tests and for custom configuration.
Remember the problem with toc.pl when the whole page was *sometimes* not
utf8-decoded? There were some thoughts that it might be associated with
memory files, and it is correct. Although I was not able to narrow it down
last time, now I did (simply because this problem appeared elsewhere).
If you look at $output variable after utf8::decode with Devel::Peek, you
will see two variants of flags. This one looks good:
FLAGS = (PADMY,POK,pPOK,UTF8)
And this one is wrong:
FLAGS = (PADMY,POK,pPOK)
This problem is weird because it works inconsistently. Most of the time
you will get correct output, but sometimes it will be broken.
Someone has to golf it down to something short in order to submit perl
bug report. This, however, does not look like a simple task.
Current workaround is as stupid as it looks like, but it works.
Somehow assigning it to another variable solves the problem (which, by the
way, is similar to solving other perl string-related problems).
We no longer require an existing webserver running a wiki at
http://localhost/cgi-bin/wiki.pl. Instead, we're running our own
stuff/server.pl on a random port and use it for testing -- and we kill
it when we're done.
ReplaceAndDiff calls Replace, which loops over all pages. That's why we
don't need to call it from SearchTitleAndBody -- that makes our code
runs way too often.
“There are no comments, yet. Be the first to leave a comment!” – that's what
you will see when you preview your comment on an empty page.
Since the user is already doing it, there is no need to tell that. Also, it
may look like it is part of the preview.
We no longer do that (after this commit). In other words, the preview should
look exactly like the resulting page.
The original issue was that looking at all changes (action=rc all=1) the
resulting diff didn't always make sense if you clicked on the diff link.
It showed the difference between that revision and the current revision.
The PrintHtmlDiff sub was changed significantly to make it easier to
understand and to help fix this issue.
The drawback is that it now requires a new key in page and keep files:
lastmajorsummary. It goes with lastmajor and diff-major and records the
summary for that particular edit. As new changes will start recording
this new key, the change will slowly propagate in existing wikis.
Whenever you look at minor diffs, however, the existing summary key is
chosen. Plus, whenever you want to look at differences between
particular revisions, this is equivalent to looking at minor diffs. So
the only situation that is problematic is an edit history like the
following:
A - major change
B - major change (major diff, major summary, last major revision)
C - minor change
When looking at this page with diff=2, we want to show major diff, major
summary, last major revision. If B happened before this commit was
installed, the summary will be missing.
Changing everything to return objects is a worthy goal, but for now we have
taken enough destructive steps towards it. Therefore, this commit fixes the
problem in backwards compatible way (by adding one more parameter to the
signatures).
Note that this additional parameter is NOT a timestamp, it is a whole page
object. Which means that we are still moving towards our goal of using page
objects everywhere, this commit is just doing it in a backwards-compatible
way.
sub ParseData is fully backwards compatible. If some module runs it in list
context, then it will get listified hash like previously. New code should
always run it in scalar context though (everything in our code base
was changed according to that).
sub GetTextRevision is not backwards compatible (don't let “wantarray” usage
to confuse you). Most modules do not touch that subroutine, so we are probably
fine (modules from our git repo that do use were changed accordingly).
“EncodePage(%$page)” looks wrong. It seems like we should change it to accept
hash ref.
Trying to solve an issue: sometimes the test fails on Alex Daniel's
test server but never on Alex Schroeder's laptop. The output of Recent
Changes being tested has no rollback button for one of the page links.
Actually, the last six edits have no rollback button:
12:34 UTC (diff) MinorPage . . . . 127.0.0.1 – Rollback to 2015-09-01 12:34 UTC (minor)
12:34 UTC (diff) AnotherEvilPage . . . . 127.0.0.1 – Rollback to 2015-09-01 12:34 UTC (minor)
12:34 UTC (diff) OtherPage . . . . 127.0.0.1 – Rollback to 2015-09-01 12:34 UTC
12:34 UTC (diff) NicePage . . . . 127.0.0.1 – Rollback to 2015-09-01 12:34 UTC
12:34 UTC (diff) EvilPage . . . . 127.0.0.1 – Rollback to 2015-09-01 12:34 UTC
12:34 UTC (diff) MinorPage . . . . 127.0.0.1 – testerror (minor)
Note that this includes the "testerror" minor edit which is about to
be rolled back. Perhaps that's because this should hold in
RollbackPossible and it does not: $ts != $LastUpdate. $ts would be the
timestamp of the testerror edit and $LastUpdate would be the timestamp
of the rollback. I've added another 1s sleep between these two.
This also requires a change in gravatar.pl because we can no longer test
for MailNewGetCommentForm. Instead, we test @MyFormChanges as variables
are being initialized and if MailCommentAdditions is already on it, we
don't add GravatarFormAddition.
GetEditForm and GetCommentForm will now call all the subs in
@FormChanges in order to let them change the generated HTML. This is
used by all the modules that used to hook into either of these two
functions.
A typical change from questionasker.pl:
push(@MyFormChanges, \&QuestionAddTo);
sub QuestionAddTo {
my ($form, $type, $upload) = @_;
if (not $upload
and not QuestionaskerException(GetId())
and not $QuestionaskerRememberAnswer && GetParam($QuestionaskerSecretKey, 0)
and not UserIsEditor()) {
my $question = QuestionaskerGetQuestion();
$form =~ s/(.*)<p>(.*?)<label for="username">/$1$question<p>$2<label for="username">/;
}
return $form;
}
This commit als moves from &$foo to $foo->() based on a recommendation
in Modern Perl by Conway.
We already called all the subs on @MyFooters and printed the result,
but this commit moves all the code from PrintFooters into subs and
puts those subs on @MyFooters. This allows us to write modules that
can better control where exactly their output should appear. In this
case the change was required in order to allow the Google +1 module to
coexist with code that maybe prints the comment form for all pages.
For example, knowing that the Google +1 sub is the first on one the
list because of unshift(@MyFooters, \&GooglePlusPrintFooter), we can
now write the following:
splice(@MyFooters, 1, 0, \&MyCommentsInTheFooter);
sub MyCommentsInTheFooter {
my ($id, $rev, $comment) = @_;
if (not $GooglePlusThisPagePrintedJournal
and (GetParam('action', 'browse') eq 'browse'
and $id and $CommentsPrefix
and $id ne $RCName
and $id !~ /^$CommentsPrefix(.*)/o)) {
my $target = $CommentsPrefix . $id;
my $page = '';
$page = PageHtml($target) if $IndexHash{$target};
return $q->div({-class=>'comment'},
$q->h2(T('Comments')),
$page)
. GetCommentForm("$CommentsPrefix$id", $rev, $comment);
}
}
The Google +1 extension was also fixed to not triger the EFF's Privacy
Badger. This is OK because we're using a two step button: The user
needs to click a button before we're loading the script from Google.
If you're running this test on a system that did not get /tmp wiped in
a 30 days (as happens after a reboot on some systems), then this test
used to fail. The files from the last run will not be changed and
therefore they will not show up in Recent Changes. This commit wipes
$UseModWiki::DataDir before running the test.
$q->param in list context can be problematic. At the same time, we don't
want to depend on $q->multi_param because it was only added in CGI 4.08
(2014). That's why we're setting $CGI::LIST_CONTEXT_WARN = 0 instead.
The recent reorganization of the search code always calls
SearchHighlight, even if the raw parameter is set. This causes a test in
namespace.t to fail.
When we decided to no longer show changes to the cookie, we knew that we
would have to change some of the tests. This commit does that for
encoding.t. The tests that looked at the HTML document now look at the
footer of an edit.
When we decided to no longer show changes to the cookie, we knew that we
would have to change some of the tests. This commit does that for
cookie.t. All the tests that looked at the HTML document now look at the
HTTP response headers.
We had decreased $VisitorTime to 5 back in commit 6bc9531...
"big-brother.t: reduce $VisitorTime to 5". As it turns out, under
certain circumstances, this time window is too short for my laptop, so
I'm increasing it again.
When the GrepFiltered sub was removed, we didn't check our modules. As
it turns out, tags.pl and mac.pl hooked into this sub to do their job. A
simple no-op Filtered sub was reintroduced for those modules.
Also, all instances of $UseGrep were removed.
The existing code basically used HTML quoted regular expressions on HTML
quoted pages. This meant that you could not search and replace HTML
tags, for example. This commit tries to fix it.
Displaying the cookie is dangerous. If someone finds a way to perform XSS
attack, then he could steal the cookies just by looking at the page contents.
Please note that otherwise cookie contents are not visible from javascript
due to httponly flag.
This feature was not really useful anyway.
With a wiki having 5934 pages:
alex@kallobombus:~/alexschroeder.ch$ for f in $(seq 10); do (time perl wiki.pl search=kabelbinder grep=0) 2>&1 1>/dev/null|grep user; done
user 0m5.816s
user 0m5.954s
user 0m5.878s
user 0m6.100s
user 0m6.043s
user 0m5.971s
user 0m5.900s
user 0m6.003s
user 0m6.065s
user 0m6.098s
alex@kallobombus:~/alexschroeder.ch$ for f in $(seq 10); do (time perl wiki.pl search=kabelbinder grep=1) 2>&1 1>/dev/null|grep user; done
user 0m6.126s
user 0m6.105s
user 0m6.109s
user 0m6.167s
user 0m6.205s
user 0m5.980s
user 0m6.107s
user 0m6.047s
user 0m6.200s
user 0m6.133s
Uploaded images had no tooltips in Firefox because there was
no “title” attribute.
This change has a positive impact on creole.pl because
Creole Extension is using GetDownloadLink core subroutine.
If XSS ever comes through, we don't want it to read passwords or do wiki
actions (like editing pages).
Although it does not protect against MitM attacks (all data sent through
HTTP is sent as plaintext, therefore it is easy to get the cookies),
still it gives a protection against script-kiddies. Use HTTPS to get
it completely secure.
This is a prerequisite for anti-CSRF Double Submit Cookies.
The conversion of : at the beginning of a line into [quote] bbCode had sometimes left me with consecutive quotes:
: a
: b
Turned into:
[quote]
a
[/quote]
[quote]
b
[/quote]
And this script turns that back into:
[quote]
a
b
[/quote]
When I decided to drop Wiki Wirds, uninstall the Local Names Extension
and uninstall the Usemod Markup Extension from my homepage, I had a
lot of markup that would no longer work. These are the files I used to
migrate my data directory.
The EN DASH is not really required in year ranges such as 2012–2015 when
we're talking about comments in source code that is probably being
displayed in a fixed font anyway. Changing back to an ordinary hypen
allows us to make a meaningful test for use utf8.
As part of the big cleanup, files that haven't been used have been
deleted. The necessary info can still be found on the Oddmuse site:
https://oddmuse.org/wiki/Using_mod_fastcgi
The Mac subdirectory and all the instructions of how to build and
install Oddmuse on a Mac using the OSX tools have been deleted.
The Slack subdirectory and all the instructions of how to build and
install Oddmuse on Slackware have been deleted.
The contrib/simple-install subdirectory and all the instructions on how
to quickly and easily install Oddmuse using Creole have been deleted.
Previously it was possible to see "The lock was created 1000 hours ago.
After ten minutes, you could try to unlock the wiki".
While technially that's true, it does not sound nice to humans.
Also, now the button to unlock the wiki is not displayed until 10 minutes
pass. This is probably a good idea to prevent unconscious unlocks.
T('Unlock Wiki') string is reused (the same string is displayed on the
Administration page)
I also added some comments explaining why we need it. When calling
ReportError, we don't know whether HTTP headers have already been
printed. If not, we need to print them or the error message will be an
invalid HTTP response. If we did, we must not reprint them or the HTML
page will contain HTTP headers as part of its response body.
$HeaderIsPrinted makes sure the HTTP headers are printed just once.
The recent changes in commit 62d6dc4b—fixing the summary for last major
revisions—resulted in some changes in the output. These changes seem to
be OK so I removed the tests for the old output.
Basically, the tests created a new page using a minor change. What
should the output be when browsing the page with diff=1? "No diff
available" is correct. There is no need to mention the last major change
because there is none.
The next tests edited the same page using minor changes. What should the
output be when browsing the page with diff=1? "No diff available" is
still correct. There is still no need to mention the last major change
because there is none.
The author's page describes it as follows: "This module is designed to
be used in conjunction with the ClusterMap Module and the Static Hybrid
Module. It alters the code that generates the RecentChanges page so that
links to a Cluster Page are direct links, not action links. This allows
your RecentChanges page to be more useful and use the pre-cached pages,
rather than calling the Oddmuse script."
http://fletcherpenney.net/2005/10/plain_cluster_rc_module
As nobody seems to be using it, I deleted it.
http://oddmuse.org/wiki/Module_Popularity
There was no documentation to be found on the wiki or in the comments of
the module. The module requires various CSS files that aren't part of
the module. That's why I deleted it.
Some more information is here:
http://fletcherpenney.net/2005/08/s5_slide_show
It's based on S5 - the Simple Standards-based Slide Show System.
http://meyerweb.com/eric/tools/s5/
"Basically, it’s a way to create slide shows using nothing more than
XHTML, CSS, and Javascript. In theory, they are compatible across all
compliant browsers, and built from quite small files making the
presentations perfect for web use."
The slide show example is no longer available.
As reported by npostavs: When looking at an URL such as
http://www.emacswiki.org/emacs?action=rss;full=1;diff=1;page=0 and
looking at a minor change, we would see the diff for the last major
change. Instead of showing the summary for that change, however, we'd
see the summary for the last (minor) edit. This commit fixes this issue.
All the translation files will call AddModuleDescription only if it is
defined, allowing us to run the translation files by themselves. A
further change to oddtrans got rid of some "Wide character in print"
warnings. Together, these changes now allow us to calculate how many
translation strings are missing for a given set of modules.
Added clear_pages() before Init(). All tests pass without significant problems.
rollback.t is still confusing:
WriteStringToFile($RcFile, "1 FirstPage 1 \n");
AppendStringToFile($RcFile, "2 SecondPage 1 \n");
clear_pages();
What's the point of writing to rc file if we delete that immediately?
Besides that, everything is OK!
Because of the lack of parenthesis CBC mode was not turned on. This was a
serious security problem. If you were using this module, now you have to
reencrypt the whole wiki. Instructions for doing this will be posted
on [[Private Wiki Extension]] eventually.
$NewText is replaced by a call to NewText() which you can overwrite. Or
you can provide translations for the texts used by NewText(). Basically,
the new text explains that the page in question does not exist and
invites you edit it.
Otherwise if you click "More..." it will give you a page that cannot be styled
like a journal (there is just no way to tell that it is a journal from css).
This didn't work as intended. Subroutines relying on memory strings such
as PageHtml were not returning any HTML leading to all sorts of
failures (no description items in RSS feeds, for example).
The file writing operations had been only partially changed from F to
$F. Unfortunately, the old code relied on the fact that a file glob like
F was global in scope. To make the change to the file handle variable
more obvious, $F was renamed to $fh and this variable is now passed to
the subroutines StaticFile and StaticHtml.
In addition to that, :encoding(UTF-8) was changed back to :utf8 because
sometimes, this didn't work as intended.
If for some reason it would be possible to not read a file and not
crash, then PageMarkedForDeletion could have marked it as marked for
deletion: $Page{text} =~ /^\s*$/ might have returned true even if
$Page{text} was undefined. Now we test for existence of the key in
addition for just whitespace.
I had code in my init file that added an entry to auto-mode-alist for
oddmuse-mode. This resulted in oddmuse-mode being called twice. I'm
locally binding it to nil, now. I also used to call write-file at the
end of oddmuse-edit. This would change the buffer-name after I had
just changed it in oddmuse-mode. Now I'm using basic-save-buffer and
moved the call to oddmuse-mode to the end of oddmuse-edit.
Otherwise they blow up to full size.
95% value is arbitrary, maybe we can use calc() from CSS4 or provide a better
size for the surrounding container, hm.
$_ is not a copy, it is an alias to the original value.
Therefore modifying it will mess with original list... That's
not what we want most of the time.
Also, using map to s/// two variables does not look right. What
a stupid race to save one line of code.
Somehow the password form was limiting the number of characters to 50.
Private Wiki Extension relies on passwords that are 64 characters in length,
so I have increased the limit.
It was checking if the number of utf8 characters is <= 120, but obviously utf8
characters could be up to 4 bytes in length. 120*4 is much greater than 255
(which is a limit on lots of file systems), so it attempted to write files
with illegal filenames. This is now fixed.
Additionally $PageNameLimit option was added. Now you can choose max page
name length yourself (which is very useful for extensions like mac.pl or
private-wiki.pl)
These flags are essential for security. The problem we are trying to
solve is the following:
1) you visit a wiki using HTTPS and you set your password.
2) you accidentally visit the same website using plain HTTP
3) although you don't notice, your cookies are sent over the insecure
connection.
Even if that website has redirection, even it denies any insecure
traffic, your cookie is still leaked. That's how cookies work.
"secure" and "httponly" flags solve this. It means that these cookies
will only be sent over a secure connection. If you have set your
password using HTTPS and later you visit the same wiki using plain HTTP,
it will look like you are not logged in (because these cookies will not
be used when you access the website using a non-secure connection).
If you have HTTPS on your website -- ALWAYS make sure that you set your
password using it. Alternatively redirect all non-secure requests to
HTTPS - that's even better.
If you set your password using HTTP, the same cookie will be used for
both HTTP and HTTPS requests - this is done for compatibility with
HTTP-only wikis.
$ENV{'HTTPS'} returns 'on' or empty string. 'on' is truthy so it
should not create any problems, we can safely use it.
I've tested this, it works as expected.
Without this it throws warnings like 'Name "OddMuse::ScriptName" used only once'.
It is unclear whether these warnings make any sense. We will hide them for now.
While this is not critical and could be worked around using more complex
css selectors, it would be much better if such thing was elimanated completely.
The test hung because it used the following:
*ApplyRules = *OldTocApplyRules;
*RunMyRules = *RunMyRulesTocOld;
But recent changes in the modules make it necessary to use the "new"
style:
*ApplyRules = \&OldTocApplyRules;
*RunMyRules = \&RunMyRulesTocOld;
The change of the default CSS file caused a test to fail. In order to
fix the test, the new CSS file has to be installed as
http://www.oddmuse.org/default.css.
moin-search.pl, phpwiki-search.pl and usemod-search.pl were moved into a
new directory, modules/near-links, because they help support search of
near sites. They act as proxies, parsing the HTML and returning a file
format Oddmuse can understand.
See http://oddmuse.org/wiki/Near_Links#Searching_Near_Sites for more
information.
We had a problem in the following situation: User A starts editing a
page at t1. This timestamp is stored in a the parameter oldtime. In the
meantime user B edits and saves the same page at t2. If user A saves,
the changes will be merged. If user A previews and saves later, the
changes would not be merged because the preview changed oldtiem from t1
to t2. This commit makes sure that the an oldtime parameter is prefered
over the actual page timestamp.
xpath_do now returns a list of results if you're calling it in list
context. This will work, for example:
my ($ts, $title, $text) = xpath_test($page,
'//input[@name="oldtime"]/attribute::value',
'//input[@name="title"]/attribute::value',
'//textarea[@name="text"]/text()');
We have just read-TFM and figured out that we can use \&Sub. This way it
passes "use strict" but produces a warning with "use warnings" (the
warning is "Subroutine package::Sub redefined at ...").
We can "fix" it with "no warnings 'redefine'"
All the banning modules have a problem. They use code like the
following:
*StrangeOldBannedContent = *BannedContent;
*BannedContent = *StrangeNewBannedContent;
The code above changes both the sub and the variable. $BannedContent now
points to $StrangeNewBannedContent (which is undefined) and the name of
the Banned Content page is only accessible via $StrangeOldBannedContent.
If we copy $StrangeOldBannedContent to $BannedContent, everything else
will keep working.
$BannedContent = $StrangeOldBannedContent;
But now use strict will not work. When we tried this:
my $StrangeOldBannedContent; # use strict
Then BannedContent disappeared from the admin page as shown by the tests
in strange-spam.t; the correct solution uses our instead of my.
I'm not sure why.
Variables which are essentially global and which contain state are
localized before they are set. In order to localize them, they have to
be declared here using vars, first.
PdfNewGetFooterLinks shows that @NoLinkToPdf is simply a list of pages
that should not offer a PDF link at the bottom. Authors can add their
own exceptions to PdfNewGetFooterLinks, I guess, but in order to do
this from your config file, use vars.
createPDF needs $id as a parameter in order to use it. This code
worked before because the calling context was missing a my $id and
thus $id ended up being a global variable.
DoUpgrade is an alias for DoBrowseRequest which doesn't get $id as a
first parameter like many actions do. Therefore determine $id like
DoBrowseRequest does: call GetId.
This code was hard to maintain because it uses the actual markup code
and replaced a lot of Oddmuse machinery. Just use markdown-rule.pl
instead if you need it.
This should now correctly list pages banned due to BannedContent.
Previously, there was a stray variable $str instead of the actual page
content being matched.
This module was deprecated. Oddmuse no longer disperses page data files
into 27 directories based on the first character of the page name. The
directories used to be "A" to "Z", and "other". If you uses your wiki as
a blog, all the pages starting with a date ended up in "other". If your
page names started with letters other than "A" to "Z", all the pages
ended up in "other". If you were using comment pages, all your comment
pages ended in "C". This module was intended to create more
subdirectories and spread them more evenly. This is no longer necessary,
as the typical filesystem's performance no longer degrades with tens of
thousands of files in a directory. I'm assuming most Oddmuse hosts to
use some form of GNU/Linux with ext3 or ext4 with dir_index option.
GetEditForm uses the second parameter to indicate that it's an upload.
We need to pass it via NewGdSecurityImageGetEditForm to
GdSecurityImageAddTo if we want to use it there.
The Beautifier::Core library is not available from CPAN.
The beautifier.org website is not longer available.
The sources are still on Source Forge but it seems clear that this is a
dead end.
Added a comment to explain these lines.
my $RegexpOldBannedContent;
*RegexpOldBannedContent = *BannedContent;
*BannedContent = *RegexpNewBannedContent;
$BannedContent = $RegexpOldBannedContent;
According to http://dev.perl.org/licenses/ the Perl license is either
the GPL or the Artistic license. We'll pick the GPL so that it matches
the rest of Oddmuse.
Some support for corner cases was added, including tests. Now it should
be possible to write the following without the code triggering:
"foo*bar is not ** foo bar" -- this should no longer be bold.
This option is never set and even it was set (in the old days it
indicated that the entire wiki was going to be exported as a single
file), then I don't see why that should prevent namespaces from
working.
10 is just too low. For wikis with css page it means that you can only
fetch about 5 pages in 20 seconds.
I've seen my users complain about that limit and I've seen it myself
too many times.
Doubling the $SurgeProtectionViews should make it more sane.
The old code decided whether the show the replacement field as part of
DoSearch and set $ReplaceForm. By that time, GetHeader had already
called GetSearchForm, so it was too late. I'm not sure why the
variable was necessary in the first place and so I'm removing it
entirely.
grep ReplaceForm *.pl modules/*.pl t/*.t comes up empty, now.
This command was used:
find . -type f -print0 | xargs -0 sed -i 's/return undef/return/g'
The idea behind this commit is described on http://oddmuse.org/wiki/Refactoring page.
In short: 'return undef' returns (undef) in list context (a list with one element),
which is wrong.
Users who currently use the back button to return to the previous page
after logging in or logging out need to select it more than once and are
often return to a cached version of the page they were previously
viewing instead of one that reflects an updated cookie state. The only
other option currently available to the user is to re-navigate to the
page which they wish to view (likely the previous page).
This change improves the usability of the logout functions by providing
a link to return to the previous pages after logging in or logging out.
Previous pages are returned without cache.
The summary for uploaded files had nested p elements; this was
removed. When no summary is provided, we now remove the "#FILE..."
stuff. In this case, no summary is better.
When closing the pipe to grep, check the status returned by the child
process in $? and return all pages if there was an error (which means
that grep did not filter any pages).
As explained on my blog
<https://alexschroeder.ch/wiki/2015-01-13_Handwritten_Optimization>,
the current implementation is "suddenly" very slow. This is specially
noticeable when loading large pages. Without quite understanding how
this is possible, I'm reverting to the old implementation.
When running TagFind and TagCloud, writing the tag file is not
necessary. This is the result of a search and replace operation that
assumed every DB_File untie is equivalent to a write operation. This
is not true.
The drawback will be that the entire tag database including all the
backlinks will be stored in a hash. On my wiki with 5799 pages the
tag.db file is just 333K so it’s not too bad.
In bullet lists, the $around parameter would overshoot. The link would
say around=20, for example, when in fact the correct value would be
around=18. It would add the "* " of the next list item, apparently. The
edit link would still look good because the test we're using is
"$EditParagraphs[0]->[1] <= $pos" -- but if we then don't set "$pos =
$EditParagraphs[0]->[1]" it won't help as we'll get a "Could not
identify the paragraph you were editing" error as soon as we try to edit
with around=20 instead of around=18.
A test for the action in GetRobots makes sure that the robots meta
element gets a NOINDEX if the action is not "browse". Since the
default is "browse", this means we need to set an action for
search=foo and match=foo.
The history command was interesting because it limits the display to
those revisions that are actually available for diff and rollback.
Eventually this might form the basis of a better interface.
The vc-diff code also needed to be fixed.
A long time ago, $NewComment was the default text for the comment form,
ie. aftertext. That's why the code still had some comparisons of
aftertext with $NewComment. Now that $NewComment is a label in the
comment form and no longer the content of the text area, these tests can
be removed.
This used to generate an extra entry for @EditParagraphs which in turn
prevented the page from ending with an edit link if it ended with
multiple newlines.
Also made $EditParagraphPencil settable in the config file.
Hook into PrintWikiToHTML instead of PrintPageContent in order to
avoid adding an edit link after every page link (as these are the
dirty blocks that get printed from the cache).
To facilitate future debugging, STDERR now also gets the UTF-8 layer.
Apparently CGI does not decode UTF-8 encoded URL parameters. Handle this
case in GetParam.
PageHtml can be called when STDOUT already has the UTF-8 layer. It needs
to be able to handle both cases. That's why we call binmode without any
layers and then we call binmode with the UTF-8 layer again. Now it will
work for RSS files as well.
Unrelated fix: In order to force a decent Etag header even if no index
file exists (and thus $LastUpdate is undef), we use $Now as an
alternative.
binmode adding utf8 layer to STDOUT resulted in double encoded pages
included via PageHtml. On my homepage I was appending the comments to
every page using the following code:
my $target = $CommentsPrefix . $id;
my $page = '';
$page = PageHtml($target) if $IndexHash{$target};
print $q->div({-class=>'comment'},
$q->h2(T('Comments')),
$page);
Previously, if calling GetHeader with 'nocache', this would get passed
on to GetHttpHeader as $ts. The code would then produce an etag header
with a value of 'nocache'. This is now fixed. A long comment now
explains how it is supposed to work to reduce confusion in the future.
On my website, I noticed that searching for matching pages with a
string containing a non-ascii character worked, where as doing a
normal search resulted in an encoding error. The difference was this:
# fix match parameter
my $match = GetParam('match', '');
SetParam('match', FreeToNormal($match)) if $match;
This may be necessary to remove underscores, but it should not be
necessary to fix encoding errors.
This option should allow automatic encoding and decoding of
parameters. This saves a few lines and solves an encoding error:
previously, searching for a text containing non-ASCII characters would
result in double-encoded text fields.
This module used a function called ‘DoRc’ that disappeared from the main oddmuse script since the 1.837 version. It was apparently replaced by ‘PrintRcHtml’.
When calling clean_pages on OSX, the mac.pl module is installed via
add_module, which in turn calls mkdir. On other systems, however,
installing the old namespace module will not work since the module
directory will not exist. This change ensures that mkdir is called
before symlinking.
When creating a symlink on HFS+, the directory doesn't need to exist,
apparently. On ext4, it needs to exist. Make the test more robust by
calling mkdir.
Changed the tests to no longer assume the default value for
$CookieName. This is important when running the tests on a system
where Apache starts a number of wikis for various virtual hosts and
one of them will end up as the host to use for http://localhost/. That
wiki might very well have a cookie name set.
It turns out that one of the tests in lock.t relied on the exact wording
of the error message. I decided to use the same wording for all
instances: "Editing not allowed: %s is read-only" and no longer using
"Editing not allowed for %s".
Closes bug #41625 "ban-quick-editors.pl can hide the error message".
DoPost now uses the same code as DoEdit and thus it will display the
error message, which solves the issue for ban-quick-editors.pl. Added a
test to demonstrate it.
I find that removing " space" and "_underscore" made it easier for me to
visually compare the XPath expressions. I also wanted to keep the
[[foo bar|text]] test (and keep the XPath expression as similar as possible).
src:local('Noticia Text Bold'),local('NoticiaText-Bold)'),url('/fonts/NoticiaText-Bold.woff')format('woff')url('/fonts/NoticiaText-Bold.ttf')format('truetype');
unicode-range:U+0102-0103,U+1EA0-1EF1,U+20AB;
}
/* latin-ext */
@font-face{
font-family:'Noticia Text';
font-style:normal;
font-weight:700;
src:local('Noticia Text Bold'),local('NoticiaText-Bold)'),url('/fonts/NoticiaText-Bold.woff')format('woff')url('/fonts/NoticiaText-Bold.ttf')format('truetype');
src:local('Noticia Text Bold'),local('NoticiaText-Bold)'),url('/fonts/NoticiaText-Bold.woff')format('woff')url('/fonts/NoticiaText-Bold.ttf')format('truetype');
src:local('Noticia Text Italic'),local('NoticiaText-Italic)'),url('/fonts/NoticiaText-Italic.woff')format('woff')url('/fonts/NoticiaText-Italic.ttf')format('truetype');
unicode-range:U+0102-0103,U+1EA0-1EF1,U+20AB;
}
/* latin-ext */
@font-face{
font-family:'Noticia Text';
font-style:italic;
font-weight:400;
src:local('Noticia Text Italic'),local('NoticiaText-Italic)'),url('/fonts/NoticiaText-Italic.woff')format('woff')url('/fonts/NoticiaText-Italic.ttf')format('truetype');
src:local('Noticia Text Italic'),local('NoticiaText-Italic)'),url('/fonts/NoticiaText-Italic.woff')format('woff')url('/fonts/NoticiaText-Italic.ttf')format('truetype');
src:local('Noticia Text Bold Italic'),local('NoticiaText-BoldItalic)'),url('/fonts/NoticiaText-BoldItalic.woff')format('woff')url('/fonts/NoticiaText-BoldItalic.ttf')format('truetype');
unicode-range:U+0102-0103,U+1EA0-1EF1,U+20AB;
}
/* latin-ext */
@font-face{
font-family:'Noticia Text';
font-style:italic;
font-weight:700;
src:local('Noticia Text Bold Italic'),local('NoticiaText-BoldItalic)'),url('/fonts/NoticiaText-BoldItalic.woff')format('woff')url('/fonts/NoticiaText-BoldItalic.ttf')format('truetype');
src:local('Noticia Text Bold Italic'),local('NoticiaText-BoldItalic)'),url('/fonts/NoticiaText-BoldItalic.woff')format('woff')url('/fonts/NoticiaText-BoldItalic.ttf')format('truetype');
ReportError(T('The search parameter is missing.'))unless$search;
printGetHeader('',Ts('Pages link to %s',$taglabel),'');
local(%Page,$OpenPageName);
@@ -46,6 +51,6 @@ my $taglabel = $search;
}
@found=map{$q->li(GetPageLink($_))}@found;
print$q->start_div({-class=>'search list'}),
$q->ul(@found),$q->end_div;
$q->ul(@found),$q->end_div;
PrintFooter();
}
}
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.