if ( is_array( $result ) && count( $result ) && !is_array( $result[0] ) ) {
// A single array representing an error
$errors[] = $result;
- } else if ( is_array( $result ) && is_array( $result[0] ) ) {
+ } elseif ( is_array( $result ) && is_array( $result[0] ) ) {
// A nested array representing multiple errors
$errors = array_merge( $errors, $result );
- } else if ( $result !== '' && is_string( $result ) ) {
+ } elseif ( $result !== '' && is_string( $result ) ) {
// A string representing a message-id
$errors[] = array( $result );
- } else if ( $result === false ) {
+ } elseif ( $result === false ) {
// a generic "We don't want them to do that"
$errors[] = array( 'badaccess-group0' );
}
&& !preg_match( '/^' . preg_quote( $user->getName(), '/' ) . '\//', $this->mTextform ) ) {
if ( $this->isCssSubpage() && !$user->isAllowed( 'editusercss' ) ) {
$errors[] = array( 'customcssprotected' );
- } else if ( $this->isJsSubpage() && !$user->isAllowed( 'edituserjs' ) ) {
+ } elseif ( $this->isJsSubpage() && !$user->isAllowed( 'edituserjs' ) ) {
$errors[] = array( 'customjsprotected' );
}
}
if ( isset( $this->mCascadeSources ) && $getPages ) {
return array( $this->mCascadeSources, $this->mCascadingRestrictions );
- } else if ( isset( $this->mHasCascadingRestrictions ) && !$getPages ) {
+ } elseif ( isset( $this->mHasCascadingRestrictions ) && !$getPages ) {
return array( $this->mHasCascadingRestrictions, $pagerestrictions );
}
if ( $wgContLang->getNsIndex( $x[1] ) ) {
# Disallow Talk:File:x type titles...
return false;
- } else if ( Interwiki::isValidInterwiki( $x[1] ) ) {
+ } elseif ( Interwiki::isValidInterwiki( $x[1] ) ) {
# Disallow Talk:Interwiki:x type titles...
return false;
}
$u->doUpdate();
$dbw->commit();
-
+
# Update site_stats
if ( $this->isContentPage() && !$nt->isContentPage() ) {
# No longer a content page
* @return String: MW timestamp
*/
public function getEarliestRevTime( $flags = 0 ) {
- $rev = $this->getFirstRevision( $flags );
+ $rev = $this->getFirstRevision( $flags );
return $rev ? $rev->getTimestamp() : null;
}
return false;
}
$wgRequest->setSessionData( 'wsUserID', $sId );
- } else if ( $sessId !== null && $sessId != 0 ) {
+ } elseif ( $sessId !== null && $sessId != 0 ) {
$sId = $sessId;
} else {
$this->loadDefaults();
if ( $wgRequest->getSessionData( 'wsUserName' ) !== null ) {
$sName = $wgRequest->getSessionData( 'wsUserName' );
- } else if ( $wgRequest->getCookie( 'UserName' ) !== null ) {
+ } elseif ( $wgRequest->getCookie( 'UserName' ) !== null ) {
$sName = $wgRequest->getCookie( 'UserName' );
$wgRequest->setSessionData( 'wsUserName', $sName );
} else {
if ( $wgRequest->getSessionData( 'wsToken' ) !== null ) {
$passwordCorrect = $proposedUser->getToken() === $wgRequest->getSessionData( 'wsToken' );
$from = 'session';
- } else if ( $wgRequest->getCookie( 'Token' ) !== null ) {
+ } elseif ( $wgRequest->getCookie( 'Token' ) !== null ) {
$passwordCorrect = $proposedUser->getToken() === $wgRequest->getCookie( 'Token' );
$from = 'cookie';
} else {
// User is already an IP?
if( IP::isIPAddress( $this->getName() ) ) {
$ip = $this->getName();
- } else if( !$ip ) {
+ } elseif( !$ip ) {
$ip = wfGetIP();
}
$blocked = false;
}
/**
- * Check if Internet Explorer will detect an incorrect cache extension in
+ * Check if Internet Explorer will detect an incorrect cache extension in
* PATH_INFO or QUERY_STRING. If the request can't be allowed, show an error
* message or redirect to a safer URL. Returns true if the URL is OK, and
* false if an error message has been shown and the request should be aborted.
}
wfHttpError( 403, 'Forbidden',
'Invalid file extension found in the path info or query string.' );
-
+
return false;
}
return true;
}
/**
- * Attempt to redirect to a URL with a QUERY_STRING that's not dangerous in
+ * Attempt to redirect to a URL with a QUERY_STRING that's not dangerous in
* IE 6. Returns true if it was successful, false otherwise.
*/
protected function doSecurityRedirect( $url ) {
<body>
<h1>Security redirect</h1>
<p>
-We can't serve non-HTML content from the URL you have requested, because
+We can't serve non-HTML content from the URL you have requested, because
Internet Explorer would interpret it as an incorrect and potentially dangerous
content type.</p>
-<p>Instead, please use <a href="$encUrl">this URL</a>, which is the same as the URL you have requested, except that
-"&*" is appended. This prevents Internet Explorer from seeing a bogus file
+<p>Instead, please use <a href="$encUrl">this URL</a>, which is the same as the URL you have requested, except that
+"&*" is appended. This prevents Internet Explorer from seeing a bogus file
extension.
</p>
</body>
* QUERY_STRING, since IE 6 and earlier will use this to get the file type
* if there was no dot before the question mark (bug 28235).
*
- * @deprecated Use checkUrlExtension().
+ * @deprecated Use checkUrlExtension().
*/
public function isPathInfoBad( $extWhitelist = array() ) {
global $wgScriptExtension;
foreach ( $langs as $lang => $val ) {
if ( $val === '' ) {
$langs[$lang] = 1;
- } else if ( $val == 0 ) {
+ } elseif ( $val == 0 ) {
unset($langs[$lang]);
}
}
// If the user is not logged in, the Namespace:title of the article must be in
// the Read array in order for the user to see it. (We have to check here to
// catch special pages etc. We check again in Article::view())
- } else if ( !$title->userCanRead() ) {
+ } elseif ( !$title->userCanRead() ) {
$output->loginToUse();
// Interwiki redirects
- } else if ( $title->getInterwiki() != '' ) {
+ } elseif ( $title->getInterwiki() != '' ) {
$rdfrom = $request->getVal( 'rdfrom' );
if ( $rdfrom ) {
$url = $title->getFullURL( 'rdfrom=' . urlencode( $rdfrom ) );
throw new ErrorPageError( 'badtitle', 'badtitletext' );
}
// Redirect loops, no title in URL, $wgUsePathInfo URLs, and URLs with a variant
- } else if ( $request->getVal( 'action', 'view' ) == 'view' && !$request->wasPosted()
+ } elseif ( $request->getVal( 'action', 'view' ) == 'view' && !$request->wasPosted()
&& ( $request->getVal( 'title' ) === null || $title->getPrefixedDBKey() != $request->getVal( 'title' ) )
&& !count( array_diff( array_keys( $request->getValues() ), array( 'action', 'title' ) ) ) )
{
$output->redirect( $targetUrl, '301' );
}
// Special pages
- } else if ( NS_SPECIAL == $title->getNamespace() ) {
+ } elseif ( NS_SPECIAL == $title->getNamespace() ) {
// actions that need to be made when we have a special pages
SpecialPageFactory::executePath( $title, $this->context );
} else {
}
if( $year ) {
$encYear = intval( $year );
- } else if( $encMonth ) {
+ } elseif( $encMonth ) {
$thisMonth = intval( gmdate( 'n' ) );
$thisYear = intval( gmdate( 'Y' ) );
if( intval($encMonth) > $thisMonth ) {
* Convenience function to build an HTML form label
* @param $label String text of the label
* @param $id
- * @param $attribs Array an attribute array. This will usuall be
+ * @param $attribs Array an attribute array. This will usuall be
* the same array as is passed to the corresponding input element,
- * so this function will cherry-pick appropriate attributes to
+ * so this function will cherry-pick appropriate attributes to
* apply to the label as well; currently only class is applied.
* @return string HTML
*/
}
/**
- * Create a call to a JavaScript function. The supplied arguments will be
- * encoded using Xml::encodeJsVar().
+ * Create a call to a JavaScript function. The supplied arguments will be
+ * encoded using Xml::encodeJsVar().
*
* @param $name String The name of the function to call, or a JavaScript expression
* which evaluates to a function object which is called.
}
/**
- * A wrapper class which causes Xml::encodeJsVar() and Xml::encodeJsCall() to
- * interpret a given string as being a JavaScript expression, instead of string
+ * A wrapper class which causes Xml::encodeJsVar() and Xml::encodeJsCall() to
+ * interpret a given string as being a JavaScript expression, instead of string
* data.
*
* Example:
if( !$user->isAllowed( 'deletedhistory' ) ) {
$output->permissionRequired( 'deletedhistory' );
return;
- } else if( wfReadOnly() ) {
+ } elseif( wfReadOnly() ) {
$output->readOnlyPage();
return;
}
foreach( $bitPars as $const => $val ) {
if( $val == 1 ) {
$newBits |= $const; // $const is the *_deleted const
- } else if( $val == -1 ) {
+ } elseif( $val == -1 ) {
$newBits |= ($oldfield & $const); // use existing
}
}
if ( !$file->exists() ) {
$wgOut->addWikiMsg( 'filedelete-nofile', $this->mFilename );
return;
- } else if( !$file->userCan( File::DELETED_FILE ) ) {
+ } elseif( !$file->userCan( File::DELETED_FILE ) ) {
if( $file->isDeleted( File::DELETED_RESTRICTED ) ) {
$wgOut->permissionRequired( 'suppressrevision' );
} else {
if( !$rev->userCan( Revision::DELETED_TEXT ) ) {
$pageLink = htmlspecialchars( $wgLang->timeanddate( $ts, true ) );
$last = wfMsgHtml( 'diff' );
- } else if( $remaining > 0 || ( $earliestLiveTime && $ts > $earliestLiveTime ) ) {
+ } elseif( $remaining > 0 || ( $earliestLiveTime && $ts > $earliestLiveTime ) ) {
$pageLink = $this->getPageLink( $rev, $titleObj, $ts, $sk );
$last = $sk->linkKnown(
$titleObj,
if ( $action == 'success' ) {
$this->showSuccess();
- } else if ( $action == 'submit' && $wgRequest->wasPosted() &&
+ } elseif ( $action == 'submit' && $wgRequest->wasPosted() &&
$wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) {
$this->doSubmit();
} else {
if ( isset( $wgLocalTZoffset ) ) {
$minDiff = $wgLocalTZoffset;
}
- } else if ( $data[0] == 'Offset' ) {
+ } elseif ( $data[0] == 'Offset' ) {
$minDiff = intval( $data[1] );
} else {
$data = explode( ':', $tz );
$c = intval( ( $Mar + 3 * ( $year - 1 ) + 5 * $b + 5 ) % 7 );
if ( $c == 0 && $a > 11 && $m >= 0.89772376543210 ) {
$Mar++;
- } else if ( $c == 1 && $a > 6 && $m >= 0.63287037037037 ) {
+ } elseif ( $c == 1 && $a > 6 && $m >= 0.63287037037037 ) {
$Mar += 2;
- } else if ( $c == 2 || $c == 4 || $c == 6 ) {
+ } elseif ( $c == 2 || $c == 4 || $c == 6 ) {
$Mar++;
}
# Add 543 years to the Gregorian calendar
# Months and days are identical
$gy_offset = $gy + 543;
- } else if ( ( !strcmp( $cName, 'minguo' ) ) || !strcmp( $cName, 'juche' ) ) {
+ } elseif ( ( !strcmp( $cName, 'minguo' ) ) || !strcmp( $cName, 'juche' ) ) {
# Minguo dates
# Deduct 1911 years from the Gregorian calendar
# Months and days are identical
$gy_offset = $gy - 1911;
- } else if ( !strcmp( $cName, 'tenno' ) ) {
+ } elseif ( !strcmp( $cName, 'tenno' ) ) {
# Nengō dates up to Meiji period
# Deduct years from the Gregorian calendar
# depending on the nengo periods
$gy_offset = '元';
}
$gy_offset = '明治' . $gy_offset;
- } else if (
+ } elseif (
( ( $gy == 1912 ) && ( $gm == 7 ) && ( $gd == 31 ) ) ||
( ( $gy == 1912 ) && ( $gm >= 8 ) ) ||
( ( $gy > 1912 ) && ( $gy < 1926 ) ) ||
$gy_offset = '元';
}
$gy_offset = '大正' . $gy_offset;
- } else if (
+ } elseif (
( ( $gy == 1926 ) && ( $gm == 12 ) && ( $gd >= 26 ) ) ||
( ( $gy > 1926 ) && ( $gy < 1989 ) ) ||
( ( $gy == 1989 ) && ( $gm == 1 ) && ( $gd < 8 ) )
for ( $i = $m; $i >= 0; $i-- ) {
if ( $i == $m ) {
$s = $l[$i];
- } else if ( $i == $m - 1 ) {
+ } elseif ( $i == $m - 1 ) {
$s = $l[$i] . $this->getMessageFromDB( 'and' ) . $this->getMessageFromDB( 'word-separator' ) . $s;
} else {
$s = $l[$i] . $this->getMessageFromDB( 'comma-separator' ) . $s;
if ( $tag != '' ) {
if ( $tagType == 0 && $lastCh != '/' ) {
$openTags[] = $tag; // tag opened (didn't close itself)
- } else if ( $tagType == 1 ) {
+ } elseif ( $tagType == 1 ) {
if ( $openTags && $tag == $openTags[count( $openTags ) - 1] ) {
array_pop( $openTags ); // tag closed
}
return preg_replace_callback (
'/([cghjsu]x?)((?:xx)*)(?!x)/i',
array( $this, 'strrtxuCallback' ), $string );
- } else if ( strcasecmp( $in, 'UTF-8' ) == 0 && strcasecmp( $out, 'x' ) == 0 ) {
+ } elseif ( strcasecmp( $in, 'UTF-8' ) == 0 && strcasecmp( $out, 'x' ) == 0 ) {
# Double Xs only if they follow cxapelutaj literoj.
return preg_replace_callback(
'/((?:[cghjsu]|\xc4[\x88\x89\x9c\x9d\xa4\xa5\xb4\xb5]|\xc5[\x9c\x9d\xac\xad])x*)/i',
if( $variant == 'sr-ec' ) {
return $numCyrillic > $numLatin;
- } else if( $variant == 'sr-el' ) {
+ } elseif( $variant == 'sr-el' ) {
return $numLatin > $numCyrillic;
} else {
return false;
if ( $n == 1 ) {
$d = "1î d' " . $this->getMonthName( $m ) .
" " . substr( $ts, 0, 4 );
- } else if ( $n == 2 || $n == 3 || $n == 20 || $n == 22 || $n == 23 ) {
+ } elseif ( $n == 2 || $n == 3 || $n == 20 || $n == 22 || $n == 23 ) {
$d = ( 0 + $n ) . " d' " . $this->getMonthName( $m ) .
" " . substr( $ts, 0, 4 );
- } else if ( $m == 4 || $m == 8 || $m == 10 ) {
+ } elseif ( $m == 4 || $m == 8 || $m == 10 ) {
$d = ( 0 + $n ) . " d' " . $this->getMonthName( $m ) .
" " . substr( $ts, 0, 4 );
} else {
if ( isset( $this->mOptions['conf'] ) ) {
$settingsFile = $this->mOptions['conf'];
- } else if ( defined("MW_CONFIG_FILE") ) {
+ } elseif ( defined("MW_CONFIG_FILE") ) {
$settingsFile = MW_CONFIG_FILE;
} else {
$settingsFile = "$IP/LocalSettings.php";
static private function stringEscape( $matches ) {
return sprintf( "\\x%02x", ord( $matches[1] ) );
}
-
+
/**
** Strips out the stuff that Mediawiki balks at in a page's title.
** Implementation copied/pasted from cleanupTable.inc & cleanupImages.php
// Tidy does not know how to valid atom or rss, so exclude from testing for the time being.
if ( $this->params["feed"] == "atom" ) { unset( $this->params["feed"] ); }
- else if ( $this->params["feed"] == "rss" ) { unset( $this->params["feed"] ); }
+ elseif ( $this->params["feed"] == "rss" ) { unset( $this->params["feed"] ); }
// Raw pages cannot really be validated
if ( $this->params["action"] == "raw" ) unset( $this->params["action"] );
// Tidy does not know how to valid atom or rss, so exclude from testing for the time being.
if ( $this->params["feed"] == "atom" ) { unset( $this->params["feed"] ); }
- else if ( $this->params["feed"] == "rss" ) { unset( $this->params["feed"] ); }
+ elseif ( $this->params["feed"] == "rss" ) { unset( $this->params["feed"] ); }
}
}
mkdir ( DIRECTORY, 0700 );
}
// otherwise, we first retest the things that we have found in previous runs
-else if ( RERUN_OLD_TESTS ) {
+elseif ( RERUN_OLD_TESTS ) {
rerunPreviousTests();
}
}
saveTest( $test, $testname );
$num_errors += 1;
- } else if ( KEEP_PASSED_TESTS ) {
+ } elseif ( KEEP_PASSED_TESTS ) {
// print current time, with microseconds (matches "strace" format), and the test name.
print " " . date( "H:i:s." ) . substr( current( explode( " ", microtime() ) ), 2 ) . " " . $testname;
saveTest( $test, $testname );
die( "failed to read comment file: {$options['comment-file']}\n" );
}
}
- else if ( isset( $options['comment'] ) ) {
+ elseif ( isset( $options['comment'] ) ) {
$comment = $options['comment'];
}
if ( isset( $options['dry'] ) ) {
echo( "done.\n" );
- } else if ( $image->recordUpload( $archive->value, $commentText, $license ) ) {
+ } elseif ( $image->recordUpload( $archive->value, $commentText, $license ) ) {
# We're done!
echo( "done.\n" );
if ( $doProtect ) {
} else {
if ( !strcmp( $options['mode'], 'wiki' ) ) {
$runMode = 'wiki';
- } else if ( !strcmp( $options['mode'], 'php' ) ) {
+ } elseif ( !strcmp( $options['mode'], 'php' ) ) {
$runMode = 'php';
- } else if ( !strcmp( $options['mode'], 'raw' ) ) {
+ } elseif ( !strcmp( $options['mode'], 'raw' ) ) {
$runMode = 'raw';
} else {
}
if ( $run ) {
if ( !strcmp( $runMode, 'wiki' ) ) {
$runMode = 'wiki';
- } else if ( !strcmp( $runMode, 'raw' ) ) {
+ } elseif ( !strcmp( $runMode, 'raw' ) ) {
$runMode = 'raw';
}
include( $messagesFile );
if ( ( !strcmp( $key, $ckey ) ) && ( !strcmp( $value, $cvalue ) ) ) {
if ( !strcmp( $runMode, 'raw' ) ) {
print( "$key\n" );
- } else if ( !strcmp( $runMode, 'php' ) ) {
+ } elseif ( !strcmp( $runMode, 'php' ) ) {
print( "'$key' => '',\n" );
- } else if ( !strcmp( $runMode, 'wiki' ) ) {
+ } elseif ( !strcmp( $runMode, 'wiki' ) ) {
$uKey = ucfirst( $key );
print( "* MediaWiki:$uKey/$langCode\n" );
} else {
foreach ( $sres as $srow ) {
if ( $srow->$userField > 0 )
$userIds[] = intval( $srow->$userField );
- else if ( $srow->$userTextField != '' )
+ elseif ( $srow->$userTextField != '' )
$userIPs[] = $srow->$userTextField;
}
// Add item author relations...
$log->addRelations( 'target_author_id', $userIds, $row->log_id );
$log->addRelations( 'target_author_ip', $userIPs, $row->log_id );
// RevisionDelete logs - log events
- } else if ( LogEventsList::typeAction( $row, $delTypes, 'event' ) ) {
+ } elseif ( LogEventsList::typeAction( $row, $delTypes, 'event' ) ) {
$params = LogPage::extractParams( $row->log_params );
// Param format: <item CSV> [<ofield> <nfield>]
if ( count( $params ) < 1 ) continue; // bad row
foreach ( $sres as $srow ) {
if ( $srow->log_user > 0 )
$userIds[] = intval( $srow->log_user );
- else if ( IP::isIPAddress( $srow->log_user_text ) )
+ elseif ( IP::isIPAddress( $srow->log_user_text ) )
$userIPs[] = $srow->log_user_text;
}
$log->addRelations( 'target_author_id', $userIds, $row->log_id );
// old old format should be treated as edit/move restriction
$oldRestrictions["edit"] = trim( $temp[0] );
$oldRestrictions["move"] = trim( $temp[0] );
- } else if ( $temp[1] ) {
+ } elseif ( $temp[1] ) {
$oldRestrictions[$temp[0]] = trim( $temp[1] );
}
}
$seleniumBrowsers,
$seleniumTestSuites,
$configFile );
- } else if ( !isset( $wgHooks['SeleniumSettings'] ) ) {
+ } elseif ( !isset( $wgHooks['SeleniumSettings'] ) ) {
$this->output("No command line, configuration file or configuration hook found.\n");
SeleniumConfig::getSeleniumSettings( $seleniumSettings,
$seleniumBrowsers,
if ( ! count( $argv ) ) {
$parser->static_tag_buf = $in;
return '';
- } else if ( count( $argv ) === 1 && isset( $argv['action'] )
+ } elseif ( count( $argv ) === 1 && isset( $argv['action'] )
&& $argv['action'] === 'flush' && $in === null )
{
// Clear the buffer, we probably don't need to
function setUser( $userName = null ) {
if ( $userName === 'anon' ) {
$this->user = $this->anonUser;
- } else if ( $userName === null || $userName === $this->userName ) {
+ } elseif ( $userName === null || $userName === $this->userName ) {
$this->user = $this->userUser;
} else {
$this->user = $this->altUser;