Commit Graph

1032 Commits (4e02dead1488930b3e5e7afffbd045f03b12c9ad)

Author SHA1 Message Date
Joey Hess 4e02dead14 Make it possible to load setup files w/o running them. Code needing to do so can call IkiWiki::Setup::load, and the values will be loaded into %IkiWiki::Setup::setup. 2008-07-09 22:39:26 -04:00
Joey Hess 06709cdf31 improve error message if virus checker fails w/o output 2008-07-09 16:53:03 -04:00
Joey Hess 2449c596af otl: Support utf-8 files. (Recai Oktaş) 2008-07-08 20:52:30 -04:00
Joey Hess ad02f69836 attachment: Support perl 5.8's buggy version of CGI.pm.
This is truely horribly disgusting. CGI::tmpFileName, in current perls, is
an undocumented function (which should be a clue..) that takes the original
filename of an uploaded attachment, and returns the name of the tempfile
that CGI has stored it in.

In old perls, though, CGI::tmpFileName does not take a filename. It takes
a key from the object's {'.tmpfiles'} hash. This key is something
crazy like '*Fh::fh00001group' -- apparently the stringification of a
filehandle object.

Just to add to the fun, tmpFileName doesn't take the key, it expects a
refernce to the key. Argh?!

But the fun doesn't stop there, because in perl 5.8, CGI.pm is also broken
in two other ways. The upload() method is supposed to return a filehandle
to the temp file. It doesn't. The param() method is supposed to return
a filehandle to the temp file, that stringifies to the original filename.
It returns just the original filename, no filehandle.

Combine all these bugs, and you end up with this disgusting commit. Since
I have no way to get the filehandle, I *need* to get the tempfile name.
If I had the filehandle, I could probably pass it into tmpFileName, and
it might strigify to the right key name. But I don't, so the only way to
determine the key is to grub through the .tmpfiles hash ourselves.

And finally, one the temp file name is discovered, a filehandle can finally
be obtained by (re)opening it.

I recommend that this commit be reverted when perl 5.8 is a mercifully
faded memory.

I'm really, really, really glad I'm actually being paid for working on
this right now!
2008-07-08 18:10:53 -04:00
Joey Hess 2e5785907d explicitly set form type to multipart
This is the default in unstable's formbuilder, but not in stable's,
and CGI multipart is needed for fule uploads.
2008-07-08 17:18:02 -04:00
Joey Hess 22839215fb check for tempfile being empty 2008-07-08 16:21:01 -04:00
Joey Hess 6f3c980e2b undef $fh before opening 2008-07-08 12:16:36 -04:00
Joey Hess 66f35e30dc another try at dealing with CGI.pm problem
open the temp file if all attempts to get a fd fail
2008-07-08 11:25:30 -04:00
Joey Hess 71f10579c0 attachment: Support old versions of CGI.pm that lack an upload method. 2008-07-08 10:42:58 -04:00
Joey Hess f156308aef attachment: Fix an uninitialised value warning when editing a page that currently has no attachments. 2008-07-08 09:40:46 -04:00
Joey Hess dbbc1e4040 minor improvements 2008-07-07 01:54:28 -04:00
Gabriel McManus 7b8f4d2d06 search: generate configuration files once only when rebuilding 2008-07-07 01:53:06 -04:00
Joey Hess 2f3a279f68 add virus checking to attachments plugin 2008-07-06 17:36:26 -04:00
Joey Hess 788c1e9eca avoid uninitialised value warnings 2008-07-06 17:35:50 -04:00
Joey Hess 6e2dc2b1fd avoid uninitialised value 2008-07-06 17:00:35 -04:00
Joey Hess 05124f9a86 editpage escaping fixes
* The editpage form now uses the raw page name, not the page title, in its
  'page' cgi parameter. Using the title was ambiguous and made it
  impossible to tell between some pages, like "foo/bar" and "foo__47__bar",
  sometimes causing the wrong page to be edited.
* This change means that some edit links need to be updated.
  Force a rebuild on upgrade to this version.
* Above change also allowed really fixing escaped slashes from the blogpost
  form.
