Index: branches/REL1_17/phase3/maintenance/language/messages.inc |
— | — | @@ -565,6 +565,8 @@ |
566 | 566 | 'userjsyoucanpreview', |
567 | 567 | 'usercsspreview', |
568 | 568 | 'userjspreview', |
| 569 | + 'sitecsspreview', |
| 570 | + 'sitejspreview', |
569 | 571 | 'userinvalidcssjstitle', |
570 | 572 | 'updated', |
571 | 573 | 'note', |
Index: branches/REL1_17/phase3/includes/diff/DifferenceEngine.php |
— | — | @@ -1013,7 +1013,7 @@ |
1014 | 1014 | 'undo' => $this->mNewid |
1015 | 1015 | ) ); |
1016 | 1016 | $htmlLink = htmlspecialchars( wfMsg( 'editundo' ) ); |
1017 | | - $htmlTitle = $wgUser->getSkin()->titleAttrib( 'undo' ); |
| 1017 | + $htmlTitle = Xml::expandAttributes( array( 'title' => $wgUser->getSkin()->titleAttrib( 'undo' ) ) ); |
1018 | 1018 | if ( $editable && !$this->mOldRev->isDeleted( Revision::DELETED_TEXT ) && !$this->mNewRev->isDeleted( Revision::DELETED_TEXT ) ) { |
1019 | 1019 | $this->mNewtitle .= " (<a href='$newUndo' $htmlTitle>" . $htmlLink . "</a>)"; |
1020 | 1020 | } |
Index: branches/REL1_17/phase3/includes/Status.php |
— | — | @@ -301,6 +301,23 @@ |
302 | 302 | } |
303 | 303 | |
304 | 304 | /** |
| 305 | + * If the specified source message exists, replace it with the specified |
| 306 | + * destination message, but keep the same parameters as in the original error. |
| 307 | + * |
| 308 | + * Return true if the replacement was done, false otherwise. |
| 309 | + */ |
| 310 | + function replaceMessage( $source, $dest ) { |
| 311 | + $replaced = false; |
| 312 | + foreach ( $this->errors as $index => $error ) { |
| 313 | + if ( $error['message'] === $source ) { |
| 314 | + $this->errors[$index]['message'] = $dest; |
| 315 | + $replaced = true; |
| 316 | + } |
| 317 | + } |
| 318 | + return $replaced; |
| 319 | + } |
| 320 | + |
| 321 | + /** |
305 | 322 | * Backward compatibility function for WikiError -> Status migration |
306 | 323 | * |
307 | 324 | * @return String |
Index: branches/REL1_17/phase3/includes/EditPage.php |
— | — | @@ -1223,7 +1223,7 @@ |
1224 | 1224 | if ( $this->showHeader() === false ) |
1225 | 1225 | return; |
1226 | 1226 | |
1227 | | - $action = htmlspecialchars($this->getActionURL($wgTitle)); |
| 1227 | + $action = htmlspecialchars( $this->getActionURL( $wgTitle ) ); |
1228 | 1228 | |
1229 | 1229 | if ( $wgUser->getOption( 'showtoolbar' ) and !$this->isCssJsSubpage ) { |
1230 | 1230 | # prepare toolbar for edit buttons |
— | — | @@ -1878,17 +1878,30 @@ |
1879 | 1879 | } |
1880 | 1880 | |
1881 | 1881 | # don't parse user css/js, show message about preview |
1882 | | - # XXX: stupid php bug won't let us use $wgTitle->isCssJsSubpage() here |
| 1882 | + # XXX: stupid php bug won't let us use $wgTitle->isCssJsSubpage() here -- This note has been there since r3530. Sure the bug was fixed time ago? |
1883 | 1883 | |
1884 | | - if ( $this->isCssJsSubpage ) { |
| 1884 | + if ( $this->isCssJsSubpage || $this->mTitle->isCssOrJsPage() ) { |
| 1885 | + $level = 'user'; |
| 1886 | + if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) { |
| 1887 | + $level = 'site'; |
| 1888 | + } |
| 1889 | + |
| 1890 | + # Used messages to make sure grep find them: |
| 1891 | + # Messages: usercsspreview, userjspreview, sitecsspreview, sitejspreview |
1885 | 1892 | if (preg_match( "/\\.css$/", $this->mTitle->getText() ) ) { |
1886 | | - $previewtext = "<div id='mw-usercsspreview'>\n" . wfMsg( 'usercsspreview' ) . "\n</div>"; |
1887 | | - } else if (preg_match( "/\\.js$/", $this->mTitle->getText() ) ) { |
1888 | | - $previewtext = "<div id='mw-userjspreview'>\n" . wfMsg( 'userjspreview' ) . "\n</div>"; |
| 1893 | + $previewtext = "<div id='mw-{$level}csspreview'>\n" . wfMsg( "{$level}csspreview" ) . "\n</div>"; |
| 1894 | + $class = "mw-code mw-css"; |
| 1895 | + } elseif (preg_match( "/\\.js$/", $this->mTitle->getText() ) ) { |
| 1896 | + $previewtext = "<div id='mw-{$level}jspreview'>\n" . wfMsg( "{$level}jspreview" ) . "\n</div>"; |
| 1897 | + $class = "mw-code mw-js"; |
| 1898 | + } else { |
| 1899 | + throw new MWException( 'A CSS/JS (sub)page but which is not css nor js!' ); |
1889 | 1900 | } |
| 1901 | + |
1890 | 1902 | $parserOptions->setTidy( true ); |
1891 | 1903 | $parserOutput = $wgParser->parse( $previewtext, $this->mTitle, $parserOptions ); |
1892 | 1904 | $previewHTML = $parserOutput->mText; |
| 1905 | + $previewHTML .= "<pre class=\"$class\" dir=\"ltr\">\n" . htmlspecialchars( $this->textbox1 ) . "\n</pre>\n"; |
1893 | 1906 | } else { |
1894 | 1907 | $rt = Title::newFromRedirectArray( $this->textbox1 ); |
1895 | 1908 | if ( $rt ) { |
— | — | @@ -2342,7 +2355,9 @@ |
2343 | 2356 | ); |
2344 | 2357 | $checkboxes['minor'] = |
2345 | 2358 | Xml::check( 'wpMinoredit', $checked['minor'], $attribs ) . |
2346 | | - " <label for='wpMinoredit' id='mw-editpage-minoredit'" . $skin->titleAttrib( 'minoredit', 'withaccess' ) . ">{$minorLabel}</label>"; |
| 2359 | + " <label for='wpMinoredit' id='mw-editpage-minoredit'" . |
| 2360 | + Xml::expandAttributes( array( 'title' => $skin->titleAttrib( 'minoredit', 'withaccess' ) ) ) . |
| 2361 | + ">{$minorLabel}</label>"; |
2347 | 2362 | } |
2348 | 2363 | |
2349 | 2364 | $watchLabel = wfMsgExt( 'watchthis', array( 'parseinline' ) ); |
— | — | @@ -2355,7 +2370,9 @@ |
2356 | 2371 | ); |
2357 | 2372 | $checkboxes['watch'] = |
2358 | 2373 | Xml::check( 'wpWatchthis', $checked['watch'], $attribs ) . |
2359 | | - " <label for='wpWatchthis' id='mw-editpage-watch'" . $skin->titleAttrib( 'watch', 'withaccess' ) . ">{$watchLabel}</label>"; |
| 2374 | + " <label for='wpWatchthis' id='mw-editpage-watch'" . |
| 2375 | + Xml::expandAttributes( array( 'title' => $skin->titleAttrib( 'watch', 'withaccess' ) ) ) . |
| 2376 | + ">{$watchLabel}</label>"; |
2360 | 2377 | } |
2361 | 2378 | wfRunHooks( 'EditPageBeforeEditChecks', array( &$this, &$checkboxes, &$tabindex ) ); |
2362 | 2379 | return $checkboxes; |
Index: branches/REL1_17/phase3/includes/HTMLForm.php |
— | — | @@ -16,32 +16,32 @@ |
17 | 17 | * The constructor input is an associative array of $fieldname => $info, |
18 | 18 | * where $info is an Associative Array with any of the following: |
19 | 19 | * |
20 | | - * 'class' -- the subclass of HTMLFormField that will be used |
21 | | - * to create the object. *NOT* the CSS class! |
22 | | - * 'type' -- roughly translates into the <select> type attribute. |
23 | | - * if 'class' is not specified, this is used as a map |
24 | | - * through HTMLForm::$typeMappings to get the class name. |
25 | | - * 'default' -- default value when the form is displayed |
26 | | - * 'id' -- HTML id attribute |
27 | | - * 'cssclass' -- CSS class |
28 | | - * 'options' -- varies according to the specific object. |
29 | | - * 'label-message' -- message key for a message to use as the label. |
30 | | - * can be an array of msg key and then parameters to |
31 | | - * the message. |
32 | | - * 'label' -- alternatively, a raw text message. Overridden by |
33 | | - * label-message |
34 | | - * 'help-message' -- message key for a message to use as a help text. |
35 | | - * can be an array of msg key and then parameters to |
36 | | - * the message. |
37 | | - * 'required' -- passed through to the object, indicating that it |
38 | | - * is a required field. |
39 | | - * 'size' -- the length of text fields |
40 | | - * 'filter-callback -- a function name to give you the chance to |
41 | | - * massage the inputted value before it's processed. |
42 | | - * @see HTMLForm::filter() |
43 | | - * 'validation-callback' -- a function name to give you the chance |
44 | | - * to impose extra validation on the field input. |
45 | | - * @see HTMLForm::validate() |
| 20 | + * 'class' -- the subclass of HTMLFormField that will be used |
| 21 | + * to create the object. *NOT* the CSS class! |
| 22 | + * 'type' -- roughly translates into the <select> type attribute. |
| 23 | + * if 'class' is not specified, this is used as a map |
| 24 | + * through HTMLForm::$typeMappings to get the class name. |
| 25 | + * 'default' -- default value when the form is displayed |
| 26 | + * 'id' -- HTML id attribute |
| 27 | + * 'cssclass' -- CSS class |
| 28 | + * 'options' -- varies according to the specific object. |
| 29 | + * 'label-message' -- message key for a message to use as the label. |
| 30 | + * can be an array of msg key and then parameters to |
| 31 | + * the message. |
| 32 | + * 'label' -- alternatively, a raw text message. Overridden by |
| 33 | + * label-message |
| 34 | + * 'help-message' -- message key for a message to use as a help text. |
| 35 | + * can be an array of msg key and then parameters to |
| 36 | + * the message. |
| 37 | + * 'required' -- passed through to the object, indicating that it |
| 38 | + * is a required field. |
| 39 | + * 'size' -- the length of text fields |
| 40 | + * 'filter-callback -- a function name to give you the chance to |
| 41 | + * massage the inputted value before it's processed. |
| 42 | + * @see HTMLForm::filter() |
| 43 | + * 'validation-callback' -- a function name to give you the chance |
| 44 | + * to impose extra validation on the field input. |
| 45 | + * @see HTMLForm::validate() |
46 | 46 | * |
47 | 47 | * TODO: Document 'section' / 'subsection' stuff |
48 | 48 | */ |
— | — | @@ -187,10 +187,10 @@ |
188 | 188 | * The here's-one-I-made-earlier option: do the submission if |
189 | 189 | * posted, or display the form with or without funky valiation |
190 | 190 | * errors |
191 | | - * @return Bool whether submission was successful. |
| 191 | + * @return Bool or Status whether submission was successful. |
192 | 192 | */ |
193 | 193 | function show() { |
194 | | - // Check if we have the info we need |
| 194 | + # Check if we have the info we need |
195 | 195 | if ( ! $this->mTitle ) { |
196 | 196 | throw new MWException( "You must call setTitle() on an HTMLForm" ); |
197 | 197 | } |
— | — | @@ -209,9 +209,7 @@ |
210 | 210 | $result = $this->trySubmit(); |
211 | 211 | } |
212 | 212 | |
213 | | - if ( $result === true || |
214 | | - ( $result instanceof Status && $result->isGood() ) ) |
215 | | - { |
| 213 | + if ( $result === true || ( $result instanceof Status && $result->isGood() ) ){ |
216 | 214 | return $result; |
217 | 215 | } |
218 | 216 | |
— | — | @@ -708,6 +706,10 @@ |
709 | 707 | return call_user_func( $this->mValidationCallback, $value, $alldata ); |
710 | 708 | } |
711 | 709 | |
| 710 | + if ( isset( $this->mParams['required'] ) && $value === '' ) { |
| 711 | + return wfMsgExt( 'htmlform-required', 'parseinline' ); |
| 712 | + } |
| 713 | + |
712 | 714 | return true; |
713 | 715 | } |
714 | 716 | |
— | — | @@ -1001,20 +1003,6 @@ |
1002 | 1004 | |
1003 | 1005 | return Html::element( 'input', $attribs ); |
1004 | 1006 | } |
1005 | | - |
1006 | | - public function validate( $value, $alldata ) { |
1007 | | - $p = parent::validate( $value, $alldata ); |
1008 | | - |
1009 | | - if ( $p !== true ) { |
1010 | | - return $p; |
1011 | | - } |
1012 | | - |
1013 | | - if ( isset( $this->mParams['required'] ) && $value === '' ) { |
1014 | | - return wfMsgExt( 'htmlform-required', 'parseinline' ); |
1015 | | - } |
1016 | | - |
1017 | | - return true; |
1018 | | - } |
1019 | 1007 | } |
1020 | 1008 | class HTMLTextAreaField extends HTMLFormField { |
1021 | 1009 | function getCols() { |
— | — | @@ -1054,20 +1042,6 @@ |
1055 | 1043 | |
1056 | 1044 | return Html::element( 'textarea', $attribs, $value ); |
1057 | 1045 | } |
1058 | | - |
1059 | | - public function validate( $value, $alldata ) { |
1060 | | - $p = parent::validate( $value, $alldata ); |
1061 | | - |
1062 | | - if ( $p !== true ) { |
1063 | | - return $p; |
1064 | | - } |
1065 | | - |
1066 | | - if ( isset( $this->mParams['required'] ) && $value === '' ) { |
1067 | | - return wfMsgExt( 'htmlform-required', 'parseinline' ); |
1068 | | - } |
1069 | | - |
1070 | | - return true; |
1071 | | - } |
1072 | 1046 | } |
1073 | 1047 | |
1074 | 1048 | /** |
— | — | @@ -1086,8 +1060,12 @@ |
1087 | 1061 | if ( $p !== true ) { |
1088 | 1062 | return $p; |
1089 | 1063 | } |
| 1064 | + |
| 1065 | + $value = trim( $value ); |
1090 | 1066 | |
1091 | | - if ( floatval( $value ) != $value ) { |
| 1067 | + # http://dev.w3.org/html5/spec/common-microsyntaxes.html#real-numbers |
| 1068 | + # with the addition that a leading '+' sign is ok. |
| 1069 | + if ( !preg_match( '/^(\+|\-)?\d+(\.\d+)?(E(\+|\-)?\d+)?$/i', $value ) ) { |
1092 | 1070 | return wfMsgExt( 'htmlform-float-invalid', 'parse' ); |
1093 | 1071 | } |
1094 | 1072 | |
— | — | @@ -1124,8 +1102,13 @@ |
1125 | 1103 | return $p; |
1126 | 1104 | } |
1127 | 1105 | |
1128 | | - if ( $value !== '' |
1129 | | - && ( !is_numeric( $value ) || round( $value ) != $value ) |
| 1106 | + # http://dev.w3.org/html5/spec/common-microsyntaxes.html#signed-integers |
| 1107 | + # with the addition that a leading '+' sign is ok. Note that leading zeros |
| 1108 | + # are fine, and will be left in the input, which is useful for things like |
| 1109 | + # phone numbers when you know that they are integers (the HTML5 type=tel |
| 1110 | + # input does not require its value to be numeric). If you want a tidier |
| 1111 | + # value to, eg, save in the DB, clean it up with intval(). |
| 1112 | + if ( !preg_match( '/^(\+|\-)?\d*$/', trim( $value ) ) |
1130 | 1113 | ) { |
1131 | 1114 | return wfMsgExt( 'htmlform-int-invalid', 'parse' ); |
1132 | 1115 | } |
— | — | @@ -1346,11 +1329,13 @@ |
1347 | 1330 | $html .= Html::rawElement( 'h1', array(), $label ) . "\n"; |
1348 | 1331 | $html .= $this->formatOptions( $info, $value ); |
1349 | 1332 | } else { |
1350 | | - $thisAttribs = array( 'id' => $this->mID . "-$info", 'value' => $info ); |
| 1333 | + $thisAttribs = array( 'id' => "{$this->mID}-$info", 'value' => $info ); |
1351 | 1334 | |
1352 | | - $checkbox = Xml::check( $this->mName . '[]', in_array( $info, $value, true ), |
1353 | | - $attribs + $thisAttribs ); |
1354 | | - $checkbox .= ' ' . Html::rawElement( 'label', array( 'for' => $this->mID . "-$info" ), $label ); |
| 1335 | + $checkbox = Xml::check( |
| 1336 | + $this->mName . '[]', |
| 1337 | + in_array( $info, $value, true ), |
| 1338 | + $attribs + $thisAttribs ); |
| 1339 | + $checkbox .= ' ' . Html::rawElement( 'label', array( 'for' => "{$this->mID}-$info" ), $label ); |
1355 | 1340 | |
1356 | 1341 | $html .= $checkbox . '<br />'; |
1357 | 1342 | } |
— | — | @@ -1490,6 +1475,10 @@ |
1491 | 1476 | # forcing the 'wp' prefix on hidden field names |
1492 | 1477 | # is undesirable |
1493 | 1478 | $this->mName = substr( $this->mName, 2 ); |
| 1479 | + |
| 1480 | + # Per HTML5 spec, hidden fields cannot be 'required' |
| 1481 | + # http://dev.w3.org/html5/spec/states-of-the-type-attribute.html#hidden-state |
| 1482 | + unset( $this->mParams['required'] ); |
1494 | 1483 | } |
1495 | 1484 | |
1496 | 1485 | public function getTableRow( $value ) { |
— | — | @@ -1535,6 +1524,13 @@ |
1536 | 1525 | protected function needsLabel() { |
1537 | 1526 | return false; |
1538 | 1527 | } |
| 1528 | + |
| 1529 | + /** |
| 1530 | + * Button cannot be invalid |
| 1531 | + */ |
| 1532 | + public function validate( $value, $alldata ){ |
| 1533 | + return true; |
| 1534 | + } |
1539 | 1535 | } |
1540 | 1536 | |
1541 | 1537 | class HTMLEditTools extends HTMLFormField { |
Index: branches/REL1_17/phase3/includes/installer/WebInstaller.php |
— | — | @@ -47,6 +47,7 @@ |
48 | 48 | */ |
49 | 49 | public $pageSequence = array( |
50 | 50 | 'Language', |
| 51 | + 'ExistingWiki', |
51 | 52 | 'Welcome', |
52 | 53 | 'DBConnect', |
53 | 54 | 'Upgrade', |
— | — | @@ -175,15 +176,7 @@ |
176 | 177 | # Get the page name. |
177 | 178 | $pageName = $this->request->getVal( 'page' ); |
178 | 179 | |
179 | | - # Check LocalSettings status |
180 | | - $localSettings = $this->getLocalSettingsStatus(); |
181 | | - |
182 | | - if( !$localSettings->isGood() && $this->getVar( '_LocalSettingsLocked' ) ) { |
183 | | - $pageName = 'Locked'; |
184 | | - $pageId = false; |
185 | | - $page = $this->getPageByName( $pageName ); |
186 | | - $page->setLocalSettingsStatus( $localSettings ); |
187 | | - } elseif ( in_array( $pageName, $this->otherPages ) ) { |
| 180 | + if ( in_array( $pageName, $this->otherPages ) ) { |
188 | 181 | # Out of sequence |
189 | 182 | $pageId = false; |
190 | 183 | $page = $this->getPageByName( $pageName ); |
— | — | @@ -620,7 +613,7 @@ |
621 | 614 | ) . "\n" . |
622 | 615 | "</div>\n" . |
623 | 616 | "<div class=\"config-info-right\">\n" . |
624 | | - $this->parse( $text ) . "\n" . |
| 617 | + $this->parse( $text, true ) . "\n" . |
625 | 618 | "</div>\n" . |
626 | 619 | "<div style=\"clear: left;\"></div>\n" . |
627 | 620 | "</div>\n"; |
Index: branches/REL1_17/phase3/includes/installer/Installer.php |
— | — | @@ -215,33 +215,30 @@ |
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
219 | | - * Determine if LocalSettings exists. If it does, return an appropriate |
220 | | - * status for whether upgrading is enabled or not. |
| 219 | + * Determine if LocalSettings.php exists. If it does, return its variables, |
| 220 | + * merged with those from AdminSettings.php, as an array. |
221 | 221 | * |
222 | | - * @return Status |
| 222 | + * @return Array |
223 | 223 | */ |
224 | | - public function getLocalSettingsStatus() { |
| 224 | + public function getExistingLocalSettings() { |
225 | 225 | global $IP; |
226 | 226 | |
227 | | - $status = Status::newGood(); |
228 | | - |
229 | 227 | wfSuppressWarnings(); |
230 | | - $ls = file_exists( "$IP/LocalSettings.php" ); |
| 228 | + $_lsExists = file_exists( "$IP/LocalSettings.php" ); |
231 | 229 | wfRestoreWarnings(); |
232 | 230 | |
233 | | - if( $ls ) { |
| 231 | + if( $_lsExists ) { |
234 | 232 | require( "$IP/includes/DefaultSettings.php" ); |
235 | | - require_once( "$IP/LocalSettings.php" ); |
| 233 | + require( "$IP/LocalSettings.php" ); |
| 234 | + if ( file_exists( "$IP/AdminSettings.php" ) ) { |
| 235 | + require( "$IP/AdminSettings.php" ); |
| 236 | + } |
236 | 237 | $vars = get_defined_vars(); |
237 | | - if( isset( $vars['wgUpgradeKey'] ) && $vars['wgUpgradeKey'] ) { |
238 | | - $status->warning( 'config-localsettings-upgrade' ); |
239 | | - $this->setVar( '_UpgradeKey', $vars['wgUpgradeKey' ] ); |
240 | | - } else { |
241 | | - $status->fatal( 'config-localsettings-noupgrade' ); |
242 | | - } |
| 238 | + unset( $vars['_lsExists'] ); |
| 239 | + return $vars; |
| 240 | + } else { |
| 241 | + return false; |
243 | 242 | } |
244 | | - |
245 | | - return $status; |
246 | 243 | } |
247 | 244 | |
248 | 245 | /** |
— | — | @@ -329,6 +326,19 @@ |
330 | 327 | return $html; |
331 | 328 | } |
332 | 329 | |
| 330 | + public function getParserOptions() { |
| 331 | + return $this->parserOptions; |
| 332 | + } |
| 333 | + |
| 334 | + public function disableLinkPopups() { |
| 335 | + $this->parserOptions->setExternalLinkTarget( false ); |
| 336 | + } |
| 337 | + |
| 338 | + public function restoreLinkPopups() { |
| 339 | + global $wgExternalLinkTarget; |
| 340 | + $this->parserOptions->setExternalLinkTarget( $wgExternalLinkTarget ); |
| 341 | + } |
| 342 | + |
333 | 343 | /** |
334 | 344 | * TODO: document |
335 | 345 | * |
Index: branches/REL1_17/phase3/includes/installer/CoreInstaller.php |
— | — | @@ -84,8 +84,8 @@ |
85 | 85 | '_CCDone' => false, |
86 | 86 | '_Extensions' => array(), |
87 | 87 | '_MemCachedServers' => '', |
88 | | - '_LocalSettingsLocked' => true, |
89 | | - '_UpgradeKey' => '', |
| 88 | + '_UpgradeKeySupplied' => false, |
| 89 | + '_ExistingDBSettings' => false, |
90 | 90 | ); |
91 | 91 | |
92 | 92 | /** |
— | — | @@ -381,7 +381,7 @@ |
382 | 382 | * |
383 | 383 | * @return Status |
384 | 384 | */ |
385 | | - protected function generateSecret( $secretName ) { |
| 385 | + protected function generateSecret( $secretName, $length = 64 ) { |
386 | 386 | if ( wfIsWindows() ) { |
387 | 387 | $file = null; |
388 | 388 | } else { |
— | — | @@ -393,12 +393,12 @@ |
394 | 394 | $status = Status::newGood(); |
395 | 395 | |
396 | 396 | if ( $file ) { |
397 | | - $secretKey = bin2hex( fread( $file, 32 ) ); |
| 397 | + $secretKey = bin2hex( fread( $file, $length / 2 ) ); |
398 | 398 | fclose( $file ); |
399 | 399 | } else { |
400 | 400 | $secretKey = ''; |
401 | 401 | |
402 | | - for ( $i=0; $i<8; $i++ ) { |
| 402 | + for ( $i = 0; $i < $length / 8; $i++ ) { |
403 | 403 | $secretKey .= dechex( mt_rand( 0, 0x7fffffff ) ); |
404 | 404 | } |
405 | 405 | |
— | — | @@ -411,13 +411,15 @@ |
412 | 412 | } |
413 | 413 | |
414 | 414 | /** |
415 | | - * Generate a default $wgUpradeKey, Will warn if we had to use |
| 415 | + * Generate a default $wgUpgradeKey. Will warn if we had to use |
416 | 416 | * mt_rand() instead of /dev/urandom |
417 | 417 | * |
418 | 418 | * @return Status |
419 | 419 | */ |
420 | | - protected function generateUpgradeKey() { |
421 | | - return $this->generateSecret( 'wgUpgradeKey' ); |
| 420 | + public function generateUpgradeKey() { |
| 421 | + if ( strval( $this->getVar( 'wgUpgradeKey' ) ) === '' ) { |
| 422 | + return $this->generateSecret( 'wgUpgradeKey', 16 ); |
| 423 | + } |
422 | 424 | } |
423 | 425 | |
424 | 426 | /** |
Index: branches/REL1_17/phase3/includes/installer/Installer.i18n.php |
— | — | @@ -15,14 +15,22 @@ |
16 | 16 | 'config-desc' => 'The installer for MediaWiki', |
17 | 17 | 'config-title' => 'MediaWiki $1 installation', |
18 | 18 | 'config-information' => 'Information', |
19 | | - 'config-localsettings-upgrade' => "'''Warning''': A <code>LocalSettings.php</code> file has been detected. |
20 | | -Your software is able to upgrade. |
21 | | -Please fill in the value of <code>\$wgUpgradeKey</code> in the box.", |
| 19 | + 'config-localsettings-upgrade' => "A <code>LocalSettings.php</code> file has been detected. |
| 20 | +To upgrade this installation, please enter the value of <code>\$wgUpgradeKey</code> in the box below. |
| 21 | +You will find it in LocalSettings.php.", |
22 | 22 | 'config-localsettings-key' => 'Upgrade key:', |
23 | | - 'config-localsettings-badkey' => 'The key you provided is incorrect', |
24 | | - 'config-localsettings-noupgrade' => "'''Error''': A <code>LocalSettings.php</code> file has been detected. |
25 | | -Your software is not able to upgrade at this time. |
26 | | -The installer has been disabled for security reasons.", |
| 23 | + 'config-localsettings-badkey' => 'The key you provided is incorrect.', |
| 24 | + 'config-upgrade-key-missing' => 'An existing installation of MediaWiki has been detected. |
| 25 | +To upgrade this installation, please put the following line at the bottom of your LocalSettings.php: |
| 26 | + |
| 27 | +$1 |
| 28 | +', |
| 29 | + 'config-localsettings-incomplete' => 'The existing LocalSettings.php appears to be incomplete. |
| 30 | +The $1 variable is not set. |
| 31 | +Please change LocalSettings.php so that this variable is set, and click "Continue".', |
| 32 | + 'config-localsettings-connection-error' => 'An error was encountered when connecting to the database using the settings specified in LocalSettings.php or AdminSettings.php. Please fix these settings and try again. |
| 33 | + |
| 34 | +$1', |
27 | 35 | 'config-session-error' => 'Error starting session: $1', |
28 | 36 | 'config-session-expired' => 'Your session data seems to have expired. |
29 | 37 | Sessions are configured for a lifetime of $1. |
— | — | @@ -51,7 +59,7 @@ |
52 | 60 | 'config-page-releasenotes' => 'Release notes', |
53 | 61 | 'config-page-copying' => 'Copying', |
54 | 62 | 'config-page-upgradedoc' => 'Upgrading', |
55 | | - 'config-page-locked' => 'Permission denied', |
| 63 | + 'config-page-existingwiki' => 'Existing wiki', |
56 | 64 | 'config-help-restart' => 'Do you want to clear all saved data that you have entered and restart the installation process?', |
57 | 65 | 'config-restart' => 'Yes, restart it', |
58 | 66 | 'config-welcome' => "=== Environmental checks === |
— | — | @@ -277,6 +285,9 @@ |
278 | 286 | |
279 | 287 | If you want to regenerate your <code>LocalSettings.php</code> file, click the button below. |
280 | 288 | This is '''not recommended''' unless you are having problems with your wiki.", |
| 289 | + 'config-upgrade-done-no-regenerate' => "Upgrade complete. |
| 290 | + |
| 291 | +You can now [$1 start using your wiki].", |
281 | 292 | 'config-regenerate' => 'Regenerate LocalSettings.php →', |
282 | 293 | 'config-show-table-status' => 'SHOW TABLE STATUS query failed!', |
283 | 294 | 'config-unknown-collation' => "'''Warning:''' Database is using unrecognised collation.", |
Index: branches/REL1_17/phase3/includes/installer/LocalSettingsGenerator.php |
— | — | @@ -282,7 +282,7 @@ |
283 | 283 | |
284 | 284 | # Site upgrade key. Must be set to a string (default provided) to turn on the |
285 | 285 | # web installer while LocalSettings.php is in place |
286 | | -#\$wgUpgradeKey = \"{$this->values['wgUpgradeKey']}\"; |
| 286 | +\$wgUpgradeKey = \"{$this->values['wgUpgradeKey']}\"; |
287 | 287 | |
288 | 288 | ## Default skin: you can change the default skin. Use the internal symbolic |
289 | 289 | ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook', 'vector': |
Index: branches/REL1_17/phase3/includes/installer/WebInstallerPage.php |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | ); |
51 | 51 | } |
52 | 52 | |
53 | | - public function endForm( $continue = 'continue' ) { |
| 53 | + public function endForm( $continue = 'continue', $back = 'back' ) { |
54 | 54 | $s = "<div class=\"config-submit\">\n"; |
55 | 55 | $id = $this->getId(); |
56 | 56 | |
— | — | @@ -63,10 +63,10 @@ |
64 | 64 | array( 'name' => "enter-$continue", 'style' => 'visibility:hidden;overflow:hidden;width:1px;margin:0' ) ) . "\n"; |
65 | 65 | } |
66 | 66 | |
67 | | - if ( $id !== 0 ) { |
68 | | - $s .= Xml::submitButton( wfMsg( 'config-back' ), |
| 67 | + if ( $back ) { |
| 68 | + $s .= Xml::submitButton( wfMsg( "config-$back" ), |
69 | 69 | array( |
70 | | - 'name' => 'submit-back', |
| 70 | + 'name' => "submit-$back", |
71 | 71 | 'tabindex' => $this->parent->nextTabIndex() |
72 | 72 | ) ) . "\n"; |
73 | 73 | } |
— | — | @@ -116,56 +116,6 @@ |
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | | -class WebInstaller_Locked extends WebInstallerPage { |
121 | | - // The status of Installer::getLocalSettingsStatus() |
122 | | - private $status; |
123 | | - |
124 | | - public function setLocalSettingsStatus( Status $s ) { |
125 | | - $this->status = $s; |
126 | | - } |
127 | | - |
128 | | - protected function getId() { |
129 | | - return 0; |
130 | | - } |
131 | | - |
132 | | - public function execute() { |
133 | | - $r = $this->parent->request; |
134 | | - if( !$r->wasPosted() || !$this->status->isOK() ) { |
135 | | - $this->display(); |
136 | | - return 'output'; |
137 | | - } else { |
138 | | - $key = $r->getText( 'config_wpUpgradeKey' ); |
139 | | - if( !$key || $key !== $this->getVar( '_UpgradeKey' ) ) { |
140 | | - $this->parent->showError( 'config-localsettings-badkey' ); |
141 | | - $this->display(); |
142 | | - return 'output'; |
143 | | - } else { |
144 | | - $this->setVar( '_LocalSettingsLocked', false ); |
145 | | - return 'continue'; |
146 | | - } |
147 | | - } |
148 | | - } |
149 | | - |
150 | | - /** |
151 | | - * Display stuff to the end user |
152 | | - */ |
153 | | - private function display() { |
154 | | - $this->startForm(); |
155 | | - $this->parent->showStatusBox( $this->status ); |
156 | | - $continue = false; |
157 | | - if( $this->status->isOK() && !$this->status->isGood() ) { |
158 | | - $this->addHTML( "<br />" . |
159 | | - $this->parent->getTextBox( array( |
160 | | - 'var' => 'wpUpgradeKey', |
161 | | - 'label' => 'config-localsettings-key', |
162 | | - ) ) |
163 | | - ); |
164 | | - $continue = 'continue'; |
165 | | - } |
166 | | - $this->endForm( $continue ); |
167 | | - } |
168 | | -} |
169 | | - |
170 | 120 | class WebInstaller_Language extends WebInstallerPage { |
171 | 121 | |
172 | 122 | public function execute() { |
— | — | @@ -222,7 +172,7 @@ |
223 | 173 | $this->getLanguageSelector( 'UserLang', 'config-your-language', $userLang, $this->parent->getHelpBox( 'config-your-language-help' ) ) . |
224 | 174 | $this->getLanguageSelector( 'ContLang', 'config-wiki-language', $contLang, $this->parent->getHelpBox( 'config-wiki-language-help' ) ); |
225 | 175 | $this->addHTML( $s ); |
226 | | - $this->endForm(); |
| 176 | + $this->endForm( 'continue', false ); |
227 | 177 | } |
228 | 178 | |
229 | 179 | /** |
— | — | @@ -245,6 +195,146 @@ |
246 | 196 | |
247 | 197 | } |
248 | 198 | |
| 199 | +class WebInstaller_ExistingWiki extends WebInstallerPage { |
| 200 | + public function execute() { |
| 201 | + // If there is no LocalSettings.php, continue to the installer welcome page |
| 202 | + $vars = $this->parent->getExistingLocalSettings(); |
| 203 | + if ( !$vars ) { |
| 204 | + return 'skip'; |
| 205 | + } |
| 206 | + |
| 207 | + // Check if the upgrade key supplied to the user has appeared in LocalSettings.php |
| 208 | + if ( $vars['wgUpgradeKey'] !== false |
| 209 | + && $this->getVar( '_UpgradeKeySupplied' ) |
| 210 | + && $this->getVar( 'wgUpgradeKey' ) === $vars['wgUpgradeKey'] ) |
| 211 | + { |
| 212 | + // It's there, so the user is authorized |
| 213 | + $status = $this->handleExistingUpgrade( $vars ); |
| 214 | + if ( $status->isOK() ) { |
| 215 | + return 'skip'; |
| 216 | + } else { |
| 217 | + $this->startForm(); |
| 218 | + $this->parent->showStatusBox( $status ); |
| 219 | + $this->endForm( 'continue' ); |
| 220 | + return 'output'; |
| 221 | + } |
| 222 | + return $this->handleExistingUpgrade( $vars ); |
| 223 | + } |
| 224 | + |
| 225 | + // If there is no $wgUpgradeKey, tell the user to add one to LocalSettings.php |
| 226 | + if ( $vars['wgUpgradeKey'] === false ) { |
| 227 | + if ( $this->getVar( 'wgUpgradeKey', false ) === false ) { |
| 228 | + $this->parent->generateUpgradeKey(); |
| 229 | + $this->setVar( '_UpgradeKeySupplied', true ); |
| 230 | + } |
| 231 | + $this->startForm(); |
| 232 | + $this->addHTML( $this->parent->getInfoBox( |
| 233 | + wfMsgNoTrans( 'config-upgrade-key-missing', |
| 234 | + "<pre>\$wgUpgradeKey = '" . $this->getVar( 'wgUpgradeKey' ) . "';</pre>" ) |
| 235 | + ) ); |
| 236 | + $this->endForm( 'continue' ); |
| 237 | + return 'output'; |
| 238 | + } |
| 239 | + |
| 240 | + // If there is an upgrade key, but it wasn't supplied, prompt the user to enter it |
| 241 | + |
| 242 | + $r = $this->parent->request; |
| 243 | + if ( $r->wasPosted() ) { |
| 244 | + $key = $r->getText( 'config_wgUpgradeKey' ); |
| 245 | + if( !$key || $key !== $vars['wgUpgradeKey'] ) { |
| 246 | + $this->parent->showError( 'config-localsettings-badkey' ); |
| 247 | + $this->showKeyForm(); |
| 248 | + return 'output'; |
| 249 | + } |
| 250 | + // Key was OK |
| 251 | + $status = $this->handleExistingUpgrade( $vars ); |
| 252 | + if ( $status->isOK() ) { |
| 253 | + return 'continue'; |
| 254 | + } else { |
| 255 | + $this->parent->showStatusBox( $status ); |
| 256 | + $this->showKeyForm(); |
| 257 | + return 'output'; |
| 258 | + } |
| 259 | + } else { |
| 260 | + $this->showKeyForm(); |
| 261 | + return 'output'; |
| 262 | + } |
| 263 | + } |
| 264 | + |
| 265 | + /** |
| 266 | + * Show the "enter key" form |
| 267 | + */ |
| 268 | + protected function showKeyForm() { |
| 269 | + $this->startForm(); |
| 270 | + $this->addHTML( |
| 271 | + $this->parent->getInfoBox( wfMsgNoTrans( 'config-localsettings-upgrade' ) ). |
| 272 | + '<br />' . |
| 273 | + $this->parent->getTextBox( array( |
| 274 | + 'var' => 'wgUpgradeKey', |
| 275 | + 'label' => 'config-localsettings-key', |
| 276 | + 'attribs' => array( 'autocomplete' => 'off' ), |
| 277 | + ) ) |
| 278 | + ); |
| 279 | + $this->endForm( 'continue' ); |
| 280 | + } |
| 281 | + |
| 282 | + protected function importVariables( $names, $vars ) { |
| 283 | + $status = Status::newGood(); |
| 284 | + foreach ( $names as $name ) { |
| 285 | + if ( !isset( $vars[$name] ) ) { |
| 286 | + $status->fatal( 'config-localsettings-incomplete', $name ); |
| 287 | + } |
| 288 | + $this->setVar( $name, $vars[$name] ); |
| 289 | + } |
| 290 | + return $status; |
| 291 | + } |
| 292 | + |
| 293 | + /** |
| 294 | + * Initiate an upgrade of the existing database |
| 295 | + * @param $vars Variables from LocalSettings.php and AdminSettings.php |
| 296 | + * @return Status |
| 297 | + */ |
| 298 | + protected function handleExistingUpgrade( $vars ) { |
| 299 | + // Check $wgDBtype |
| 300 | + if ( !isset( $vars['wgDBtype'] ) || !in_array( $vars['wgDBtype'], Installer::getDBTypes() ) ) { |
| 301 | + return Status::newFatal( 'config-localsettings-connection-error', '' ); |
| 302 | + } |
| 303 | + |
| 304 | + // Set the relevant variables from LocalSettings.php |
| 305 | + $requiredVars = array( 'wgDBtype', 'wgDBuser', 'wgDBpassword' ); |
| 306 | + $status = $this->importVariables( $requiredVars , $vars ); |
| 307 | + $installer = $this->parent->getDBInstaller(); |
| 308 | + $status->merge( $this->importVariables( $installer->getGlobalNames(), $vars ) ); |
| 309 | + if ( !$status->isOK() ) { |
| 310 | + return $status; |
| 311 | + } |
| 312 | + |
| 313 | + if ( isset( $vars['wgDBadminuser'] ) ) { |
| 314 | + $this->setVar( '_InstallUser', $vars['wgDBadminuser'] ); |
| 315 | + } else { |
| 316 | + $this->setVar( '_InstallUser', $vars['wgDBuser'] ); |
| 317 | + } |
| 318 | + if ( isset( $vars['wgDBadminpassword'] ) ) { |
| 319 | + $this->setVar( '_InstallPassword', $vars['wgDBadminpassword'] ); |
| 320 | + } else { |
| 321 | + $this->setVar( '_InstallPassword', $vars['wgDBpassword'] ); |
| 322 | + } |
| 323 | + |
| 324 | + // Test the database connection |
| 325 | + $status = $installer->getConnection(); |
| 326 | + if ( !$status->isOK() ) { |
| 327 | + // Adjust the error message to explain things correctly |
| 328 | + $status->replaceMessage( 'config-connection-error', |
| 329 | + 'config-localsettings-connection-error' ); |
| 330 | + return $status; |
| 331 | + } |
| 332 | + |
| 333 | + // All good |
| 334 | + $this->setVar( '_ExistingDBSettings', true ); |
| 335 | + return $status; |
| 336 | + } |
| 337 | +} |
| 338 | + |
249 | 339 | class WebInstaller_Welcome extends WebInstallerPage { |
250 | 340 | |
251 | 341 | public function execute() { |
— | — | @@ -268,6 +358,10 @@ |
269 | 359 | class WebInstaller_DBConnect extends WebInstallerPage { |
270 | 360 | |
271 | 361 | public function execute() { |
| 362 | + if ( $this->getVar( '_ExistingDBSettings' ) ) { |
| 363 | + return 'skip'; |
| 364 | + } |
| 365 | + |
272 | 366 | $r = $this->parent->request; |
273 | 367 | if ( $r->wasPosted() ) { |
274 | 368 | $status = $this->submit(); |
— | — | @@ -341,7 +435,10 @@ |
342 | 436 | |
343 | 437 | public function execute() { |
344 | 438 | if ( $this->getVar( '_UpgradeDone' ) ) { |
345 | | - if ( $this->parent->request->wasPosted() ) { |
| 439 | + // Allow regeneration of LocalSettings.php, unless we are working |
| 440 | + // from a pre-existing LocalSettings.php file and we want to avoid |
| 441 | + // leaking its contents |
| 442 | + if ( $this->parent->request->wasPosted() && !$this->getVar( '_ExistingDBSettings' ) ) { |
346 | 443 | // Done message acknowledged |
347 | 444 | return 'continue'; |
348 | 445 | } else { |
— | — | @@ -389,16 +486,24 @@ |
390 | 487 | |
391 | 488 | public function showDoneMessage() { |
392 | 489 | $this->startForm(); |
| 490 | + $regenerate = !$this->getVar( '_ExistingDBSettings' ); |
| 491 | + if ( $regenerate ) { |
| 492 | + $msg = 'config-upgrade-done'; |
| 493 | + } else { |
| 494 | + $msg = 'config-upgrade-done-no-regenerate'; |
| 495 | + } |
| 496 | + $this->parent->disableLinkPopups(); |
393 | 497 | $this->addHTML( |
394 | 498 | $this->parent->getInfoBox( |
395 | | - wfMsgNoTrans( 'config-upgrade-done', |
| 499 | + wfMsgNoTrans( $msg, |
396 | 500 | $GLOBALS['wgServer'] . |
397 | 501 | $this->getVar( 'wgScriptPath' ) . '/index' . |
398 | 502 | $this->getVar( 'wgScriptExtension' ) |
399 | 503 | ), 'tick-32.png' |
400 | 504 | ) |
401 | 505 | ); |
402 | | - $this->endForm( 'regenerate' ); |
| 506 | + $this->parent->restoreLinkPopups(); |
| 507 | + $this->endForm( $regenerate ? 'regenerate' : false, false ); |
403 | 508 | } |
404 | 509 | |
405 | 510 | } |
— | — | @@ -935,6 +1040,7 @@ |
936 | 1041 | $this->parent->request->response()->header( "Refresh: 0;$lsUrl" ); |
937 | 1042 | |
938 | 1043 | $this->startForm(); |
| 1044 | + $this->parent->disableLinkPopups(); |
939 | 1045 | $this->addHTML( |
940 | 1046 | $this->parent->getInfoBox( |
941 | 1047 | wfMsgNoTrans( 'config-install-done', |
— | — | @@ -946,7 +1052,8 @@ |
947 | 1053 | ), 'tick-32.png' |
948 | 1054 | ) |
949 | 1055 | ); |
950 | | - $this->endForm( false ); |
| 1056 | + $this->parent->restoreLinkPopups(); |
| 1057 | + $this->endForm( false, false ); |
951 | 1058 | } |
952 | 1059 | } |
953 | 1060 | |
Index: branches/REL1_17/phase3/includes/api/ApiQueryRecentChanges.php |
— | — | @@ -79,7 +79,13 @@ |
80 | 80 | return false; |
81 | 81 | } |
82 | 82 | |
83 | | - return $wgUser->editToken( $rc->getAttribute( 'rc_id' ) ); |
| 83 | + // The patrol token is always the same, let's exploit that |
| 84 | + static $cachedPatrolToken = null; |
| 85 | + if ( is_null( $cachedPatrolToken ) ) { |
| 86 | + $cachedPatrolToken = $wgUser->editToken( 'patrol' ); |
| 87 | + } |
| 88 | + |
| 89 | + return $cachedPatrolToken; |
84 | 90 | } |
85 | 91 | |
86 | 92 | /** |
Index: branches/REL1_17/phase3/includes/api/ApiPatrol.php |
— | — | @@ -59,6 +59,10 @@ |
60 | 60 | $this->getResult()->addValue( null, $this->getModuleName(), $result ); |
61 | 61 | } |
62 | 62 | |
| 63 | + public function mustBePosted() { |
| 64 | + return true; |
| 65 | + } |
| 66 | + |
63 | 67 | public function isWriteMode() { |
64 | 68 | return true; |
65 | 69 | } |
— | — | @@ -95,8 +99,7 @@ |
96 | 100 | } |
97 | 101 | |
98 | 102 | public function getTokenSalt() { |
99 | | - $params = $this->extractRequestParams(); |
100 | | - return $params['rcid']; |
| 103 | + return 'patrol'; |
101 | 104 | } |
102 | 105 | |
103 | 106 | protected function getExamples() { |
Index: branches/REL1_17/phase3/includes/api/ApiQueryInfo.php |
— | — | @@ -87,6 +87,7 @@ |
88 | 88 | 'unblock' => array( 'ApiQueryInfo', 'getUnblockToken' ), |
89 | 89 | 'email' => array( 'ApiQueryInfo', 'getEmailToken' ), |
90 | 90 | 'import' => array( 'ApiQueryInfo', 'getImportToken' ), |
| 91 | + 'patrol' => array( 'ApiQueryRecentChanges', 'getPatrolToken' ), |
91 | 92 | ); |
92 | 93 | wfRunHooks( 'APIQueryInfoTokens', array( &$this->tokenFunctions ) ); |
93 | 94 | return $this->tokenFunctions; |
Index: branches/REL1_17/phase3/includes/WebRequest.php |
— | — | @@ -65,6 +65,11 @@ |
66 | 66 | public function interpolateTitle() { |
67 | 67 | global $wgUsePathInfo; |
68 | 68 | |
| 69 | + // bug 16019: title interpolation on API queries is useless and possible harmful |
| 70 | + if ( defined( 'MW_API' ) ) { |
| 71 | + return; |
| 72 | + } |
| 73 | + |
69 | 74 | if ( $wgUsePathInfo ) { |
70 | 75 | // PATH_INFO is mangled due to http://bugs.php.net/bug.php?id=31892 |
71 | 76 | // And also by Apache 2.x, double slashes are converted to single slashes. |
Index: branches/REL1_17/phase3/includes/AutoLoader.php |
— | — | @@ -57,7 +57,6 @@ |
58 | 58 | 'DBABagOStuff' => 'includes/BagOStuff.php', |
59 | 59 | 'DependencyWrapper' => 'includes/CacheDependency.php', |
60 | 60 | 'DiffHistoryBlob' => 'includes/HistoryBlob.php', |
61 | | - 'DistributionRepository' => 'includes/DistributionRepository.php', |
62 | 61 | 'DjVuImage' => 'includes/DjVuImage.php', |
63 | 62 | 'DoubleReplacer' => 'includes/StringUtils.php', |
64 | 63 | 'DublinCoreRdf' => 'includes/Metadata.php', |
— | — | @@ -172,7 +171,6 @@ |
173 | 172 | 'MWNamespace' => 'includes/Namespace.php', |
174 | 173 | 'OldChangesList' => 'includes/ChangesList.php', |
175 | 174 | 'OutputPage' => 'includes/OutputPage.php', |
176 | | - 'PackageRepository' => 'includes/PackageRepository.php', |
177 | 175 | 'PageQueryPage' => 'includes/PageQueryPage.php', |
178 | 176 | 'PageHistory' => 'includes/HistoryPage.php', |
179 | 177 | 'PageHistoryPager' => 'includes/HistoryPage.php', |
Property changes on: branches/REL1_17/phase3/includes/AutoLoader.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
180 | 178 | Merged /trunk/phase3/includes/AutoLoader.php:r77981-77982,77994,78097,78118-78119,78137,78141,78165,78192,78204,78209,78230,78246,78250-78251,78264,78276,78404,78424 |
Index: branches/REL1_17/phase3/includes/DefaultSettings.php |
— | — | @@ -2288,15 +2288,14 @@ |
2289 | 2289 | * of new blocks in monobook. vector and modern should work without any special css. |
2290 | 2290 | * |
2291 | 2291 | * $wgFooterIcons itself is a key/value array. |
2292 | | - * The key os the name of a block that the icons will be wrapped in. |
2293 | | - * The final id varries by skin; Monobook and Vector will turn poweredby into f-poweredbyico |
2294 | | - * while Modern turns it into mw_poweredby. |
2295 | | - * The value is a key/value array of icons. The key may or may not be used by the |
2296 | | - * skin but it can be used to find the icon and unset it or change the icon if needed. |
2297 | | - * This is useful for disabling icons that are set by extensions. |
2298 | | - * The value should be either a string or an array. |
2299 | | - * If it is a string it will be output directly, however some skins may choose to ignore it. |
2300 | | - * An array is the preferred format for the icon, the following keys are used: |
| 2292 | + * The key is the name of a block that the icons will be wrapped in. The final id varies |
| 2293 | + * by skin; Monobook and Vector will turn poweredby into f-poweredbyico while Modern |
| 2294 | + * turns it into mw_poweredby. The value is a key/value array of icons. The key may or |
| 2295 | + * may not be used by the skin but it can be used to find the icon and unset it or |
| 2296 | + * change the icon if needed. This is useful for disabling icons that are set by extensions. |
| 2297 | + * The value should be either a string or an array. If it is a string it will be output |
| 2298 | + * directly, however some skins may choose to ignore it. An array is the preferred format |
| 2299 | + * for the icon, the following keys are used: |
2301 | 2300 | * src: An absolute url to the image to use for the icon, this is recommended |
2302 | 2301 | * but not required, however some skins will ignore icons without an image |
2303 | 2302 | * url: The url to use in the <a> arround the text or icon, if not set an <a> will not be outputted |
— | — | @@ -4132,8 +4131,13 @@ |
4133 | 4132 | $wgReadOnlyFile = false; |
4134 | 4133 | |
4135 | 4134 | /** |
4136 | | - * If this is set to some string, this opens up config/index.php for upgrades |
4137 | | - * when needed. You will need to provide this key to use it |
| 4135 | + * When you run the web-based upgrade utility, it will tell you what to set |
| 4136 | + * this to in order to authorize the upgrade process. It will subsequently be |
| 4137 | + * used as a password, to authorize further upgrades. |
| 4138 | + * |
| 4139 | + * For security, do not set this to a guessable string. Use the value supplied |
| 4140 | + * by the install/upgrade process. To cause the upgrader to generate a new key, |
| 4141 | + * delete the old key from LocalSettings.php. |
4138 | 4142 | */ |
4139 | 4143 | $wgUpgradeKey = false; |
4140 | 4144 | |
— | — | @@ -5233,8 +5237,6 @@ |
5234 | 5238 | $wgSeleniumTestConfigs = array(); |
5235 | 5239 | $wgSeleniumConfigFile = null; |
5236 | 5240 | |
5237 | | - |
5238 | | - |
5239 | 5241 | /** |
5240 | 5242 | * For really cool vim folding this needs to be at the end: |
5241 | 5243 | * vim: foldmarker=@{,@} foldmethod=marker |
Index: branches/REL1_17/phase3/includes/specials/SpecialListgrouprights.php |
— | — | @@ -60,12 +60,23 @@ |
61 | 61 | '</tr>' |
62 | 62 | ); |
63 | 63 | |
64 | | - $allGroups = array_unique( array_merge( array_keys( $wgGroupPermissions ), |
65 | | - array_keys( $wgRevokePermissions ) ) ); |
| 64 | + $allGroups = array_unique( array_merge( |
| 65 | + array_keys( $wgGroupPermissions ), |
| 66 | + array_keys( $wgRevokePermissions ), |
| 67 | + array_keys( $wgAddGroups ), |
| 68 | + array_keys( $wgRemoveGroups ), |
| 69 | + array_keys( $wgGroupsAddToSelf ), |
| 70 | + array_keys( $wgGroupsRemoveFromSelf ) |
| 71 | + ) ); |
| 72 | + asort( $allGroups ); |
| 73 | + |
66 | 74 | foreach ( $allGroups as $group ) { |
67 | | - $permissions = isset( $wgGroupPermissions[$group] ) ? |
68 | | - $wgGroupPermissions[$group] : array(); |
69 | | - $groupname = ( $group == '*' ) ? 'all' : $group; // Replace * with a more descriptive groupname |
| 75 | + $permissions = isset( $wgGroupPermissions[$group] ) |
| 76 | + ? $wgGroupPermissions[$group] |
| 77 | + : array(); |
| 78 | + $groupname = ( $group == '*' ) // Replace * with a more descriptive groupname |
| 79 | + ? 'all' |
| 80 | + : $group; |
70 | 81 | |
71 | 82 | $msg = wfMsg( 'group-' . $groupname ); |
72 | 83 | if ( wfEmptyMsg( 'group-' . $groupname, $msg ) || $msg == '' ) { |
Index: branches/REL1_17/phase3/includes/specials/SpecialEmailuser.php |
— | — | @@ -279,7 +279,7 @@ |
280 | 280 | |
281 | 281 | $status = UserMailer::send( $to, $mailFrom, $subject, $text, $replyTo ); |
282 | 282 | |
283 | | - if( !$status->isGood() && false ) { |
| 283 | + if( !$status->isGood() ) { |
284 | 284 | return $status; |
285 | 285 | } else { |
286 | 286 | // if the user requested a copy of this mail, do this now, |
Index: branches/REL1_17/phase3/includes/Block.php |
— | — | @@ -815,7 +815,7 @@ |
816 | 816 | // IPv6 |
817 | 817 | if ( IP::isIPv6( $range ) && $parts[1] >= 64 && $parts[1] <= 128 ) { |
818 | 818 | $bits = $parts[1]; |
819 | | - $ipint = IP::toUnsigned6( $parts[0] ); |
| 819 | + $ipint = IP::toUnsigned( $parts[0] ); |
820 | 820 | # Native 32 bit functions WON'T work here!!! |
821 | 821 | # Convert to a padded binary number |
822 | 822 | $network = wfBaseConvert( $ipint, 10, 2, 128 ); |
Index: branches/REL1_17/phase3/includes/Preferences.php |
— | — | @@ -29,6 +29,11 @@ |
30 | 30 | static $defaultPreferences = null; |
31 | 31 | static $saveFilters = array( |
32 | 32 | 'timecorrection' => array( 'Preferences', 'filterTimezoneInput' ), |
| 33 | + 'cols' => array( 'Preferences', 'filterIntval' ), |
| 34 | + 'rows' => array( 'Preferences', 'filterIntval' ), |
| 35 | + 'rclimit' => array( 'Preferences', 'filterIntval' ), |
| 36 | + 'wllimit' => array( 'Preferences', 'filterIntval' ), |
| 37 | + 'searchlimit' => array( 'Preferences', 'filterIntval' ), |
33 | 38 | ); |
34 | 39 | |
35 | 40 | static function getPreferences( $user ) { |
— | — | @@ -1214,6 +1219,10 @@ |
1215 | 1220 | } |
1216 | 1221 | return $opt; |
1217 | 1222 | } |
| 1223 | + |
| 1224 | + static function filterIntval( $value, $alldata ){ |
| 1225 | + return intval( $value ); |
| 1226 | + } |
1218 | 1227 | |
1219 | 1228 | static function filterTimezoneInput( $tz, $alldata ) { |
1220 | 1229 | $data = explode( '|', $tz, 3 ); |
Index: branches/REL1_17/phase3/includes/SpecialPage.php |
— | — | @@ -702,7 +702,16 @@ |
703 | 703 | * @param $file String: file which is included by execute(). It is also constructed from $name by default |
704 | 704 | * @param $includable Boolean: whether the page can be included in normal pages |
705 | 705 | */ |
706 | | - function __construct( $name = '', $restriction = '', $listed = true, $function = false, $file = 'default', $includable = false ) { |
| 706 | + public function __construct( $name = '', $restriction = '', $listed = true, $function = false, $file = 'default', $includable = false ) { |
| 707 | + $this->init( $name, $restriction, $listed, $function, $file, $includable ); |
| 708 | + } |
| 709 | + |
| 710 | + /** |
| 711 | + * Do the real work for the constructor, mainly so __call() can intercept |
| 712 | + * calls to SpecialPage() |
| 713 | + * @see __construct() for param docs |
| 714 | + */ |
| 715 | + private function init( $name, $restriction, $listed, $function, $file, $includable ) { |
707 | 716 | $this->mName = $name; |
708 | 717 | $this->mRestriction = $restriction; |
709 | 718 | $this->mListed = $listed; |
— | — | @@ -719,6 +728,29 @@ |
720 | 729 | } |
721 | 730 | } |
722 | 731 | |
| 732 | + /** |
| 733 | + * Use PHP's magic __call handler to get calls to the old PHP4 constructor |
| 734 | + * because PHP E_STRICT yells at you for having __construct() and SpecialPage() |
| 735 | + * |
| 736 | + * @param $name String Name of called method |
| 737 | + * @param $a Array Arguments to the method |
| 738 | + * @deprecated Call isn't deprecated, but SpecialPage::SpecialPage() is |
| 739 | + */ |
| 740 | + public function __call( $fName, $a ) { |
| 741 | + // Sometimes $fName is SpecialPage, sometimes it's specialpage. <3 PHP |
| 742 | + if( strtolower( $fName ) == 'specialpage' ) { |
| 743 | + // Debug messages now, warnings in 1.19 or 1.20? |
| 744 | + wfDebug( "Deprecated SpecialPage::SpecialPage() called, use __construct();\n" ); |
| 745 | + $name = isset( $a[0] ) ? $a[0] : ''; |
| 746 | + $restriction = isset( $a[1] ) ? $a[1] : ''; |
| 747 | + $listed = isset( $a[2] ) ? $a[2] : true; |
| 748 | + $function = isset( $a[3] ) ? $a[3] : false; |
| 749 | + $file = isset( $a[4] ) ? $a[4] : 'default'; |
| 750 | + $includable = isset( $a[5] ) ? $a[5] : false; |
| 751 | + $this->init( $name, $restriction, $listed, $function, $file, $includable ); |
| 752 | + } |
| 753 | + } |
| 754 | + |
723 | 755 | /**#@+ |
724 | 756 | * Accessor |
725 | 757 | * |
Property changes on: branches/REL1_17/phase3/includes/SpecialPage.php |
___________________________________________________________________ |
Modified: svn:mergeinfo |
726 | 758 | Merged /trunk/phase3/includes/SpecialPage.php:r77981-77982,77994,78097,78118-78119,78137,78141,78165,78192,78204,78209,78230,78246,78250-78251,78264,78276,78404,78424 |
Index: branches/REL1_17/phase3/api.php |
— | — | @@ -34,6 +34,9 @@ |
35 | 35 | * in the URL. |
36 | 36 | */ |
37 | 37 | |
| 38 | +// So extensions (and other code) can check whether they're running in API mode |
| 39 | +define( 'MW_API', true ); |
| 40 | + |
38 | 41 | // Initialise common code |
39 | 42 | require ( dirname( __FILE__ ) . '/includes/WebStart.php' ); |
40 | 43 | |
— | — | @@ -99,9 +102,6 @@ |
100 | 103 | } |
101 | 104 | } |
102 | 105 | |
103 | | -// So extensions can check whether they're running in API mode |
104 | | -define( 'MW_API', true ); |
105 | | - |
106 | 106 | // Set a dummy $wgTitle, because $wgTitle == null breaks various things |
107 | 107 | // In a perfect world this wouldn't be necessary |
108 | 108 | $wgTitle = Title::makeTitle( NS_MAIN, 'API' ); |
Index: branches/REL1_17/phase3/languages/messages/MessagesQqq.php |
— | — | @@ -838,6 +838,10 @@ |
839 | 839 | 'clearyourcache' => 'Text at the top of .js/.css pages', |
840 | 840 | 'usercssyoucanpreview' => "Text displayed on every css page. The 'Show preview' part should be the same as {{msg-mw|showpreview}} (or you can use <nowiki>{{int:showpreview}}</nowiki>).", |
841 | 841 | 'userjsyoucanpreview' => 'Text displayed on every js page.', |
| 842 | +'usercsspreview' => 'Text displayed on preview of every user .css subpage', |
| 843 | +'userjspreview' => 'Text displayed on preview of every user .js subpage', |
| 844 | +'sitecsspreview' => 'Text displayed on preview of .css pages in MediaWiki namespace', |
| 845 | +'sitejspreview' => 'Text displayed on preview of .js pages in MediaWiki namespace', |
842 | 846 | 'updated' => '{{Identical|Updated}}', |
843 | 847 | 'previewnote' => 'Note displayed when clicking on Show preview', |
844 | 848 | 'editing' => "Shown as page title when editing a page. \$1 is the name of the page that is being edited. Example: \"''Editing Main Page''\".", |
Index: branches/REL1_17/phase3/languages/messages/MessagesEn.php |
— | — | @@ -1300,6 +1300,10 @@ |
1301 | 1301 | '''It has not yet been saved!'''", |
1302 | 1302 | 'userjspreview' => "'''Remember that you are only testing/previewing your user JavaScript.''' |
1303 | 1303 | '''It has not yet been saved!'''", |
| 1304 | +'sitecsspreview' => "'''Remember that you are only previewing this global CSS.''' |
| 1305 | +'''It has not yet been saved!'''", |
| 1306 | +'sitejspreview' => "'''Remember that you are only previewing this global JavaScript code.''' |
| 1307 | +'''It has not yet been saved!'''", |
1304 | 1308 | 'userinvalidcssjstitle' => "'''Warning:''' There is no skin \"\$1\". |
1305 | 1309 | Custom .css and .js pages use a lowercase title, e.g. {{ns:user}}:Foo/vector.css as opposed to {{ns:user}}:Foo/Vector.css.", |
1306 | 1310 | 'updated' => '(Updated)', |
Index: branches/REL1_17/phase3/RELEASE-NOTES |
— | — | @@ -233,6 +233,7 @@ |
234 | 234 | * Special wrapping setups can now define MW_CONFIG_FILE to load a config file |
235 | 235 | other than LocalSettings.php. This is like MW_CONFIG_CALLBACK but works in |
236 | 236 | some cases where MW_CONFIG_CALLBACK will not work. |
| 237 | +* (bug 16019) $wgArticlePath = "/$1" no longer breaks API edit/watch actions |
237 | 238 | |
238 | 239 | === Bug fixes in 1.17 === |
239 | 240 | * (bug 17560) Half-broken deletion moved image files to deletion archive |
— | — | @@ -469,6 +470,8 @@ |
470 | 471 | * rebuildFileCache.php no longer creates inappropriate cache files for redirects |
471 | 472 | * (bug 18372) $wgFileExtensions will now override $wgFileBlacklist |
472 | 473 | * (bug 25512) Subcategory list should not include category prefix for members. |
| 474 | +* (bug 10871) Javascript and CSS pages in MediaWiki namespace are no longer treated |
| 475 | + as wikitext on preview. |
473 | 476 | |
474 | 477 | === API changes in 1.17 === |
475 | 478 | * (bug 22738) Allow filtering by action type on query=logevent. |