Commit Graph

2018 Commits

Author SHA1 Message Date
Alex Schroeder
8d5ca8698e With /x, # has a special meaning (escape it!) 2015-09-11 02:55:18 +03:00
Alex Schroeder
c60a19ed0e smarttitles.pl: allow patterns in #SUBURL
(with a colon) to get interlinks interpreted, but now any link pattern will
be parsed in regular #SUBURL.
2015-09-11 00:41:15 +03:00
Alex Schroeder
7e9b92b85e askpage.pl: forgot to add some variables to our (...) 2015-09-07 03:47:23 +03:00
Alex Schroeder
32695af01a askpage.pl: changed according to recent oddmuse changes 2015-09-07 03:42:32 +03:00
Alex Schroeder
70acebed66 Merge remote-tracking branch 'origin/return-objects' 2015-09-06 08:10:46 +02:00
Alex Schroeder
e1e5131ef0 aawrapperdiv.pl: wrap PrintFooter correctly 2015-09-06 02:55:36 +03:00
Alex Schroeder
3bd596529c google-plus-one.pl: fix plusone action
Privacy Badger is acting up and I think we're better off creating the
buttons dynamically.
2015-09-04 14:00:44 +02:00
Alex Schroeder
0666ed13af 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
Alex Schroeder
5f019a6ce2 No more /o, modifiers sorted alphabetically 2015-08-23 21:22:12 +03:00
Alex Schroeder
b7dab00759 atom.pl: use XML::Atom explicitly
So that it is easier to find the required dependency
2015-08-20 14:59:00 +03:00
Alex Schroeder
40675c1665 Renamed MailCommentAdditions to MailFormAddition 2015-08-18 12:44:08 +02:00
Alex Schroeder
7ed80944fb Use @MyFormChanges in mail.pl
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.
2015-08-18 12:37:18 +02:00
Alex Schroeder
1b1d18c903 static-copy.pl: do not mess with GetCommentForm
This used to be necessary because we used PrintFooter. As static-copy.pl
no longer uses PrintFooter, this futzing is unnecessary and was removed.
2015-08-18 12:35:31 +02:00
Alex Schroeder
d9635490e2 Introducing @MyFormChanges
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.
2015-08-18 11:11:13 +02:00
Alex Schroeder
2faa5ca3a1 askpage.pl: don't hook into GetCommentForm
When GetCommentForm is part of @MyFooters, changing it turns into a
problem. We're hooking into GetTextArea instead.
2015-08-18 11:07:51 +02:00
Alex Schroeder
0ec8dd44e6 use v5.10 everywhere + enabled test in meta.t 2015-08-18 10:48:03 +02:00
Alex Schroeder
c8a3ae8791 recaptcha.pl: same fix as questionasker.pl
We need to replace the old reference in @MyFooters with the new code
reference.
2015-08-18 09:44:43 +02:00
Alex Schroeder
24d9af7e26 Undo the commit of version numbers 2015-08-17 16:54:07 +02:00
Alex Schroeder
4176e5d313 PrintFooter relies on @MyFooters
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.
2015-08-17 13:39:34 +02:00
Alex Schroeder
0de910336d silence warnings about $q->param
$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.
2015-08-15 22:48:12 +02:00
Alex Schroeder
f13c481288 our $q
The recent change to $q->remote_addr() necessitated the addition of our
$q to a few modules.
2015-08-15 10:32:11 +02:00
Alex Schroeder
5ebceca4ab Reintroducing Filtered
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.
2015-08-15 10:02:14 +02:00
Alex Schroeder
6d582698bf Getting rid of %InvisibleCookieParameters
This is no longer required because we don't print cookies nowadays.
2015-08-08 03:40:23 +03:00
Alex Schroeder
6dc169b40a No more visible cookies
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.
2015-08-08 03:22:56 +03:00
Alex Schroeder
9c3f01e424 cart.pl: use strict and AddModuleDescription 2015-08-07 02:43:46 +03:00
Alex Schroeder
1cd9407b2e cart.pl: whitespace issues 2015-08-07 02:36:35 +03:00
Alex Schroeder
aa140aa288 Just “cart”, no bfc 2015-08-07 02:32:37 +03:00
Alex Schroeder
eb1edf914f Found a newer version of Cart Extension 2015-08-07 02:32:07 +03:00
Alex Schroeder
ee0f1c114a cart-bfc.pl module stolen from http://bfc.sfsu.edu/source/cart-bfc.pl 2015-08-07 02:26:10 +03:00
Alex Schroeder
946bd40b61 flashbox.pl deleted because nobody likes Flash 2015-08-07 01:59:19 +03:00
Alex Schroeder
dff4615824 pdf.pl: deleted 2015-08-05 12:25:03 +02:00
Alex Schroeder
b39835331c Replace GetRemoteHost with $q->remote_addr() 2015-07-31 09:35:51 +02:00
Alex Schroeder
42a4083daf 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
Alex Schroeder
5efaf324e1 Revert "Changed EN DASH to - in copyright lines"
This reverts commit 06c7fedec0.
2015-07-28 22:44:53 +02:00
Alex Schroeder
8f3db6ebfe 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
Alex Schroeder
b2cae9a5a3 agree-disagree.pl: fix leading whitespace 2015-07-28 21:59:47 +02:00
Alex Schroeder
c269d0c303 agree-disagree.pl: fix issues 2015-07-28 21:58:15 +02:00
Alex Schroeder
030cbadfed 404handler.pl: use our for variables 2015-07-28 10:55:13 +02:00
Alex Schroeder
895c3d1e56 upload.pl: fix missing my 2015-07-28 10:49:42 +02:00
Alex Schroeder
d539ff813a Remove trailing whitespace
I love those meta tests.
2015-07-28 10:47:21 +02:00
Alex Schroeder
88758978b3 New old module agree-disagree.pl (copied from wiki) 2015-07-28 03:35:33 +03:00
Alex Schroeder
86a01c1505 static-copy.t skips a test without HTTPS support
The static.css file is copied from https://oddmuse.org/ -- so if
LWP::Protocol::https is not installed, this cannot work.
2015-07-21 12:42:06 +02:00
Alex Schroeder
60eaef5d72 static-copy.pl use HTTPS to access oddmuse.org 2015-07-21 12:22:39 +02:00
Alex Schroeder
8c6b18286b Moved 404handler.pl to modules 2015-07-21 09:34:17 +02:00
Alex Schroeder
9f3fc348ee pygmentize.pl: warn if an error occured
There's now a test that checks the error message when no pygmentize tool
can be found on the PATH.
2015-07-16 22:14:32 +02:00
Alex Schroeder
5d867d8306 Revert changes in modules/recaptcha.pl, I did not mean this 2015-07-15 01:07:54 +03:00
Alex Schroeder
1df2559084 File BUGS is deleted.
According to "git blame BUGS" all these bug reports are more than 10 years old.
2015-07-15 01:04:54 +03:00
Alex Schroeder
d2b73985b6 removed package OddMuse declarations 2015-07-14 16:45:18 +02:00
Alex Schroeder
2847a07d2e plainclusterrc.pl: deleted
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
2015-07-13 15:46:10 +02:00
Alex Schroeder
9b49abbc7c slideshow.pl: deleted
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.
2015-07-13 15:42:32 +02:00