}
function sendHeaders() {
- global $wgUseSquid, $wgUseESI, $wgSquidMaxage;
+ global $wgUseSquid, $wgUseESI;
if ( $this->mResponseCode ) {
$n = preg_replace( '/^ *(\d+)/', '\1', $this->mResponseCode );
* returns true iff the response code was set to 304 Not Modified.
*/
function checkLastModified ( $timestamp ) {
- global $wgCachePages, $wgCacheEpoch, $wgUser, $wgRequest;
+ global $wgCachePages, $wgCacheEpoch, $wgUser;
$fname = 'AjaxResponse::checkLastModified';
if ( !$timestamp || $timestamp == '19700101000000' ) {
*/
function isFileCacheable() {
global $wgUser, $wgUseFileCache, $wgShowIPinHeader, $wgRequest;
- extract( $wgRequest->getValues( 'action', 'oldid', 'diff', 'redirect', 'printable' ) );
+ $action = $wgRequest->getVal( 'action' );
+ $oldid = $wgRequest->getVal( 'oldid' );
+ $diff = $wgRequest->getVal( 'diff' );
+ $redirect = $wgRequest->getVal( 'redirect' );
+ $printable = $wgRequest->getVal( 'printable' );
return $wgUseFileCache
and (!$wgShowIPinHeader)
# This code is UGLY UGLY UGLY.
# Somebody PLEASE come up with a more elegant way to do it.
- $summary = '';
-
#Redirect autosummaries
$summary = self::getRedirectAutosummary( $newtext );
$options = array();
$db =& $this->getDBOptions( $options );
- $ret = false;
- $killed = false;
-
if ( 0 == $user && $address == '' ) {
# Invalid user specification, not blocked
$this->clear();
$s .= ' '.$articlelink;
}
- function insertTimestamp(&$s, &$rc) {
+ function insertTimestamp(&$s, $rc) {
global $wgLang;
# Timestamp
$s .= '; ' . $wgLang->time( $rc->mAttribs['rc_timestamp'], true, true ) . ' . . ';
# Extract DB fields into local scope
extract( $rc->mAttribs );
- $curIdEq = 'curid=' . $rc_cur_id;
# Should patrol-related stuff be shown?
$unpatrolled = $this->usePatrol() && $rc_patrolled == 0;
$userlinks = array();
foreach( $block as $rcObj ) {
$oldid = $rcObj->mAttribs['rc_last_oldid'];
- $newid = $rcObj->mAttribs['rc_this_oldid'];
if( $rcObj->mAttribs['rc_new'] ) {
$isnew = true;
}
return '';
}
$blockOut = '';
- foreach( $this->rc_cache as $secureName => $block ) {
+ foreach( $this->rc_cache as $block ) {
if( count( $block ) < 2 ) {
$blockOut .= $this->recentChangesBlockLine( array_shift( $block ) );
} else {
}
function getHTML() {
- global $wgTitle, $wgUseFileCache, $title, $wgInputEncoding, $wgOutputEncoding;
- global $wgSitename, $wgServer, $wgMessageCache, $wgLogo;
+ global $wgTitle, $wgUseFileCache, $title, $wgInputEncoding;
+ global $wgSitename, $wgServer, $wgMessageCache;
# I give up, Brion is right. Getting the message cache to work when there is no DB is tricky.
# Hard coding strings instead.
# Add a comment for easy SHOW PROCESSLIST interpretation
if ( $fname ) {
- $commentedSql = preg_replace("/\s/", " /* $fname */ ", $sql, 1);
+ $commentedSql = preg_replace('/\s/', " /* $fname */ ", $sql, 1);
} else {
$commentedSql = $sql;
}
* @param bool $tempIgnore
*/
function reportQueryError( $error, $errno, $sql, $fname, $tempIgnore = false ) {
- global $wgCommandLineMode, $wgFullyInitialised, $wgColorErrors;
+ global $wgCommandLineMode;
# Ignore errors during error handling to avoid infinite recursion
$ignore = $this->ignoreErrors( true );
++$this->mErrorCount;
case '\\!': return '!';
case '\\&': return '&';
}
- list( $n, $arg ) = each( $this->preparedArgs );
+ list( /* $n */ , $arg ) = each( $this->preparedArgs );
switch( $matches[1] ) {
case '?': return $this->addQuotes( $arg );
case '!': return $arg;
$sql = preg_replace ('/".*"/s', "'X'", $sql);
# All newlines, tabs, etc replaced by single space
- $sql = preg_replace ( "/\s+/", ' ', $sql);
+ $sql = preg_replace ( '/\s+/', ' ', $sql);
# All numbers => N
$sql = preg_replace ('/-?[0-9]+/s', 'N', $sql);
$row = $this->fetchObject( $res );
$this->freeResult( $res );
- if ( preg_match( "/\((.*)\)/", $row->Type, $m ) ) {
+ $m = array();
+ if ( preg_match( '/\((.*)\)/', $row->Type, $m ) ) {
$size = $m[1];
} else {
$size = -1;
$res = $this->query( 'SHOW PROCESSLIST' );
# Find slave SQL thread. Assumed to be the second one running, which is a bit
# dubious, but unfortunately there's no easy rigorous way
- $slaveThreads = 0;
while ( $row = $this->fetchObject( $res ) ) {
/* This should work for most situations - when default db
* for thread is not specified, it had no events executed,
$failFunction = false, $flags = 0 )
{
- global $wgOut, $wgDBprefix, $wgCommandLineMode;
+ global $wgOut;
# Can't get a reference if it hasn't been set yet
if ( !isset( $wgOut ) ) {
$wgOut = NULL;
$this->mPassword = $password;
$this->mDBname = $dbName;
- $success = false;
$hstring="";
if ($server!=false && $server!="") {
$hstring="host=$server ";
## If this is the initial connection, setup the schema stuff and possibly create the user
if (defined('MEDIAWIKI_INSTALL')) {
global $wgDBname, $wgDBuser, $wgDBpassword, $wgDBsuperuser, $wgDBmwschema,
- $wgDBts2schema, $wgDBts2locale;
+ $wgDBts2schema;
print "OK</li>\n";
print "<li>Checking the version of Postgres...";
$version = pg_fetch_result($this->doQuery("SELECT version()"),0,0);
- if (!preg_match("/PostgreSQL (\d+\.\d+)(\S+)/", $version, $thisver)) {
+ $thisver = array();
+ if (!preg_match('/PostgreSQL (\d+\.\d+)(\S+)/', $version, $thisver)) {
print "<b>FAILED</b> (could not determine the version)</li>\n";
dieout("</ul>");
}
$SQL = "INSERT INTO interwiki(iw_prefix,iw_url,iw_local) VALUES ";
while ( ! feof( $f ) ) {
$line = fgets($f,1024);
- if (!preg_match("/^\s*(\(.+?),(\d)\)/", $line, $matches)) {
+ $matches = array();
+ if (!preg_match('/^\s*(\(.+?),(\d)\)/', $line, $matches)) {
continue;
}
- $yesno = $matches[2]; ## ? "'true'" : "'false'";
$this->query("$SQL $matches[1],$matches[2])");
}
print " (table interwiki successfully populated)...\n";
return "E'$s[1]'";
}
return "'" . pg_escape_string($s) . "'";
- return "E'" . pg_escape_string($s) . "'";
+ // Unreachable: return "E'" . pg_escape_string($s) . "'";
}
function quote_ident( $s ) {
}
$sk = $wgUser->getSkin();
- $talk = $wgContLang->getNsText( NS_TALK );
- $contribs = wfMsg( 'contribslink' );
if ( $this->mNewRev->isCurrent() && $wgUser->isAllowed('rollback') ) {
$rollback = ' ' . $sk->generateRollback( $this->mNewRev );
$ymids[$k] = $ymids[$k-1];
break;
}
- while (list ($junk, $y) = each($matches)) {
+ while (list ( /* $junk */, $y) = each($matches)) {
if ($y > $this->seq[$k-1]) {
USE_ASSERTS && assert($y < $this->seq[$k]);
// Optimization: this is a common case:
$words[] = $line;
$stripped[] = $line;
} else {
+ $m = array();
if (preg_match_all('/ ( [^\S\n]+ | [0-9_A-Za-z\x80-\xff]+ | . ) (?: (?!< \n) [^\S\n])? /xs',
$line, $m))
{
global $wgDjvuToXML;
if ( isset( $wgDjvuToXML ) ) {
$cmd = $wgDjvuToXML . ' --without-anno --without-text ' . $this->mFilename;
- $xml = wfShellExec( $cmd, $retval );
+ $xml = wfShellExec( $cmd );
} else {
$xml = null;
}
*/
$toolarray=array(
array( 'image'=>'button_bold.png',
- 'open' => "\'\'\'",
- 'close' => "\'\'\'",
+ 'open' => '\\\'\\\'\\\'',
+ 'close' => '\\\'\\\'\\\'',
'sample'=> wfMsg('bold_sample'),
'tip' => wfMsg('bold_tip'),
'key' => 'B'
),
array( 'image'=>'button_italic.png',
- 'open' => "\'\'",
- 'close' => "\'\'",
+ 'open' => '\\\'\\\'',
+ 'close' => '\\\'\\\'',
'sample'=> wfMsg('italic_sample'),
'tip' => wfMsg('italic_tip'),
'key' => 'I'
$dbw = wfGetDB( DB_MASTER );
$lockname = $dbw->addQuotes( FileStore::lockName() );
$result = $dbw->query( "SELECT RELEASE_LOCK($lockname)", __METHOD__ );
- $row = $dbw->fetchObject( $result );
+ $dbw->fetchObject( $result );
$dbw->freeResult( $result );
}
$numRows = $res->numRows();
$numBatches = ceil( $numRows / $this->mRowsPerJob );
$realBatchSize = $numRows / $numBatches;
- $boundaries = array();
$start = false;
$jobs = array();
do {
$flags = explode( ',', $row->old_flags );
if( in_array( 'external', $flags ) ) {
$url=$row->old_text;
- @list($proto,$path)=explode('://',$url,2);
+ @list( /* $proto */ ,$path)=explode('://',$url,2);
if ($path=="") {
wfProfileOut( $fname );
return false;
function wfRunHooks($event, $args = null) {
global $wgHooks;
- $fname = 'wfRunHooks';
if (!is_array($wgHooks)) {
throw new MWException("Global hooks array is not an array!\n");
* @return boolean True if it is valid.
*/
public static function isValid( $ip ) {
- return preg_match( '/^' . RE_IP_ADD . '$/', $ip, $matches) ;
+ return preg_match( '/^' . RE_IP_ADD . '$/', $ip) ;
}
/**
* @return array
*/
public static function toArray( $ipblock ) {
+ $matches = array();
if(! preg_match( '/^' . RE_IP_ADD . '(?:\/(?:'.RE_IP_PREFIX.'))?' . '$/', $ipblock, $matches ) ) {
return false;
} else {
* Load metadata from the file itself
*/
function loadFromFile() {
- global $wgUseSharedUploads, $wgSharedUploadDirectory, $wgContLang, $wgShowEXIF;
+ global $wgUseSharedUploads, $wgSharedUploadDirectory, $wgContLang;
wfProfileIn( __METHOD__ );
$this->imagePath = $this->getFullPath();
$this->fileExists = file_exists( $this->imagePath );
if ( !$this->mustRender() && $width == $this->width && $height == $this->height ) {
$url = $this->getURL();
} else {
- list( $isScriptUrl, $url ) = $this->thumbUrl( $width );
+ list( /* $isScriptUrl */, $url ) = $this->thumbUrl( $width );
}
$thumb = new ThumbnailImage( $url, $width, $height );
} else {
$dir = wfImageThumbDir( $this->name, $shared );
$urls = array();
foreach ( $files as $file ) {
+ $m = array();
if ( preg_match( '/^(\d+)px/', $file, $m ) ) {
- list( $isScriptUrl, $url ) = $this->thumbUrl( $m[1] );
+ list( /* $isScriptUrl */, $url ) = $this->thumbUrl( $m[1] );
$urls[] = $url;
@unlink( "$dir/$file" );
}
'' => 1.0, // "User units" pixels by default
'%' => 2.0, // Fake it!
);
+ $matches = array();
if( preg_match( '/^(\d+(?:\.\d+)?)(em|ex|px|pt|pc|cm|mm|in|%|)$/', $length, $matches ) ) {
$length = floatval( $matches[1] );
$unit = $matches[2];
fclose( $f );
// Uber-crappy hack! Run through a real XML parser.
+ $matches = array();
if( !preg_match( '/<svg\s*([^>]*)\s*>/s', $chunk, $matches ) ) {
return false;
}
}
# Find all links
+ $m = array();
if ( !preg_match_all( '/\[\[:?(.*?)\]\]/', $line, $m ) ) {
continue;
}
*
*/
function toHTML() {
- global $wgLang, $wgIgnoreImageErrors, $wgGenerateThumbnailOnParse;
+ global $wgLang, $wgGenerateThumbnailOnParse;
$sk = $this->getSkin();
$img =& $pair[0];
$text = $pair[1];
- $name = $img->getName();
$nt = $img->getTitle();
if( $nt->getNamespace() != NS_IMAGE ) {
* Used in matchAndRemove()
* @private
**/
- function pregRemoveAndRecord( $match ) {
+ function pregRemoveAndRecord( ) {
$this->mFound = true;
return '';
}
$retval = substr ($contents, 0, 1);
$errmsg = '';
if (($retval == 'C') || ($retval == 'M') || ($retval == 'L')) {
- if ($retval == 'C')
+ if ($retval == 'C') {
$this->conservativeness = 2;
- else if ($retval == 'M')
+ } else if ($retval == 'M') {
$this->conservativeness = 1;
- else
+ } else {
$this->conservativeness = 0;
+ }
$outdata = substr ($contents, 33);
$i = strpos($outdata, "\000");
$this->mathml = substr($outdata, $i+1);
} else if (($retval == 'c') || ($retval == 'm') || ($retval == 'l')) {
$this->html = substr ($contents, 33);
- if ($retval == 'c')
+ if ($retval == 'c') {
$this->conservativeness = 2;
- else if ($retval == 'm')
+ } else if ($retval == 'm') {
$this->conservativeness = 1;
- else
+ } else {
$this->conservativeness = 0;
+ }
$this->mathml = NULL;
} else if ($retval == 'X') {
$this->html = NULL;
$this->hash = substr ($contents, 1, 32);
}
- $res = wfRunHooks( 'MathAfterTexvc', array( &$this, &$errmsg ) );
+ wfRunHooks( 'MathAfterTexvc', array( &$this, &$errmsg ) );
if ( $errmsg ) {
return $errmsg;
*/
/**
- *
+ * TODO: Perhaps make this file into a Metadata class, with static methods (declared
+ * as private where indicated), to move these functions out of the global namespace?
*/
define('RDF_TYPE_PREFS', "application/rdf+xml,text/xml;q=0.7,application/xml;q=0.5,text/rdf;q=0.1");
dcPerson('contributor', $user_parts[0], $user_parts[1], $user_parts[2]);
}
- dcRights($article);
+ dcRights();
}
/**
* different pages.
* @private
*/
-function dcRights($article) {
+function dcRights() {
global $wgRightsPage, $wgRightsUrl, $wgRightsText;
* Do the list
*/
$pager = new PageHistoryPager( $this );
- $navbar = $pager->getNavigationBar();
$this->linesonpage = $pager->getNumRows();
$wgOut->addHTML(
$pager->getNavigationBar() .
$next = array( 'offset' => $this->mLastShown, 'limit' => $urlLimit );
$last = array( 'dir' => 'prev', 'limit' => $urlLimit );
}
- return compact( 'prev', 'next', 'first', 'last' );
+ return array( 'prev' => $prev, 'next' => $next, 'first' => $first, 'last' => $last );
}
/**
$fname = 'ParserCache::get';
wfProfileIn( $fname );
- $hash = $user->getPageRenderingHash();
- $pageid = intval( $article->getID() );
$key = $this->getKey( $article, $user );
wfDebug( "Trying parser cache $key\n" );
}
function profileOut($functionname) {
- $memory = memory_get_usage();
-
global $wgDebugFunctionEntry;
if ($wgDebugFunctionEntry) {
$this->debug(str_repeat(' ', count($this->mWorkStack) - 1).'Exiting '.$functionname."\n");
}
- list($ofname,$ocount,$ortime,$octime) = array_pop($this->mWorkStack);
+ list($ofname, /* $ocount */ ,$ortime,$octime) = array_pop($this->mWorkStack);
if (!$ofname) {
$this->debug("Profiling error: $functionname\n");
# Use external methods for external objects, text in table is URL-only then
if ( in_array( 'external', $flags ) ) {
$url=$text;
- @list($proto,$path)=explode('://',$url,2);
+ @list(/* $proto */,$path)=explode('://',$url,2);
if ($path=="") {
wfProfileOut( $fname );
return false;
$this->searchTerms = array();
# FIXME: This doesn't handle parenthetical expressions.
+ $m = array();
if( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
$filteredText, $m, PREG_SET_ORDER ) ) {
foreach( $m as $terms ) {
$this->searchTerms[] = $regexp;
}
wfDebug( "Would search with '$searchon'\n" );
- wfDebug( "Match with /\b" . implode( '\b|\b', $this->searchTerms ) . "\b/\n" );
+ wfDebug( 'Match with /\b' . implode( '\b|\b', $this->searchTerms ) . "\b/\n" );
} else {
wfDebug( "Can't understand search query '{$filteredText}'\n" );
}
$this->searchTerms = array();
# FIXME: This doesn't handle parenthetical expressions.
+ $m = array();
if( preg_match_all( '/([-+<>~]?)(([' . $lc . ']+)(\*?)|"[^"]*")/',
$filteredText, $m, PREG_SET_ORDER ) ) {
foreach( $m as $terms ) {
$this->searchTerms[] = $regexp;
}
wfDebug( "Would search with '$searchon'\n" );
- wfDebug( "Match with /\b" . implode( '\b|\b', $this->searchTerms ) . "\b/\n" );
+ wfDebug( 'Match with /\b' . implode( '\b|\b', $this->searchTerms ) . "\b/\n" );
} else {
wfDebug( "Can't understand search query '{$this->filteredText}'\n" );
}
# while code from www.php.net
while (false !== ($file = $skinDir->read())) {
// Skip non-PHP files, hidden files, and '.dep' includes
+ $matches = array();
if(preg_match('/^([^.]*)\.php$/',$file, $matches)) {
$aSkin = $matches[1];
$wgValidSkinNames[strtolower($aSkin)] = $aSkin;
function getUserStylesheet() {
global $wgStylePath, $wgRequest, $wgContLang, $wgSquidMaxage, $wgStyleVersion;
$sheet = $this->getStylesheet();
- $action = $wgRequest->getText('action');
$s = "@import \"$wgStylePath/common/common.css?$wgStyleVersion\";\n";
$s .= "@import \"$wgStylePath/$sheet?$wgStyleVersion\";\n";
if($wgContLang->isRTL()) $s .= "@import \"$wgStylePath/common/common_rtl.css?$wgStyleVersion\";\n";
else $a = array( 'bgcolor' => '#FFFFFF' );
if($wgOut->isArticle() && $wgUser->getOption('editondblclick') &&
$wgTitle->userCanEdit() ) {
- $t = wfMsg( 'editthispage' );
$s = $wgTitle->getFullURL( $this->editUrlOptions() );
$s = 'document.location = "' .wfEscapeJSString( $s ) .'";';
$a += array ('ondblclick' => $s);
function pageTitleLinks() {
global $wgOut, $wgTitle, $wgUser, $wgRequest;
- extract( $wgRequest->getValues( 'oldid', 'diff' ) );
+ $oldid = $wgRequest->getVal( 'oldid' );
+ $diff = $wgRequest->getVal( 'diff' );
$action = $wgRequest->getText( 'action' );
$s = $this->printableLink();
function nameAndLogin() {
global $wgUser, $wgTitle, $wgLang, $wgContLang, $wgShowIPinHeader;
- $li = $wgContLang->specialPage( 'Userlogin' );
$lo = $wgContLang->specialPage( 'Userlogout' );
$s = '';
global $wgOut, $wgLang, $wgArticle, $wgRequest, $wgUser;
global $wgDisableCounters, $wgMaxCredits, $wgShowCreditsIfMax, $wgTitle, $wgPageShowWatchingUsers;
- extract( $wgRequest->getValues( 'oldid', 'diff' ) );
+ $oldid = $wgRequest->getVal( 'oldid' );
+ $diff = $wgRequest->getVal( 'diff' );
if ( ! $wgOut->isArticle() ) { return ''; }
if ( isset( $oldid ) || isset( $diff ) ) { return ''; }
if ( 0 == $wgArticle->getID() ) { return ''; }
*/
function specialPagesList() {
global $wgUser, $wgContLang, $wgServer, $wgRedirectScript;
- $a = array();
$pages = array_merge( SpecialPage::getRegularPages(), SpecialPage::getRestrictedPages() );
foreach ( $pages as $name => $page ) {
$pages[$name] = $page->getDescription();
}
}
if ($cacheSidebar)
- $cachednotice = $parserMemc->set( $key, $bar, 86400 );
+ $parserMemc->set( $key, $bar, 86400 );
wfProfileOut( $fname );
return $bar;
}
// adding of CSS or Javascript by extensions.
wfRunHooks( 'BeforePageDisplay', array( &$out ) );
- extract( $wgRequest->getValues( 'oldid', 'diff' ) );
+ $oldid = $wgRequest->getVal( 'oldid' );
+ $diff = $wgRequest->getVal( 'diff' );
wfProfileIn( "$fname-init" );
$this->initPage( $out );
$variants = $wgContLang->getVariants();
if( !$wgDisableLangConversion && sizeof( $variants ) > 1 ) {
$preferred = $wgContLang->getPreferredVariant();
- $actstr = '';
- if( $action )
- $actstr = 'action=' . $action . '&';
$vcount=0;
foreach( $variants as $code ) {
$varname = $wgContLang->getVariantname( $code );
$action = $wgRequest->getText( 'action' );
$oldid = $wgRequest->getVal( 'oldid' );
- $diff = $wgRequest->getVal( 'diff' );
$nav_urls = array();
$nav_urls['mainpage'] = array( 'href' => self::makeI18nUrl( 'mainpage') );
# Make sure all extension messages are available
MessageCache::loadAllMessages();
- $first = true;
$sortedArray = array_merge( Language::getMessagesFor( 'en' ), $wgMessageCache->getExtensionMessagesFor( 'en' ) );
ksort( $sortedArray );
$messages = array();
} else {
$comment = '';
}
- $txt .= "'$key' => '" . preg_replace( "/(?<!\\\\)'/", "\'", $m['msg']) . "',$comment\n";
+ $txt .= "'$key' => '" . preg_replace( '/(?<!\\\\)\'/', "\'", $m['msg']) . "',$comment\n";
}
$txt .= ');';
return $txt;
$sk =& $wgUser->getSkin();
$talk = $wgLang->getNsText( NS_TALK );
- $mwnspace = $wgLang->getNsText( NS_MEDIAWIKI );
- $mwtalk = $wgLang->getNsText( NS_MEDIAWIKI_TALK );
$input = wfElement( 'input', array(
'type' => 'text',
* @param integer $namespace (Default NS_MAIN)
*/
function showline( $inpoint, $outpoint, $namespace = NS_MAIN ) {
- global $wgUser;
-
$inpointf = htmlspecialchars( str_replace( '_', ' ', $inpoint ) );
$outpointf = htmlspecialchars( str_replace( '_', ' ', $outpoint ) );
$queryparams = ($namespace ? "namespace=$namespace" : '');
function showList() {
global $wgOut, $wgContLang;
- $fname = "BookSourceList::showList()";
# First, see if we have a custom list setup in
# [[Wikipedia:Book sources]] or equivalent.
function askForm() {
global $wgOut, $wgTitle;
- $fname = "BookSourceList::askForm()";
$action = $wgTitle->escapeLocalUrl();
$isbn = htmlspecialchars( wfMsg( "isbn" ) );
function getSQL() {
$dbr =& wfGetDB( DB_SLAVE );
- extract( $dbr->tableNames( 'page', 'pagelinks', 'templatelinks' ) );
+ list( $page, $pagelinks, $templatelinks) = $dbr->tableNamesN( 'page', 'pagelinks', 'templatelinks' );
$dMsgText = wfMsgForContent('disambiguationspage');
global $wgExportAllowHistory, $wgExportMaxHistory;
$curonly = true;
- $fullHistory = array(
- 'dir' => 'asc',
- 'offset' => false,
- 'limit' => $wgExportMaxHistory,
- );
if( $wgRequest->wasPosted() ) {
$page = $wgRequest->getText( 'pages' );
$curonly = $wgRequest->getCheck( 'curonly' );
*
*/
function wfSpecialImagelist() {
- global $wgUser, $wgOut, $wgLang, $wgContLang, $wgRequest, $wgMiserMode;
+ global $wgOut;
$pager = new ImageListPager;
}
$conds = array();
+ $matches = array();
if ( $this->ip == '' ) {
// No extra conditions
} elseif ( substr( $this->ip, 0, 1 ) == '#' ) {
} elseif ( IP::toUnsigned( $this->ip ) !== false ) {
$conds['ipb_address'] = $this->ip;
$conds['ipb_auto'] = 0;
- } elseif( preg_match( "/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\\/(\\d{1,2})$/", $this->ip, $matches ) ) {
+ } elseif( preg_match( '/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\\/(\\d{1,2})$/', $this->ip, $matches ) ) {
$conds['ipb_address'] = Block::normaliseRange( $this->ip );
$conds['ipb_auto'] = 0;
} else {
*/
function getQuery() {
$logging = $this->db->tableName( "logging" );
- $user = $this->db->tableName( 'user' );
$sql = "SELECT /*! STRAIGHT_JOIN */ log_type, log_action, log_timestamp,
log_user, user_name,
log_namespace, log_title, page_id,
function logLine( $s ) {
global $wgLang;
$title = Title::makeTitle( $s->log_namespace, $s->log_title );
- $user = Title::makeTitleSafe( NS_USER, $s->user_name );
$time = $wgLang->timeanddate( wfTimestamp(TS_MW, $s->log_timestamp), true );
// Enter the existence or non-existence of this page into the link cache,
* Load some values
*/
function PreferencesForm( &$request ) {
- global $wgLang, $wgContLang, $wgUser, $wgAllowRealName;
+ global $wgContLang, $wgUser, $wgAllowRealName;
$this->mQuickbar = $request->getVal( 'wpQuickbar' );
$this->mOldpass = $request->getVal( 'wpOldpass' );
$togs = User::getToggles();
foreach ( $togs as $tname ) {
- $ttext = wfMsg('tog-'.$tname);
$this->mToggles[$tname] = $wgUser->getOption( $tname );
}
$enotifusertalkpages = ($wgEnotifUserTalk) ? $this->getToggle( 'enotifusertalkpages', false, $disableEmailPrefs ) : '';
$enotifminoredits = ($wgEnotifWatchlist && $wgEnotifMinorEdits) ? $this->getToggle( 'enotifminoredits', false, $disableEmailPrefs ) : '';
$enotifrevealaddr = (($wgEnotifWatchlist || $wgEnotifUserTalk) && $wgEnotifRevealEditorAddress) ? $this->getToggle( 'enotifrevealaddr', false, $disableEmailPrefs ) : '';
- $prefs_help_email_enotif = ( $wgEnotifWatchlist || $wgEnotifUserTalk) ? ' ' . wfMsg('prefs-help-email-enotif') : '';
- $prefs_help_realname = '';
# </FIXME>
$n = 0;
$out = '<table style="background: inherit;" border="0" width="100%">';
- $namespaces = $wgContLang->getFormattedNamespaces();
while( ($n < $this->maxPerPage) && ($s = $dbr->fetchObject( $res )) ) {
$t = Title::makeTitle( $s->page_namespace, $s->page_title );
if( $t ) {
* used as e.g. Special:Randompage/Category
*/
function wfSpecialRandompage( $par = NS_MAIN ) {
- global $wgOut, $wgExtraRandompageSQL, $wgContLang, $wgLang;
+ global $wgOut, $wgExtraRandompageSQL;
$fname = 'wfSpecialRandompage';
# Determine namespace
function goResult( $term ) {
global $wgOut;
global $wgGoToEdit;
- global $wgContLang;
$this->setupPage( $term );
# No match, generate an edit URL
$t = Title::newFromText( $term );
- if( is_null( $t ) ) {
- $editurl = ''; # hrm...
- } else {
+ if( ! is_null( $t ) ) {
wfRunHooks( 'SpecialSearchNogomatch', array( &$t ) );
# If the feature is enabled, go straight to the edit page
if ( $wgGoToEdit ) {
$wgOut->redirect( $t->getFullURL( 'action=edit' ) );
return;
- } else {
- $editurl = $t->escapeLocalURL( 'action=edit' );
- }
+ }
}
$wgOut->addWikiText( wfMsg( 'noexactmatch', wfEscapeWikiText( $term ) ) );
$this->setupPage( $term );
- global $wgUser, $wgOut;
- $sk = $wgUser->getSkin();
+ global $wgOut;
$wgOut->addWikiText( wfMsg( 'searchresulttext' ) );
#if ( !$this->parseQuery() ) {
break;
}
++$lineno;
+ $m = array();
if ( ! preg_match( $pat1, $line, $m ) ) {
continue;
}
/** Put them into a sortable array */
$sortedPages = array();
- foreach ( $pages as $name => $page ) {
+ foreach ( $pages as $page ) {
if ( $page->isListed() ) {
$sortedPages[$page->getDescription()] = $page->getTitle();
}
}
$revision = null;
- $newRevId = $previousRevId;
$restored = 0;
while( $row = $dbw->fetchObject( $result ) ) {
'minor_edit' => $row->ar_minor_edit,
'text_id' => $row->ar_text_id,
) );
- $newRevId = $revision->insertOn( $dbw );
+ $revision->insertOn( $dbw );
$restored++;
}
}
$archive = new PageArchive( $this->mTargetObj );
- $text = $archive->getLastRevisionText();
/*
+ $text = $archive->getLastRevisionText();
if( is_null( $text ) ) {
$wgOut->addWikiText( wfMsg( "nohistory" ) );
return;
global $wgOut, $wgUser;
if( !is_null( $this->mTargetObj ) ) {
$archive = new PageArchive( $this->mTargetObj );
- $ok = true;
$ok = $archive->undelete(
$this->mTargetTimestamp,
// subversion is release 1.4
return intval( $content[3] );
}
-
- return false;
}
/**#@-*/
wfProfileIn( $fname );
# Get a list of URLs linking to this page
- $id = $title->getArticleID();
-
$dbr =& wfGetDB( DB_SLAVE );
$res = $dbr->select( array( 'links', 'page' ),
array( 'page_namespace', 'page_title' ),
$encEnd = preg_quote( $endDelim, '!' );
$strcmp = strpos( $flags, 'i' ) === false ? 'strcmp' : 'strcasecmp';
$endLength = strlen( $endDelim );
-
+ $m = array();
+
while ( $inputPos < strlen( $subject ) &&
preg_match( "!($encStart)|($encEnd)!S$flags", $subject, $m, PREG_OFFSET_CAPTURE, $inputPos ) )
{
* @access public
*/
public static function newFromText( $text, $defaultNamespace = NS_MAIN ) {
- $fname = 'Title::newFromText';
-
if( is_object( $text ) ) {
throw new MWException( 'Title::newFromText given an object' );
}
$mwRedir = MagicWord::get( 'redirect' );
$rt = NULL;
if ( $mwRedir->matchStart( $text ) ) {
+ $m = array();
if ( preg_match( '/\[{2}(.*?)(?:\||\]{2})/', $text, $m ) ) {
# categories are escaped using : for example one can enter:
# #REDIRECT [[:Category:Music]]. Need to remove it.
} else {
global $wgActionPaths;
$url = false;
+ $matches = array();
if( !empty( $wgActionPaths ) &&
preg_match( '/^(.*&|)action=([^&]*)(&(.*)|)$/', $query, $matches ) )
{
*/
/* private */ function secureAndSplit() {
global $wgContLang, $wgLocalInterwiki, $wgCapitalLinks;
- $fname = 'Title::secureAndSplit';
# Initialisation
static $rxTc = false;
# Namespace or interwiki prefix
$firstPass = true;
do {
+ $m = array();
if ( preg_match( "/^(.+?)_*:_*(.*)$/S", $t, $m ) ) {
$p = $m[1];
$lowerNs = $wgContLang->lc( $p );
*/
function getLinksTo( $options = '', $table = 'pagelinks', $prefix = 'pl' ) {
$linkCache =& LinkCache::singleton();
- $id = $this->getArticleID();
if ( $options ) {
$db =& wfGetDB( DB_MASTER );
}
$now = wfTimestampNow();
- $rand = wfRandom();
$newid = $nt->getArticleID();
$oldid = $this->getArticleID();
$dbw =& wfGetDB( DB_MASTER );
'page' => $newid,
'comment' => $comment,
'text' => $redirectText ) );
- $revid = $redirectRevision->insertOn( $dbw );
+ $redirectRevision->insertOn( $dbw );
$redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 );
$linkCache->clearLink( $this->getPrefixedDBkey() );
$oldid = $this->getArticleID();
$dbw =& wfGetDB( DB_MASTER );
$now = $dbw->timestamp();
- $rand = wfRandom();
$linkCache =& LinkCache::singleton();
# Save a null revision in the page's history notifying of the move
'page' => $newid,
'comment' => $comment,
'text' => $redirectText ) );
- $revid = $redirectRevision->insertOn( $dbw );
+ $redirectRevision->insertOn( $dbw );
$redirectArticle->updateRevisionOn( $dbw, $redirectRevision, 0 );
$linkCache->clearLink( $this->getPrefixedDBkey() );
# Does the redirect point to the source?
# Or is it a broken self-redirect, usually caused by namespace collisions?
+ $m = array();
if ( preg_match( "/\\[\\[\\s*([^\\]\\|]*)]]/", $text, $m ) ) {
$redirTitle = Title::newFromText( $m[1] );
if( !is_object( $redirTitle ) ||
'comment' => $comment,
'text' => "#REDIRECT [[" . $dest->getPrefixedText() . "]]\n",
) );
- $revisionId = $revision->insertOn( $dbw );
+ $revision->insertOn( $dbw );
$article->updateRevisionOn( $dbw, $revision, 0 );
# Link table
*/
function isSpecial( $name ) {
if ( $this->getNamespace() == NS_SPECIAL ) {
- list( $thisName, $subpage ) = SpecialPage::resolveAliasWithSubpage( $this->getDBkey() );
+ list( $thisName, /* $subpage */ ) = SpecialPage::resolveAliasWithSubpage( $this->getDBkey() );
if ( $name == $thisName ) {
return true;
}
*/
function sendConfirmationMail() {
global $wgContLang;
+ $expiration = null; // gets passed-by-ref and defined in next line.
$url = $this->confirmationTokenUrl( $expiration );
return $this->sendMail( wfMsg( 'confirmemail_subject' ),
wfMsg( 'confirmemail_body',
* @return bool
* @static
*/
- public static function isError( &$object ) {
+ public static function isError( $object ) {
return $object instanceof WikiError;
}
}
return false;
$this->stats['get_multi']++;
-
+ $sock_keys = array();
+
foreach ($keys as $key)
{
$sock = $this->get_sock($key);
list ($ip, $port) = explode(":", $host);
$sock = false;
$timeout = $this->_connect_timeout;
+ $errno = $errstr = null;
for ($i = 0; !$sock && $i < $this->_connect_attempts; $i++) {
if ($i > 0) {
# Sleep until the timeout, in case it failed fast
function _dead_sock ($sock)
{
$host = array_search($sock, $this->_cache_sock);
- @list ($ip, $port) = explode(":", $host);
+ @list ($ip, /* $port */) = explode(":", $host);
$this->_host_dead[$ip] = time() + 30 + intval(rand(0, 10));
$this->_host_dead[$host] = $this->_host_dead[$ip];
unset($this->_cache_sock[$host]);
stream_set_timeout($sock, 1, 0);
$line = fgets($sock);
+ $match = array();
if (!preg_match('/^(\d+)/', $line, $match))
return null;
return $match[1];
if (isset($this->_cache_sock[$host]))
return $this->_cache_sock[$host];
+ $sock = null;
$now = time();
- list ($ip, $port) = explode (":", $host);
+ list ($ip, /* $port */) = explode (":", $host);
if (isset($this->_host_dead[$host]) && $this->_host_dead[$host] > $now ||
isset($this->_host_dead[$ip]) && $this->_host_dead[$ip] > $now)
return null;