Index: trunk/phase3/includes/SpecialImport.php |
— | — | @@ -208,7 +208,7 @@ |
209 | 209 | $dbw = wfGetDB( DB_MASTER ); |
210 | 210 | $nullRevision = Revision::newNullRevision( |
211 | 211 | $dbw, $title->getArticleId(), $comment, true ); |
212 | | - $nullRevId = $nullRevision->insertOn( $dbw ); |
| 212 | + $nullRevision->insertOn( $dbw ); |
213 | 213 | } |
214 | 214 | } |
215 | 215 | |
— | — | @@ -304,7 +304,6 @@ |
305 | 305 | } |
306 | 306 | |
307 | 307 | function importOldRevision() { |
308 | | - $fname = "WikiImporter::importOldRevision"; |
309 | 308 | $dbw =& wfGetDB( DB_MASTER ); |
310 | 309 | |
311 | 310 | # Sneak a single revision into place |
Index: trunk/phase3/includes/SpecialMovepage.php |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | * Constructor |
11 | 11 | */ |
12 | 12 | function wfSpecialMovepage( $par = null ) { |
13 | | - global $wgUser, $wgOut, $wgRequest, $action, $wgOnlySysopMayMove; |
| 13 | + global $wgUser, $wgOut, $wgRequest, $action; |
14 | 14 | |
15 | 15 | # Check rights |
16 | 16 | if ( !$wgUser->isAllowed( 'move' ) ) { |
— | — | @@ -189,7 +189,6 @@ |
190 | 190 | |
191 | 191 | function doSubmit() { |
192 | 192 | global $wgOut, $wgUser, $wgRequest; |
193 | | - $fname = "MovePageForm::doSubmit"; |
194 | 193 | |
195 | 194 | if ( $wgUser->pingLimiter( 'move' ) ) { |
196 | 195 | $wgOut->rateLimited(); |
Index: trunk/phase3/includes/SpecialRevisiondelete.php |
— | — | @@ -10,12 +10,11 @@ |
11 | 11 | */ |
12 | 12 | |
13 | 13 | function wfSpecialRevisiondelete( $par = null ) { |
14 | | - global $wgOut, $wgRequest, $wgUser; |
| 14 | + global $wgOut, $wgRequest; |
15 | 15 | |
16 | 16 | $target = $wgRequest->getVal( 'target' ); |
17 | 17 | $oldid = $wgRequest->getIntArray( 'oldid' ); |
18 | 18 | |
19 | | - $sk = $wgUser->getSkin(); |
20 | 19 | $page = Title::newFromUrl( $target ); |
21 | 20 | |
22 | 21 | if( is_null( $page ) ) { |
— | — | @@ -156,7 +155,7 @@ |
157 | 156 | function extractBitfield( $request ) { |
158 | 157 | $bitfield = 0; |
159 | 158 | foreach( $this->checks as $item ) { |
160 | | - list( $message, $name, $field ) = $item; |
| 159 | + list( /* message */ , $name, $field ) = $item; |
161 | 160 | if( $request->getCheck( $name ) ) { |
162 | 161 | $bitfield |= $field; |
163 | 162 | } |
— | — | @@ -167,7 +166,7 @@ |
168 | 167 | function save( $bitfield, $reason ) { |
169 | 168 | $dbw = wfGetDB( DB_MASTER ); |
170 | 169 | $deleter = new RevisionDeleter( $dbw ); |
171 | | - $ok = $deleter->setVisibility( $this->revisions, $bitfield, $reason ); |
| 170 | + $deleter->setVisibility( $this->revisions, $bitfield, $reason ); |
172 | 171 | } |
173 | 172 | } |
174 | 173 | |
Index: trunk/phase3/includes/api/ApiQueryInfo.php |
— | — | @@ -52,7 +52,7 @@ |
53 | 53 | $pageTouched = $pageSet->getCustomField('page_touched'); |
54 | 54 | $pageLatest = $pageSet->getCustomField('page_latest'); |
55 | 55 | |
56 | | - foreach ($titles as $pageid => $title) { |
| 56 | + foreach ( array_keys($titles) as $pageid) { |
57 | 57 | $pageInfo = array ( |
58 | 58 | 'touched' => wfTimestamp(TS_ISO_8601, $pageTouched[$pageid]), |
59 | 59 | 'lastrevid' => intval($pageLatest[$pageid]) |
Index: trunk/phase3/includes/api/ApiMain.php |
— | — | @@ -296,7 +296,7 @@ |
297 | 297 | |
298 | 298 | $astriks = str_repeat('*** ', 10); |
299 | 299 | $msg .= "\n\n$astriks Modules $astriks\n\n"; |
300 | | - foreach ($this->mModules as $moduleName => $moduleClass) { |
| 300 | + foreach( array_keys($this->mModules) as $moduleName ) { |
301 | 301 | $msg .= "* action=$moduleName *"; |
302 | 302 | $module = new $this->mModules[$moduleName] ($this, $moduleName); |
303 | 303 | $msg2 = $module->makeHelpMsg(); |
— | — | @@ -306,7 +306,7 @@ |
307 | 307 | } |
308 | 308 | |
309 | 309 | $msg .= "\n$astriks Formats $astriks\n\n"; |
310 | | - foreach ($this->mFormats as $formatName => $moduleClass) { |
| 310 | + foreach( array_keys($this->mFormats) as $formatName ) { |
311 | 311 | $msg .= "* format=$formatName *"; |
312 | 312 | $module = $this->createPrinterByName($formatName); |
313 | 313 | $msg2 = $module->makeHelpMsg(); |
Index: trunk/phase3/includes/api/ApiFeedWatchlist.php |
— | — | @@ -65,7 +65,7 @@ |
66 | 66 | $data = $module->getResultData(); |
67 | 67 | |
68 | 68 | $feedItems = array (); |
69 | | - foreach ($data['query']['watchlist'] as $index => $info) { |
| 69 | + foreach ($data['query']['watchlist'] as $info) { |
70 | 70 | $feedItems[] = $this->createFeedItem($info); |
71 | 71 | } |
72 | 72 | |
— | — | @@ -79,8 +79,6 @@ |
80 | 80 | } |
81 | 81 | |
82 | 82 | private function createFeedItem($info) { |
83 | | - global $wgUser; |
84 | | - |
85 | 83 | $titleStr = $info['title']; |
86 | 84 | $title = Title :: newFromText($titleStr); |
87 | 85 | $titleUrl = $title->getFullUrl(); |
Index: trunk/phase3/includes/api/ApiOpenSearch.php |
— | — | @@ -68,7 +68,7 @@ |
69 | 69 | |
70 | 70 | // Reformat useful data for future printing by JSON engine |
71 | 71 | $srchres = array (); |
72 | | - foreach ($data['query']['allpages'] as $pageid => & $pageinfo) { |
| 72 | + foreach ($data['query']['allpages'] as & $pageinfo) { |
73 | 73 | // Note: this data will no be printable by the xml engine |
74 | 74 | // because it does not support lists of unnamed items |
75 | 75 | $srchres[] = $pageinfo['title']; |
Index: trunk/phase3/includes/api/ApiQueryBacklinks.php |
— | — | @@ -185,7 +185,6 @@ |
186 | 186 | $this->parseContinueParam($continue, $redirect); |
187 | 187 | |
188 | 188 | // Skip all completed links |
189 | | - $db = & $this->getDB(); |
190 | 189 | |
191 | 190 | } else { |
192 | 191 | if ($count !== 1) |
Index: trunk/phase3/includes/api/ApiQueryUserContributions.php |
— | — | @@ -99,16 +99,19 @@ |
100 | 100 | |
101 | 101 | //If we got data on the revision only, use only |
102 | 102 | // that data. |
103 | | - if($revvals && !$pagevals) |
| 103 | + if($revvals && !$pagevals) { |
104 | 104 | $data[] = $revvals; |
| 105 | + } |
105 | 106 | //If we got data on the page only, use only |
106 | 107 | // that data. |
107 | | - else if($pagevals && !$revvals) |
| 108 | + else if($pagevals && !$revvals) { |
108 | 109 | $data[] = $pagevals; |
| 110 | + } |
109 | 111 | //... and if we got data on both the revision and |
110 | 112 | // the page, merge the data and send it out. |
111 | | - else if($pagevals && $revvals) |
| 113 | + else if($pagevals && $revvals) { |
112 | 114 | $data[] = array_merge($revvals, $pagevals); |
| 115 | + } |
113 | 116 | } |
114 | 117 | |
115 | 118 | //Free the database record so the connection can get on with other stuff |
Index: trunk/phase3/includes/api/ApiPageSet.php |
— | — | @@ -382,7 +382,7 @@ |
383 | 383 | if($processTitles) { |
384 | 384 | // The remaining titles in $remaining are non-existant pages |
385 | 385 | foreach ($remaining as $ns => $dbkeys) { |
386 | | - foreach ($dbkeys as $dbkey => $nothing) { |
| 386 | + foreach ( array_keys($dbkeys) as $dbkey ) { |
387 | 387 | $title = Title :: makeTitle($ns, $dbkey); |
388 | 388 | $this->mMissingTitles[] = $title; |
389 | 389 | $this->mAllPages[$ns][$dbkey] = 0; |
Index: trunk/phase3/includes/api/ApiQueryWatchlist.php |
— | — | @@ -59,7 +59,7 @@ |
60 | 60 | |
61 | 61 | $user = (false !== array_search('user', $prop)); |
62 | 62 | $comment = (false !== array_search('comment', $prop)); |
63 | | - $timestamp = (false !== array_search('timestamp', $prop)); |
| 63 | + $timestamp = (false !== array_search('timestamp', $prop)); // TODO: $timestamp not currently being used. |
64 | 64 | $patrol = (false !== array_search('patrol', $prop)); |
65 | 65 | |
66 | 66 | if ($patrol) { |
Index: trunk/phase3/includes/api/ApiQueryRecentChanges.php |
— | — | @@ -36,7 +36,7 @@ |
37 | 37 | } |
38 | 38 | |
39 | 39 | public function execute() { |
40 | | - $limit = $prop = $from = $namespace = $show = $dir = $start = $end = null; |
| 40 | + $limit = $prop = $namespace = $show = $dir = $start = $end = null; |
41 | 41 | extract($this->extractRequestParams()); |
42 | 42 | |
43 | 43 | $this->addTables('recentchanges'); |
Index: trunk/phase3/includes/api/ApiFormatYaml_spyc.php |
— | — | @@ -463,6 +463,7 @@ |
464 | 464 | * @param string $line A line from the YAML file |
465 | 465 | */ |
466 | 466 | function _getIndent($line) { |
| 467 | + $match = array(); |
467 | 468 | preg_match('/^\s{1,}/',$line,$match); |
468 | 469 | if (!empty($match[0])) { |
469 | 470 | $indent = substr_count($match[0],' '); |
— | — | @@ -500,6 +501,7 @@ |
501 | 502 | } elseif (preg_match('/^(.+):/',$line,$key)) { |
502 | 503 | // It's a key/value pair most likely |
503 | 504 | // If the key is in double quotes pull it out |
| 505 | + $matches = array(); |
504 | 506 | if (preg_match('/^(["\'](.*)["\'](\s)*:)/',$line,$matches)) { |
505 | 507 | $value = trim(str_replace($matches[1],'',$line)); |
506 | 508 | $key = $matches[2]; |
— | — | @@ -529,6 +531,7 @@ |
530 | 532 | * @return mixed |
531 | 533 | */ |
532 | 534 | function _toType($value) { |
| 535 | + $matches = array(); |
533 | 536 | if (preg_match('/^("(.*)"|\'(.*)\')/',$value,$matches)) { |
534 | 537 | $value = (string)preg_replace('/(\'\'|\\\\\')/',"'",end($matches)); |
535 | 538 | $value = preg_replace('/\\\\"/','"',$value); |
— | — | @@ -596,6 +599,7 @@ |
597 | 600 | |
598 | 601 | // Check for strings |
599 | 602 | $regex = '/(?:(")|(?:\'))((?(1)[^"]+|[^\']+))(?(1)"|\')/'; |
| 603 | + $strings = array(); |
600 | 604 | if (preg_match_all($regex,$inline,$strings)) { |
601 | 605 | $saved_strings[] = $strings[0][0]; |
602 | 606 | $inline = preg_replace($regex,'YAMLString',$inline); |
— | — | @@ -603,12 +607,14 @@ |
604 | 608 | unset($regex); |
605 | 609 | |
606 | 610 | // Check for sequences |
| 611 | + $seqs = array(); |
607 | 612 | if (preg_match_all('/\[(.+)\]/U',$inline,$seqs)) { |
608 | 613 | $inline = preg_replace('/\[(.+)\]/U','YAMLSeq',$inline); |
609 | 614 | $seqs = $seqs[0]; |
610 | 615 | } |
611 | 616 | |
612 | 617 | // Check for mappings |
| 618 | + $maps = array(); |
613 | 619 | if (preg_match_all('/{(.+)}/U',$inline,$maps)) { |
614 | 620 | $inline = preg_replace('/{(.+)}/U','YAMLMap',$inline); |
615 | 621 | $maps = $maps[0]; |
— | — | @@ -704,6 +710,7 @@ |
705 | 711 | function _linkRef(&$n,$key,$k = NULL,$v = NULL) { |
706 | 712 | if (empty($k) && empty($v)) { |
707 | 713 | // Look for &refs |
| 714 | + $matches = array(); |
708 | 715 | if (preg_match('/^&([^ ]+)/',$n->data[$key],$matches)) { |
709 | 716 | // Flag the node so we know it's a reference |
710 | 717 | $this->_allNodes[$n->id]->ref = substr($matches[0],1); |
— | — | @@ -837,7 +844,7 @@ |
838 | 845 | $ret = array(); |
839 | 846 | |
840 | 847 | foreach($keys as $key) { |
841 | | - list($unused,$val) = each($vals); |
| 848 | + list( /* unused */ ,$val) = each($vals); |
842 | 849 | // This is the good part! If a key already exists, but it's part of a |
843 | 850 | // sequence (an int), just keep addin numbers until we find a fresh one. |
844 | 851 | if (isset($ret[$key]) and is_int($key)) { |
Index: trunk/phase3/includes/api/ApiBase.php |
— | — | @@ -154,7 +154,6 @@ |
155 | 155 | $replacement = '\\0' . "\n " . 'http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/api/\\2'; |
156 | 156 | |
157 | 157 | if (is_array($versions)) { |
158 | | - $ver2 = array(); |
159 | 158 | foreach ($versions as &$v) |
160 | 159 | $v = eregi_replace($pattern, $replacement, $v); |
161 | 160 | $versions = implode("\n ", $versions); |
Index: trunk/phase3/includes/api/ApiQueryAllpages.php |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | wfProfileOut($this->getModuleProfileName() . '-getDB'); |
55 | 55 | |
56 | 56 | wfProfileIn($this->getModuleProfileName() . '-parseParams'); |
57 | | - $limit = $from = $namespace = $filterredir = null; |
| 57 | + $limit = $from = $namespace = $filterredir = $prefix = null; |
58 | 58 | extract($this->extractRequestParams()); |
59 | 59 | |
60 | 60 | $this->addTables('page'); |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -243,7 +243,7 @@ |
244 | 244 | $lb->execute(); |
245 | 245 | |
246 | 246 | $sk =& $wgUser->getSkin(); |
247 | | - foreach ( $categories as $category => $arbitrary ) { |
| 247 | + foreach ( array_keys($categories) as $category ) { |
248 | 248 | $title = Title::makeTitleSafe( NS_CATEGORY, $category ); |
249 | 249 | $text = $wgContLang->convertHtml( $title->getText() ); |
250 | 250 | $this->mCategoryLinks[] = $sk->makeLinkObj( $title, $text ); |
— | — | @@ -512,7 +512,7 @@ |
513 | 513 | public function output() { |
514 | 514 | global $wgUser, $wgOutputEncoding, $wgRequest; |
515 | 515 | global $wgContLanguageCode, $wgDebugRedirects, $wgMimeType; |
516 | | - global $wgJsMimeType, $wgStylePath, $wgUseAjax, $wgAjaxSearch, $wgScriptPath, $wgServer; |
| 516 | + global $wgJsMimeType, $wgStylePath, $wgUseAjax, $wgAjaxSearch, $wgServer; |
517 | 517 | global $wgStyleVersion; |
518 | 518 | |
519 | 519 | if( $this->mDoNothing ){ |
— | — | @@ -1010,8 +1010,8 @@ |
1011 | 1011 | if ( !is_array( $links2d ) ) { |
1012 | 1012 | return; |
1013 | 1013 | } |
1014 | | - foreach ( $links2d as $ns => $dbkeys ) { |
1015 | | - foreach( $dbkeys as $dbkey => $id ) { |
| 1014 | + foreach ( $links2d as $dbkeys ) { |
| 1015 | + foreach( array_keys($dbkeys) as $dbkey ) { |
1016 | 1016 | $this->addKeyword( $dbkey ); |
1017 | 1017 | if ( ++$count > 10 ) { |
1018 | 1018 | break 2; |
Index: trunk/phase3/includes/Xml.php |
— | — | @@ -270,8 +270,8 @@ |
271 | 271 | xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, false ); |
272 | 272 | |
273 | 273 | if( !xml_parse( $parser, $text, true ) ) { |
274 | | - $err = xml_error_string( xml_get_error_code( $parser ) ); |
275 | | - $position = xml_get_current_byte_index( $parser ); |
| 274 | + //$err = xml_error_string( xml_get_error_code( $parser ) ); |
| 275 | + //$position = xml_get_current_byte_index( $parser ); |
276 | 276 | //$fragment = $this->extractFragment( $html, $position ); |
277 | 277 | //$this->mXmlError = "$err at byte $position:\n$fragment"; |
278 | 278 | xml_parser_free( $parser ); |
Index: trunk/phase3/includes/Licenses.php |
— | — | @@ -63,12 +63,14 @@ |
64 | 64 | $obj = new License( $line ); |
65 | 65 | $this->stackItem( $this->licenses, $levels, $obj ); |
66 | 66 | } else { |
67 | | - if ( $level < count( $levels ) ) |
| 67 | + if ( $level < count( $levels ) ) { |
68 | 68 | $levels = array_slice( $levels, 0, $level ); |
69 | | - if ( $level == count( $levels ) ) |
| 69 | + } |
| 70 | + if ( $level == count( $levels ) ) { |
70 | 71 | $levels[$level - 1] = $line; |
71 | | - else if ( $level > count( $levels ) ) |
| 72 | + } else if ( $level > count( $levels ) ) { |
72 | 73 | $levels[] = $line; |
| 74 | + } |
73 | 75 | } |
74 | 76 | } |
75 | 77 | } |
Index: trunk/phase3/includes/SpecialUserlogin.php |
— | — | @@ -177,7 +177,6 @@ |
178 | 178 | } else { |
179 | 179 | # Confirm that the account was created |
180 | 180 | global $wgOut; |
181 | | - $skin = $wgUser->getSkin(); |
182 | 181 | $self = SpecialPage::getTitleFor( 'Userlogin' ); |
183 | 182 | $wgOut->setPageTitle( wfMsgHtml( 'accountcreated' ) ); |
184 | 183 | $wgOut->setArticleRelated( false ); |
Index: trunk/phase3/includes/SpecialUpload.php |
— | — | @@ -106,7 +106,7 @@ |
107 | 107 | * @access private |
108 | 108 | */ |
109 | 109 | function initializeFromUrl( $request ) { |
110 | | - global $wgTmpDirectory, $wgMaxUploadSize; |
| 110 | + global $wgTmpDirectory; |
111 | 111 | $url = $request->getText( 'wpUploadFileURL' ); |
112 | 112 | $local_file = tempnam( $wgTmpDirectory, 'WEBUPLOAD' ); |
113 | 113 | |
— | — | @@ -126,7 +126,7 @@ |
127 | 127 | * Returns true if there was an error, false otherwise |
128 | 128 | */ |
129 | 129 | private function curlCopy( $url, $dest ) { |
130 | | - global $wgMaxUploadSize, $wgUser, $wgOut; |
| 130 | + global $wgUser, $wgOut; |
131 | 131 | |
132 | 132 | if( !$wgUser->isAllowed( 'upload_by_url' ) ) { |
133 | 133 | $wgOut->permissionRequired( 'upload_by_url' ); |
— | — | @@ -704,9 +704,7 @@ |
705 | 705 | $wgOut->addHTML( '<div id="uploadtext">' ); |
706 | 706 | $wgOut->addWikiText( wfMsg( 'uploadtext' ) ); |
707 | 707 | $wgOut->addHTML( '</div>' ); |
708 | | - $sk = $wgUser->getSkin(); |
709 | 708 | |
710 | | - |
711 | 709 | $sourcefilename = wfMsgHtml( 'sourcefilename' ); |
712 | 710 | $destfilename = wfMsgHtml( 'destfilename' ); |
713 | 711 | $summary = wfMsgWikiHtml( 'fileuploadsummary' ); |
— | — | @@ -732,7 +730,6 @@ |
733 | 731 | |
734 | 732 | // Prepare form for upload or upload/copy |
735 | 733 | if( $wgAllowCopyUploads && $wgUser->isAllowed( 'upload_by_url' ) ) { |
736 | | - $source_comment = wfMsgHtml( 'upload_source_url' ); |
737 | 734 | $filename_form = |
738 | 735 | "<input type='radio' id='wpSourceTypeFile' name='wpSourceType' value='file' onchange='toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\")' checked />" . |
739 | 736 | "<input tabindex='1' type='file' name='wpUploadFile' id='wpUploadFile' onfocus='toggle_element_activation(\"wpUploadFileURL\",\"wpUploadFile\");toggle_element_check(\"wpSourceTypeFile\",\"wpSourceTypeURL\")'" . |
— | — | @@ -1055,13 +1052,13 @@ |
1056 | 1053 | $chunk = Sanitizer::decodeCharReferences( $chunk ); |
1057 | 1054 | |
1058 | 1055 | #look for script-types |
1059 | | - if (preg_match("!type\s*=\s*['\"]?\s*(\w*/)?(ecma|java)!sim",$chunk)) return true; |
| 1056 | + if (preg_match('!type\s*=\s*[\'"]?\s*(\w*/)?(ecma|java)!sim',$chunk)) return true; |
1060 | 1057 | |
1061 | 1058 | #look for html-style script-urls |
1062 | | - if (preg_match("!(href|src|data)\s*=\s*['\"]?\s*(ecma|java)script:!sim",$chunk)) return true; |
| 1059 | + if (preg_match('!(href|src|data)\s*=\s*[\'"]?\s*(ecma|java)script:!sim',$chunk)) return true; |
1063 | 1060 | |
1064 | 1061 | #look for css-style script-urls |
1065 | | - if (preg_match("!url\s*\(\s*['\"]?\s*(ecma|java)script:!sim",$chunk)) return true; |
| 1062 | + if (preg_match('!url\s*\(\s*[\'"]?\s*(ecma|java)script:!sim',$chunk)) return true; |
1066 | 1063 | |
1067 | 1064 | wfDebug("SpecialUpload::detectScript: no scripts found\n"); |
1068 | 1065 | return false; |
— | — | @@ -1113,21 +1110,25 @@ |
1114 | 1111 | #NOTE: there's a 50 line workaround to make stderr redirection work on windows, too. |
1115 | 1112 | # that does not seem to be worth the pain. |
1116 | 1113 | # Ask me (Duesentrieb) about it if it's ever needed. |
| 1114 | + $output = array(); |
1117 | 1115 | if (wfIsWindows()) exec("$scanner",$output,$code); |
1118 | 1116 | else exec("$scanner 2>&1",$output,$code); |
1119 | 1117 | |
1120 | | - $exit_code= $code; #remeber for user feedback |
| 1118 | + $exit_code= $code; #remember for user feedback |
1121 | 1119 | |
1122 | 1120 | if ($virus_scanner_codes) { #map exit code to AV_xxx constants. |
1123 | | - if (isset($virus_scanner_codes[$code])) $code= $virus_scanner_codes[$code]; #explicite mapping |
1124 | | - else if (isset($virus_scanner_codes["*"])) $code= $virus_scanner_codes["*"]; #fallback mapping |
| 1121 | + if (isset($virus_scanner_codes[$code])) { |
| 1122 | + $code= $virus_scanner_codes[$code]; # explicit mapping |
| 1123 | + } else if (isset($virus_scanner_codes["*"])) { |
| 1124 | + $code= $virus_scanner_codes["*"]; # fallback mapping |
| 1125 | + } |
1125 | 1126 | } |
1126 | 1127 | |
1127 | 1128 | if ($code===AV_SCAN_FAILED) { #scan failed (code was mapped to false by $virus_scanner_codes) |
1128 | 1129 | wfDebug("$fname: failed to scan $file (code $exit_code).\n"); |
1129 | 1130 | |
1130 | | - if ($wgAntivirusRequired) return "scan failed (code $exit_code)"; |
1131 | | - else return NULL; |
| 1131 | + if ($wgAntivirusRequired) { return "scan failed (code $exit_code)"; } |
| 1132 | + else { return NULL; } |
1132 | 1133 | } |
1133 | 1134 | else if ($code===AV_SCAN_ABORTED) { #scan failed because filetype is unknown (probably imune) |
1134 | 1135 | wfDebug("$fname: unsupported file type $file (code $exit_code).\n"); |
— | — | @@ -1141,7 +1142,7 @@ |
1142 | 1143 | $output= join("\n",$output); |
1143 | 1144 | $output= trim($output); |
1144 | 1145 | |
1145 | | - if (!$output) $output= true; #if ther's no output, return true |
| 1146 | + if (!$output) $output= true; #if there's no output, return true |
1146 | 1147 | else if ($msg_pattern) { |
1147 | 1148 | $groups= array(); |
1148 | 1149 | if (preg_match($msg_pattern,$output,$groups)) { |
Index: trunk/phase3/includes/DatabaseOracle.php |
— | — | @@ -55,9 +55,6 @@ |
56 | 56 | $this->mPassword = $password; |
57 | 57 | $this->mDBname = $dbName; |
58 | 58 | |
59 | | - $success = false; |
60 | | - |
61 | | - $hstring=""; |
62 | 59 | $this->mConn = oci_new_connect($user, $password, $dbName, "AL32UTF8"); |
63 | 60 | if ( $this->mConn === false ) { |
64 | 61 | wfDebug( "DB connection error\n" ); |
— | — | @@ -147,7 +144,6 @@ |
148 | 145 | |
149 | 146 | for ($i = 1; $i <= $this->mNcols[$res]; $i++) { |
150 | 147 | $name = $this->mFieldNames[$res][$i]; |
151 | | - $type = $this->mFieldTypes[$res][$i]; |
152 | 148 | if (isset($this->mFetchCache[$res][$this->mFetchID[$res]][$name])) |
153 | 149 | $value = $this->mFetchCache[$res][$this->mFetchID[$res]][$name]; |
154 | 150 | else $value = NULL; |
— | — | @@ -165,7 +161,7 @@ |
166 | 162 | return false; |
167 | 163 | $i = 0; |
168 | 164 | $ret = array(); |
169 | | - foreach ($r as $key => $value) { |
| 165 | + foreach ($r as $value) { |
170 | 166 | wfdebug("ret[$i]=[$value]\n"); |
171 | 167 | $ret[$i++] = $value; |
172 | 168 | } |
— | — | @@ -201,14 +197,19 @@ |
202 | 198 | |
203 | 199 | function lastError() { |
204 | 200 | if ($this->mErr === false) { |
205 | | - if ($this->mLastResult !== false) $what = $this->mLastResult; |
206 | | - else if ($this->mConn !== false) $what = $this->mConn; |
207 | | - else $what = false; |
| 201 | + if ($this->mLastResult !== false) { |
| 202 | + $what = $this->mLastResult; |
| 203 | + } else if ($this->mConn !== false) { |
| 204 | + $what = $this->mConn; |
| 205 | + } else { |
| 206 | + $what = false; |
| 207 | + } |
208 | 208 | $err = ($what !== false) ? oci_error($what) : oci_error(); |
209 | | - if ($err === false) |
| 209 | + if ($err === false) { |
210 | 210 | $this->mErr = 'no error'; |
211 | | - else |
| 211 | + } else { |
212 | 212 | $this->mErr = $err['message']; |
| 213 | + } |
213 | 214 | } |
214 | 215 | return str_replace("\n", '<br />', $this->mErr); |
215 | 216 | } |
Index: trunk/phase3/includes/ProtectionForm.php |
— | — | @@ -130,7 +130,7 @@ |
131 | 131 | $out .= "<table id='mwProtectSet'>"; |
132 | 132 | $out .= "<tbody>"; |
133 | 133 | $out .= "<tr>\n"; |
134 | | - foreach( $this->mRestrictions as $action => $required ) { |
| 134 | + foreach( array_keys($this->mRestrictions) as $action ) { |
135 | 135 | /* Not all languages have V_x <-> N_x relation */ |
136 | 136 | $out .= "<th>" . wfMsgHtml( 'restriction-' . $action ) . "</th>\n"; |
137 | 137 | } |
Index: trunk/phase3/includes/ZhClient.php |
— | — | @@ -38,6 +38,7 @@ |
39 | 39 | */ |
40 | 40 | function connect() { |
41 | 41 | wfSuppressWarnings(); |
| 42 | + $errno = $errstr = ''; |
42 | 43 | $this->mFP = fsockopen($this->mHost, $this->mPort, $errno, $errstr, 30); |
43 | 44 | wfRestoreWarnings(); |
44 | 45 | if(!$this->mFP) { |
— | — | @@ -115,7 +116,6 @@ |
116 | 117 | foreach($info as $variant) { |
117 | 118 | list($code, $len) = explode(' ', $variant); |
118 | 119 | $ret[strtolower($code)] = substr($data, $i, $len); |
119 | | - $r = $ret[strtolower($code)]; |
120 | 120 | $i+=$len; |
121 | 121 | } |
122 | 122 | return $ret; |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -571,6 +571,7 @@ |
572 | 572 | $this->mMetaData = '' ; |
573 | 573 | |
574 | 574 | # Check for spam |
| 575 | + $matches = array(); |
575 | 576 | if ( $wgSpamRegex && preg_match( $wgSpamRegex, $this->textbox1, $matches ) ) { |
576 | 577 | $this->spamPage ( $matches[0] ); |
577 | 578 | wfProfileOut( "$fname-checks" ); |
— | — | @@ -858,6 +859,7 @@ |
859 | 860 | $s = wfMsg('editingcomment', $this->mTitle->getPrefixedText() ); |
860 | 861 | } else { |
861 | 862 | $s = wfMsg('editingsection', $this->mTitle->getPrefixedText() ); |
| 863 | + $matches = array(); |
862 | 864 | if( !$this->summary && !$this->preview && !$this->diff ) { |
863 | 865 | preg_match( "/^(=+)(.+)\\1/mi", |
864 | 866 | $this->textbox1, |
— | — | @@ -1513,6 +1515,7 @@ |
1514 | 1516 | } |
1515 | 1517 | $currentText = $currentRevision->getText(); |
1516 | 1518 | |
| 1519 | + $result = ''; |
1517 | 1520 | if( wfMerge( $baseText, $editText, $currentText, $result ) ){ |
1518 | 1521 | $editText = $result; |
1519 | 1522 | wfProfileOut( $fname ); |
Index: trunk/phase3/includes/Profiler.php |
— | — | @@ -164,7 +164,7 @@ |
165 | 165 | } |
166 | 166 | |
167 | 167 | function getCallTreeLine($entry) { |
168 | | - list ($fname, $level, $start, $x, $end) = $entry; |
| 168 | + list ($fname, $level, $start, /* $x */, $end) = $entry; |
169 | 169 | $delta = $end - $start; |
170 | 170 | $space = str_repeat(' ', $level); |
171 | 171 | |
— | — | @@ -208,7 +208,6 @@ |
209 | 209 | # First, subtract the overhead! |
210 | 210 | foreach ($this->mStack as $entry) { |
211 | 211 | $fname = $entry[0]; |
212 | | - $thislevel = $entry[1]; |
213 | 212 | $start = $entry[2]; |
214 | 213 | $end = $entry[4]; |
215 | 214 | $elapsed = $end - $start; |
— | — | @@ -229,7 +228,6 @@ |
230 | 229 | # Collate |
231 | 230 | foreach ($this->mStack as $index => $entry) { |
232 | 231 | $fname = $entry[0]; |
233 | | - $thislevel = $entry[1]; |
234 | 232 | $start = $entry[2]; |
235 | 233 | $end = $entry[4]; |
236 | 234 | $elapsed = $end - $start; |
Index: trunk/phase3/includes/HTMLForm.php |
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | if ( $this->mRequest->wasPosted() ) { |
101 | 101 | $arr = $this->mRequest->getArray( $varname ); |
102 | 102 | if ( is_array( $arr ) ) { |
103 | | - foreach ( $_POST[$varname] as $index => $element ) { |
| 103 | + foreach ( $_POST[$varname] as $element ) { |
104 | 104 | $s .= htmlspecialchars( $element )."\n"; |
105 | 105 | } |
106 | 106 | } |
Index: trunk/phase3/includes/SpecialUserrights.php |
— | — | @@ -89,7 +89,6 @@ |
90 | 90 | |
91 | 91 | $oldGroups = $u->getGroups(); |
92 | 92 | $newGroups = $oldGroups; |
93 | | - $logcomment = ' '; |
94 | 93 | // remove then add groups |
95 | 94 | if(isset($removegroup)) { |
96 | 95 | $newGroups = array_diff($newGroups, $removegroup); |
Index: trunk/phase3/includes/SpecialWatchlist.php |
— | — | @@ -150,21 +150,17 @@ |
151 | 151 | wfAppendToArrayIfNotDefault( 'namespace', $nameSpace, $defaults, $nondefaults ); |
152 | 152 | |
153 | 153 | if ( $days <= 0 ) { |
154 | | - $docutoff = ''; |
155 | 154 | $cutoff = false; |
156 | 155 | $npages = wfMsg( 'watchlistall1' ); |
157 | 156 | } else { |
158 | | - $docutoff = "AND rev_timestamp > '" . |
159 | | - ( $cutoff = $dbr->timestamp( time() - intval( $days * 86400 ) ) ) |
160 | | - . "'"; |
161 | | - /* |
162 | | - $sql = "SELECT COUNT(*) AS n FROM $page, $revision WHERE rev_timestamp>'$cutoff' AND page_id=rev_page"; |
163 | | - $res = $dbr->query( $sql, $fname ); |
164 | | - $s = $dbr->fetchObject( $res ); |
165 | | - $npages = $s->n; |
166 | | - */ |
167 | | - $npages = 40000 * $days; |
168 | | - |
| 157 | + $cutoff = $dbr->timestamp( time() - intval( $days * 86400 ) ); |
| 158 | + /* |
| 159 | + $sql = "SELECT COUNT(*) AS n FROM $page, $revision WHERE rev_timestamp>'$cutoff' AND page_id=rev_page"; |
| 160 | + $res = $dbr->query( $sql, $fname ); |
| 161 | + $s = $dbr->fetchObject( $res ); |
| 162 | + $npages = $s->n; |
| 163 | + */ |
| 164 | + $npages = 40000 * $days; |
169 | 165 | } |
170 | 166 | |
171 | 167 | /* Edit watchlist form */ |
— | — | @@ -215,7 +211,6 @@ |
216 | 212 | } else { |
217 | 213 | global $wgContLang; |
218 | 214 | $toolLinks = array(); |
219 | | - $titleText = $titleObj->getPrefixedText(); |
220 | 215 | $pageLink = $sk->makeLinkObj( $titleObj ); |
221 | 216 | $toolLinks[] = $sk->makeLinkObj( $titleObj->getTalkPage(), $wgLang->getNsText( NS_TALK ) ); |
222 | 217 | if( $titleObj->exists() ) |
— | — | @@ -327,7 +322,6 @@ |
328 | 323 | # Spit out some control panel links |
329 | 324 | $thisTitle = SpecialPage::getTitleFor( 'Watchlist' ); |
330 | 325 | $skin = $wgUser->getSkin(); |
331 | | - $linkElements = array( 'hideOwn' => 'wlhideshowown', 'hideBots' => 'wlhideshowbots' ); |
332 | 326 | |
333 | 327 | # Problems encountered using the fancier method |
334 | 328 | $label = $hideBots ? wfMsgHtml( 'show' ) : wfMsgHtml( 'hide' ); |
— | — | @@ -428,7 +422,6 @@ |
429 | 423 | function wlCutoffLinks( $days, $page = 'Watchlist', $options = array() ) { |
430 | 424 | $hours = array( 1, 2, 6, 12 ); |
431 | 425 | $days = array( 1, 3, 7 ); |
432 | | - $cl = ''; |
433 | 426 | $i = 0; |
434 | 427 | foreach( $hours as $h ) { |
435 | 428 | $hours[$i++] = wlHoursLink( $h, $page, $options ); |
Index: trunk/phase3/includes/SpecialNewimages.php |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | * |
11 | 11 | */ |
12 | 12 | function wfSpecialNewimages( $par, $specialPage ) { |
13 | | - global $wgUser, $wgOut, $wgLang, $wgContLang, $wgRequest, $wgGroupPermissions; |
| 13 | + global $wgUser, $wgOut, $wgLang, $wgRequest, $wgGroupPermissions; |
14 | 14 | |
15 | 15 | $wpIlMatch = $wgRequest->getText( 'wpIlMatch' ); |
16 | 16 | $dbr =& wfGetDB( DB_SLAVE ); |
— | — | @@ -67,9 +67,11 @@ |
68 | 68 | /** Hardcode this for now. */ |
69 | 69 | $limit = 48; |
70 | 70 | |
71 | | - if ( $parval = intval( $par ) ) |
72 | | - if ( $parval <= $limit && $parval > 0 ) |
| 71 | + if ( $parval = intval( $par ) ) { |
| 72 | + if ( $parval <= $limit && $parval > 0 ) { |
73 | 73 | $limit = $parval; |
| 74 | + } |
| 75 | + } |
74 | 76 | |
75 | 77 | $where = array(); |
76 | 78 | $searchpar = ''; |
— | — | @@ -163,7 +165,6 @@ |
164 | 166 | htmlspecialchars( $wpIlMatch ) . "\" /> " . |
165 | 167 | "<input type='submit' name=\"wpIlSubmit\" value=\"{$sub}\" /></form>" ); |
166 | 168 | } |
167 | | - $here = $wgContLang->specialPage( 'Newimages' ); |
168 | 169 | |
169 | 170 | /** |
170 | 171 | * Paging controls... |
Index: trunk/phase3/includes/Linker.php |
— | — | @@ -38,7 +38,6 @@ |
39 | 39 | function getInterwikiLinkAttributes( $link, $text, $class='' ) { |
40 | 40 | global $wgContLang; |
41 | 41 | |
42 | | - $same = ($link == $text); |
43 | 42 | $link = urldecode( $link ); |
44 | 43 | $link = $wgContLang->checkTitleEncoding( $link ); |
45 | 44 | $link = preg_replace( '/[\\x00-\\x1f]/', ' ', $link ); |
— | — | @@ -200,8 +199,6 @@ |
201 | 200 | return "<!-- ERROR -->{$prefix}{$text}{$trail}"; |
202 | 201 | } |
203 | 202 | |
204 | | - $ns = $nt->getNamespace(); |
205 | | - $dbkey = $nt->getDBkey(); |
206 | 203 | if ( $nt->isExternal() ) { |
207 | 204 | $u = $nt->getFullURL(); |
208 | 205 | $link = $nt->getPrefixedURL(); |
— | — | @@ -210,6 +207,7 @@ |
211 | 208 | |
212 | 209 | $inside = ''; |
213 | 210 | if ( '' != $trail ) { |
| 211 | + $m = array(); |
214 | 212 | if ( preg_match( '/^([a-z]+)(.*)$$/sD', $trail, $m ) ) { |
215 | 213 | $inside = $m[1]; |
216 | 214 | $trail = $m[2]; |
— | — | @@ -381,8 +379,6 @@ |
382 | 380 | * the end of the link. |
383 | 381 | */ |
384 | 382 | function makeStubLinkObj( $nt, $text = '', $query = '', $trail = '', $prefix = '' ) { |
385 | | - $link = $nt->getPrefixedURL(); |
386 | | - |
387 | 383 | $u = $nt->escapeLocalURL( $query ); |
388 | 384 | |
389 | 385 | if ( '' == $text ) { |
— | — | @@ -717,7 +713,6 @@ |
718 | 714 | ### HOTFIX. Instead of breaking, return empty string. |
719 | 715 | return $text; |
720 | 716 | } else { |
721 | | - $name = $title->getDBKey(); |
722 | 717 | $img = new Image( $title ); |
723 | 718 | if( $img->exists() ) { |
724 | 719 | $url = $img->getURL(); |
— | — | @@ -901,6 +896,7 @@ |
902 | 897 | # some nasty regex. |
903 | 898 | # We look for all comments, match any text before and after the comment, |
904 | 899 | # add a separator where needed and format the comment itself with CSS |
| 900 | + $match = array(); |
905 | 901 | while (preg_match('/(.*)\/\*\s*(.*?)\s*\*\/(.*)/', $comment,$match)) { |
906 | 902 | $pre=$match[1]; |
907 | 903 | $auto=$match[2]; |
— | — | @@ -943,6 +939,7 @@ |
944 | 940 | } else { |
945 | 941 | $text = $match[1]; |
946 | 942 | } |
| 943 | + $submatch = array(); |
947 | 944 | if( preg_match( '/^' . $medians . '(.*)$/i', $match[1], $submatch ) ) { |
948 | 945 | # Media link; trail not supported. |
949 | 946 | $linkRegexp = '/\[\[(.*?)\]\]/'; |
— | — | @@ -1094,6 +1091,7 @@ |
1095 | 1092 | } |
1096 | 1093 | $inside = ''; |
1097 | 1094 | if ( '' != $trail ) { |
| 1095 | + $m = array(); |
1098 | 1096 | if ( preg_match( $regex, $trail, $m ) ) { |
1099 | 1097 | $inside = $m[1]; |
1100 | 1098 | $trail = $m[2]; |
Index: trunk/phase3/includes/MimeMagic.php |
— | — | @@ -403,8 +403,6 @@ |
404 | 404 | elseif ($tag==="svg") $mime= "image/svg"; |
405 | 405 | elseif (strpos($doctype,"-//W3C//DTD XHTML")===0) $mime= "text/html"; |
406 | 406 | elseif ($tag==="html") $mime= "text/html"; |
407 | | - |
408 | | - $test_more= false; |
409 | 407 | } |
410 | 408 | } |
411 | 409 | |
Index: trunk/phase3/includes/Parser.php |
— | — | @@ -383,10 +383,9 @@ |
384 | 384 | */ |
385 | 385 | function recursiveTagParse( $text ) { |
386 | 386 | wfProfileIn( __METHOD__ ); |
387 | | - $x =& $this->mStripState; |
388 | | - wfRunHooks( 'ParserBeforeStrip', array( &$this, &$text, &$x ) ); |
389 | | - $text = $this->strip( $text, $x ); |
390 | | - wfRunHooks( 'ParserAfterStrip', array( &$this, &$text, &$x ) ); |
| 387 | + wfRunHooks( 'ParserBeforeStrip', array( &$this, &$text, &$this->mStripState ) ); |
| 388 | + $text = $this->strip( $text, $this->mStripState ); |
| 389 | + wfRunHooks( 'ParserAfterStrip', array( &$this, &$text, &$this->mStripState ) ); |
391 | 390 | $text = $this->internalParse( $text ); |
392 | 391 | wfProfileOut( __METHOD__ ); |
393 | 392 | return $text; |
— | — | @@ -931,8 +930,7 @@ |
932 | 931 | wfProfileIn( $fname ); |
933 | 932 | |
934 | 933 | # Hook to suspend the parser in this state |
935 | | - $x =& $this->mStripState; // FIXME: Please check that this initialization is correct. |
936 | | - if ( !wfRunHooks( 'ParserBeforeInternalParse', array( &$this, &$text, &$x ) ) ) { |
| 934 | + if ( !wfRunHooks( 'ParserBeforeInternalParse', array( &$this, &$text, &$this->mStripState ) ) ) { |
937 | 935 | wfProfileOut( $fname ); |
938 | 936 | return $text ; |
939 | 937 | } |
— | — | @@ -1820,7 +1818,7 @@ |
1821 | 1819 | * @return string less-or-more HTML with NOPARSE bits |
1822 | 1820 | */ |
1823 | 1821 | function armorLinks( $text ) { |
1824 | | - return preg_replace( "/\b(" . wfUrlProtocols() . ')/', |
| 1822 | + return preg_replace( '/\b(' . wfUrlProtocols() . ')/', |
1825 | 1823 | "{$this->mUniqPrefix}NOPARSE$1", $text ); |
1826 | 1824 | } |
1827 | 1825 | |
Index: trunk/phase3/includes/LinkBatch.php |
— | — | @@ -97,7 +97,7 @@ |
98 | 98 | |
99 | 99 | // The remaining links in $data are bad links, register them as such |
100 | 100 | foreach ( $remaining as $ns => $dbkeys ) { |
101 | | - foreach ( $dbkeys as $dbkey => $nothing ) { |
| 101 | + foreach ( array_keys($dbkeys) as $dbkey ) { |
102 | 102 | $title = Title::makeTitle( $ns, $dbkey ); |
103 | 103 | $cache->addBadLinkObj( $title ); |
104 | 104 | $ids[$title->getPrefixedDBkey()] = 0; |
— | — | @@ -112,7 +112,6 @@ |
113 | 113 | */ |
114 | 114 | function doQuery() { |
115 | 115 | $fname = 'LinkBatch::doQuery'; |
116 | | - $namespaces = array(); |
117 | 116 | |
118 | 117 | if ( $this->isEmpty() ) { |
119 | 118 | return false; |
— | — | @@ -161,7 +160,7 @@ |
162 | 161 | $sql .= "({$prefix}_namespace=$ns AND {$prefix}_title IN ("; |
163 | 162 | |
164 | 163 | $firstTitle = true; |
165 | | - foreach( $dbkeys as $dbkey => $nothing ) { |
| 164 | + foreach( array_keys($dbkeys) as $dbkey ) { |
166 | 165 | if ( $firstTitle ) { |
167 | 166 | $firstTitle = false; |
168 | 167 | } else { |
Index: trunk/phase3/includes/User.php |
— | — | @@ -344,7 +344,7 @@ |
345 | 345 | * @return bool |
346 | 346 | */ |
347 | 347 | static function isIP( $name ) { |
348 | | - return preg_match("/^\d{1,3}\.\d{1,3}\.\d{1,3}\.(?:xxx|\d{1,3})$/",$name); |
| 348 | + return preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.(?:xxx|\d{1,3})$/',$name); |
349 | 349 | /*return preg_match("/^ |
350 | 350 | (?:[01]?\d{1,2}|2(:?[0-4]\d|5[0-5]))\. |
351 | 351 | (?:[01]?\d{1,2}|2(:?[0-4]\d|5[0-5]))\. |
— | — | @@ -873,6 +873,7 @@ |
874 | 874 | $found = false; |
875 | 875 | $host = ''; |
876 | 876 | |
| 877 | + $m = array(); |
877 | 878 | if ( preg_match( '/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/', $ip, $m ) ) { |
878 | 879 | # Make hostname |
879 | 880 | for ( $i=4; $i>=1; $i-- ) { |
— | — | @@ -939,6 +940,7 @@ |
940 | 941 | if( isset( $limits['ip'] ) ) { |
941 | 942 | $keys["mediawiki:limiter:$action:ip:$ip"] = $limits['ip']; |
942 | 943 | } |
| 944 | + $matches = array(); |
943 | 945 | if( isset( $limits['subnet'] ) && preg_match( '/^(\d+\.\d+\.\d+)\.\d+$/', $ip, $matches ) ) { |
944 | 946 | $subnet = $matches[1]; |
945 | 947 | $keys["mediawiki:limiter:$action:subnet:$subnet"] = $limits['subnet']; |
— | — | @@ -1585,7 +1587,7 @@ |
1586 | 1588 | * @todo FIXME : need to check the old failback system [AV] |
1587 | 1589 | */ |
1588 | 1590 | function &getSkin() { |
1589 | | - global $IP, $wgRequest; |
| 1591 | + global $wgRequest; |
1590 | 1592 | if ( ! isset( $this->mSkin ) ) { |
1591 | 1593 | wfProfileIn( __METHOD__ ); |
1592 | 1594 | |
— | — | @@ -1672,7 +1674,7 @@ |
1673 | 1675 | // any matching rows |
1674 | 1676 | if ( $watched ) { |
1675 | 1677 | $dbw =& wfGetDB( DB_MASTER ); |
1676 | | - $success = $dbw->update( 'watchlist', |
| 1678 | + $dbw->update( 'watchlist', |
1677 | 1679 | array( /* SET */ |
1678 | 1680 | 'wl_notificationtimestamp' => NULL |
1679 | 1681 | ), array( /* WHERE */ |
— | — | @@ -1703,7 +1705,7 @@ |
1704 | 1706 | if( $currentUser != 0 ) { |
1705 | 1707 | |
1706 | 1708 | $dbw =& wfGetDB( DB_MASTER ); |
1707 | | - $success = $dbw->update( 'watchlist', |
| 1709 | + $dbw->update( 'watchlist', |
1708 | 1710 | array( /* SET */ |
1709 | 1711 | 'wl_notificationtimestamp' => NULL |
1710 | 1712 | ), array( /* WHERE */ |
— | — | @@ -1740,6 +1742,7 @@ |
1741 | 1743 | $this->mOptions = array(); |
1742 | 1744 | $a = explode( "\n", $str ); |
1743 | 1745 | foreach ( $a as $s ) { |
| 1746 | + $m = array(); |
1744 | 1747 | if ( preg_match( "/^(.[^=]*)=(.*)$/", $s, $m ) ) { |
1745 | 1748 | $this->mOptions[$m[1]] = $m[2]; |
1746 | 1749 | } |
— | — | @@ -1819,7 +1822,6 @@ |
1820 | 1823 | * Checks if a user with the given name exists, returns the ID |
1821 | 1824 | */ |
1822 | 1825 | function idForName() { |
1823 | | - $gotid = 0; |
1824 | 1826 | $s = trim( $this->getName() ); |
1825 | 1827 | if ( 0 == strcmp( '', $s ) ) return 0; |
1826 | 1828 | |
Index: trunk/phase3/includes/ImagePage.php |
— | — | @@ -142,6 +142,7 @@ |
143 | 143 | $fields = array(); |
144 | 144 | $lines = explode( "\n", wfMsgForContent( 'metadata-fields' ) ); |
145 | 145 | foreach( $lines as $line ) { |
| 146 | + $matches = array(); |
146 | 147 | if( preg_match( '/^\\*\s*(.*?)\s*$/', $line, $matches ) ) { |
147 | 148 | $fields[] = $matches[1]; |
148 | 149 | } |
— | — | @@ -536,15 +537,10 @@ |
537 | 538 | * @param $reason User provided reason for deletion. |
538 | 539 | */ |
539 | 540 | function doDelete( $reason ) { |
540 | | - global $wgOut, $wgRequest, $wgUseSquid; |
541 | | - global $wgPostCommitUpdateList; |
| 541 | + global $wgOut, $wgRequest; |
542 | 542 | |
543 | | - $fname = 'ImagePage::doDelete'; |
544 | | - |
545 | 543 | $oldimage = $wgRequest->getVal( 'oldimage' ); |
546 | 544 | |
547 | | - $dbw =& wfGetDB( DB_MASTER ); |
548 | | - |
549 | 545 | if ( !is_null( $oldimage ) ) { |
550 | 546 | if ( strlen( $oldimage ) < 16 ) { |
551 | 547 | $wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars($oldimage) ); |
Index: trunk/phase3/includes/SpecialBlockip.php |
— | — | @@ -80,7 +80,6 @@ |
81 | 81 | } |
82 | 82 | |
83 | 83 | $scBlockAddress = htmlspecialchars( $this->BlockAddress ); |
84 | | - $scBlockExpiry = htmlspecialchars( $this->BlockExpiry ); |
85 | 84 | $scBlockReason = htmlspecialchars( $this->BlockReason ); |
86 | 85 | $scBlockOtherTime = htmlspecialchars( $this->BlockOther ); |
87 | 86 | $scBlockExpiryOptions = htmlspecialchars( wfMsgForContent( 'ipboptions' ) ); |
— | — | @@ -189,6 +188,7 @@ |
190 | 189 | |
191 | 190 | # Check for invalid specifications |
192 | 191 | if ( ! preg_match( "/^$rxIP$/", $this->BlockAddress ) ) { |
| 192 | + $matches = array(); |
193 | 193 | if ( preg_match( "/^($rxIP)\\/(\\d{1,2})$/", $this->BlockAddress, $matches ) ) { |
194 | 194 | if ( $wgSysopRangeBans ) { |
195 | 195 | if ( $matches[2] > 31 || $matches[2] < 16 ) { |
Index: trunk/phase3/includes/RecentChange.php |
— | — | @@ -95,7 +95,7 @@ |
96 | 96 | # Writes the data in this object to the database |
97 | 97 | function save() |
98 | 98 | { |
99 | | - global $wgLocalInterwiki, $wgPutIPinRC, $wgRC2UDPAddress, $wgRC2UDPPort, $wgRC2UDPPrefix, $wgUseRCPatrol; |
| 99 | + global $wgLocalInterwiki, $wgPutIPinRC, $wgRC2UDPAddress, $wgRC2UDPPort, $wgRC2UDPPrefix; |
100 | 100 | $fname = 'RecentChange::save'; |
101 | 101 | |
102 | 102 | $dbw =& wfGetDB( DB_MASTER ); |
Index: trunk/phase3/includes/SpecialAllpages.php |
— | — | @@ -83,8 +83,7 @@ |
84 | 84 | * @param integer $namespace (default NS_MAIN) |
85 | 85 | */ |
86 | 86 | function showToplevel ( $namespace = NS_MAIN, $including = false ) { |
87 | | - global $wgOut, $wgUser; |
88 | | - $sk = $wgUser->getSkin(); |
| 87 | + global $wgOut; |
89 | 88 | $fname = "indexShowToplevel"; |
90 | 89 | |
91 | 90 | # TODO: Either make this *much* faster or cache the title index points |
— | — | @@ -186,8 +185,6 @@ |
187 | 186 | */ |
188 | 187 | function showline( $inpoint, $outpoint, $namespace = NS_MAIN ) { |
189 | 188 | global $wgUser; |
190 | | - $sk = $wgUser->getSkin(); |
191 | | - $dbr =& wfGetDB( DB_SLAVE ); |
192 | 189 | |
193 | 190 | $inpointf = htmlspecialchars( str_replace( '_', ' ', $inpoint ) ); |
194 | 191 | $outpointf = htmlspecialchars( str_replace( '_', ' ', $outpoint ) ); |
— | — | @@ -241,7 +238,6 @@ |
242 | 239 | $n = 0; |
243 | 240 | $out = '<table style="background: inherit;" border="0" width="100%">'; |
244 | 241 | |
245 | | - $namespaces = $wgContLang->getFormattedNamespaces(); |
246 | 242 | while( ($n < $this->maxPerPage) && ($s = $dbr->fetchObject( $res )) ) { |
247 | 243 | $t = Title::makeTitle( $s->page_namespace, $s->page_title ); |
248 | 244 | if( $t ) { |
— | — | @@ -298,18 +294,20 @@ |
299 | 295 | return array( $ns, '', '' ); # shortcut for common case |
300 | 296 | |
301 | 297 | $t = Title::makeTitleSafe($ns, $text); |
302 | | - if ( $t && $t->isLocal() ) |
| 298 | + if ( $t && $t->isLocal() ) { |
303 | 299 | return array( $t->getNamespace(), $t->getDBkey(), $t->getText() ); |
304 | | - else if ( $t ) |
| 300 | + } else if ( $t ) { |
305 | 301 | return NULL; |
| 302 | + } |
306 | 303 | |
307 | 304 | # try again, in case the problem was an empty pagename |
308 | 305 | $text = preg_replace('/(#|$)/', 'X$1', $text); |
309 | 306 | $t = Title::makeTitleSafe($ns, $text); |
310 | | - if ( $t && $t->isLocal() ) |
| 307 | + if ( $t && $t->isLocal() ) { |
311 | 308 | return array( $t->getNamespace(), '', '' ); |
312 | | - else |
| 309 | + } else { |
313 | 310 | return NULL; |
| 311 | + } |
314 | 312 | } |
315 | 313 | } |
316 | 314 | |
Index: trunk/phase3/includes/SearchPostgres.php |
— | — | @@ -60,6 +60,7 @@ |
61 | 61 | $this->searchTerms = array(); |
62 | 62 | |
63 | 63 | # FIXME: This doesn't handle parenthetical expressions. |
| 64 | + $m = array(); |
64 | 65 | if( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/', |
65 | 66 | $filteredText, $m, PREG_SET_ORDER ) ) { |
66 | 67 | foreach( $m as $terms ) { |
— | — | @@ -77,7 +78,7 @@ |
78 | 79 | $this->searchTerms[] = $regexp; |
79 | 80 | } |
80 | 81 | wfDebug( "Would search with '$searchon'\n" ); |
81 | | - wfDebug( "Match with /\b" . implode( '\b|\b', $this->searchTerms ) . "\b/\n" ); |
| 82 | + wfDebug( 'Match with /\b' . implode( '\b|\b', $this->searchTerms ) . "\b/\n" ); |
82 | 83 | } else { |
83 | 84 | wfDebug( "Can't understand search query '{$this->filteredText}'\n" ); |
84 | 85 | } |
Index: trunk/phase3/includes/normal/RandomTest.php |
— | — | @@ -68,6 +68,7 @@ |
69 | 69 | $diffs = new Diff( $ota, $nta ); |
70 | 70 | $formatter = new TableDiffFormatter(); |
71 | 71 | $funky = $formatter->format( $diffs ); |
| 72 | + $matches = array(); |
72 | 73 | preg_match_all( '/<span class="diffchange">(.*?)<\/span>/', $funky, $matches ); |
73 | 74 | foreach( $matches[1] as $bit ) { |
74 | 75 | $hex = bin2hex( $bit ); |
Index: trunk/phase3/includes/normal/UtfNormalGenerate.php |
— | — | @@ -43,6 +43,7 @@ |
44 | 44 | print "Initializing normalization quick check tables...\n"; |
45 | 45 | $checkNFC = array(); |
46 | 46 | while( false !== ($line = fgets( $in ) ) ) { |
| 47 | + $matches = array(); |
47 | 48 | if( preg_match( '/^([0-9A-F]+)(?:..([0-9A-F]+))?\s*;\s*(NFC_QC)\s*;\s*([MN])/', $line, $matches ) ) { |
48 | 49 | list( $junk, $first, $last, $prop, $value ) = $matches; |
49 | 50 | #print "$first $last $prop $value\n"; |
Index: trunk/phase3/includes/normal/Utf8Test.php |
— | — | @@ -45,6 +45,7 @@ |
46 | 46 | |
47 | 47 | $columns = 0; |
48 | 48 | while( false !== ( $line = fgets( $in ) ) ) { |
| 49 | + $matches = array(); |
49 | 50 | if( preg_match( '/^(Here come the tests:\s*)\|$/', $line, $matches ) ) { |
50 | 51 | $columns = strpos( $line, '|' ); |
51 | 52 | break; |
— | — | @@ -86,6 +87,7 @@ |
87 | 88 | $success = 0; |
88 | 89 | $total = 0; |
89 | 90 | while( false !== ( $line = fgets( $in ) ) ) { |
| 91 | + $matches = array(); |
90 | 92 | if( preg_match( '/^(\d+)\s+(.*?)\s*\|/', $line, $matches ) ) { |
91 | 93 | $section = $matches[1]; |
92 | 94 | print $line; |
Index: trunk/phase3/includes/normal/UtfNormal.php |
— | — | @@ -224,8 +224,7 @@ |
225 | 225 | * @static |
226 | 226 | */ |
227 | 227 | static function loadData() { |
228 | | - # fixme : are $utfCanonicalComp, $utfCanonicalDecomp really used? |
229 | | - global $utfCombiningClass, $utfCanonicalComp, $utfCanonicalDecomp; |
| 228 | + global $utfCombiningClass; |
230 | 229 | if( !isset( $utfCombiningClass ) ) { |
231 | 230 | require_once( 'UtfNormalData.inc' ); |
232 | 231 | } |
— | — | @@ -329,6 +328,7 @@ |
330 | 329 | # large ASCII parts can be handled much more quickly. |
331 | 330 | # Don't chop up Unicode areas for punctuation, though, |
332 | 331 | # that wastes energy. |
| 332 | + $matches = array(); |
333 | 333 | preg_match_all( |
334 | 334 | '/([\x00-\x7f]+|[\x80-\xff][\x00-\x40\x5b-\x5f\x7b-\xff]*)/', |
335 | 335 | $string, $matches ); |
— | — | @@ -551,7 +551,7 @@ |
552 | 552 | * @return string a UTF-8 string decomposed, not yet normalized (needs sorting) |
553 | 553 | * @static |
554 | 554 | */ |
555 | | - static function fastDecompose( $string, &$map ) { |
| 555 | + static function fastDecompose( $string, $map ) { |
556 | 556 | UtfNormal::loadData(); |
557 | 557 | $len = strlen( $string ); |
558 | 558 | $out = ''; |
Index: trunk/phase3/includes/normal/UtfNormalTest.php |
— | — | @@ -73,6 +73,7 @@ |
74 | 74 | while( false !== ( $line = fgets( $in ) ) ) { |
75 | 75 | list( $data, $comment ) = explode( '#', $line ); |
76 | 76 | if( $data === '' ) continue; |
| 77 | + $matches = array(); |
77 | 78 | if( preg_match( '/@Part([\d])/', $data, $matches ) ) { |
78 | 79 | if( $matches[1] > 0 ) { |
79 | 80 | $ok = reportResults( $total, $success, $failure ) && $ok; |
— | — | @@ -236,7 +237,6 @@ |
237 | 238 | $result = verbosify( $char, $u->toNFD( $char ), 1, 'NFD', $reportFailure ) && $result; |
238 | 239 | $result = verbosify( $char, $u->toNFKC( $char ), 1, 'NFKC', $reportFailure ) && $result; |
239 | 240 | $result = verbosify( $char, $u->toNFKD( $char ), 1, 'NFKD', $reportFailure ) && $result; |
240 | | - $c = $char; |
241 | 241 | $result = verbosify( $char, $u->cleanUp( $char ), 1, 'cleanUp', $reportFailure ) && $result; |
242 | 242 | global $verbose; |
243 | 243 | if( $verbose && !$result && !$reportFailure ) { |
Index: trunk/phase3/includes/MessageCache.php |
— | — | @@ -298,8 +298,6 @@ |
299 | 299 | if ( !$dbr ) { |
300 | 300 | throw new MWException( 'Invalid database object' ); |
301 | 301 | } |
302 | | - $conditions = array( 'page_is_redirect' => 0, |
303 | | - 'page_namespace' => NS_MEDIAWIKI); |
304 | 302 | $res = $dbr->select( array( 'page', 'revision', 'text' ), |
305 | 303 | array( 'page_title', 'old_text', 'old_flags' ), |
306 | 304 | 'page_is_redirect=0 AND page_namespace='.NS_MEDIAWIKI.' AND page_latest=rev_id AND rev_text_id=old_id', |
— | — | @@ -315,7 +313,7 @@ |
316 | 314 | # Go through the language array and the extension array and make a note of |
317 | 315 | # any keys missing from the cache |
318 | 316 | $allMessages = Language::getMessagesFor( 'en' ); |
319 | | - foreach ( $allMessages as $key => $value ) { |
| 317 | + foreach ( array_keys($allMessages) as $key ) { |
320 | 318 | $uckey = $wgLang->ucfirst( $key ); |
321 | 319 | if ( !array_key_exists( $uckey, $this->mCache ) ) { |
322 | 320 | $this->mCache[$uckey] = false; |
— | — | @@ -326,7 +324,7 @@ |
327 | 325 | MessageCache::loadAllMessages(); |
328 | 326 | |
329 | 327 | # Add them to the cache |
330 | | - foreach ( $this->mExtensionMessages as $key => $value ) { |
| 328 | + foreach ( array_keys($this->mExtensionMessages) as $key ) { |
331 | 329 | $uckey = $wgLang->ucfirst( $key ); |
332 | 330 | if ( !array_key_exists( $uckey, $this->mCache ) && |
333 | 331 | ( isset( $this->mExtensionMessages[$key][$wgLang->getCode()] ) || isset( $this->mExtensionMessages[$key]['en'] ) ) ) { |
— | — | @@ -345,7 +343,7 @@ |
346 | 344 | if ( !$this->mKeys ) { |
347 | 345 | $this->mKeys = array(); |
348 | 346 | $allMessages = Language::getMessagesFor( 'en' ); |
349 | | - foreach ( $allMessages as $key => $value ) { |
| 347 | + foreach ( array_keys($allMessages) as $key ) { |
350 | 348 | $title = $wgContLang->ucfirst( $key ); |
351 | 349 | array_push( $this->mKeys, $title ); |
352 | 350 | } |
Index: trunk/phase3/includes/SpecialWhatlinkshere.php |
— | — | @@ -57,8 +57,6 @@ |
58 | 58 | $wgOut->setPagetitle( $this->target->getPrefixedText() ); |
59 | 59 | $wgOut->setSubtitle( wfMsg( 'linklistsub' ) ); |
60 | 60 | |
61 | | - $isredir = ' (' . wfMsg( 'isredirect' ) . ")\n"; |
62 | | - |
63 | 61 | $wgOut->addHTML( wfMsg( 'whatlinkshere-barrow' ) . ' ' .$this->skin->makeLinkObj($this->target, '', 'redirect=no' )."<br />\n"); |
64 | 62 | |
65 | 63 | $this->showIndirectLinks( 0, $this->target, $this->limit, $this->from, $this->dir ); |
Index: trunk/phase3/includes/SpecialRecentchanges.php |
— | — | @@ -14,7 +14,7 @@ |
15 | 15 | * Constructor |
16 | 16 | */ |
17 | 17 | function wfSpecialRecentchanges( $par, $specialPage ) { |
18 | | - global $wgUser, $wgOut, $wgRequest, $wgUseRCPatrol, $wgDBtype; |
| 18 | + global $wgUser, $wgOut, $wgRequest, $wgUseRCPatrol; |
19 | 19 | global $wgRCShowWatchingUsers, $wgShowUpdatedMarker; |
20 | 20 | global $wgAllowCategorizedRecentChanges ; |
21 | 21 | $fname = 'wfSpecialRecentchanges'; |
— | — | @@ -90,7 +90,8 @@ |
91 | 91 | if ( is_numeric( $bit ) ) { |
92 | 92 | $limit = $bit; |
93 | 93 | } |
94 | | - |
| 94 | + |
| 95 | + $m = array(); |
95 | 96 | if ( preg_match( '/^limit=(\d+)$/', $bit, $m ) ) { |
96 | 97 | $limit = $m[1]; |
97 | 98 | } |
— | — | @@ -222,7 +223,6 @@ |
223 | 224 | } |
224 | 225 | |
225 | 226 | // And now for the content |
226 | | - $sk = $wgUser->getSkin(); |
227 | 227 | $wgOut->setSyndicated( true ); |
228 | 228 | |
229 | 229 | $list = ChangesList::newFromUser( $wgUser ); |
— | — | @@ -397,7 +397,6 @@ |
398 | 398 | $sorted[$n] = $obj; |
399 | 399 | $n++; |
400 | 400 | } |
401 | | - $first = false; |
402 | 401 | } |
403 | 402 | |
404 | 403 | foreach( $sorted as $obj ) { |
Index: trunk/phase3/includes/Article.php |
— | — | @@ -79,7 +79,7 @@ |
80 | 80 | } |
81 | 81 | } else { |
82 | 82 | if( $rt->getNamespace() == NS_SPECIAL ) { |
83 | | - // Gotta hand redirects to special pages differently: |
| 83 | + // Gotta handle redirects to special pages differently: |
84 | 84 | // Fill the HTTP response "Location" header and ignore |
85 | 85 | // the rest of the page we're on. |
86 | 86 | // |
— | — | @@ -139,7 +139,7 @@ |
140 | 140 | * @return Return the text of this revision |
141 | 141 | */ |
142 | 142 | function getContent() { |
143 | | - global $wgRequest, $wgUser, $wgOut; |
| 143 | + global $wgUser, $wgOut; |
144 | 144 | |
145 | 145 | wfProfileIn( __METHOD__ ); |
146 | 146 | |
— | — | @@ -236,9 +236,6 @@ |
237 | 237 | |
238 | 238 | # Pre-fill content with error message so that if something |
239 | 239 | # fails we'll have something telling us what we intended. |
240 | | - |
241 | | - $t = $this->mTitle->getPrefixedText(); |
242 | | - |
243 | 240 | $this->mOldId = $oldid; |
244 | 241 | $this->fetchContent( $oldid ); |
245 | 242 | } |
— | — | @@ -575,13 +572,10 @@ |
576 | 573 | function getContributors($limit = 0, $offset = 0) { |
577 | 574 | # XXX: this is expensive; cache this info somewhere. |
578 | 575 | |
579 | | - $title = $this->mTitle; |
580 | 576 | $contribs = array(); |
581 | 577 | $dbr =& wfGetDB( DB_SLAVE ); |
582 | 578 | $revTable = $dbr->tableName( 'revision' ); |
583 | 579 | $userTable = $dbr->tableName( 'user' ); |
584 | | - $encDBkey = $dbr->addQuotes( $title->getDBkey() ); |
585 | | - $ns = $title->getNamespace(); |
586 | 580 | $user = $this->getUser(); |
587 | 581 | $pageId = $this->getId(); |
588 | 582 | |
— | — | @@ -784,9 +778,6 @@ |
785 | 779 | if( !$wasRedirected && $this->isCurrent() ) { |
786 | 780 | $wgOut->setSubtitle( wfMsgHtml( 'redirectpagesub' ) ); |
787 | 781 | } |
788 | | - $targetUrl = $rt->escapeLocalURL(); |
789 | | - # fixme unused $titleText : |
790 | | - $titleText = htmlspecialchars( $rt->getPrefixedText() ); |
791 | 782 | $link = $sk->makeLinkObj( $rt ); |
792 | 783 | |
793 | 784 | $wgOut->addHTML( '<img src="'.$imageUrl.'" alt="#REDIRECT" />' . |
— | — | @@ -1924,7 +1915,7 @@ |
1925 | 1916 | */ |
1926 | 1917 | function doDeleteArticle( $reason ) { |
1927 | 1918 | global $wgUseSquid, $wgDeferredUpdateList; |
1928 | | - global $wgPostCommitUpdateList, $wgUseTrackbacks; |
| 1919 | + global $wgUseTrackbacks; |
1929 | 1920 | |
1930 | 1921 | wfDebug( __METHOD__."\n" ); |
1931 | 1922 | |
— | — | @@ -2041,8 +2032,6 @@ |
2042 | 2033 | $bot = $wgRequest->getBool( 'bot' ); |
2043 | 2034 | |
2044 | 2035 | # Replace all this user's current edits with the next one down |
2045 | | - $tt = $this->mTitle->getDBKey(); |
2046 | | - $n = $this->mTitle->getNamespace(); |
2047 | 2036 | |
2048 | 2037 | # Get the last editor |
2049 | 2038 | $current = Revision::newFromTitle( $this->mTitle ); |
— | — | @@ -2409,8 +2398,7 @@ |
2410 | 2399 | 'comment' => $comment, |
2411 | 2400 | 'minor_edit' => $minor ? 1 : 0, |
2412 | 2401 | ) ); |
2413 | | - # fixme : $revisionId never used |
2414 | | - $revisionId = $revision->insertOn( $dbw ); |
| 2402 | + $revision->insertOn( $dbw ); |
2415 | 2403 | $this->updateRevisionOn( $dbw, $revision ); |
2416 | 2404 | $dbw->commit(); |
2417 | 2405 | |
— | — | @@ -2524,8 +2512,6 @@ |
2525 | 2513 | static function onArticleEdit( $title ) { |
2526 | 2514 | global $wgDeferredUpdateList, $wgUseFileCache; |
2527 | 2515 | |
2528 | | - $urls = array(); |
2529 | | - |
2530 | 2516 | // Invalidate caches of articles which include this page |
2531 | 2517 | $update = new HTMLCacheUpdate( $title, 'templatelinks' ); |
2532 | 2518 | $wgDeferredUpdateList[] = $update; |
Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -52,6 +52,7 @@ |
53 | 53 | # UTF-8 substr function based on a PHP manual comment |
54 | 54 | if ( !function_exists( 'mb_substr' ) ) { |
55 | 55 | function mb_substr( $str, $start ) { |
| 56 | + $ar = array(); |
56 | 57 | preg_match_all( '/./us', $str, $ar ); |
57 | 58 | |
58 | 59 | if( func_num_args() >= 3 ) { |
— | — | @@ -71,7 +72,7 @@ |
72 | 73 | */ |
73 | 74 | function array_diff_key( $left, $right ) { |
74 | 75 | $result = $left; |
75 | | - foreach ( $left as $key => $value ) { |
| 76 | + foreach ( array_keys($left) as $key ) { |
76 | 77 | if ( isset( $right[$key] ) ) { |
77 | 78 | unset( $result[$key] ); |
78 | 79 | } |
— | — | @@ -382,8 +383,6 @@ |
383 | 384 | * @return String: the requested message. |
384 | 385 | */ |
385 | 386 | function wfMsgReal( $key, $args, $useDB = true, $forContent=false, $transform = true ) { |
386 | | - $fname = 'wfMsgReal'; |
387 | | - |
388 | 387 | $message = wfMsgGetKey( $key, $useDB, $forContent, $transform ); |
389 | 388 | $message = wfMsgReplaceArgs( $message, $args ); |
390 | 389 | return $message; |
— | — | @@ -530,7 +529,7 @@ |
531 | 530 | * <i>parsemag<i>: ?? |
532 | 531 | */ |
533 | 532 | function wfMsgExt( $key, $options ) { |
534 | | - global $wgOut, $wgMsgParserOptions, $wgParser; |
| 533 | + global $wgOut, $wgParser; |
535 | 534 | |
536 | 535 | $args = func_get_args(); |
537 | 536 | array_shift( $args ); |
— | — | @@ -807,6 +806,7 @@ |
808 | 807 | global $wgUseGzip; |
809 | 808 | if( $wgUseGzip ) { |
810 | 809 | # FIXME: we may want to blacklist some broken browsers |
| 810 | + $m = array(); |
811 | 811 | if( preg_match( |
812 | 812 | '/\bgzip(?:;(q)=([0-9]+(?:\.[0-9]+)))?\b/', |
813 | 813 | $_SERVER['HTTP_ACCEPT_ENCODING'], |
— | — | @@ -972,6 +972,7 @@ |
973 | 973 | } |
974 | 974 | // Double the backslashes before the end of the string, because |
975 | 975 | // we will soon add a quote |
| 976 | + $m = array(); |
976 | 977 | if ( preg_match( '/^(.*?)(\\\\+)$/', $arg, $m ) ) { |
977 | 978 | $arg = $m[1] . str_replace( '\\', '\\\\', $m[2] ); |
978 | 979 | } |
— | — | @@ -1095,6 +1096,7 @@ |
1096 | 1097 | foreach( $parts as $part ) { |
1097 | 1098 | # FIXME: doesn't deal with params like 'text/html; level=1' |
1098 | 1099 | @list( $value, $qpart ) = explode( ';', $part ); |
| 1100 | + $match = array(); |
1099 | 1101 | if( !isset( $qpart ) ) { |
1100 | 1102 | $prefs[$value] = 1; |
1101 | 1103 | } elseif( preg_match( '/q\s*=\s*(\d*\.\d+)/', $qpart, $match ) ) { |
— | — | @@ -1289,19 +1291,19 @@ |
1290 | 1292 | $da = array(); |
1291 | 1293 | if ($ts==0) { |
1292 | 1294 | $uts=time(); |
1293 | | - } elseif (preg_match("/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)$/D",$ts,$da)) { |
| 1295 | + } elseif (preg_match('/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)$/D',$ts,$da)) { |
1294 | 1296 | # TS_DB |
1295 | 1297 | $uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6], |
1296 | 1298 | (int)$da[2],(int)$da[3],(int)$da[1]); |
1297 | | - } elseif (preg_match("/^(\d{4}):(\d\d):(\d\d) (\d\d):(\d\d):(\d\d)$/D",$ts,$da)) { |
| 1299 | + } elseif (preg_match('/^(\d{4}):(\d\d):(\d\d) (\d\d):(\d\d):(\d\d)$/D',$ts,$da)) { |
1298 | 1300 | # TS_EXIF |
1299 | 1301 | $uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6], |
1300 | 1302 | (int)$da[2],(int)$da[3],(int)$da[1]); |
1301 | | - } elseif (preg_match("/^(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/D",$ts,$da)) { |
| 1303 | + } elseif (preg_match('/^(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/D',$ts,$da)) { |
1302 | 1304 | # TS_MW |
1303 | 1305 | $uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6], |
1304 | 1306 | (int)$da[2],(int)$da[3],(int)$da[1]); |
1305 | | - } elseif (preg_match("/^(\d{1,13})$/D",$ts,$datearray)) { |
| 1307 | + } elseif (preg_match('/^(\d{1,13})$/D',$ts,$da)) { |
1306 | 1308 | # TS_UNIX |
1307 | 1309 | $uts = $ts; |
1308 | 1310 | } elseif (preg_match('/^(\d{1,2})-(...)-(\d\d(\d\d)?) (\d\d)\.(\d\d)\.(\d\d)/', $ts, $da)) { |
— | — | @@ -1312,11 +1314,11 @@ |
1313 | 1315 | # TS_ISO_8601 |
1314 | 1316 | $uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6], |
1315 | 1317 | (int)$da[2],(int)$da[3],(int)$da[1]); |
1316 | | - } elseif (preg_match("/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)[\+\- ](\d\d)$/",$ts,$da)) { |
| 1318 | + } elseif (preg_match('/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d)[\+\- ](\d\d)$/',$ts,$da)) { |
1317 | 1319 | # TS_POSTGRES |
1318 | 1320 | $uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6], |
1319 | 1321 | (int)$da[2],(int)$da[3],(int)$da[1]); |
1320 | | - } elseif (preg_match("/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/",$ts,$da)) { |
| 1322 | + } elseif (preg_match('/^(\d{4})\-(\d\d)\-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/',$ts,$da)) { |
1321 | 1323 | # TS_POSTGRES |
1322 | 1324 | $uts=gmmktime((int)$da[4],(int)$da[5],(int)$da[6], |
1323 | 1325 | (int)$da[2],(int)$da[3],(int)$da[1]); |
— | — | @@ -1687,7 +1689,7 @@ |
1688 | 1690 | |
1689 | 1691 | $output = array(); |
1690 | 1692 | $retval = 1; // error by default? |
1691 | | - $lastline = exec( $cmd, $output, $retval ); |
| 1693 | + exec( $cmd, $output, $retval ); // returns the last line of output. |
1692 | 1694 | return implode( "\n", $output ); |
1693 | 1695 | |
1694 | 1696 | } |
— | — | @@ -1753,6 +1755,7 @@ |
1754 | 1756 | * @return string |
1755 | 1757 | */ |
1756 | 1758 | function wfBaseName( $path ) { |
| 1759 | + $matches = array(); |
1757 | 1760 | if( preg_match( '#([^/\\\\]*)[/\\\\]*$#', $path, $matches ) ) { |
1758 | 1761 | return $matches[1]; |
1759 | 1762 | } else { |
Index: trunk/phase3/includes/SearchEngine.php |
— | — | @@ -126,6 +126,7 @@ |
127 | 127 | } |
128 | 128 | |
129 | 129 | # Quoted term? Try without the quotes... |
| 130 | + $matches = array(); |
130 | 131 | if( preg_match( '/^"([^"]+)"$/', $searchterm, $matches ) ) { |
131 | 132 | return SearchEngine::getNearMatch( $matches[1] ); |
132 | 133 | } |
Index: trunk/phase3/includes/Exif.php |
— | — | @@ -439,7 +439,7 @@ |
440 | 440 | return false; |
441 | 441 | } |
442 | 442 | |
443 | | - if ( preg_match( "/^\s*$/", $in ) ) { |
| 443 | + if ( preg_match( '/^\s*$/', $in ) ) { |
444 | 444 | $this->debug( $in, __FUNCTION__, 'input consisted solely of whitespace' ); |
445 | 445 | return false; |
446 | 446 | } |
— | — | @@ -468,7 +468,8 @@ |
469 | 469 | } |
470 | 470 | |
471 | 471 | function isRational( $in ) { |
472 | | - if ( !is_array( $in ) && @preg_match( "/^(\d+)\/(\d+[1-9]|[1-9]\d*)$/", $in, $m ) ) { # Avoid division by zero |
| 472 | + $m = array(); |
| 473 | + if ( !is_array( $in ) && @preg_match( '/^(\d+)\/(\d+[1-9]|[1-9]\d*)$/', $in, $m ) ) { # Avoid division by zero |
473 | 474 | return $this->isLong( $m[1] ) && $this->isLong( $m[2] ); |
474 | 475 | } else { |
475 | 476 | $this->debug( $in, __FUNCTION__, 'fed a non-fraction value' ); |
— | — | @@ -477,7 +478,7 @@ |
478 | 479 | } |
479 | 480 | |
480 | 481 | function isUndefined( $in ) { |
481 | | - if ( !is_array( $in ) && preg_match( "/^\d{4}$/", $in ) ) { // Allow ExifVersion and FlashpixVersion |
| 482 | + if ( !is_array( $in ) && preg_match( '/^\d{4}$/', $in ) ) { // Allow ExifVersion and FlashpixVersion |
482 | 483 | $this->debug( $in, __FUNCTION__, true ); |
483 | 484 | return true; |
484 | 485 | } else { |
— | — | @@ -497,7 +498,8 @@ |
498 | 499 | } |
499 | 500 | |
500 | 501 | function isSrational( $in ) { |
501 | | - if ( !is_array( $in ) && preg_match( "/^(\d+)\/(\d+[1-9]|[1-9]\d*)$/", $in, $m ) ) { # Avoid division by zero |
| 502 | + $m = array(); |
| 503 | + if ( !is_array( $in ) && preg_match( '/^(\d+)\/(\d+[1-9]|[1-9]\d*)$/', $in, $m ) ) { # Avoid division by zero |
502 | 504 | return $this->isSlong( $m[0] ) && $this->isSlong( $m[1] ); |
503 | 505 | } else { |
504 | 506 | $this->debug( $in, __FUNCTION__, 'fed a non-fraction value' ); |
— | — | @@ -729,7 +731,7 @@ |
730 | 732 | case 'DateTime': |
731 | 733 | case 'DateTimeOriginal': |
732 | 734 | case 'DateTimeDigitized': |
733 | | - if( preg_match( "/^(\d{4}):(\d\d):(\d\d) (\d\d):(\d\d):(\d\d)$/", $val ) ) { |
| 735 | + if( preg_match( '/^(\d{4}):(\d\d):(\d\d) (\d\d):(\d\d):(\d\d)$/', $val ) ) { |
734 | 736 | $tags[$tag] = $wgLang->timeanddate( wfTimestamp(TS_MW, $val) ); |
735 | 737 | } |
736 | 738 | break; |
— | — | @@ -1054,6 +1056,7 @@ |
1055 | 1057 | * @return mixed A floating point number or whatever we were fed |
1056 | 1058 | */ |
1057 | 1059 | function formatNum( $num ) { |
| 1060 | + $m = array(); |
1058 | 1061 | if ( preg_match( '/^(\d+)\/(\d+)$/', $num, $m ) ) |
1059 | 1062 | return $m[2] != 0 ? $m[1] / $m[2] : $num; |
1060 | 1063 | else |
— | — | @@ -1069,6 +1072,7 @@ |
1070 | 1073 | * @return mixed A floating point number or whatever we were fed |
1071 | 1074 | */ |
1072 | 1075 | function formatFraction( $num ) { |
| 1076 | + $m = array(); |
1073 | 1077 | if ( preg_match( '/^(\d+)\/(\d+)$/', $num, $m ) ) { |
1074 | 1078 | $numerator = intval( $m[1] ); |
1075 | 1079 | $denominator = intval( $m[2] ); |
Index: trunk/phase3/includes/DatabaseFunctions.php |
— | — | @@ -14,7 +14,6 @@ |
15 | 15 | * @param $fname String: name of the php function calling |
16 | 16 | */ |
17 | 17 | function wfQuery( $sql, $db, $fname = '' ) { |
18 | | - global $wgOut; |
19 | 18 | if ( !is_numeric( $db ) ) { |
20 | 19 | # Someone has tried to call this the old way |
21 | 20 | throw new FatalError( wfMsgNoDB( 'wrong_wfQuery_params', $db, $sql ) ); |
Index: trunk/phase3/includes/SpecialRecentchangeslinked.php |
— | — | @@ -48,7 +48,7 @@ |
49 | 49 | if ( ! $days ) { $days = 7; } |
50 | 50 | } |
51 | 51 | $days = (int)$days; |
52 | | - list( $limit, $offset ) = wfCheckLimits( 100, 'rclimit' ); |
| 52 | + list( $limit, /* offset */ ) = wfCheckLimits( 100, 'rclimit' ); |
53 | 53 | |
54 | 54 | $dbr =& wfGetDB( DB_SLAVE ); |
55 | 55 | $cutoff = $dbr->timestamp( time() - ( $days * 86400 ) ); |
Index: trunk/phase3/includes/SpecialContributions.php |
— | — | @@ -168,7 +168,6 @@ |
169 | 169 | */ |
170 | 170 | function wfSpecialContributions( $par = null ) { |
171 | 171 | global $wgUser, $wgOut, $wgLang, $wgRequest; |
172 | | - $fname = 'wfSpecialContributions'; |
173 | 172 | |
174 | 173 | $target = isset( $par ) ? $par : $wgRequest->getVal( 'target' ); |
175 | 174 | if ( !strlen( $target ) ) { |
Index: trunk/phase3/includes/SpecialSearch.php |
— | — | @@ -70,7 +70,7 @@ |
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
74 | | - * If an exact title match can be found, jump straight ahead to |
| 74 | + * If an exact title match can be found, jump straight ahead to it. |
75 | 75 | * @param string $term |
76 | 76 | * @public |
77 | 77 | */ |
— | — | @@ -82,7 +82,6 @@ |
83 | 83 | $this->setupPage( $term ); |
84 | 84 | |
85 | 85 | # Try to go to page as entered. |
86 | | - # |
87 | 86 | $t = Title::newFromText( $term ); |
88 | 87 | |
89 | 88 | # If the string cannot be used to create a title |
Index: trunk/phase3/includes/Sanitizer.php |
— | — | @@ -391,8 +391,9 @@ |
392 | 392 | $tagstack = $tablestack = array(); |
393 | 393 | foreach ( $bits as $x ) { |
394 | 394 | $prev = error_reporting( E_ALL & ~( E_NOTICE | E_WARNING ) ); |
| 395 | + $regs = array(); |
395 | 396 | preg_match( '!^(/?)(\\w+)([^>]*?)(/{0,1}>)([^<]*)$!', $x, $regs ); |
396 | | - list( $qbar, $slash, $t, $params, $brace, $rest ) = $regs; |
| 397 | + list( /* $qbar */, $slash, $t, $params, $brace, $rest ) = $regs; |
397 | 398 | error_reporting( $prev ); |
398 | 399 | |
399 | 400 | $badtag = 0 ; |
— | — | @@ -487,7 +488,7 @@ |
488 | 489 | foreach ( $bits as $x ) { |
489 | 490 | preg_match( '/^(\\/?)(\\w+)([^>]*?)(\\/{0,1}>)([^<]*)$/', |
490 | 491 | $x, $regs ); |
491 | | - @list( $qbar, $slash, $t, $params, $brace, $rest ) = $regs; |
| 492 | + @list( /* $qbar */, $slash, $t, $params, $brace, $rest ) = $regs; |
492 | 493 | if ( isset( $htmlelements[$t = strtolower( $t )] ) ) { |
493 | 494 | if( is_callable( $processCallback ) ) { |
494 | 495 | call_user_func_array( $processCallback, array( &$params, $args ) ); |
— | — | @@ -1223,8 +1224,9 @@ |
1224 | 1225 | $url = preg_replace( '/[\][<>"\\x00-\\x20\\x7F]/e', "urlencode('\\0')", $url ); |
1225 | 1226 | |
1226 | 1227 | # Validate hostname portion |
| 1228 | + $matches = array(); |
1227 | 1229 | if( preg_match( '!^([^:]+:)(//[^/]+)?(.*)$!iD', $url, $matches ) ) { |
1228 | | - list( $whole, $protocol, $host, $rest ) = $matches; |
| 1230 | + list( /* $whole */, $protocol, $host, $rest ) = $matches; |
1229 | 1231 | |
1230 | 1232 | // Characters that will be ignored in IDNs. |
1231 | 1233 | // http://tools.ietf.org/html/3454#section-3.1 |
Index: trunk/phase3/includes/cbt/CBTCompiler.php |
— | — | @@ -75,7 +75,6 @@ |
76 | 76 | * Returns true on success, error message on failure |
77 | 77 | */ |
78 | 78 | function compile() { |
79 | | - $fname = 'CBTProcessor::compile'; |
80 | 79 | $this->mLastError = false; |
81 | 80 | $this->mOps = array(); |
82 | 81 | |
— | — | @@ -222,7 +221,6 @@ |
223 | 222 | if ( $char == '{' ) { |
224 | 223 | // Switch to text mode |
225 | 224 | ++$p; |
226 | | - $tokenStart = $p; |
227 | 225 | $this->doOpenText( $p, $end ); |
228 | 226 | ++$argCount; |
229 | 227 | } elseif ( $char == '}' ) { |
— | — | @@ -292,7 +290,7 @@ |
293 | 291 | wfProfileIn( $fname ); |
294 | 292 | $stack = array(); |
295 | 293 | |
296 | | - foreach( $this->mOps as $index => $op ) { |
| 294 | + foreach( $this->mOps as $op ) { |
297 | 295 | switch( $op->opcode ) { |
298 | 296 | case CBT_PUSH: |
299 | 297 | $stack[] = $this->phpQuote( $op->arg1 ); |