Commit Graph

83 Commits

Author SHA1 Message Date
Alex Schroeder
1855c84cec namespaces.pl: more changes to get it working
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.
2016-08-11 17:14:14 +02:00
Alex Schroeder
7053561f89 Revert "NamespacesInitVariables not decoding path_info"
This reverts commit 5fce7f4b63.

Same as the previous revert for wiki.pl.
2016-08-11 14:20:45 +02:00
Alex Schroeder
5fce7f4b63 NamespacesInitVariables not decoding path_info
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.
2016-07-25 09:03:33 +02:00
Alex Schroeder
74288ba3f3 Moving from utf8::encode to encode_utf8 2016-06-22 14:43:28 +02:00
Alex Schroeder
c121607f61 All open and tie calls need utf8::encode 2016-06-19 13:51:11 +02:00
Alex Schroeder
032c7aea73 bsd_glob replaced with Glob 2016-06-19 11:55:58 +02:00
Alex Schroeder
83f13a9a1a Use helper functions for accessing the file system
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.
2016-06-17 14:49:34 +02:00
Alex Schroeder
fee15fd880 Simplify namespaces.pl initialization 2016-06-12 21:24:43 +02:00
Aleks-Daniel Jakimenko
1c4e082755 Return objects where it begs for it
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.
2015-09-04 04:55:48 +03:00
Aleks-Daniel Jakimenko
4eef4d2d76 No more /o, modifiers sorted alphabetically 2015-08-23 21:22:12 +03:00
Alex Schroeder
58e9a1e240 use v5.10 everywhere + enabled test in meta.t 2015-08-18 10:48:03 +02:00
Aleks-Daniel Jakimenko
d83106faa4 No more bareword filehandles in modules 2015-05-02 03:49:07 +03:00
Aleks-Daniel Jakimenko
17b2562054 No more "*Sub = *NewSub", \&NewSub used instead. (Completely now!) 2015-04-12 22:50:50 +03:00
Aleks-Daniel Jakimenko
40ec24349a No more "*Sub = *NewSub", \&NewSub used instead. (Partial progress) 2015-04-11 23:41:33 +03:00
Aleks-Daniel Jakimenko
6f8d281d79 No more "use vars"! 2015-04-10 13:31:28 +03:00
Alex Schroeder
87a576271d namespaces.pl uses strict
Apparently whatever prevented this from working has been fixed in the
mean time.
2015-03-29 23:15:35 +02:00
Alex Schroeder
09697fba23 Merge commit '5e4426b' 2015-03-27 12:12:47 +01:00
Aleks-Daniel Jakimenko
4492ede096 "use strict;" in modules (some modules have problems) 2015-03-27 03:01:01 +02:00
Alex Schroeder
089630a1e1 namespaces.pl: remove $Monolithic
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.
2015-03-17 07:13:44 +01:00
Alex Schroeder
17edc1c523 namespaces.pl: add match to @NamespaceParameters
When using $MatchingPages = 1, the following URL would is a
possiblity:
https://campaignwiki.org/wiki/Adventures?search=&match=dung&dosearch=Go%21

In this situation, "Adventures" needs to be the namespace. The
'search' parameter is ignored and the script needs to react to
'match'.
2015-01-07 15:16:09 +01:00
Alex Schroeder
5aba2ae56f Fixed typo in AddModuleDescription sub name 2014-08-21 22:23:23 +02:00
Alex Jakimenko
ee932dee37 Automatically reformatted modules 2014-08-21 07:29:46 +03:00
Alex Schroeder
f5e86f4ddc Prevent double "Showing revision X" by passing QUIET to GetTextRevision. 2012-11-16 15:51:19 +01:00
Alex Schroeder
7ca0f6172b Use bsd_glob instead of glob.
Glob will split patterns on whitespace and non-breaking spaces are now
treated as whitespace.
2012-07-21 00:40:42 +02:00
Alex Schroeder
6c813b8297 $q->path_info lacks UTF-8 decoding.
Fix other encoding issues with namespaces.
2012-07-19 09:05:07 -04:00
Alex Schroeder
f27ec6c142 Use utf8::encode when creating a directory.
There is no way to provide an encoding layer to directory names.
Therefore they need to be raw bytes and not characters. This becomes
apparent when creating namespaces containing non-ASCII characters.
2012-07-19 13:58:58 +02:00
Alex Schroeder
217055fab2 Pod fix.
Changed =head to =head2 as suggested by anonymous visitor to the wiki.
2012-06-22 18:23:51 +02:00
Alex Schroeder
3174e184f9 Fix an encoding error in namespaces.pl on Debian
The Debian installation uses ext3 and therefore raw bytes for
filenames unlike the HFS filesystem of Mac OSX.

