Commit Graph

25 Commits

Author SHA1 Message Date
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
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
Alex Schroeder
dfa71cb2e3 Revert "Changed EN DASH to - in copyright lines"
This reverts commit 06c7fedec0.
2015-07-28 22:44:53 +02:00
Alex Schroeder
06c7fedec0 Changed EN DASH to - in copyright lines
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.
2015-07-28 22:14:37 +02: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
47b7d205fa near-links.pl uses strict
This should also fix the searching for Near Pages which apparently
didn't work.
2015-03-29 16:46:20 +02:00
Aleks-Daniel Jakimenko
4492ede096 "use strict;" in modules (some modules have problems) 2015-03-27 03:01:01 +02: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
9beff3748b Set @IndexOptions via @MyInitVariables.
With commit deec99c353 @InitOptions can
no longer be set at load time. Setting it at load time also disables
translations unless they get loaded earlier. Thus, @MyInitVariables.
2013-11-30 22:50:31 +01: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
614bcadc84 Only remove duplicate entries when we are in fact listing ordinary
pages as well as near pages.
2011-01-29 14:38:45 +00:00
Alex Schroeder
ef5f7f9fa7 (ListNearPages): Skip pages that exist
locally for the index action.
2011-01-29 14:33:15 +00:00
Alex Schroeder
c0a4ffcb20 (NearLinksInit): Initialize
%NearLinksException here instead of at top level so other modules
can add to it as well.
2009-08-31 08:31:04 +00:00
Alex Schroeder
8a7189bd4c (%NearLinksException): New option.
(NewNearLinksSearchTitleAndBody): Use it.
2009-08-30 19:19:59 +00:00
Alex Schroeder
4770e561d7 (SearchNearPages): Switch from
HighlightRegex to SearchRegexp.
2009-03-13 15:18:46 +00:00
Alex Schroeder
32f1dee9fa (NewNearLinksResolveId): Make sure that
comment links are "forbidden" -- they never redirect to a remote
place.
2008-10-22 14:01:05 +00:00
Alex Schroeder
731ede3932 (DoNearLinksList): Use semicolon instead
of br to separate pages, use page link.
2007-10-11 10:35:47 +00:00
Alex Schroeder
e9d9c61aba ($SisterSiteLogoUrl): Added. 2007-10-02 13:21:10 +00:00
Alex Schroeder
b5e4b1a39d Switch some head3 to head2 and get rid of the User Interface heading. 2007-10-02 10:00:05 +00:00
Alex Schroeder
9028100e14 Updated copyright years based on the earliest mention in the ChangeLog
file.
2007-10-02 09:54:50 +00:00
Alex Schroeder
f8579b544e New, moved from wiki.pl. 2007-10-02 09:51:00 +00:00