From: Chad Horohoe Date: Tue, 30 Sep 2008 15:13:13 +0000 (+0000) Subject: Added setVal accessor to $wgRequest->data so we don't have to access it directly... X-Git-Tag: 1.31.0-rc.0~44987 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22suivi_revisions%22%29%20.%20%22?a=commitdiff_plain;h=acf01dd7b8263af7bf5f4069333a7bced8720e53;p=lhc%2Fweb%2Fwiklou.git Added setVal accessor to $wgRequest->data so we don't have to access it directly. Use this in ApiEditPage. --- diff --git a/includes/WebRequest.php b/includes/WebRequest.php index 949901fdaa..9d9f10d140 100644 --- a/includes/WebRequest.php +++ b/includes/WebRequest.php @@ -256,6 +256,18 @@ class WebRequest { return (string)$val; } } + + /** + * Set an aribtrary value into our get/post data. + * @param $key string Key name to use + * @param $value mixed Value to set + * @return mixed old value if one was present, null otherwise + */ + function setVal( $key, $value ) { + $ret = isset( $this->data[$key] ) ? $this->data[$key] : null; + $this->data[$key] = $value; + return $ret; + } /** * Fetch an array from the input or return $default if it's not set. diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index ec896e661c..b67f4e2b2a 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -136,9 +136,9 @@ class ApiEditPage extends ApiBase { # Handle CAPTCHA parameters global $wgRequest; if(isset($params['captchaid'])) - $wgRequest->data['wpCaptchaId'] = $params['captchaid']; + $wgRequest->setVal( 'wpCaptchaId' ) = $params['captchaid']; if(isset($params['captchaword'])) - $wgRequest->data['wpCaptchaWord'] = $params['captchaword']; + $wgRequest->setVal( 'wpCaptchaWord' ) = $params['captchaword']; $r = array(); if(!wfRunHooks('APIEditBeforeSave', array(&$ep, $ep->textbox1, &$r))) {