Commit Graph

3228 Commits (94afbc2fa61088afa0e09763afeb752d55e52649)

Author SHA1 Message Date
Simon McVittie ceab72ad34 page.tmpl: tell mobile browsers we have a responsive layout, unless told not to
Mobile browsers typically assume that arbitrary web pages are
designed for a "desktop-sized" browser window (around 1000px)
and display that layout, zoomed out, in order to avoid breaking
naive designs that assume nobody will ever look at a website on
a phone or something. People who are actually doing "responsive
design" need to opt-in to mobile browsers rendering it at a
more normal size.
2014-12-01 21:29:46 +00:00
Simon McVittie 6c51b764bc Merge branch 'ready/html5' 2014-11-26 11:58:05 +00:00
Simon McVittie 1abf35e1b5 Fix numeric comparisons with undef 2014-11-26 11:29:14 +00:00
Simon McVittie 36f5e63d73 fix some typos 2014-11-26 09:23:24 +00:00
Simon McVittie 96566c33a7 Merge remote-tracking branch 'spalax/calendar-autocreate' 2014-11-26 09:13:44 +00:00
Louis 473bcbe7a4 Corrected error: month pages were created even without calendar_autocreate config option 2014-11-14 14:59:58 +01:00
Louis d0b3495124 Deleted unnecessary code 2014-11-14 12:52:51 +01:00
Louis 1d97160dae Indentation 2014-11-14 12:50:17 +01:00
Joey Hess ea8c7a7e02 openid: Stop suppressing the email field on the Preferences page.
This is needed for notifyemail, and not all openid providers report an
email address, or necessarily the one the user wants to get email.
2014-11-06 15:00:09 -04:00
Joey Hess 82a4fb49ae add ikiwiki-comment program 2014-10-20 12:08:07 -04:00
Amitai Schlair 305c91ccfb Remove space from perl shebang path. 2014-10-17 09:05:00 -04:00
Amitai Schlair 09e7c1ad99 IkiWiki::Plugin::openid: as a precaution, do not call non-coderefs
We're running under "use strict" here, so if CGI->param's array-context
misbehaviour passes an extra non-ref parameter, it shouldn't be executed
anyway... but it's as well to be safe.

[commit message added by smcv]
2014-10-16 22:24:48 +01:00
Amitai Schlair cfbcbda0ad Call CGI->param_fetch instead of CGI->param in array context
CGI->param has the misfeature that it is context-sensitive, and in
particular can expand to more than one scalar in function calls.
This led to a security vulnerability in Bugzilla, and recent versions
of CGI.pm will warn when it is used in this way.

In the situations where we do want to cope with more than one parameter
of the same name, CGI->param_fetch (which always returns an
array-reference) makes the intention clearer.

[commit message added by smcv]
2014-10-16 22:24:47 +01:00
Simon McVittie f4ec7b06d9 Make sure we do not pass multiple CGI parameters in function calls
When CGI->param is called in list context, such as in function
parameters, it expands to all the potentially multiple values
of the parameter: for instance, if we parse query string a=b&a=c&d=e
and call func($cgi->param('a')), that's equivalent to func('b', 'c').
Most of the functions we're calling do not expect that.

I do not believe this is an exploitable security vulnerability in
ikiwiki, but it was exploitable in Bugzilla.
2014-10-16 22:24:47 +01:00
Simon McVittie a052771287 Now that we're always using HTML5, <base href> can be relative 2014-10-16 11:05:19 +01:00
Simon McVittie 490a1eca7b Always produce HTML5 doctype and new attributes, but not new elements
According to caniuse.com, a significant fraction of Web users are
still using Internet Explorer versions that do not support HTML5
sectioning elements. However, claiming we're XHTML 1.0 Strict
means we can't use features invented in the last 12 years, even if
they degrade gracefully in older browsers (like the role and placeholder
attributes).

