Commit graph

73 commits

Author SHA1 Message Date
Aryeh Gregor
5c1205314c Tighten up unquoted attribute output
Only affects wikis with $wgWellFormedXml = false.  In principle, the old
behavior might have permitted XSS in IE if that setting is false (which
is not the default), but I haven't checked.  See
<http://code.google.com/p/html5lib/issues/detail?id=92>.
2009-09-18 15:28:46 +00:00
Aaron Schulz
6c182ab889 typecast $attribs to an array to avoid on-site notices 2009-09-18 14:55:42 +00:00
Aryeh Gregor
4a02cca0a3 Don't drop default attrib values in non-HTML5
Some attributes that have defaults in HTML5 don't have defaults in
XHTML1, particularly type="" on scripts and styles (bug 20713).  There's
not much point in trying to maintain two separate sets of defaults,
so I've just kept the HTML5 ones and haven't tried to strip any defaults
in XHTML1 mode.
2009-09-18 14:19:34 +00:00
Aaron Schulz
539dbc2d31 Default $attribs to an array in expandAttributes() 2009-09-16 22:52:15 +00:00
Alex Z
e886186e41 (bug 20655) If $wgHtml5 is false, run attribute values through Sanitizer::encodeAttribute() 2009-09-16 05:29:44 +00:00
Aryeh Gregor
f03c53b8a7 Fix silly <table class=''> 2009-09-07 15:25:22 +00:00
Aryeh Gregor
a039be051b Refactor redundant attrib dropping into new method
This saves code in a few places on the caller's side, and will reduce
the size of output HTML more consistently.
2009-09-07 00:21:55 +00:00
Aryeh Gregor
1cdedb1d44 Fix YET ANOTHER PHP WEAK TYPING BUG
Literal "0" was getting quoted.  Because, of course, 0 is equal to the
empty string.
2009-09-06 15:08:10 +00:00
Aryeh Gregor
e476e97314 Move more <input> logic from input() to element() 2009-09-06 15:07:52 +00:00
Aryeh Gregor
49e2599368 Use type=search for Monobook sidebar
Didn't bother to do this for other skins at the moment.  This should
allow more native-looking styling on some platforms (e.g., Safari on
Mac).
2009-08-26 14:59:59 +00:00
Aryeh Gregor
5e72d3501e Emit CDATA more intelligently
This fixes some possible XML invalidity from r54767: CDATA stuff was
being added only if $wgHtml5 was false, instead of whenever
$wgWellFormedXml is true.  Also, it uses CDATA for script as well as
style, but in both cases only uses it if there's a & or < somewhere.
2009-08-23 21:06:54 +00:00
Aryeh Gregor
daa8ed1a6e Typo in comment 2009-08-21 22:30:51 +00:00
Aryeh Gregor
faedd9d09f Autofocus Special:Search box
Also generally clean up the code around there: add some line breaks, use
Html instead of Xml (using new Html::hidden()).
2009-08-21 21:57:26 +00:00
Aryeh Gregor
f61d9e089d Omit useless value="" in Html::input() 2009-08-21 21:34:52 +00:00
Aryeh Gregor
3d3aa7c369 Only require necessary fields in Special:ResetPass
This fixes r54567.  That made the password fields on Special:ResetPass
always required, but in fact the current password should never be
required (existing users always might have empty passwords), and the new
password is only required if $wgMinimalPasswordLength > 0.

This commit also permits passing array( 'required' ) to
Html::(rawE|e)lement() instead of array( 'required' => 'meaningless' ),
for boolean attribs only.  This syntax is used in SpecialResetpass.
2009-08-21 21:06:06 +00:00
Aryeh Gregor
f103c057d0 Move validation logic from input() to rawElement()
This way callers of rawElement() or element() will also get correct
behavior.
2009-08-21 20:50:35 +00:00
Aryeh Gregor
defb1eeaf0 Correct outdated comments 2009-08-21 20:39:16 +00:00
Aryeh Gregor
ef664913d1 Don't escape >" in tag contents, no point 2009-08-21 20:38:53 +00:00
Aryeh Gregor
643dad9da3 Remove somewhat braindead comments
On second thought, if you're outputting user-supplied JS without careful
validation, it doesn't really matter if it's HTML-escaped or not.  :D
CSS has expr() and such too.
2009-08-20 21:30:47 +00:00
Brion Vibber
9bcb7bc8b0 Cleanup from r54770 "Add Html::input() convenience function"
Split the giant arrays of attributes/values to one item per line, which makes them easier to look at, easier to grep, and easier to see what's happening when they're changed in diffs.
We're not printing; vertical space isn't at a premium. ;)
2009-08-19 01:39:05 +00:00
Aryeh Gregor
8494a6cdb8 Make element() escape input like in Xml
Added rawElement() to allow unescaped input (like Xml::tags() but
better-named :) ).  This makes sure the easier case is the safer one as
well, and trades a risk of XSS for a risk of double-escaping.  After
discussion in #mediawiki a few days ago.
2009-08-18 01:01:47 +00:00
Aryeh Gregor
e9e6223e71 Add Html::input() convenience function
Currently only used in SpecialResetpass.  Also added some whitespace to
the HTML output of SpecialResetpass, so that it's somewhat readable.
2009-08-11 01:00:44 +00:00
Aryeh Gregor
7aa4a8f90c For HTML 5, drop type="" attributes for CSS/JS
This time done in a nice, centralized fashion, reducing LOC for callers
even if HTML 5 is disabled.  The implementation is a new Html class,
similar to Xml but intended to be HTML-specific from the beginning
instead of half-heartedly attempting to provide generic XML services but
actually with lots of HTML-specific stuff tacked on.

As part of the new Html class, a global config option $wgWellFormedXml
is added.  It's set to true by default, but if set to false, the Html
class will drop some things that HTML 5 doesn't require, like
self-closing " />" syntax and attribute quotation marks (sometimes).
2009-08-11 00:09:24 +00:00