// Give hooks a chance to customise the output
if( wfRunHooks( 'ShowRawCssJs', array( $this->mContent, $this->mTitle, $wgOut ) ) ) {
// Wrap the whole lot in a <pre> and don't parse
+ $m = array();
preg_match( '!\.(css|js)$!u', $this->mTitle->getText(), $m );
$wgOut->addHtml( "<pre class=\"mw-code mw-{$m[1]}\" dir=\"ltr\">\n" );
$wgOut->addHtml( htmlspecialchars( $this->mContent ) );
$wgOut->returnToMain( false, $this->mTitle );
break;
default:
- throw new MWException( __METHOD__ . ": Unknown return value `{$retval}`" );
+ throw new MWException( __METHOD__ . ": Unknown return value `{$result}`" );
}
}
$cache = new HTMLFileCache( $t );
if( $cache->isFileCached() ) {
- // FIXME: $msg is not defined on the next line.
+ // @todo, FIXME: $msg is not defined on the next line.
$msg = '<p style="color: red"><b>'.$msg."<br />\n" .
$cachederror . "</b></p>\n";
*/
function edit() {
global $wgOut, $wgUser, $wgRequest, $wgTitle;
- global $wgEmailConfirmToEdit;
if ( ! wfRunHooks( 'AlternateEdit', array( &$this ) ) )
return;
if ($error[0] == 'readonlytext')
{
- if ($this->edit)
+ if ($this->edit) {
$this->formtype = 'preview';
- else if ($this->save || $this->preview || $this->diff)
+ } elseif ($this->save || $this->preview || $this->diff) {
$remove[] = $error;
+ }
}
}
# array_diff returns elements in $permErrors that are not in $remove.
if ( count($cascadeSources) > 0 ) {
# Explain, and list the titles responsible
$notice = wfMsgExt( 'cascadeprotectedwarning', array('parsemag'), count($cascadeSources) ) . "\n";
- foreach( $cascadeSources as $id => $page )
+ foreach( $cascadeSources as $page ) {
$notice .= '* [[:' . $page->getPrefixedText() . "]]\n";
}
+ }
$wgOut->addWikiText( $notice );
}
* pending authentication, confirmation, etc.
*/
public function execute() {
- global $wgOut, $wgRequest, $wgUser, $wgLang, $wgServer;
+ global $wgOut, $wgRequest, $wgUser;
$this->setHeaders();
if( wfReadOnly() ) {
$r = wfMsg( 'metadata-help' ) . "\n\n";
$r .= "{| id=mw_metadata class=mw_metadata\n";
foreach ( $metadata as $type => $stuff ) {
- foreach ( $stuff as $k => $v ) {
+ foreach ( $stuff as $v ) {
$class = Sanitizer::escapeId( $v['id'] );
if( $type == 'collapsed' ) {
$class .= ' collapsable';
if ($showLink) {
$filename = wfEscapeWikiText( $this->img->getName() );
- $info = wfMsg( 'file-info', $sk->formatSize( $this->img->getSize() ), $mime );
global $wgContLang;
$dirmark = $wgContLang->getDirMark();
}
public function imageHistoryLine( $iscur, $timestamp, $img, $user, $usertext, $size, $description, $dims ) {
- global $wgUser, $wgLang, $wgTitle, $wgContLang;
+ global $wgUser, $wgLang, $wgContLang;
$local = $this->img->isLocal();
$row = '';
$medians = '(?:' . preg_quote( Namespace::getCanonicalName( NS_MEDIA ), '/' ) . '|';
$medians .= preg_quote( $wgContLang->getNsText( NS_MEDIA ), '/' ) . '):';
+ $match = array();
while(preg_match('/\[\[:?(.*?)(\|(.*?))*\]\](.*)$/',$comment,$match)) {
# Handle link renaming [[foo|text]] will show link as "text"
if( "" != $match[3] ) {
// continue;
throw new MWException( __METHOD__ . ': bad parameter name' );
}
- list( $synIndex, $magicName ) = $parts;
+ list( /* $synIndex */, $magicName ) = $parts;
$paramValue = next( $m );
return array( $magicName, $paramValue );
}
public function matchVariableStartToEnd( $text ) {
global $wgContLang;
$regexes = $this->getVariableStartToEndRegex();
- foreach ( $regexes as $case => $regex ) {
+ foreach ( $regexes as $regex ) {
if ( $regex !== '' ) {
$m = false;
if ( preg_match( $regex, $text, $m ) ) {
$this->addWikiText( wfMsgExt( 'cascadeprotected', 'parsemag', $count ) . "\n{$titles}" );
} elseif( !$wgTitle->isProtected( 'edit' ) && $wgTitle->isNamespaceProtected() ) {
// Namespace protection
- global $wgNamespaceProtection;
$ns = $wgTitle->getNamespace() == NS_MAIN
? wfMsg( 'nstab-main' )
: $wgTitle->getNsText();
'rc_patrolled' => 1
),
array(
- 'rc_id' => $change
+ 'rc_id' => $rcid
),
__METHOD__
);
function wfSpecialListusers( $par = null ) {
global $wgRequest, $wgOut;
- list( $limit, $offset ) = wfCheckLimits();
-
- $groupTarget = isset($par) ? $par : $wgRequest->getVal( 'group' );
-
$up = new UsersPager($par);
# getBody() first to check, if empty
}
function showSuccess() {
- global $wgOut, $wgRequest, $wgUser, $wgRawHtml;
+ global $wgOut, $wgRequest, $wgUser;
$old = Title::newFromText( $wgRequest->getVal( 'oldtitle' ) );
$new = Title::newFromText( $wgRequest->getVal( 'newtitle' ) );
}
function formatRow( $row ) {
- $block = new Block;
return $this->mForm->formatRow( $row );
}
*/
function wfSpecialProtectedpages() {
- list( $limit, $offset ) = wfCheckLimits();
-
$ppForm = new ProtectedPagesForm();
$ppForm->showList();
$restoreAll = empty( $timestamps );
$dbw = wfGetDB( DB_MASTER );
- $page = $dbw->tableName( 'archive' );
# Does this page already exist? We'll have to update it...
$article = new Article( $this->title );
}
// Success, redirect to description page
$wgOut->redirect( $this->mLocalFile->getTitle()->getFullURL() );
+ $img = null; // @todo: added to avoid passing a ref to null - should this be defined somewhere?
wfRunHooks( 'UploadComplete', array( &$img ) );
}
}
function mainUploadForm( $msg='' ) {
global $wgOut, $wgUser, $wgContLang;
global $wgUseCopyrightUpload, $wgUseAjax, $wgAjaxUploadDestCheck, $wgAjaxLicensePreview;
- global $wgRequest, $wgAllowCopyUploads, $wgEnableAPI;
+ global $wgRequest, $wgAllowCopyUploads;
global $wgStylePath, $wgStyleVersion;
$useAjaxDestCheck = $wgUseAjax && $wgAjaxUploadDestCheck;
* constructor
*/
function wfSpecialUserlogin() {
- global $wgCommandLineMode;
global $wgRequest;
if( session_id() == '' ) {
wfSetupSession();
* @return Array array( 'add' => array( addablegroups ), 'remove' => array( removablegroups ) )
*/
private function changeableGroups() {
- global $wgUser, $wgGroupPermissions;
+ global $wgUser;
$groups = array( 'add' => array(), 'remove' => array() );
$addergroups = $wgUser->getEffectiveGroups();
* @return string
*/
public function formatResult( $skin, $result ) {
- global $wgLang;
$title = Title::makeTitleSafe( $result->namespace, $result->title );
if( $title instanceof Title ) {
if( $this->isCached() ) {
* @param $par Parameter passed to the page
*/
function wfSpecialWatchlist( $par ) {
- global $wgUser, $wgOut, $wgLang, $wgRequest, $wgContLang;
+ global $wgUser, $wgOut, $wgLang, $wgRequest;
global $wgRCShowWatchingUsers, $wgEnotifWatchlist, $wgShowUpdatedMarker;
global $wgEnotifWatchlist;
$fname = 'wfSpecialWatchlist';
$redir = MagicWord::get( 'redirect' );
if( $redir->matchStart( $text ) ) {
// Extract the first link and see if it's usable
+ $m = array();
if( preg_match( '!\[{2}(.*?)(?:\||\]{2})!', $text, $m ) ) {
// Strip preceding colon used to "escape" categories, etc.
// and URL-decode links
$errors[] = array( 'readonlytext' );
}
- global $wgEmailConfirmToEdit;
+ global $wgEmailConfirmToEdit, $wgUser;
if ( $wgEmailConfirmToEdit && !$wgUser->isEmailConfirmed() )
{
$right = ( $right == 'sysop' ) ? 'protect' : $right;
if( '' != $right && !$user->isAllowed( $right ) ) {
$pages = '';
- foreach( $cascadingSources as $id => $page )
+ foreach( $cascadingSources as $page )
$pages .= '* [[:' . $page->getPrefixedText() . "]]\n";
$errors[] = array( 'cascadeprotected', count( $cascadingSources ), $pages );
}
*/
if( $this->getNamespace() == NS_SPECIAL ) {
$name = $this->getText();
- list( $name, $subpage ) = SpecialPage::resolveAliasWithSubpage( $name );
+ list( $name, /* $subpage */) = SpecialPage::resolveAliasWithSubpage( $name );
$pure = SpecialPage::getTitleFor( $name )->getPrefixedText();
if( in_array( $pure, $wgWhitelistRead, true ) )
return true;
* @return bool If the page is subject to cascading restrictions.
*/
public function isCascadeProtected() {
- list( $sources, $restrictions ) = $this->getCascadeProtectionSources( false );
+ list( $sources, /* $restrictions */ ) = $this->getCascadeProtectionSources( false );
return ( $sources > 0 );
}
function notifyOnPageChange($editor, &$title, $timestamp, $summary, $minorEdit, $oldid = false) {
global $wgEnotifUseJobQ;
- global $wgEnotifWatchlist, $wgShowUpdatedMarker;
if( $title->getNamespace() < 0 )
return;
$this->addTables('interwiki');
$this->addFields(array('iw_prefix', 'iw_local', 'iw_url'));
- if($filter === 'local')
+ if($filter === 'local') {
$this->addWhere('iw_local = 1');
- else if($filter === '!local')
+ } elseif($filter === '!local') {
$this->addWhere('iw_local = 0');
- else if($filter !== false)
+ } elseif($filter !== false) {
ApiBase :: dieDebug(__METHOD__, "Unknown filter=$filter");
+ }
$this->addOption('ORDER BY', 'iw_prefix');
}
$decoded = array();
foreach ( $array as $name => $value ) {
- $deprefixedName = substr( $name, $prefixLength );
$decoded[substr( $name, $prefixLength )] = $value;
}
$decoded['timestamp'] = wfTimestamp( TS_MW, $decoded['timestamp'] );
$dir = $this->getThumbPath();
$urls = array();
foreach ( $files as $file ) {
- $m = array();
# Check that the base file name is part of the thumb name
# This is a basic sanity check to avoid erasing unrelated directories
if ( strpos( $file, $this->getName() ) !== false ) {
$dbw = $this->file->repo->getMasterDB();
list( $oldRels, $deleteCurrent ) = $this->getOldRels();
if ( $deleteCurrent ) {
- $where = array( 'img_name' => $this->file->getName() );
$dbw->delete( 'image', array( 'img_name' => $this->file->getName() ), __METHOD__ );
}
if ( count( $oldRels ) ) {
if ( $first && !$exists ) {
// This revision will be published as the new current version
$destRel = $this->file->getRel();
- $info = $this->file->repo->getFileProps( $deletedUrl );
$insertCurrent = array(
'img_name' => $row->fa_name,
'img_size' => $row->fa_size,
$dbw = $this->repo->getMasterDB();
list( $major, $minor ) = self::splitMime( $this->mime );
- $mime = $this->mime;
wfDebug(__METHOD__.': upgrading '.$this->archive_name." to the current schema\n");
$dbw->update( 'oldimage',
function getFileProps( $fileName ) {
if ( FileRepo::isVirtualUrl( $fileName ) ) {
- list( $repoName, $zone, $rel ) = $this->splitVirtualUrl( $fileName );
+ list( $repoName, /* $zone */, /* $rel */ ) = $this->splitVirtualUrl( $fileName );
if ( $repoName === '' ) {
$repoName = 'local';
}
global $wgLang;
$nbytes = '(' . wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ),
$wgLang->formatNum( $file->getSize() ) ) . ')';
+ return "($nbytes)";
}
function getLongDesc( $file ) {