This means our output is no longer valid according to any particular
DTD. Real browsers and other non-validator user-agents have never
cared about DTD compliance anyway, so I don't think this is a real loss.
2014-10-16 11:04:53 +01:00
Simon McVittie 17fccbca94 Do not pass ignored sid parameter to checksessionexpiry
checksessionexpiry's signature changed from
(CGI::Session, CGI->param('sid')) to (CGI, CGI::Session) in commit
985b229b, but editpage still passed the sid as a useless third
parameter, and this was later cargo-culted into remove, rename and
recentchanges.
2014-10-12 18:03:57 +01:00
Simon McVittie 4e2bfe1e17 comments: don't log remote IP address for signed-in users
The intention was that signed-in users (for instance via httpauth,
passwordauth or openid) are already adequately identified, but
there's nothing to indicate who an anonymous commenter is unless
their IP address is recorded.
2014-10-12 18:03:28 +01:00
Simon McVittie 33f60260b2 In html5 mode, generate a host- or protocol-relative <base> for the CGI
This increases the number of situations in which we do the right thing.
2014-10-05 23:49:37 +01:00
Simon McVittie 3b8da667cc Add reverse_proxy option which hard-codes cgiurl in CGI output
This solves several people's issues with the CGI trying to be
too clever when IkiWiki is placed behind a reverse-proxy.
2014-10-05 23:49:37 +01:00
Simon McVittie b0a35c817e Force use of $config{url} as top URL in w3mmode 2014-10-05 15:19:55 +01:00
Joey Hess 6294894f31 Fix crash that can occur when only_committed_changes is set and a file is deleted from the underlay.
srcfile_stat got called on a file from the underlay that no longer existed.

I am not 100% sure of the circumstances of that; I was able to reproduce
the bug but neglected to snapshot the tree, and then accidentially
got it to stop crashing. I know that a transient tag page got deleted using
the web interface to trigger the crash.

It seems that process_changed_files must have returned the file, despite it
being deleted. And since the file was not checked into git, it seems it
must have not been included in @IkiWiki::underlayfiles, which would have
caused process_changed_files to not return it.

I do not know why a transient tag page would not be in
@IkiWiki::underlayfiles. There is a bug here that I don't understand.

This is just a workaround -- run srcfile_stat such that it won't crash,
and if it is unable to stat a file, find_changed knows it's not changed,
so it's ok to skip it.

Also made find_new_files run srcfile_stat such that it won't crash, just
because I was there.
2014-09-26 18:55:09 -04:00
Simon McVittie eb4945a3bc img: raise an error if we cannot find the image's size
This happens for PDFs without ghostscript installed, for instance.
2014-09-16 10:00:40 +01:00
Simon McVittie 7f5c2cfa5a Merge branch 'ready/templatebody' 2014-09-15 21:52:03 +01:00
Simon McVittie c1b80c54fa Merge branch 'ready/autoindex-more-often' 2014-09-15 21:23:18 +01:00
Simon McVittie ea2ab6f885 Merge branch 'ready/more-magic' 2014-09-15 21:08:40 +01:00
Simon McVittie 9d928bd694 Merge remote-tracking branch 'jcflack/early-env' 2014-09-15 09:44:51 +01:00
Lafayette Chamber Singers Webmaster 29e80b4eed More cautious escaping of environment values.
Tightened the escaping per this review comment:
http://source.ikiwiki.branchable.com/?p=source.git;a=commitdiff;h=f35fc6a603b5473ce2c07bb0236e28e57f718315

(I didn't introduce a $tmp, as $val was local to that block already, and each
hex encoding is in its own C string literal to avoid consuming subsequent
chars that are valid hex digits.)
2014-09-14 20:07:43 -04:00
Lafayette Chamber Singers Webmaster bc4721da04 Installing ikiwiki on a shared-hosting server, there may be no access to
install prerequisite Perl modules in the systemwide locations. They may
have to be installed under the home directory, such as by using local::lib
(which is how the cPanel Perl-module installer works, on systems that use it).

For that to work, the local::lib-defined value for PERL5LIB must be in
the environment when Perl starts up. The former way %config{ENV} was handled
was too late, depending on the Perl code to unpack it from the storable and
put it into the environment.

Easy solution is to build the wrapper to repopulate the environment based on
%config{ENV} before ever exec'ing Perl (and then remove it from the storable
as there is nothing more that the Perl code will need to do with it).
2014-09-14 12:12:09 -04:00
Simon McVittie 9be3f95116 Merge branch 'ready/imgforpdf-and-more' 2014-09-12 21:59:00 +01:00
Simon McVittie 669a5f5ecc Merge branch 'ready/chrysn/linkmapenhancement' 2014-09-12 21:57:04 +01:00
Simon McVittie 390f12a845 Merge branch 'ready/edittemplate2' 2014-09-12 21:54:13 +01:00
Simon McVittie dadde570a1 Merge branch 'ready/postform-no' 2014-09-12 21:46:04 +01:00
Simon McVittie 252804628d Merge branch 'ready/perf' 2014-09-12 21:45:04 +01:00
Simon McVittie a55752a7be Merge branch 'ready/comments' 2014-09-12 21:40:24 +01:00
Simon McVittie 2eea320b67 Merge branch 'ready/trail-sort' 2014-09-12 21:38:06 +01:00
Simon McVittie 77a2267dcf filecheck: accept MIME types that don't contain ';' 2014-09-10 09:00:20 +01:00
Antoine Beaupré feb21ebfac do not double-decode unicode in CGI forms
this works around a behavior change introduced in Encode.pm 2.53
shipped with the Perl 5.20 release described here:

http://ikiwiki.info/bugs/garbled_non-ascii_characters_in_body_in_web_interface/
2014-09-09 23:11:51 -04:00
Simon McVittie 26d62b386e edittemplate: use unambiguous RFC 3339 datestamps
These take into account the timezone offset (and convert it to UTC+0000)
rather than being in an unspecified timezone.
2014-09-01 09:01:07 +01:00
Simon McVittie 6806ddfdff Only provide time, not formatted_time, to edittemplate templates
I'm not sure what the use-case is for formatted_time, and chrysn
pointed out that for display in HTML, [[!date "<TMPL_VAR time>"]]
would be nicer.
2014-09-01 08:58:12 +01:00
Jonathon Anderson 9adee0a222 Provide the current time to edittemplate.
The `time` variable contains a fixed-format time, guaranteed suitable
for parsing by timedate.

The `formatted_time` variable contains the same time formatted by
IkiWiki::formattime.
2014-09-01 08:54:37 +01:00
Simon McVittie eb87dd177a Use Linux uuid facility instead of an external library if possible 2014-09-01 08:54:37 +01:00
Simon McVittie 4a11dc4d16 edittemplate: only generate a UUID on-demand
If the template doesn't use <TMPL_VAR UUID> there's no point in
incurring any cost.
2014-09-01 08:54:37 +01:00
Jonathon Anderson 7aa10a2952 Provide a UUID in edittemplate templates.
I want to make GUIDs for my RSS feeds that don't change when I move
pages around.  To that end, I've used UUID::Tiny to generate a
version 4 (random) UUID that is presented in a `uuid` variable in
the template.

At that point, you can do something like this:

    [[!meta guid="urn:uuid:<TMPL_VAR uuid>"]]
2014-09-01 08:54:37 +01:00
David Bremner adbc9cb8d6 Plugins::highlight: replace use of langdefdir with searchFile
In recent versions of highlight there can be more than one langdefdir.
This patch fixes the ensuing hilarity when the user adds a single
highlight lang definition and highlight.pm expects all definitions to
be in the same place.
2014-08-06 22:29:25 -03:00
David Bremner a55a20f5f8 cope with missing getConfDir in 3.18+ of highlight.
Unfortunately we have to try a couple things since the API changed
between 3.9 and 3.18
2014-08-06 22:28:32 -03:00
chrysn fa2a4d0db4 show resized img in preview using data: urls
in analogy to sparklines, this renders scaled imgs to
data:img/...;base64,... urls in preview mode.

if the image is already present on the server (eg because it was not
just inserted), the already rendered image is referenced instead.
2014-07-15 13:47:37 +02:00
chrysn a308b212ad img plugin: split resizing calculations and actual resizing
there is now a size calculating part (which chooses a final size) and a
scaling part (which triggers if the sizes calculated by the former
indicate a downscaling).

this solves the issue of unproportional upscalings
(bugs/image_rescaling_distorts_with_small_pictures).

also, "small" pdf files (or pdf files without explicit size settings),
which would not be converted under the old mechanism, now get rendered
to pngs.

this commit affects a unit test: while svgs were previously
unconditionally rendered to pngs, this now only happens on downscaling.
this is intentional -- while a small version of an svg graphic is
likely to be more compact when rendered (eg as a preview), a large
version would not have that benefit, and why convert something that
browsers basically can show and be inconsistend with how other images
are handled. the new unit test simply makes the original svg larger to
check for the same behaviros as before.
2014-07-15 13:44:22 +02:00
Simon McVittie 3f4a935740 trail: don't generate a costly dependency when forcing sort order
pagespec_match_list() makes the current page depend on the pagespec
being matched, so if you use [[!trailoptions sort="..."]] to force
a sort order, the trail ends up depending on internal(*) and is
rebuilt whenever anything changes. Add a new sort_pages() and use that
instead.
2014-07-11 22:08:08 +01:00
Louis f35b62d454 Calendar pages are now rebuilt when previous or next page have changed 2014-07-07 15:12:36 +02:00