2008-07-06 15:52:04 -04:00
Joey Hess ca6d9da279 link to pagespec/attachment 2008-07-02 18:22:49 -04:00
Joey Hess c150590e27 factor out glob2re 2008-07-02 18:22:49 -04:00
Joey Hess 84e6c4fa66 add mimetype checking 2008-07-02 18:22:49 -04:00
Joey Hess ba707cdcd9 add user and ip support to attachment pagespecs 2008-07-02 16:33:35 -04:00
Joey Hess edfbd7e1aa toggle: Add javascript to top of page, not to end. This avoids flicker since closed toggles will not be displayed as the page is loading. 2008-07-02 16:14:18 -04:00
Joey Hess 1289beb53b xhtml fixes 2008-07-02 16:08:48 -04:00
Joey Hess 895faed642 toggle: Add support for toggles that are open by default.
Also fix to work in preview mode.
2008-07-02 16:02:01 -04:00
Joey Hess d593533af5 attachments interface visibility toggling 2008-07-02 15:42:32 -04:00
Joey Hess e998235240 export javascript, and support default-open toggles 2008-07-02 15:33:52 -04:00
Joey Hess ed25c2abf2 fixes 2008-07-01 20:35:54 -04:00
Joey Hess 883da338a4 some fit and finish fixes 2008-07-01 19:05:15 -04:00
Joey Hess 0abaf5aaae only show one sig fig 2008-07-01 18:41:30 -04:00
Joey Hess e8a13c32ba display human sizes 2008-07-01 18:40:42 -04:00
Joey Hess 8441d31535 add both kinds of links 2008-07-01 18:08:31 -04:00
Joey Hess c1e9e121b7 basic attachment list 2008-07-01 17:19:38 -04:00
Joey Hess 14cb2b0869 save attachments when page is saved too
A user might specify an attachment, but not click the upload button,
and just save the whole page instead.
2008-07-01 16:13:47 -04:00
Joey Hess 1405006fbf check attachments in and refresh 2008-07-01 15:35:01 -04:00
Joey Hess e87c3ae6df add allowed attachments field to admin prefs 2008-07-01 14:02:30 -04:00
Joey Hess 00962f589a minor optimisation 2008-07-01 13:51:22 -04:00
Joey Hess d7ca2f8f9b fix expensive move code path 2008-07-01 13:48:07 -04:00
Joey Hess 7cd40ea4eb better approach for cgi upload disabling
Make it a config setting, this way subtle load order issues don't come into
play. (As much?)
2008-07-01 13:43:32 -04:00
Joey Hess 5aee8d937d bugfixes 2008-07-01 13:39:02 -04:00
Joey Hess a78a981792 attachment location
Put the attachment in a subdir of the page it's attached to,
unless that page is an "index" page.
2008-07-01 13:31:09 -04:00
Joey Hess b4296a4943 simplification 2008-07-01 13:31:03 -04:00
Joey Hess de6ed410bc reorder
canedit should fail first as it's a less expensive and harder to pass test
2008-07-01 13:22:11 -04:00
Joey Hess dbf23748dd call check_canedit
Needed to prevent uploads of locked pages as attachments.
2008-07-01 13:20:42 -04:00
Joey Hess cec45b69da bugfix; support pagetype of "0" 2008-07-01 00:43:19 -04:00
Joey Hess 4fa115fdb5 copy the attachment into srcdir 2008-07-01 00:42:42 -04:00
Joey Hess 0f8ea7ecca break out fast_file_copy 2008-07-01 00:42:23 -04:00
Joey Hess 49514f39f6 fix some messages 2008-06-30 23:32:08 -04:00
Joey Hess b01ee9b3b3 add an ispage limit 2008-06-30 23:17:01 -04:00
Joey Hess 622033f5d6 minor improvements 2008-06-30 23:04:37 -04:00
Joey Hess 0a37c45f32 basic attachment plugin, unfinished
Currently includes UI, and a few tests of the attachment, as well as the
framework to extend pagespecs to test attachments. Does not actually save
the file yet.
2008-06-30 22:58:33 -04:00
Joey Hess dbab5e9b85 disable cgi uploads earlier
This allows plugins that want to enable uploads to do so by changing the
value of $CGI::DISABLE_UPLOADS at some point before the cgi hook is run.
2008-06-30 21:13:41 -04:00