Index: trunk/phase3/tests/phpunit/includes/api/ApiQueryTest.php |
— | — | @@ -11,59 +11,59 @@ |
12 | 12 | parent::setUp(); |
13 | 13 | $this->doLogin(); |
14 | 14 | } |
15 | | - |
| 15 | + |
16 | 16 | function testTitlesGetNormalized() { |
17 | | - |
| 17 | + |
18 | 18 | global $wgSitename; |
19 | | - |
| 19 | + |
20 | 20 | $data = $this->doApiRequest( array( |
21 | 21 | 'action' => 'query', |
22 | 22 | 'titles' => 'Project:articleA|article_B' ) ); |
23 | | - |
24 | | - |
| 23 | + |
| 24 | + |
25 | 25 | $this->assertArrayHasKey( 'query', $data[0] ); |
26 | 26 | $this->assertArrayHasKey( 'normalized', $data[0]['query'] ); |
27 | | - |
28 | | - $this->assertEquals( |
29 | | - array( |
| 27 | + |
| 28 | + $this->assertEquals( |
| 29 | + array( |
30 | 30 | 'from' => 'Project:articleA', |
31 | 31 | 'to' => $wgSitename . ':ArticleA' |
32 | 32 | ), |
33 | 33 | $data[0]['query']['normalized'][0] |
34 | 34 | ); |
35 | | - |
36 | | - $this->assertEquals( |
37 | | - array( |
| 35 | + |
| 36 | + $this->assertEquals( |
| 37 | + array( |
38 | 38 | 'from' => 'article_B', |
39 | 39 | 'to' => 'Article B' |
40 | 40 | ), |
41 | 41 | $data[0]['query']['normalized'][1] |
42 | 42 | ); |
43 | | - |
| 43 | + |
44 | 44 | } |
45 | | - |
| 45 | + |
46 | 46 | function testTitlesAreRejectedIfInvalid() { |
47 | 47 | $title = false; |
48 | 48 | while( !$title || Title::newFromText( $title )->exists() ) { |
49 | 49 | $title = md5( mt_rand( 0, 10000 ) + rand( 0, 999000 ) ); |
50 | 50 | } |
51 | | - |
| 51 | + |
52 | 52 | $data = $this->doApiRequest( array( |
53 | 53 | 'action' => 'query', |
54 | 54 | 'titles' => $title . '|Talk:' ) ); |
55 | | - |
56 | | - |
| 55 | + |
| 56 | + |
57 | 57 | $this->assertArrayHasKey( 'query', $data[0] ); |
58 | 58 | $this->assertArrayHasKey( 'pages', $data[0]['query'] ); |
59 | 59 | $this->assertEquals( 2, count( $data[0]['query']['pages'] ) ); |
60 | | - |
| 60 | + |
61 | 61 | $this->assertArrayHasKey( -2, $data[0]['query']['pages'] ); |
62 | 62 | $this->assertArrayHasKey( -1, $data[0]['query']['pages'] ); |
63 | | - |
| 63 | + |
64 | 64 | $this->assertArrayHasKey( 'missing', $data[0]['query']['pages'][-2] ); |
65 | 65 | $this->assertArrayHasKey( 'invalid', $data[0]['query']['pages'][-1] ); |
66 | | - |
67 | | - |
| 66 | + |
| 67 | + |
68 | 68 | } |
69 | 69 | |
70 | 70 | } |
Index: trunk/phase3/includes/diff/DifferenceEngine.php |
— | — | @@ -445,7 +445,7 @@ |
446 | 446 | |
447 | 447 | $this->loadNewText(); |
448 | 448 | $wgOut->setRevisionId( $this->mNewRev->getId() ); |
449 | | - |
| 449 | + |
450 | 450 | if ( $this->mTitle->isCssJsSubpage() || $this->mTitle->isCssOrJsPage() ) { |
451 | 451 | // Stolen from Article::view --AG 2007-10-11 |
452 | 452 | // Give hooks a chance to customise the output |
— | — | @@ -465,7 +465,7 @@ |
466 | 466 | $wgOut->addParserOutput( $pOutput ); |
467 | 467 | } else { |
468 | 468 | $article->doViewParse(); |
469 | | - } |
| 469 | + } |
470 | 470 | } else { |
471 | 471 | $wgOut->addWikiTextTidy( $this->mNewtext ); |
472 | 472 | } |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -1765,7 +1765,7 @@ |
1766 | 1766 | * |
1767 | 1767 | * @param $dbw DatabaseBase: object |
1768 | 1768 | * @param $revision Revision: For ID number, and text used to set |
1769 | | - length and redirect status fields |
| 1769 | + length and redirect status fields |
1770 | 1770 | * @param $lastRevision Integer: if given, will not overwrite the page field |
1771 | 1771 | * when different from the currently set value. |
1772 | 1772 | * Giving 0 indicates the new page flag should be set |
— | — | @@ -4403,7 +4403,7 @@ |
4404 | 4404 | $parserOptions = new ParserOptions( $user ); |
4405 | 4405 | $parserOptions->setTidy( true ); |
4406 | 4406 | $parserOptions->enableLimitReport(); |
4407 | | - |
| 4407 | + |
4408 | 4408 | if ( $canonical ) { |
4409 | 4409 | $parserOptions->setUserLang( $wgLanguageCode ); # Must be set explicitely |
4410 | 4410 | return $parserOptions; |
Index: trunk/phase3/includes/parser/LinkHolderArray.php |
— | — | @@ -307,7 +307,7 @@ |
308 | 308 | $threshold = $this->getStubThreshold(); |
309 | 309 | $titlesToBeConverted = ''; |
310 | 310 | $titlesAttrs = array(); |
311 | | - |
| 311 | + |
312 | 312 | // Concatenate titles to a single string, thus we only need auto convert the |
313 | 313 | // single string to all variants. This would improve parser's performance |
314 | 314 | // significantly. |
— | — | @@ -322,14 +322,14 @@ |
323 | 323 | 'ns' => $ns, |
324 | 324 | 'key' => "$ns:$index", |
325 | 325 | 'titleText' => $titleText, |
326 | | - ); |
| 326 | + ); |
327 | 327 | // separate titles with \0 because it would never appears |
328 | 328 | // in a valid title |
329 | 329 | $titlesToBeConverted .= $titleText . "\0"; |
330 | 330 | } |
331 | 331 | } |
332 | 332 | } |
333 | | - |
| 333 | + |
334 | 334 | // Now do the conversion and explode string to text of titles |
335 | 335 | $titlesAllVariants = $wgContLang->autoConvertToAllVariants( $titlesToBeConverted ); |
336 | 336 | $allVariantsName = array_keys( $titlesAllVariants ); |
Index: trunk/phase3/includes/parser/CoreLinkFunctions.php |
— | — | @@ -27,7 +27,7 @@ |
28 | 28 | } |
29 | 29 | return $holders->makeHolder( $title, isset($displayText) ? $displayText : $titleText, '', '', '' ); |
30 | 30 | } |
31 | | - |
| 31 | + |
32 | 32 | static function categoryLinkHook( $parser, $holders, $markers, |
33 | 33 | Title $title, $titleText, &$sortText = null, &$leadingColon = false ) { |
34 | 34 | global $wgContLang; |
— | — | @@ -48,5 +48,5 @@ |
49 | 49 | $parser->mOutput->addCategory( $title->getDBkey(), $sortText ); |
50 | 50 | return ''; |
51 | 51 | } |
52 | | - |
| 52 | + |
53 | 53 | } |
Index: trunk/phase3/includes/parser/Preprocessor_DOM.php |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | * @file |
7 | 7 | * @ingroup Parser |
8 | 8 | */ |
9 | | - |
| 9 | + |
10 | 10 | /** |
11 | 11 | * @ingroup Parser |
12 | 12 | */ |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | $xml = "<list>"; |
42 | 42 | |
43 | 43 | foreach ( $values as $k => $val ) { |
44 | | - |
| 44 | + |
45 | 45 | if ( is_int( $k ) ) { |
46 | 46 | $xml .= "<part><name index=\"$k\"/><value>" . htmlspecialchars( $val ) ."</value></part>"; |
47 | 47 | } else { |
— | — | @@ -95,7 +95,7 @@ |
96 | 96 | function preprocessToObj( $text, $flags = 0 ) { |
97 | 97 | wfProfileIn( __METHOD__ ); |
98 | 98 | global $wgMemc, $wgPreprocessorCacheThreshold; |
99 | | - |
| 99 | + |
100 | 100 | $xml = false; |
101 | 101 | $cacheable = $wgPreprocessorCacheThreshold !== false && strlen( $text ) > $wgPreprocessorCacheThreshold; |
102 | 102 | if ( $cacheable ) { |
— | — | @@ -146,7 +146,7 @@ |
147 | 147 | wfProfileOut( __METHOD__ ); |
148 | 148 | return $obj; |
149 | 149 | } |
150 | | - |
| 150 | + |
151 | 151 | function preprocessToXml( $text, $flags = 0 ) { |
152 | 152 | wfProfileIn( __METHOD__ ); |
153 | 153 | $rules = array( |
— | — | @@ -388,8 +388,8 @@ |
389 | 389 | } else { |
390 | 390 | $attrEnd = $tagEndPos; |
391 | 391 | // Find closing tag |
392 | | - if ( preg_match( "/<\/" . preg_quote( $name, '/' ) . "\s*>/i", |
393 | | - $text, $matches, PREG_OFFSET_CAPTURE, $tagEndPos + 1 ) ) |
| 392 | + if ( preg_match( "/<\/" . preg_quote( $name, '/' ) . "\s*>/i", |
| 393 | + $text, $matches, PREG_OFFSET_CAPTURE, $tagEndPos + 1 ) ) |
394 | 394 | { |
395 | 395 | $inner = substr( $text, $tagEndPos + 1, $matches[0][1] - $tagEndPos - 1 ); |
396 | 396 | $i = $matches[0][1] + strlen( $matches[0][0] ); |
— | — | @@ -654,7 +654,7 @@ |
655 | 655 | $xml = $stack->rootAccum; |
656 | 656 | |
657 | 657 | wfProfileOut( __METHOD__ ); |
658 | | - |
| 658 | + |
659 | 659 | return $xml; |
660 | 660 | } |
661 | 661 | } |
— | — | @@ -1057,11 +1057,11 @@ |
1058 | 1058 | # Heading |
1059 | 1059 | $s = $this->expand( $contextNode->childNodes, $flags ); |
1060 | 1060 | |
1061 | | - # Insert a heading marker only for <h> children of <root> |
1062 | | - # This is to stop extractSections from going over multiple tree levels |
1063 | | - if ( $contextNode->parentNode->nodeName == 'root' |
1064 | | - && $this->parser->ot['html'] ) |
1065 | | - { |
| 1061 | + # Insert a heading marker only for <h> children of <root> |
| 1062 | + # This is to stop extractSections from going over multiple tree levels |
| 1063 | + if ( $contextNode->parentNode->nodeName == 'root' |
| 1064 | + && $this->parser->ot['html'] ) |
| 1065 | + { |
1066 | 1066 | # Insert heading index marker |
1067 | 1067 | $headingIndex = $contextNode->getAttribute( 'i' ); |
1068 | 1068 | $titleText = $this->title->getPrefixedDBkey(); |
— | — | @@ -1320,7 +1320,7 @@ |
1321 | 1321 | } |
1322 | 1322 | return $arguments; |
1323 | 1323 | } |
1324 | | - |
| 1324 | + |
1325 | 1325 | function getNumberedArguments() { |
1326 | 1326 | $arguments = array(); |
1327 | 1327 | foreach ( array_keys($this->numberedArgs) as $key ) { |
— | — | @@ -1328,7 +1328,7 @@ |
1329 | 1329 | } |
1330 | 1330 | return $arguments; |
1331 | 1331 | } |
1332 | | - |
| 1332 | + |
1333 | 1333 | function getNamedArguments() { |
1334 | 1334 | $arguments = array(); |
1335 | 1335 | foreach ( array_keys($this->namedArgs) as $key ) { |
Index: trunk/phase3/includes/WatchlistEditor.php |
— | — | @@ -220,7 +220,7 @@ |
221 | 221 | |
222 | 222 | if( $res && $dbr->numRows( $res ) > 0 ) { |
223 | 223 | $cache = LinkCache::singleton(); |
224 | | - foreach ( $res as $row ) { |
| 224 | + foreach ( $res as $row ) { |
225 | 225 | $title = Title::makeTitleSafe( $row->wl_namespace, $row->wl_title ); |
226 | 226 | if( $title instanceof Title ) { |
227 | 227 | // Update the link cache while we're at it |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -1333,7 +1333,7 @@ |
1334 | 1334 | if ( $this->wasDeletedSinceLastEdit() && 'save' == $this->formtype ) { |
1335 | 1335 | $username = $this->lastDelete->user_name; |
1336 | 1336 | $comment = $this->lastDelete->log_comment; |
1337 | | - |
| 1337 | + |
1338 | 1338 | // It is better to not parse the comment at all than to have templates expanded in the middle |
1339 | 1339 | // TODO: can the checkLabel be moved outside of the div so that wrapWikiMsg could be used? |
1340 | 1340 | $wgOut->addHTML( |
— | — | @@ -1878,20 +1878,20 @@ |
1879 | 1879 | $data = $dbr->selectRow( |
1880 | 1880 | array( 'logging', 'user' ), |
1881 | 1881 | array( 'log_type', |
1882 | | - 'log_action', |
1883 | | - 'log_timestamp', |
1884 | | - 'log_user', |
1885 | | - 'log_namespace', |
1886 | | - 'log_title', |
1887 | | - 'log_comment', |
1888 | | - 'log_params', |
1889 | | - 'log_deleted', |
1890 | | - 'user_name' ), |
| 1882 | + 'log_action', |
| 1883 | + 'log_timestamp', |
| 1884 | + 'log_user', |
| 1885 | + 'log_namespace', |
| 1886 | + 'log_title', |
| 1887 | + 'log_comment', |
| 1888 | + 'log_params', |
| 1889 | + 'log_deleted', |
| 1890 | + 'user_name' ), |
1891 | 1891 | array( 'log_namespace' => $this->mTitle->getNamespace(), |
1892 | | - 'log_title' => $this->mTitle->getDBkey(), |
1893 | | - 'log_type' => 'delete', |
1894 | | - 'log_action' => 'delete', |
1895 | | - 'user_id=log_user' ), |
| 1892 | + 'log_title' => $this->mTitle->getDBkey(), |
| 1893 | + 'log_type' => 'delete', |
| 1894 | + 'log_action' => 'delete', |
| 1895 | + 'user_id=log_user' ), |
1896 | 1896 | __METHOD__, |
1897 | 1897 | array( 'LIMIT' => 1, 'ORDER BY' => 'log_timestamp DESC' ) |
1898 | 1898 | ); |
— | — | @@ -2379,11 +2379,11 @@ |
2380 | 2380 | array_map( array( 'Xml', 'encodeJsVar' ), $params ) ); |
2381 | 2381 | $script .= "addButton($paramList);\n"; |
2382 | 2382 | } |
2383 | | - |
| 2383 | + |
2384 | 2384 | $wgOut->addScript( Html::inlineScript( |
2385 | 2385 | "if ( window.mediaWiki ) { jQuery(function(){{$script}}); }" |
2386 | 2386 | ) ); |
2387 | | - |
| 2387 | + |
2388 | 2388 | $toolbar .= "\n</div>"; |
2389 | 2389 | |
2390 | 2390 | wfRunHooks( 'EditPageBeforeEditToolbar', array( &$toolbar ) ); |
— | — | @@ -2715,7 +2715,7 @@ |
2716 | 2716 | switch ( $value ) { |
2717 | 2717 | case self::AS_HOOK_ERROR_EXPECTED: |
2718 | 2718 | case self::AS_CONTENT_TOO_BIG: |
2719 | | - case self::AS_ARTICLE_WAS_DELETED: |
| 2719 | + case self::AS_ARTICLE_WAS_DELETED: |
2720 | 2720 | case self::AS_CONFLICT_DETECTED: |
2721 | 2721 | case self::AS_SUMMARY_NEEDED: |
2722 | 2722 | case self::AS_TEXTBOX_EMPTY: |
— | — | @@ -2765,22 +2765,22 @@ |
2766 | 2766 | $this->userNotLoggedInPage(); |
2767 | 2767 | return false; |
2768 | 2768 | |
2769 | | - case self::AS_READ_ONLY_PAGE_LOGGED: |
2770 | | - case self::AS_READ_ONLY_PAGE: |
2771 | | - $wgOut->readOnlyPage(); |
2772 | | - return false; |
| 2769 | + case self::AS_READ_ONLY_PAGE_LOGGED: |
| 2770 | + case self::AS_READ_ONLY_PAGE: |
| 2771 | + $wgOut->readOnlyPage(); |
| 2772 | + return false; |
2773 | 2773 | |
2774 | | - case self::AS_RATE_LIMITED: |
2775 | | - $wgOut->rateLimited(); |
2776 | | - return false; |
| 2774 | + case self::AS_RATE_LIMITED: |
| 2775 | + $wgOut->rateLimited(); |
| 2776 | + return false; |
2777 | 2777 | |
2778 | | - case self::AS_NO_CREATE_PERMISSION: |
2779 | | - $this->noCreatePermission(); |
2780 | | - return; |
| 2778 | + case self::AS_NO_CREATE_PERMISSION: |
| 2779 | + $this->noCreatePermission(); |
| 2780 | + return; |
2781 | 2781 | |
2782 | 2782 | case self::AS_BLANK_ARTICLE: |
2783 | | - $wgOut->redirect( $this->getContextTitle()->getFullURL() ); |
2784 | | - return false; |
| 2783 | + $wgOut->redirect( $this->getContextTitle()->getFullURL() ); |
| 2784 | + return false; |
2785 | 2785 | |
2786 | 2786 | case self::AS_IMAGE_REDIRECT_LOGGED: |
2787 | 2787 | $wgOut->permissionRequired( 'upload' ); |
Index: trunk/phase3/includes/installer/DatabaseInstaller.php |
— | — | @@ -96,7 +96,7 @@ |
97 | 97 | |
98 | 98 | /** |
99 | 99 | * Open a connection to the database using the administrative user/password |
100 | | - * currently defined in the session, without any caching. Returns a status |
| 100 | + * currently defined in the session, without any caching. Returns a status |
101 | 101 | * object. On success, the status object will contain a Database object in |
102 | 102 | * its value member. |
103 | 103 | * |
— | — | @@ -114,9 +114,9 @@ |
115 | 115 | |
116 | 116 | /** |
117 | 117 | * Connect to the database using the administrative user/password currently |
118 | | - * defined in the session. Returns a status object. On success, the status |
| 118 | + * defined in the session. Returns a status object. On success, the status |
119 | 119 | * object will contain a Database object in its value member. |
120 | | - * |
| 120 | + * |
121 | 121 | * This will return a cached connection if one is available. |
122 | 122 | * |
123 | 123 | * @return Status |
— | — | @@ -212,7 +212,7 @@ |
213 | 213 | public abstract function getLocalSettings(); |
214 | 214 | |
215 | 215 | /** |
216 | | - * Override this to provide DBMS-specific schema variables, to be |
| 216 | + * Override this to provide DBMS-specific schema variables, to be |
217 | 217 | * substituted into tables.sql and other schema files. |
218 | 218 | */ |
219 | 219 | public function getSchemaVars() { |
— | — | @@ -236,7 +236,7 @@ |
237 | 237 | |
238 | 238 | /** |
239 | 239 | * Set up LBFactory so that wfGetDB() etc. works. |
240 | | - * We set up a special LBFactory instance which returns the current |
| 240 | + * We set up a special LBFactory instance which returns the current |
241 | 241 | * installer connection. |
242 | 242 | */ |
243 | 243 | public function enableLB() { |
Index: trunk/phase3/includes/installer/WebInstallerPage.php |
— | — | @@ -368,6 +368,7 @@ |
369 | 369 | $r = $this->parent->request; |
370 | 370 | if ( $r->wasPosted() ) { |
371 | 371 | $status = $this->submit(); |
| 372 | + |
372 | 373 | if ( $status->isGood() ) { |
373 | 374 | $this->setVar( '_UpgradeDone', false ); |
374 | 375 | return 'continue'; |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -76,7 +76,7 @@ |
77 | 77 | # Don't change the following default, NS_MAIN is hardcoded in several |
78 | 78 | # places. See bug 696. |
79 | 79 | var $mDefaultNamespace = NS_MAIN; // /< Namespace index when there is no namespace |
80 | | - # Zero except in {{transclusion}} tags |
| 80 | + # Zero except in {{transclusion}} tags |
81 | 81 | var $mWatched = null; // /< Is $wgUser watching this page? null if unfilled, accessed through userIsWatching() |
82 | 82 | var $mLength = -1; // /< The page length, 0 for special pages |
83 | 83 | var $mRedirect = null; // /< Is the article at this title a redirect? |
— | — | @@ -226,7 +226,7 @@ |
227 | 227 | return array(); |
228 | 228 | } |
229 | 229 | $dbr = wfGetDB( DB_SLAVE ); |
230 | | - |
| 230 | + |
231 | 231 | $res = $dbr->select( |
232 | 232 | 'page', |
233 | 233 | array( |
— | — | @@ -1427,7 +1427,7 @@ |
1428 | 1428 | |
1429 | 1429 | /** |
1430 | 1430 | * Check restrictions on cascading pages. |
1431 | | - * |
| 1431 | + * |
1432 | 1432 | * @param $action String the action to check |
1433 | 1433 | * @param $user User to check |
1434 | 1434 | * @param $errors Array list of current errors |
— | — | @@ -1841,7 +1841,7 @@ |
1842 | 1842 | * cache that we don't need to over-optimize by doing direct comparisons and |
1843 | 1843 | * acidentally creating new bugs where $title->equals( Title::newFromText() ) |
1844 | 1844 | * ends up reporting something differently than $title->isMainPage(); |
1845 | | - * |
| 1845 | + * |
1846 | 1846 | * @return Bool |
1847 | 1847 | */ |
1848 | 1848 | public function isMainPage() { |
— | — | @@ -2004,7 +2004,7 @@ |
2005 | 2005 | public function userCanEditJsSubpage() { |
2006 | 2006 | global $wgUser; |
2007 | 2007 | return ( ( $wgUser->isAllowed( 'editusercssjs' ) && $wgUser->isAllowed( 'edituserjs' ) ) |
2008 | | - || preg_match( '/^' . preg_quote( $wgUser->getName(), '/' ) . '\//', $this->mTextform ) ); |
| 2008 | + || preg_match( '/^' . preg_quote( $wgUser->getName(), '/' ) . '\//', $this->mTextform ) ); |
2009 | 2009 | } |
2010 | 2010 | |
2011 | 2011 | /** |
— | — | @@ -2503,6 +2503,7 @@ |
2504 | 2504 | if ( $this->mInterwiki != '' ) { |
2505 | 2505 | $p = $this->mInterwiki . ':'; |
2506 | 2506 | } |
| 2507 | + |
2507 | 2508 | if ( 0 != $this->mNamespace ) { |
2508 | 2509 | $p .= $this->getNsText() . ':'; |
2509 | 2510 | } |
— | — | @@ -2640,7 +2641,7 @@ |
2641 | 2642 | |
2642 | 2643 | # Redundant interwiki prefix to the local wiki |
2643 | 2644 | if ( $wgLocalInterwiki !== false |
2644 | | - && 0 == strcasecmp( $this->mInterwiki, $wgLocalInterwiki ) ) |
| 2645 | + && 0 == strcasecmp( $this->mInterwiki, $wgLocalInterwiki ) ) |
2645 | 2646 | { |
2646 | 2647 | if ( $dbkey == '' ) { |
2647 | 2648 | # Can't have an empty self-link |
— | — | @@ -2687,13 +2688,13 @@ |
2688 | 2689 | # reachable due to the way web browsers deal with 'relative' URLs. |
2689 | 2690 | # Also, they conflict with subpage syntax. Forbid them explicitly. |
2690 | 2691 | if ( strpos( $dbkey, '.' ) !== false && |
2691 | | - ( $dbkey === '.' || $dbkey === '..' || |
2692 | | - strpos( $dbkey, './' ) === 0 || |
2693 | | - strpos( $dbkey, '../' ) === 0 || |
2694 | | - strpos( $dbkey, '/./' ) !== false || |
2695 | | - strpos( $dbkey, '/../' ) !== false || |
2696 | | - substr( $dbkey, -2 ) == '/.' || |
2697 | | - substr( $dbkey, -3 ) == '/..' ) ) |
| 2692 | + ( $dbkey === '.' || $dbkey === '..' || |
| 2693 | + strpos( $dbkey, './' ) === 0 || |
| 2694 | + strpos( $dbkey, '../' ) === 0 || |
| 2695 | + strpos( $dbkey, '/./' ) !== false || |
| 2696 | + strpos( $dbkey, '/../' ) !== false || |
| 2697 | + substr( $dbkey, -2 ) == '/.' || |
| 2698 | + substr( $dbkey, -3 ) == '/..' ) ) |
2698 | 2699 | { |
2699 | 2700 | return false; |
2700 | 2701 | } |
— | — | @@ -2972,7 +2973,7 @@ |
2973 | 2974 | } |
2974 | 2975 | if ( ( $this->getDBkey() == '' ) || |
2975 | 2976 | ( !$oldid ) || |
2976 | | - ( $nt->getDBkey() == '' ) ) { |
| 2977 | + ( $nt->getDBkey() == '' ) ) { |
2977 | 2978 | $errors[] = array( 'badarticleerror' ); |
2978 | 2979 | } |
2979 | 2980 | |
— | — | @@ -3092,7 +3093,7 @@ |
3093 | 3094 | ); |
3094 | 3095 | $dbw->update( 'categorylinks', |
3095 | 3096 | array( |
3096 | | - 'cl_sortkey' => Collation::singleton()->getSortKey( |
| 3097 | + 'cl_sortkey' => Collation::singleton()->getSortKey( |
3097 | 3098 | $nt->getCategorySortkey( $prefix ) ), |
3098 | 3099 | 'cl_timestamp=cl_timestamp' ), |
3099 | 3100 | array( 'cl_from' => $pageid ), |
— | — | @@ -3694,7 +3695,7 @@ |
3695 | 3696 | |
3696 | 3697 | /** |
3697 | 3698 | * Callback for usort() to do title sorts by (namespace, title) |
3698 | | - * |
| 3699 | + * |
3699 | 3700 | * @return Integer: result of string comparison, or namespace comparison |
3700 | 3701 | */ |
3701 | 3702 | public static function compare( $a, $b ) { |
— | — | @@ -3922,8 +3923,8 @@ |
3923 | 3924 | // Spec: http://www.sixapart.com/pronet/docs/trackback_spec |
3924 | 3925 | return "<!-- |
3925 | 3926 | <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" |
3926 | | - xmlns:dc=\"http://purl.org/dc/elements/1.1/\" |
3927 | | - xmlns:trackback=\"http://madskills.com/public/xml/rss/module/trackback/\"> |
| 3927 | + xmlns:dc=\"http://purl.org/dc/elements/1.1/\" |
| 3928 | + xmlns:trackback=\"http://madskills.com/public/xml/rss/module/trackback/\"> |
3928 | 3929 | <rdf:Description |
3929 | 3930 | rdf:about=\"$url\" |
3930 | 3931 | dc:identifier=\"$url\" |
— | — | @@ -4108,15 +4109,15 @@ |
4109 | 4110 | */ |
4110 | 4111 | public function getRestrictionTypes() { |
4111 | 4112 | global $wgRestrictionTypes; |
4112 | | - |
| 4113 | + |
4113 | 4114 | $types = $this->exists() ? $wgRestrictionTypes : array( 'create' ); |
4114 | 4115 | |
4115 | 4116 | if ( $this->getNamespace() != NS_FILE ) { |
4116 | 4117 | $types = array_diff( $types, array( 'upload' ) ); |
4117 | 4118 | } |
4118 | | - |
| 4119 | + |
4119 | 4120 | wfRunHooks( 'TitleGetRestrictionTypes', array( $this, &$types ) ); |
4120 | | - |
| 4121 | + |
4121 | 4122 | return $types; |
4122 | 4123 | } |
4123 | 4124 | |
Index: trunk/phase3/includes/job/UploadFromUrlJob.php |
— | — | @@ -8,7 +8,7 @@ |
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Job for asynchronous upload-by-url. |
12 | | - * |
| 12 | + * |
13 | 13 | * This job is in fact an interface to UploadFromUrl, which is designed such |
14 | 14 | * that it does not require any globals. If it does, fix it elsewhere, do not |
15 | 15 | * add globals in here. |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | */ |
19 | 19 | class UploadFromUrlJob extends Job { |
20 | 20 | const SESSION_KEYNAME = 'wsUploadFromUrlJobData'; |
21 | | - |
| 21 | + |
22 | 22 | public $upload; |
23 | 23 | protected $user; |
24 | 24 | |
— | — | @@ -28,20 +28,20 @@ |
29 | 29 | public function run() { |
30 | 30 | # Initialize this object and the upload object |
31 | 31 | $this->upload = new UploadFromUrl(); |
32 | | - $this->upload->initialize( |
33 | | - $this->title->getText(), |
| 32 | + $this->upload->initialize( |
| 33 | + $this->title->getText(), |
34 | 34 | $this->params['url'], |
35 | 35 | false |
36 | 36 | ); |
37 | 37 | $this->user = User::newFromName( $this->params['userName'] ); |
38 | | - |
| 38 | + |
39 | 39 | # Fetch the file |
40 | 40 | $status = $this->upload->fetchFile(); |
41 | 41 | if ( !$status->isOk() ) { |
42 | 42 | $this->leaveMessage( $status ); |
43 | 43 | return true; |
44 | 44 | } |
45 | | - |
| 45 | + |
46 | 46 | # Verify upload |
47 | 47 | $result = $this->upload->verifyUpload(); |
48 | 48 | if ( $result['status'] != UploadBase::OK ) { |
— | — | @@ -49,17 +49,17 @@ |
50 | 50 | $this->leaveMessage( $status ); |
51 | 51 | return true; |
52 | 52 | } |
53 | | - |
| 53 | + |
54 | 54 | # Check warnings |
55 | 55 | if ( !$this->params['ignoreWarnings'] ) { |
56 | 56 | $warnings = $this->upload->checkWarnings(); |
57 | | - if ( $warnings ) { |
| 57 | + if ( $warnings ) { |
58 | 58 | wfSetupSession( $this->params['sessionId'] ); |
59 | | - |
| 59 | + |
60 | 60 | if ( $this->params['leaveMessage'] ) { |
61 | | - $this->user->leaveUserMessage( |
| 61 | + $this->user->leaveUserMessage( |
62 | 62 | wfMsg( 'upload-warning-subj' ), |
63 | | - wfMsg( 'upload-warning-msg', |
| 63 | + wfMsg( 'upload-warning-msg', |
64 | 64 | $this->params['sessionKey'], |
65 | 65 | $this->params['url'] ) |
66 | 66 | ); |
— | — | @@ -67,17 +67,17 @@ |
68 | 68 | $this->storeResultInSession( 'Warning', |
69 | 69 | 'warnings', $warnings ); |
70 | 70 | } |
71 | | - |
| 71 | + |
72 | 72 | # Stash the upload in the session |
73 | 73 | $this->upload->stashSession( $this->params['sessionKey'] ); |
74 | 74 | session_write_close(); |
75 | | - |
| 75 | + |
76 | 76 | return true; |
77 | 77 | } |
78 | 78 | } |
79 | | - |
| 79 | + |
80 | 80 | # Perform the upload |
81 | | - $status = $this->upload->performUpload( |
| 81 | + $status = $this->upload->performUpload( |
82 | 82 | $this->params['comment'], |
83 | 83 | $this->params['pageText'], |
84 | 84 | $this->params['watch'], |
— | — | @@ -85,47 +85,47 @@ |
86 | 86 | ); |
87 | 87 | $this->leaveMessage( $status ); |
88 | 88 | return true; |
89 | | - |
| 89 | + |
90 | 90 | } |
91 | | - |
| 91 | + |
92 | 92 | /** |
93 | 93 | * Leave a message on the user talk page or in the session according to |
94 | 94 | * $params['leaveMessage']. |
95 | | - * |
| 95 | + * |
96 | 96 | * @param $status Status |
97 | 97 | */ |
98 | 98 | protected function leaveMessage( $status ) { |
99 | 99 | if ( $this->params['leaveMessage'] ) { |
100 | 100 | if ( $status->isGood() ) { |
101 | 101 | $this->user->leaveUserMessage( wfMsg( 'upload-success-subj' ), |
102 | | - wfMsg( 'upload-success-msg', |
| 102 | + wfMsg( 'upload-success-msg', |
103 | 103 | $this->upload->getTitle()->getText(), |
104 | | - $this->params['url'] |
| 104 | + $this->params['url'] |
105 | 105 | ) ); |
106 | 106 | } else { |
107 | 107 | $this->user->leaveUserMessage( wfMsg( 'upload-failure-subj' ), |
108 | | - wfMsg( 'upload-failure-msg', |
| 108 | + wfMsg( 'upload-failure-msg', |
109 | 109 | $status->getWikiText(), |
110 | 110 | $this->params['url'] |
111 | 111 | ) ); |
112 | 112 | } |
113 | 113 | } else { |
114 | | - wfSetupSession( $this->params['sessionId'] ); |
| 114 | + wfSetupSession( $this->params['sessionId'] ); |
115 | 115 | if ( $status->isOk() ) { |
116 | | - $this->storeResultInSession( 'Success', |
| 116 | + $this->storeResultInSession( 'Success', |
117 | 117 | 'filename', $this->upload->getLocalFile()->getName() ); |
118 | 118 | } else { |
119 | 119 | $this->storeResultInSession( 'Failure', |
120 | 120 | 'errors', $status->getErrorsArray() ); |
121 | 121 | } |
122 | | - session_write_close(); |
| 122 | + session_write_close(); |
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
127 | 127 | * Store a result in the session data. Note that the caller is responsible |
128 | 128 | * for appropriate session_start and session_write_close calls. |
129 | | - * |
| 129 | + * |
130 | 130 | * @param $result String: the result (Success|Warning|Failure) |
131 | 131 | * @param $dataKey String: the key of the extra data |
132 | 132 | * @param $dataValue Mixed: the extra data itself |
— | — | @@ -135,7 +135,7 @@ |
136 | 136 | $session['result'] = $result; |
137 | 137 | $session[$dataKey] = $dataValue; |
138 | 138 | } |
139 | | - |
| 139 | + |
140 | 140 | /** |
141 | 141 | * Initialize the session data. Sets the intial result to queued. |
142 | 142 | */ |
— | — | @@ -143,7 +143,7 @@ |
144 | 144 | $session =& self::getSessionData( $this->params['sessionKey'] ); |
145 | 145 | $$session['result'] = 'Queued'; |
146 | 146 | } |
147 | | - |
| 147 | + |
148 | 148 | public static function &getSessionData( $key ) { |
149 | 149 | if ( !isset( $_SESSION[self::SESSION_KEYNAME][$key] ) ) { |
150 | 150 | $_SESSION[self::SESSION_KEYNAME][$key] = array(); |
Index: trunk/phase3/includes/ConfEditor.php |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -/** |
| 4 | +/** |
5 | 5 | * This is a state machine style parser with two internal stacks: |
6 | 6 | * * A next state stack, which determines the state the machine will progress to next |
7 | 7 | * * A path stack, which keeps track of the logical location in the file. |
— | — | @@ -40,8 +40,8 @@ |
41 | 41 | /** The previous ConfEditorToken object */ |
42 | 42 | var $prevToken; |
43 | 43 | |
44 | | - /** |
45 | | - * The state machine stack. This is an array of strings where the topmost |
| 44 | + /** |
| 45 | + * The state machine stack. This is an array of strings where the topmost |
46 | 46 | * element will be popped off and become the next parser state. |
47 | 47 | */ |
48 | 48 | var $stateStack; |
— | — | @@ -66,7 +66,7 @@ |
67 | 67 | var $pathStack; |
68 | 68 | |
69 | 69 | /** |
70 | | - * The elements of the top of the pathStack for every path encountered, indexed |
| 70 | + * The elements of the top of the pathStack for every path encountered, indexed |
71 | 71 | * by slash-separated path. |
72 | 72 | */ |
73 | 73 | var $pathInfo; |
— | — | @@ -77,7 +77,7 @@ |
78 | 78 | var $serial; |
79 | 79 | |
80 | 80 | /** |
81 | | - * Editor state. This consists of the internal copy/insert operations which |
| 81 | + * Editor state. This consists of the internal copy/insert operations which |
82 | 82 | * are applied to the source string to obtain the destination string. |
83 | 83 | */ |
84 | 84 | var $edits; |
— | — | @@ -103,7 +103,7 @@ |
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
107 | | - * Edit the text. Returns the edited text. |
| 107 | + * Edit the text. Returns the edited text. |
108 | 108 | * @param $ops Array of operations. |
109 | 109 | * |
110 | 110 | * Operations are given as an associative array, with members: |
— | — | @@ -114,20 +114,20 @@ |
115 | 115 | * |
116 | 116 | * delete |
117 | 117 | * Deletes an array element or statement with the specified path. |
118 | | - * e.g. |
| 118 | + * e.g. |
119 | 119 | * array('type' => 'delete', 'path' => '$foo/bar/baz' ) |
120 | 120 | * is equivalent to the runtime PHP code: |
121 | 121 | * unset( $foo['bar']['baz'] ); |
122 | 122 | * |
123 | 123 | * set |
124 | | - * Sets the value of an array element. If the element doesn't exist, it |
125 | | - * is appended to the array. If it does exist, the value is set, with |
| 124 | + * Sets the value of an array element. If the element doesn't exist, it |
| 125 | + * is appended to the array. If it does exist, the value is set, with |
126 | 126 | * comments and indenting preserved. |
127 | 127 | * |
128 | 128 | * append |
129 | 129 | * Appends a new element to the end of the array. Adds a trailing comma. |
130 | 130 | * e.g. |
131 | | - * array( 'type' => 'append', 'path', '$foo/bar', |
| 131 | + * array( 'type' => 'append', 'path', '$foo/bar', |
132 | 132 | * 'key' => 'baz', 'value' => "'x'" ) |
133 | 133 | * is like the PHP code: |
134 | 134 | * $foo['bar']['baz'] = 'x'; |
— | — | @@ -187,7 +187,7 @@ |
188 | 188 | list( $indent, ) = $this->getIndent( $start ); |
189 | 189 | $textToInsert = "$indent$value,"; |
190 | 190 | } else { |
191 | | - list( $indent, $arrowIndent ) = |
| 191 | + list( $indent, $arrowIndent ) = |
192 | 192 | $this->getIndent( $start, $key, $lastEltInfo['arrowByte'] ); |
193 | 193 | $textToInsert = "$indent$key$arrowIndent=> $value,"; |
194 | 194 | } |
— | — | @@ -210,7 +210,7 @@ |
211 | 211 | list( $indent, ) = $this->getIndent( $start ); |
212 | 212 | $textToInsert = "$indent$value,"; |
213 | 213 | } else { |
214 | | - list( $indent, $arrowIndent ) = |
| 214 | + list( $indent, $arrowIndent ) = |
215 | 215 | $this->getIndent( $start, $key, $info['arrowByte'] ); |
216 | 216 | $textToInsert = "$indent$key$arrowIndent=> $value,"; |
217 | 217 | } |
— | — | @@ -239,13 +239,13 @@ |
240 | 240 | try { |
241 | 241 | $this->parse(); |
242 | 242 | } catch ( ConfEditorParseError $e ) { |
243 | | - throw new MWException( |
| 243 | + throw new MWException( |
244 | 244 | "Sorry, ConfEditor broke the file during editing and it won't parse anymore: " . |
245 | 245 | $e->getMessage() ); |
246 | 246 | } |
247 | 247 | return $out; |
248 | 248 | } |
249 | | - |
| 249 | + |
250 | 250 | /** |
251 | 251 | * Get the variables defined in the text |
252 | 252 | * @return array( varname => value ) |
— | — | @@ -266,7 +266,7 @@ |
267 | 267 | strlen( $trimmedPath ) - strlen( $name ) ); |
268 | 268 | if( substr( $parentPath, -1 ) == '/' ) |
269 | 269 | $parentPath = substr( $parentPath, 0, -1 ); |
270 | | - |
| 270 | + |
271 | 271 | $value = substr( $this->text, $data['valueStartByte'], |
272 | 272 | $data['valueEndByte'] - $data['valueStartByte'] |
273 | 273 | ); |
— | — | @@ -275,7 +275,7 @@ |
276 | 276 | } |
277 | 277 | return $vars; |
278 | 278 | } |
279 | | - |
| 279 | + |
280 | 280 | /** |
281 | 281 | * Set a value in an array, unless it's set already. For instance, |
282 | 282 | * setVar( $arr, 'foo/bar', 'baz', 3 ); will set |
— | — | @@ -298,7 +298,7 @@ |
299 | 299 | if ( !isset( $target[$key] ) ) |
300 | 300 | $target[$key] = $value; |
301 | 301 | } |
302 | | - |
| 302 | + |
303 | 303 | /** |
304 | 304 | * Parse a scalar value in PHP |
305 | 305 | * @return mixed Parsed value |
— | — | @@ -364,8 +364,8 @@ |
365 | 365 | } |
366 | 366 | |
367 | 367 | /** |
368 | | - * Finds the source byte region which you would want to delete, if $pathName |
369 | | - * was to be deleted. Includes the leading spaces and tabs, the trailing line |
| 368 | + * Finds the source byte region which you would want to delete, if $pathName |
| 369 | + * was to be deleted. Includes the leading spaces and tabs, the trailing line |
370 | 370 | * break, and any comments in between. |
371 | 371 | */ |
372 | 372 | function findDeletionRegion( $pathName ) { |
— | — | @@ -419,9 +419,9 @@ |
420 | 420 | } |
421 | 421 | |
422 | 422 | /** |
423 | | - * Find the byte region in the source corresponding to the value part. |
424 | | - * This includes the quotes, but does not include the trailing comma |
425 | | - * or semicolon. |
| 423 | + * Find the byte region in the source corresponding to the value part. |
| 424 | + * This includes the quotes, but does not include the trailing comma |
| 425 | + * or semicolon. |
426 | 426 | * |
427 | 427 | * The end position is the past-the-end (end + 1) value as per convention. |
428 | 428 | */ |
— | — | @@ -519,7 +519,7 @@ |
520 | 520 | } |
521 | 521 | |
522 | 522 | /** |
523 | | - * Run the parser on the text. Throws an exception if the string does not |
| 523 | + * Run the parser on the text. Throws an exception if the string does not |
524 | 524 | * match our defined subset of PHP syntax. |
525 | 525 | */ |
526 | 526 | public function parse() { |
— | — | @@ -706,7 +706,7 @@ |
707 | 707 | } |
708 | 708 | |
709 | 709 | /** |
710 | | - * Set the parse position. Do not call this except from firstToken() and |
| 710 | + * Set the parse position. Do not call this except from firstToken() and |
711 | 711 | * nextToken(), there is more to update than just the position. |
712 | 712 | */ |
713 | 713 | protected function setPos( $pos ) { |
— | — | @@ -800,7 +800,7 @@ |
801 | 801 | if ( $this->currentToken && $this->currentToken->type == $type ) { |
802 | 802 | return $this->nextToken(); |
803 | 803 | } else { |
804 | | - $this->error( "expected " . $this->getTypeName( $type ) . |
| 804 | + $this->error( "expected " . $this->getTypeName( $type ) . |
805 | 805 | ", got " . $this->getTypeName( $this->currentToken->type ) ); |
806 | 806 | } |
807 | 807 | } |
— | — | @@ -875,7 +875,7 @@ |
876 | 876 | } |
877 | 877 | |
878 | 878 | /** |
879 | | - * Go to the next path on the same level. This ends the current path and |
| 879 | + * Go to the next path on the same level. This ends the current path and |
880 | 880 | * starts a new one. If $path is \@next, the new path is set to the next |
881 | 881 | * numeric array element. |
882 | 882 | */ |
— | — | @@ -889,7 +889,7 @@ |
890 | 890 | } else { |
891 | 891 | $this->pathStack[$i]['name'] = $path; |
892 | 892 | } |
893 | | - $this->pathStack[$i] = |
| 893 | + $this->pathStack[$i] = |
894 | 894 | array( |
895 | 895 | 'startByte' => $this->byteNum, |
896 | 896 | 'startToken' => $this->pos, |
— | — | @@ -955,8 +955,8 @@ |
956 | 956 | } |
957 | 957 | |
958 | 958 | /** |
959 | | - * Looks ahead to see if the given type is the next token type, starting |
960 | | - * from the current position plus the given offset. Skips any intervening |
| 959 | + * Looks ahead to see if the given type is the next token type, starting |
| 960 | + * from the current position plus the given offset. Skips any intervening |
961 | 961 | * whitespace. |
962 | 962 | */ |
963 | 963 | function isAhead( $type, $offset = 0 ) { |
— | — | @@ -992,8 +992,8 @@ |
993 | 993 | $out = ''; |
994 | 994 | foreach ( $this->tokens as $token ) { |
995 | 995 | $obj = $this->newTokenObj( $token ); |
996 | | - $out .= sprintf( "%-28s %s\n", |
997 | | - $this->getTypeName( $obj->type ), |
| 996 | + $out .= sprintf( "%-28s %s\n", |
| 997 | + $this->getTypeName( $obj->type ), |
998 | 998 | addcslashes( $obj->text, "\0..\37" ) ); |
999 | 999 | } |
1000 | 1000 | echo "<pre>" . htmlspecialchars( $out ) . "</pre>"; |
— | — | @@ -1008,7 +1008,7 @@ |
1009 | 1009 | function __construct( $editor, $msg ) { |
1010 | 1010 | $this->lineNum = $editor->lineNum; |
1011 | 1011 | $this->colNum = $editor->colNum; |
1012 | | - parent::__construct( "Parse error on line {$editor->lineNum} " . |
| 1012 | + parent::__construct( "Parse error on line {$editor->lineNum} " . |
1013 | 1013 | "col {$editor->colNum}: $msg" ); |
1014 | 1014 | } |
1015 | 1015 | |
— | — | @@ -1028,7 +1028,7 @@ |
1029 | 1029 | */ |
1030 | 1030 | class ConfEditorToken { |
1031 | 1031 | var $type, $text; |
1032 | | - |
| 1032 | + |
1033 | 1033 | static $scalarTypes = array( T_LNUMBER, T_DNUMBER, T_STRING, T_CONSTANT_ENCAPSED_STRING ); |
1034 | 1034 | static $skipTypes = array( T_WHITESPACE, T_COMMENT, T_DOC_COMMENT ); |
1035 | 1035 | |
Index: trunk/phase3/includes/libs/JavaScriptDistiller.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | /** |
4 | 4 | * JavaScript Distiller |
5 | | - * |
| 5 | + * |
6 | 6 | * Author: Dean Edwards, Nicholas Martin, Trevor Parscal |
7 | 7 | * License: LGPL |
8 | 8 | */ |
— | — | @@ -11,10 +11,10 @@ |
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Removes most of the white-space from JavaScript code. |
15 | | - * |
| 15 | + * |
16 | 16 | * This code came from the first pass of Dean Edwards' JavaScript Packer. Compared to using |
17 | 17 | * JSMin::minify, this produces < 1% larger output (after gzip) in approx. 25% of the time. |
18 | | - * |
| 18 | + * |
19 | 19 | * @param $script String: JavaScript code to minify |
20 | 20 | * @param $stripVerticalSpace Boolean: Try to remove as much vertical whitespace as possible |
21 | 21 | */ |
— | — | @@ -60,7 +60,7 @@ |
61 | 61 | |
62 | 62 | /* |
63 | 63 | * Creates an instance of ParseMaster and protects sensitive JavaScript regions. |
64 | | - * |
| 64 | + * |
65 | 65 | * This parser is based on regular expressions, which all get or'd together, so rules take |
66 | 66 | * precedence in the order they are added. We can use it to minify by armoring certain regions |
67 | 67 | * by matching them and replacing them with the full match, leaving the remaining regions around |
— | — | @@ -94,23 +94,23 @@ |
95 | 95 | * ParseMaster, version 1.0.2 (2005-08-19) Copyright 2005, Dean Edwards |
96 | 96 | * A multi-pattern parser. |
97 | 97 | * License: http://creativecommons.org/licenses/LGPL/2.1/ |
98 | | - * |
| 98 | + * |
99 | 99 | * This is the PHP version of the ParseMaster component of Dean Edwards' (http://dean.edwards.name/) |
100 | 100 | * Packer, which was originally written in JavaScript. It was ported to PHP by Nicolas Martin. |
101 | | - * |
| 101 | + * |
102 | 102 | * Original Source: http://joliclic.free.fr/php/javascript-packer/en/ |
103 | | - * |
| 103 | + * |
104 | 104 | * Changes should be pushed back upstream. |
105 | 105 | */ |
106 | 106 | class ParseMaster { |
107 | 107 | public $ignoreCase = false; |
108 | 108 | public $escapeChar = ''; |
109 | | - |
| 109 | + |
110 | 110 | // constants |
111 | 111 | const EXPRESSION = 0; |
112 | 112 | const REPLACEMENT = 1; |
113 | 113 | const LENGTH = 2; |
114 | | - |
| 114 | + |
115 | 115 | // used to determine nesting levels |
116 | 116 | private $GROUPS = '/\\(/';//g |
117 | 117 | private $SUB_REPLACE = '/\\$\\d/'; |
— | — | @@ -119,12 +119,12 @@ |
120 | 120 | private $ESCAPE = '/\\\./';//g |
121 | 121 | private $QUOTE = '/\'/'; |
122 | 122 | private $DELETED = '/\\x01[^\\x01]*\\x01/';//g |
123 | | - |
| 123 | + |
124 | 124 | public function add($expression, $replacement = '') { |
125 | 125 | // count the number of sub-expressions |
126 | 126 | // - add one because each pattern is itself a sub-expression |
127 | 127 | $length = 1 + preg_match_all($this->GROUPS, $this->_internalEscape((string)$expression), $out); |
128 | | - |
| 128 | + |
129 | 129 | // treat only strings $replacement |
130 | 130 | if (is_string($replacement)) { |
131 | 131 | // does the pattern deal with sub-expressions? |
— | — | @@ -136,7 +136,7 @@ |
137 | 137 | } else { // a complicated lookup (e.g. "Hello $2 $1") |
138 | 138 | // build a function to do the lookup |
139 | 139 | $quote = preg_match($this->QUOTE, $this->_internalEscape($replacement)) |
140 | | - ? '"' : "'"; |
| 140 | + ? '"' : "'"; |
141 | 141 | $replacement = array( |
142 | 142 | 'fn' => '_backReferences', |
143 | 143 | 'data' => array( |
— | — | @@ -152,11 +152,11 @@ |
153 | 153 | if (!empty($expression)) $this->_add($expression, $replacement, $length); |
154 | 154 | else $this->_add('/^$/', $replacement, $length); |
155 | 155 | } |
156 | | - |
| 156 | + |
157 | 157 | public function exec($string) { |
158 | 158 | // execute the global replacement |
159 | 159 | $this->_escaped = array(); |
160 | | - |
| 160 | + |
161 | 161 | // simulate the _patterns.toSTring of Dean |
162 | 162 | $regexp = '/'; |
163 | 163 | foreach ($this->_patterns as $reg) { |
— | — | @@ -164,7 +164,7 @@ |
165 | 165 | } |
166 | 166 | $regexp = substr($regexp, 0, -1) . '/S'; |
167 | 167 | $regexp .= ($this->ignoreCase) ? 'i' : ''; |
168 | | - |
| 168 | + |
169 | 169 | $string = $this->_escape($string, $this->escapeChar); |
170 | 170 | $string = preg_replace_callback( |
171 | 171 | $regexp, |
— | — | @@ -175,10 +175,10 @@ |
176 | 176 | $string |
177 | 177 | ); |
178 | 178 | $string = $this->_unescape($string, $this->escapeChar); |
179 | | - |
| 179 | + |
180 | 180 | return preg_replace($this->DELETED, '', $string); |
181 | 181 | } |
182 | | - |
| 182 | + |
183 | 183 | public function reset() { |
184 | 184 | // clear the patterns collection so that this object may be re-used |
185 | 185 | $this->_patterns = array(); |
— | — | @@ -187,17 +187,17 @@ |
188 | 188 | // private |
189 | 189 | private $_escaped = array(); // escaped characters |
190 | 190 | private $_patterns = array(); // patterns stored by index |
191 | | - |
| 191 | + |
192 | 192 | // create and add a new pattern to the patterns collection |
193 | 193 | private function _add() { |
194 | 194 | $arguments = func_get_args(); |
195 | 195 | $this->_patterns[] = $arguments; |
196 | 196 | } |
197 | | - |
| 197 | + |
198 | 198 | // this is the global replace function (it's quite complicated) |
199 | 199 | private function _replacement($arguments) { |
200 | 200 | if (empty($arguments)) return ''; |
201 | | - |
| 201 | + |
202 | 202 | $i = 1; $j = 0; |
203 | 203 | // loop through the patterns |
204 | 204 | while (isset($this->_patterns[$j])) { |
— | — | @@ -205,28 +205,28 @@ |
206 | 206 | // do we have a result? |
207 | 207 | if (isset($arguments[$i]) && ($arguments[$i] != '')) { |
208 | 208 | $replacement = $pattern[self::REPLACEMENT]; |
209 | | - |
| 209 | + |
210 | 210 | if (is_array($replacement) && isset($replacement['fn'])) { |
211 | | - |
| 211 | + |
212 | 212 | if (isset($replacement['data'])) $this->buffer = $replacement['data']; |
213 | 213 | return call_user_func(array(&$this, $replacement['fn']), $arguments, $i); |
214 | | - |
| 214 | + |
215 | 215 | } elseif (is_int($replacement)) { |
216 | 216 | return $arguments[$replacement + $i]; |
217 | | - |
| 217 | + |
218 | 218 | } |
219 | 219 | $delete = ($this->escapeChar == '' || |
220 | | - strpos($arguments[$i], $this->escapeChar) === false) |
221 | | - ? '' : "\x01" . $arguments[$i] . "\x01"; |
| 220 | + strpos($arguments[$i], $this->escapeChar) === false) |
| 221 | + ? '' : "\x01" . $arguments[$i] . "\x01"; |
222 | 222 | return $delete . $replacement; |
223 | | - |
| 223 | + |
224 | 224 | // skip over references to sub-expressions |
225 | 225 | } else { |
226 | 226 | $i += $pattern[self::LENGTH]; |
227 | 227 | } |
228 | 228 | } |
229 | 229 | } |
230 | | - |
| 230 | + |
231 | 231 | private function _backReferences($match, $offset) { |
232 | 232 | $replacement = $this->buffer['replacement']; |
233 | 233 | $quote = $this->buffer['quote']; |
— | — | @@ -236,22 +236,22 @@ |
237 | 237 | } |
238 | 238 | return $replacement; |
239 | 239 | } |
240 | | - |
| 240 | + |
241 | 241 | private function _replace_name($match, $offset){ |
242 | 242 | $length = strlen($match[$offset + 2]); |
243 | 243 | $start = $length - max($length - strlen($match[$offset + 3]), 0); |
244 | 244 | return substr($match[$offset + 1], $start, $length) . $match[$offset + 4]; |
245 | 245 | } |
246 | | - |
| 246 | + |
247 | 247 | private function _replace_encoded($match, $offset) { |
248 | 248 | return $this->buffer[$match[$offset]]; |
249 | 249 | } |
250 | | - |
251 | | - |
| 250 | + |
| 251 | + |
252 | 252 | // php : we cannot pass additional data to preg_replace_callback, |
253 | 253 | // and we cannot use &$this in create_function, so let's go to lower level |
254 | 254 | private $buffer; |
255 | | - |
| 255 | + |
256 | 256 | // encode escaped characters |
257 | 257 | private function _escape($string, $escapeChar) { |
258 | 258 | if ($escapeChar) { |
— | — | @@ -261,7 +261,7 @@ |
262 | 262 | array(&$this, '_escapeBis'), |
263 | 263 | $string |
264 | 264 | ); |
265 | | - |
| 265 | + |
266 | 266 | } else { |
267 | 267 | return $string; |
268 | 268 | } |
— | — | @@ -270,7 +270,7 @@ |
271 | 271 | $this->_escaped[] = $match[1]; |
272 | 272 | return $this->buffer; |
273 | 273 | } |
274 | | - |
| 274 | + |
275 | 275 | // decode escaped characters |
276 | 276 | private function _unescape($string, $escapeChar) { |
277 | 277 | if ($escapeChar) { |
— | — | @@ -282,7 +282,7 @@ |
283 | 283 | array(&$this, '_unescapeBis'), |
284 | 284 | $string |
285 | 285 | ); |
286 | | - |
| 286 | + |
287 | 287 | } else { |
288 | 288 | return $string; |
289 | 289 | } |
— | — | @@ -298,7 +298,7 @@ |
299 | 299 | $this->buffer['i']++; |
300 | 300 | return $this->buffer['escapeChar'] . $temp; |
301 | 301 | } |
302 | | - |
| 302 | + |
303 | 303 | private function _internalEscape($string) { |
304 | 304 | return preg_replace($this->ESCAPE, '', $string); |
305 | 305 | } |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -443,11 +443,11 @@ |
444 | 444 | $wgAllowAsyncCopyUploads = false; |
445 | 445 | |
446 | 446 | /** |
447 | | - * Max size for uploads, in bytes. If not set to an array, applies to all |
| 447 | + * Max size for uploads, in bytes. If not set to an array, applies to all |
448 | 448 | * uploads. If set to an array, per upload type maximums can be set, using the |
449 | 449 | * file and url keys. If the * key is set this value will be used as maximum |
450 | 450 | * for non-specified types. |
451 | | - * |
| 451 | + * |
452 | 452 | * For example: |
453 | 453 | * $wgUploadSize = array( |
454 | 454 | * '*' => 250 * 1024, |
— | — | @@ -455,7 +455,7 @@ |
456 | 456 | * ); |
457 | 457 | * Sets the maximum for all uploads to 250 kB except for upload-by-url, which |
458 | 458 | * will have a maximum of 500 kB. |
459 | | - * |
| 459 | + * |
460 | 460 | */ |
461 | 461 | $wgMaxUploadSize = 1024*1024*100; # 100MB |
462 | 462 | |
— | — | @@ -559,7 +559,7 @@ |
560 | 560 | # MS Office OpenXML and other Open Package Conventions files are zip files |
561 | 561 | # and thus blacklisted just as other zip files. If you remove these entries |
562 | 562 | # from the blacklist in your local configuration, a malicious file upload |
563 | | - # will be able to compromise the wiki's user accounts, and the user |
| 563 | + # will be able to compromise the wiki's user accounts, and the user |
564 | 564 | # accounts of any other website in the same cookie domain. |
565 | 565 | 'application/x-opc+zip', |
566 | 566 | 'application/msword', |
— | — | @@ -1697,9 +1697,9 @@ |
1698 | 1698 | * to setting $wgCacheEpoch to the modification time of LocalSettings.php, as |
1699 | 1699 | * was previously done in the default LocalSettings.php file. |
1700 | 1700 | * |
1701 | | - * On high-traffic wikis, this should be set to false, to avoid the need to |
| 1701 | + * On high-traffic wikis, this should be set to false, to avoid the need to |
1702 | 1702 | * check the file modification time, and to avoid the performance impact of |
1703 | | - * unnecessary cache invalidations. |
| 1703 | + * unnecessary cache invalidations. |
1704 | 1704 | */ |
1705 | 1705 | $wgInvalidateCacheOnLocalSettingsChange = true; |
1706 | 1706 | |
— | — | @@ -2293,7 +2293,7 @@ |
2294 | 2294 | $wgBreakFrames = false; |
2295 | 2295 | |
2296 | 2296 | /** |
2297 | | - * The X-Frame-Options header to send on pages sensitive to clickjacking |
| 2297 | + * The X-Frame-Options header to send on pages sensitive to clickjacking |
2298 | 2298 | * attacks, such as edit pages. This prevents those pages from being displayed |
2299 | 2299 | * in a frame or iframe. The options are: |
2300 | 2300 | * |
— | — | @@ -2303,9 +2303,9 @@ |
2304 | 2304 | * to allow framing within a trusted domain. This is insecure if there |
2305 | 2305 | * is a page on the same domain which allows framing of arbitrary URLs. |
2306 | 2306 | * |
2307 | | - * - false: Allow all framing. This opens up the wiki to XSS attacks and thus |
2308 | | - * full compromise of local user accounts. Private wikis behind a |
2309 | | - * corporate firewall are especially vulnerable. This is not |
| 2307 | + * - false: Allow all framing. This opens up the wiki to XSS attacks and thus |
| 2308 | + * full compromise of local user accounts. Private wikis behind a |
| 2309 | + * corporate firewall are especially vulnerable. This is not |
2310 | 2310 | * recommended. |
2311 | 2311 | * |
2312 | 2312 | * For extra safety, set $wgBreakFrames = true, to prevent framing on all pages, |
— | — | @@ -2334,17 +2334,17 @@ |
2335 | 2335 | * You can add new icons to the built in copyright or poweredby, or you can create |
2336 | 2336 | * a new block. Though note that you may need to add some custom css to get good styling |
2337 | 2337 | * of new blocks in monobook. vector and modern should work without any special css. |
2338 | | - * |
| 2338 | + * |
2339 | 2339 | * $wgFooterIcons itself is a key/value array. |
2340 | | - * The key is the name of a block that the icons will be wrapped in. The final id varies |
2341 | | - * by skin; Monobook and Vector will turn poweredby into f-poweredbyico while Modern |
| 2340 | + * The key is the name of a block that the icons will be wrapped in. The final id varies |
| 2341 | + * by skin; Monobook and Vector will turn poweredby into f-poweredbyico while Modern |
2342 | 2342 | * turns it into mw_poweredby. |
2343 | 2343 | * The value is either key/value array of icons or a string. |
2344 | 2344 | * In the key/value array the key may or may not be used by the skin but it can |
2345 | 2345 | * be used to find the icon and unset it or change the icon if needed. |
2346 | 2346 | * This is useful for disabling icons that are set by extensions. |
2347 | | - * The value should be either a string or an array. If it is a string it will be output |
2348 | | - * directly as html, however some skins may choose to ignore it. An array is the preferred format |
| 2347 | + * The value should be either a string or an array. If it is a string it will be output |
| 2348 | + * directly as html, however some skins may choose to ignore it. An array is the preferred format |
2349 | 2349 | * for the icon, the following keys are used: |
2350 | 2350 | * src: An absolute url to the image to use for the icon, this is recommended |
2351 | 2351 | * but not required, however some skins will ignore icons without an image |
— | — | @@ -3373,7 +3373,7 @@ |
3374 | 3374 | * Set of available actions that can be restricted via action=protect |
3375 | 3375 | * You probably shouldn't change this. |
3376 | 3376 | * Translated through restriction-* messages. |
3377 | | - * Title::getRestrictionTypes() will remove restrictions that are not |
| 3377 | + * Title::getRestrictionTypes() will remove restrictions that are not |
3378 | 3378 | * applicable to a specific title (upload currently) |
3379 | 3379 | */ |
3380 | 3380 | $wgRestrictionTypes = array( 'edit', 'move', 'upload' ); |
— | — | @@ -4185,12 +4185,12 @@ |
4186 | 4186 | $wgReadOnlyFile = false; |
4187 | 4187 | |
4188 | 4188 | /** |
4189 | | - * When you run the web-based upgrade utility, it will tell you what to set |
| 4189 | + * When you run the web-based upgrade utility, it will tell you what to set |
4190 | 4190 | * this to in order to authorize the upgrade process. It will subsequently be |
4191 | 4191 | * used as a password, to authorize further upgrades. |
4192 | 4192 | * |
4193 | | - * For security, do not set this to a guessable string. Use the value supplied |
4194 | | - * by the install/upgrade process. To cause the upgrader to generate a new key, |
| 4193 | + * For security, do not set this to a guessable string. Use the value supplied |
| 4194 | + * by the install/upgrade process. To cause the upgrader to generate a new key, |
4195 | 4195 | * delete the old key from LocalSettings.php. |
4196 | 4196 | */ |
4197 | 4197 | $wgUpgradeKey = false; |
— | — | @@ -4636,24 +4636,24 @@ |
4637 | 4637 | $wgCategoryPagingLimit = 200; |
4638 | 4638 | |
4639 | 4639 | /** |
4640 | | - * Specify how category names should be sorted, when listed on a category page. |
| 4640 | + * Specify how category names should be sorted, when listed on a category page. |
4641 | 4641 | * A sorting scheme is also known as a collation. |
4642 | 4642 | * |
4643 | 4643 | * Available values are: |
4644 | 4644 | * |
4645 | 4645 | * - uppercase: Converts the category name to upper case, and sorts by that. |
4646 | 4646 | * |
4647 | | - * - uca-default: Provides access to the Unicode Collation Algorithm with |
| 4647 | + * - uca-default: Provides access to the Unicode Collation Algorithm with |
4648 | 4648 | * the default element table. This is a compromise collation which sorts |
4649 | 4649 | * all languages in a mediocre way. However, it is better than "uppercase". |
4650 | 4650 | * |
4651 | | - * To use the uca-default collation, you must have PHP's intl extension |
4652 | | - * installed. See http://php.net/manual/en/intl.setup.php . The details of the |
4653 | | - * resulting collation will depend on the version of ICU installed on the |
| 4651 | + * To use the uca-default collation, you must have PHP's intl extension |
| 4652 | + * installed. See http://php.net/manual/en/intl.setup.php . The details of the |
| 4653 | + * resulting collation will depend on the version of ICU installed on the |
4654 | 4654 | * server. |
4655 | 4655 | * |
4656 | 4656 | * After you change this, you must run maintenance/updateCollation.php to fix |
4657 | | - * the sort keys in the database. |
| 4657 | + * the sort keys in the database. |
4658 | 4658 | */ |
4659 | 4659 | $wgCategoryCollation = 'uppercase'; |
4660 | 4660 | |
Index: trunk/phase3/includes/specials/SpecialRevisiondelete.php |
— | — | @@ -168,13 +168,13 @@ |
169 | 169 | $this->typeInfo = self::$allowedTypes[$this->typeName]; |
170 | 170 | |
171 | 171 | # If we have revisions, get the title from the first one |
172 | | - # since they should all be from the same page. This allows |
| 172 | + # since they should all be from the same page. This allows |
173 | 173 | # for more flexibility with page moves... |
174 | 174 | if( $this->typeName == 'revision' ) { |
175 | 175 | $rev = Revision::newFromId( $this->ids[0] ); |
176 | 176 | $this->targetObj = $rev ? $rev->getTitle() : $this->targetObj; |
177 | 177 | } |
178 | | - |
| 178 | + |
179 | 179 | $this->otherReason = $wgRequest->getVal( 'wpReason' ); |
180 | 180 | # We need a target page! |
181 | 181 | if( is_null($this->targetObj) ) { |
— | — | @@ -201,7 +201,7 @@ |
202 | 202 | } else { |
203 | 203 | $this->showForm(); |
204 | 204 | } |
205 | | - |
| 205 | + |
206 | 206 | $qc = $this->getLogQueryCond(); |
207 | 207 | # Show relevant lines from the deletion log |
208 | 208 | $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" ); |
— | — | @@ -337,7 +337,7 @@ |
338 | 338 | } |
339 | 339 | |
340 | 340 | /** |
341 | | - * Show a list of items that we will operate on, and show a form with checkboxes |
| 341 | + * Show a list of items that we will operate on, and show a form with checkboxes |
342 | 342 | * which will allow the user to choose new visibility settings. |
343 | 343 | */ |
344 | 344 | protected function showForm() { |
— | — | @@ -373,7 +373,7 @@ |
374 | 374 | $wgOut->showErrorPage( 'revdelete-nooldid-title', 'revdelete-nooldid-text' ); |
375 | 375 | return; |
376 | 376 | } |
377 | | - |
| 377 | + |
378 | 378 | $wgOut->addHTML( "</ul>" ); |
379 | 379 | // Explanation text |
380 | 380 | $this->addUsageText(); |
— | — | @@ -384,7 +384,7 @@ |
385 | 385 | // Show form if the user can submit |
386 | 386 | if( $this->mIsAllowed ) { |
387 | 387 | $out = Xml::openElement( 'form', array( 'method' => 'post', |
388 | | - 'action' => $this->getTitle()->getLocalUrl( array( 'action' => 'submit' ) ), |
| 388 | + 'action' => $this->getTitle()->getLocalUrl( array( 'action' => 'submit' ) ), |
389 | 389 | 'id' => 'mw-revdel-form-revisions' ) ) . |
390 | 390 | Xml::fieldset( wfMsg( 'revdelete-legend' ) ) . |
391 | 391 | $this->buildCheckBoxes() . |
— | — | @@ -453,7 +453,7 @@ |
454 | 454 | $wgOut->addWikiMsg( 'revdelete-confirm' ); |
455 | 455 | } |
456 | 456 | } |
457 | | - |
| 457 | + |
458 | 458 | /** |
459 | 459 | * @return String: HTML |
460 | 460 | */ |
— | — | @@ -503,7 +503,7 @@ |
504 | 504 | $html .= "<tr>$line</tr>\n"; |
505 | 505 | } |
506 | 506 | } |
507 | | - |
| 507 | + |
508 | 508 | $html .= '</table>'; |
509 | 509 | return $html; |
510 | 510 | } |
— | — | @@ -586,7 +586,7 @@ |
587 | 587 | } |
588 | 588 | return $bitfield; |
589 | 589 | } |
590 | | - |
| 590 | + |
591 | 591 | /** |
592 | 592 | * Put together a rev_deleted bitfield |
593 | 593 | * @param $bitPars array extractBitParams() params |
Index: trunk/phase3/includes/QueryPage.php |
— | — | @@ -130,7 +130,7 @@ |
131 | 131 | function getQueryInfo() { |
132 | 132 | return null; |
133 | 133 | } |
134 | | - |
| 134 | + |
135 | 135 | /** |
136 | 136 | * For back-compat, subclasses may return a raw SQL query here, as a string. |
137 | 137 | * This is stronly deprecated; getQueryInfo() should be overridden instead. |
— | — | @@ -274,7 +274,7 @@ |
275 | 275 | if ( !$this->isCacheable() ) { |
276 | 276 | return 0; |
277 | 277 | } |
278 | | - |
| 278 | + |
279 | 279 | $fname = get_class( $this ) . '::recache'; |
280 | 280 | $dbw = wfGetDB( DB_MASTER ); |
281 | 281 | $dbr = wfGetDB( DB_SLAVE, array( $this->getName(), __METHOD__, 'vslow' ) ); |
Index: trunk/phase3/includes/SpecialPage.php |
— | — | @@ -660,7 +660,7 @@ |
661 | 661 | } |
662 | 662 | } |
663 | 663 | if ( !$found ) { |
664 | | - wfWarn( "Did not find alias for special page '$name'. " . |
| 664 | + wfWarn( "Did not find alias for special page '$name'. " . |
665 | 665 | "Perhaps no aliases are defined for it?" ); |
666 | 666 | } |
667 | 667 | } |
Index: trunk/phase3/includes/LinkCache.php |
— | — | @@ -150,7 +150,7 @@ |
151 | 151 | wfProfileOut( __METHOD__ ); |
152 | 152 | return 0; |
153 | 153 | } |
154 | | - |
| 154 | + |
155 | 155 | # Some fields heavily used for linking... |
156 | 156 | if ( $this->mForUpdate ) { |
157 | 157 | $db = wfGetDB( DB_MASTER ); |
— | — | @@ -164,7 +164,7 @@ |
165 | 165 | $options = array(); |
166 | 166 | } |
167 | 167 | |
168 | | - $s = $db->selectRow( 'page', |
| 168 | + $s = $db->selectRow( 'page', |
169 | 169 | array( 'page_id', 'page_len', 'page_is_redirect', 'page_latest' ), |
170 | 170 | array( 'page_namespace' => $nt->getNamespace(), 'page_title' => $nt->getDBkey() ), |
171 | 171 | __METHOD__, $options ); |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -2730,11 +2730,11 @@ |
2731 | 2731 | function getPreferredVariant() { |
2732 | 2732 | return $this->mConverter->getPreferredVariant(); |
2733 | 2733 | } |
2734 | | - |
| 2734 | + |
2735 | 2735 | function getDefaultVariant() { |
2736 | 2736 | return $this->mConverter->getDefaultVariant(); |
2737 | 2737 | } |
2738 | | - |
| 2738 | + |
2739 | 2739 | function getURLVariant() { |
2740 | 2740 | return $this->mConverter->getURLVariant(); |
2741 | 2741 | } |