Copyright years were updated. The maintenance output of for drafts was
cleaned up.
2012-05-25 01:00:10 +02:00
Alex Schroeder
f11e2a8731 getting rid of $Id$ tags in $WikiDescription
Replaced the $Id$ tags in $WikiDescription for all the modules and wiki.pl itself with a link to the source and an appropriate wiki page, if possible. This is shown in action=version and should help users figure out what another wiki has installed.
2012-04-19 02:18:45 +02:00
Alex Schroeder
8e9b5f72b5 (NewNamespaceBrowsePage): Allow redirection to namespaces.
(NamespacesNewGetId): Allow for the provision of the ns parameter.
2012-03-20 16:41:22 +00:00
Alex Schroeder
63410250fb Concise notation. 2012-03-18 01:03:56 +00:00
Alex Schroeder
a973495be4 (NamespacesNewGetId): Fix the special case
http://example.org/cgi-bin/wiki.pl/Test?rollback-1234=foo where
Test refers to the namespace and not to the page id.
2012-03-17 19:35:19 +00:00
Alex Schroeder
13075717e3 (NamespacesInitVariables): URL encode the
current namespace for $ScriptName, $FullUrl and $StaticUrl.
2011-06-23 00:31:59 +00:00
Alex Schroeder
6ca68914af (DoNamespacesList): Fix the links to
namespaces.
2010-05-07 15:18:57 +00:00
Alex Schroeder
937fd7d573 (NewNamespaceGetRcLines): Fix bug that
prevented the oldrc.log file from being read if rc.log was missing
or empty.
2009-07-03 13:49:47 +00:00
Alex Schroeder
8a23ba4adb (DoNamespacesList): Add trailing newline to raw output. 2009-06-07 18:11:17 +00:00
Alex Schroeder
2758e9f49d (NamespacesInitVariables): Don't list Main and Self.
(DoNamespacesList): Provide a raw alternative.
2009-06-07 18:05:46 +00:00
Alex Schroeder
1adb6577da Added documentation explaining why full=1 is not supported for the
main RSS feed.
2009-06-07 17:59:07 +00:00
Alex Schroeder
c8ca5e242a (%Namespaces): New option to differentiate
between intersites and namespaces.
(NamespacesInitVariables): Set it instead of a local variable.
(DoNamespacesList): Use it.
(NamespacesMenu): Add it to a menu.
2009-06-07 17:03:06 +00:00
Alex Schroeder
359b7754ce (@NamespaceParameters): New.
(NamespacesInitVariables): Use new option.
(NamespacesInitVariables): Use new function.
2009-04-06 00:26:46 +00:00
Alex Schroeder
76ee1b683d (NamespacesInitVariables): Match the code
changes in GetId.
2009-04-05 23:36:20 +00:00
Alex Schroeder
9bdae89099 (NewNamespaceGetRcLines): Strip rollbacks
for every namespace separately.
2009-03-08 23:44:54 +00:00
Alex Schroeder
39f8e2045e (NewNamespaceScriptUrl): Try and handle
the case of namespaces containing non-ASCII characters. This
should be legal, but lead to problems when generating links to
pages in such namespaces. The URL encoding of the non-ASCII
characters prevented the $InterSitePattern from matching. Instead
of using this regular expression, we now try and guess at the
string using URL constraints ([^/?&;=]+), URL decoding it, and
then checking the $InterSitePattern.
2008-12-02 23:45:41 +00:00
Alex Schroeder
c7d95bb83b (NewNamespaceGetAuthorLink): New hook into
GetAuthorLink to make sure the author link is never considered
invalid using NewNamespaceValidId.
(NamespaceValidId): Deleted.
(NewNamespaceValidId): Fully featured replacement only used by
GetAuthorLink. $NamespaceSlashing remains unused.
2008-09-22 01:31:38 +00:00
Alex Schroeder
5e8c218e2d (NewNamespaceDoRc): No longer needed.
(NewNamespaceGetRcLines): New.
(NamespaceRcLines): No longer needed.
2008-09-19 23:55:19 +00:00
Alex Schroeder
dcfc719058 (NewNamespaceScriptUrl): Replaces
NewNamespaceScriptLink. This change depends on the related change
to ScriptLink in wiki.pl and fixes the RSS links.
2008-03-07 09:43:26 +00:00
Alex Schroeder
c709ea4413 (NamespacesInitVariables): Always set
$NamespaceRoot because it will be used below when redirecting. Not
setting it will cause redirection to the Main namespace to produce
a wrong edit link to the source page.
2007-11-17 23:59:58 +00:00
Alex Schroeder
4ceae6896c (NamespaceRcLines): Use StripRollbacks. 2007-11-13 20:28:16 +00:00
Alex Schroeder
f6367b88b7 (NewNamespaceBrowsePage): Fix test from
$WikiLinks to $FreeLinks.
2007-11-07 17:02:07 +00:00
Alex Schroeder
cfaba495e3 Added some POD documentation.
(NewNamespaceScriptLink): Added edit backlink for interlink
redirection.
(NewNamespaceBrowsePage): Replaces BrowsePage; adds redirection
for interlinks.
2007-09-25 15:32:30 +00:00