Commit Graph

55 Commits

Author SHA1 Message Date
Alex Schroeder
f571007516 Fix issues discovered by meta.t 2016-06-23 00:34:56 +02:00
Alex Schroeder
a91ef8602f Moving modules from utf8::encode to encode_utf8 2016-06-22 15:37:04 +02:00
Alex Schroeder
f992897e7a opendir also requires bytes 2016-06-19 15:55:03 +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
cad08ee17c Translation: "Define external redirect: "
Removed trailing whitespace.
2015-10-15 19:10:59 +02:00
Alex Schroeder
e91797fcba Translation: "Name: " and "URL: "
Removed trailing whitespace.
2015-10-15 14:55:54 +02: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
642cec5e7d Fix utf8 encoding and enable meta test
We now check POD and code with two separate checks. One checks for use
utf8, the other checks for =encoding utf8.
2015-07-28 23:02:23 +02:00
Aleks-Daniel Jakimenko
a615bedccf Fixed a bunch of stuff 2015-04-28 00:03:11 +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
Aleks-Daniel Jakimenko
4492ede096 "use strict;" in modules (some modules have problems) 2015-03-27 03:01:01 +02:00
Aleks-Daniel Jakimenko
62c7553d82 'return undef' changed to 'return'
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.
2015-02-27 12:10:18 +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
294e5745e7 Fixed syntax problem as warned by Perl 5.18 2013-08-21 10:19:45 +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
c904436961 (GetWantedPages): Try a different fix. 2011-05-11 13:48:08 +00:00
Alex Schroeder
ee26d8c0d3 (NewLocalNamesResolveId): Fix it again. 2011-05-11 13:22:37 +00:00
Alex Schroeder
a499978297 (NewLocalNamesResolveId): Fix it again. 2011-05-11 13:19:47 +00:00
Alex Schroeder
deaf916577 (NewLocalNamesResolveId): Fix it again. 2011-05-11 13:17:20 +00:00
Alex Schroeder
23500bd24d (NewLocalNamesResolveId): Fix it again. 2011-05-11 13:11:15 +00:00
Alex Schroeder
0109757c74 (NewLocalNamesResolveId): Don't duplicate near links. 2011-05-11 13:10:16 +00:00
Alex Schroeder
529a0424d2 (DoDefine): New. Added to @MyAdminCode and
%Action.
(%WantedPages): New.
(LocalNamesInit): Initialize it.
(NewLocalNamesResolveId): Set it.
(GetWantedPages): New. Added to @MyFooters. Uses %WantedPages to
print definition links, which are handled by DoDefine.
2011-05-11 12:52:54 +00:00
Alex Schroeder
54f7e0c488 (DoDefine): New. Added to @MyAdminCode and
%Action.
2011-05-11 12:10:11 +00:00
Alex Schroeder
61b394ee1c (LocalNamesNewSave): Localize
$OpenPageName and %Page so that it doesn't confuse other
extensions hooking into Save.
2009-03-21 23:22:39 +00:00
Alex Schroeder
5c4b4f5c95 (NewLocalNamesResolveId): Existing local pages take precedence
over local names, but local names take precedence over Near Links.
2007-10-02 12:36:02 +00:00
Alex Schroeder
e84e333b98 Make localnames.pl independent from the near link machinery and
simplify the initialization somewhat. Added POD.

($LocalNamesInit, NewLocalNamesReInit): Deleted.
(LocalNamesInit): No longer use %NearSource.
(NewLocalNamesGetInterSiteUrl, NewLocalNamesResolveId): Hook into
ResolveId instead of GetInterSiteUrl.
2007-10-02 12:32:49 +00:00
Alex Schroeder
ec9aa9092e (LocalNamesInit): Replaced @AdminPages
with %AdminPages.
2006-07-15 23:13:14 +00:00
Alex Schroeder
449b3e37d9 (DoLocalNames): New. 2006-07-02 23:17:40 +00:00
Alex Schroeder
f8a570a736 (LocalNamesInit): Fix regular expression. 2006-07-02 18:49:28 +00:00
Alex Schroeder
fa547fa3db (LocalNamesInit): Dot is not in double quotes. 2006-07-02 12:32:19 +00:00
Alex Schroeder
293400a29c (LocalNamesInit): Be lax about whitespace 2006-07-02 12:26:54 +00:00
Alex Schroeder
3d3ec777e3 (LocalNamesInit): Fix handling of "." 2006-07-02 12:23:32 +00:00
Alex Schroeder
4b3da92ff2 (LocalNamesInit): Handle "." 2006-07-02 12:17:12 +00:00
Alex Schroeder
96dd32243c (LocalNamesInit): Handle mixed DOS/Unix EOL. 2006-07-02 12:11:52 +00:00
Alex Schroeder
74eb24577e *** empty log message *** 2006-07-02 12:04:03 +00:00
Alex Schroeder
bfc82fda39 (LocalNamesInit): Non-greedy matching. 2006-07-02 11:28:13 +00:00
Alex Schroeder
1d7a750071 (LocalNamesInit): Accept [[ln:url]] without text. 2006-07-02 11:24:24 +00:00
Alex Schroeder
efa3aaea52 (LocalNamesInit): Remove code duplication. 2006-07-02 11:20:56 +00:00
Alex Schroeder
c5b9248226 ($LnDir, $LnCacheHours, GetLnFile,
LnMaintenance, LocalNamesRule): New.
(LocalNamesInit): Handle LN references.
2006-07-02 11:05:33 +00:00
Alex Schroeder
8f83f5cc61 (LocalNamesNewSave): Sort list of defined
names to facilitate testing.
2006-03-18 19:52:53 +00:00
Alex Schroeder
7683e238d0 (LocalNamesNewSave): Bugfix. 2006-03-16 23:36:43 +00:00
Alex Schroeder
c236c042b4 ($LocalNamesCollectMaxWords)
(LocalNamesNewSave): New option, use it.
2005-12-23 13:52:38 +00:00
Alex Schroeder
bc6423e353 (LocalNamesNewSave): Note what local names
have been added in the summary for the LocalNames page.
2005-12-22 10:52:16 +00:00
Alex Schroeder
e3a62ce0a5 (LocalNamesNewSave): New, to automatically
add all named external links to LocalNames.
($LocalNamesCollect): New option.
2005-12-20 16:01:43 +00:00
Alex Schroeder
80b207aef6 Removed debugging code. 2005-10-28 15:20:55 +00:00
Alex Schroeder
4a30d130dc update copyright year 2005-10-28 15:20:18 +00:00
Alex Schroeder
e566f3b97e (NewLocalNamesReInit): New. 2005-10-28 08:07:39 +00:00