Index: trunk/phase3/includes/api/ApiEditPage.php |
— | — | @@ -68,15 +68,17 @@ |
69 | 69 | $this->dieUsageMsg($errors[0]); |
70 | 70 | |
71 | 71 | $articleObj = new Article($titleObj); |
| 72 | + $toMD5 = $params['text']; |
72 | 73 | if(!is_null($params['appendtext']) || !is_null($params['prependtext'])) |
73 | 74 | { |
74 | 75 | $content = $articleObj->getContent(); |
75 | 76 | $params['text'] = $params['prependtext'] . $content . $params['appendtext']; |
| 77 | + $toMD5 = $params['prependtext'] . $params['appendtext']; |
76 | 78 | } |
77 | 79 | |
78 | 80 | # See if the MD5 hash checks out |
79 | 81 | if(isset($params['md5'])) |
80 | | - if(md5($params['text']) !== $params['md5']) |
| 82 | + if(md5($toMD5) !== $params['md5']) |
81 | 83 | $this->dieUsageMsg(array('hashcheckfailed')); |
82 | 84 | |
83 | 85 | $ep = new EditPage($articleObj); |
— | — | @@ -272,7 +274,8 @@ |
273 | 275 | 'unwatch' => 'Remove the page from your watchlist', |
274 | 276 | 'captchaid' => 'CAPTCHA ID from previous request', |
275 | 277 | 'captchaword' => 'Answer to the CAPTCHA', |
276 | | - 'md5' => 'The MD5 hash of the new article text. If set, the edit won\'t be done unless the hash is correct', |
| 278 | + 'md5' => array( 'The MD5 hash of the text parameter, or the prependtext and appendtext parameters concatenated.', |
| 279 | + 'If set, the edit won\'t be done unless the hash is correct'), |
277 | 280 | 'prependtext' => array( 'Add this text to the beginning of the page. Overrides text.', |
278 | 281 | 'Don\'t use together with section: that won\'t do what you expect.'), |
279 | 282 | 'appendtext' => 'Add this text to the end of the page. Overrides text', |