r101231 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101230‎ | r101231 | r101232 >
Date:23:23, 28 October 2011
Author:foxtrott
Status:deferred
Tags:
Comment:
bugfix (Form submission not controlled by permissions)
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_AutoeditAPI.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_FormField.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormField.php
@@ -6,8 +6,8 @@
77 */
88
99 /**
10 - * This class is distinct from SFTemplateField in that it represents a
11 - * template field defined in a form - it contains a SFTemplateField object
 10+ * This class is distinct from SFTemplateField in that it represents a template
 11+ * field defined in a form definition - it contains a SFTemplateField object
1212 * within it (the $template_field variable), along with the other properties
1313 * for that field that are set within the form
1414 * @ingroup SF
Index: trunk/extensions/SemanticForms/includes/SF_AutoeditAPI.php
@@ -18,7 +18,7 @@
1919 */
2020 class SFAutoeditAPI extends ApiBase {
2121
22 - private $mOptions;
 22+ private $mOptions = array();
2323 private $mIsApiQuery = true;
2424
2525 /**
@@ -83,7 +83,11 @@
8484 $parseroptions->enableLimitReport( false );
8585
8686
87 - return $wgParser->parse( $result, $title, $parseroptions )->getText();
 87+ $result = new AjaxResponse($wgParser->parse( $result, $title, $parseroptions )->getText());
 88+ $result->setResponseCode('400 Bad Request');
 89+ $result->setContentType('text/html');
 90+
 91+ return $result;
8892 }
8993
9094 /**
@@ -482,7 +486,7 @@
483487 // $toplevel: if this is a toplevel value.
484488 private function addToArray( &$array, $key, $value, $toplevel = true ) {
485489 $matches = array();
486 -
 490+
487491 if ( preg_match( '/^([^\[\]]*)\[([^\[\]]*)\](.*)/', $key, $matches ) ) {
488492
489493 // for some reason toplevel keys get their spaces encoded by MW.
@@ -547,8 +551,8 @@
548552 * @param String $msg
549553 */
550554 private function reportError( $msg ) {
551 - header( 'HTTP/Status: 400 Bad Request' );
552555 if ( $this->isApiQuery() ) {
 556+ header( 'HTTP/Status: 400 Bad Request' );
553557 $this->getResult()->addValue( null, 'result', array('code' => '400', '*' => $msg) );
554558 }
555559 return $msg;