$undo = $wgRequest->getInt( 'undo' );
if ( $undo > 0 && $undoafter > 0 ) {
-
$undorev = Revision::newFromId( $undo );
$oldrev = Revision::newFromId( $undoafter );
# Otherwise, $content will be left as-is.
if ( !is_null( $undorev ) && !is_null( $oldrev ) &&
!$undorev->isDeleted( Revision::DELETED_TEXT ) &&
- !$oldrev->isDeleted( Revision::DELETED_TEXT ) ) {
-
+ !$oldrev->isDeleted( Revision::DELETED_TEXT )
+ ) {
$content = $this->mArticle->getUndoContent( $undorev, $oldrev );
if ( $content === false ) {
if ( $this->mArticleBodyOnly ) {
echo $this->mBodytext;
} else {
-
$sk = $this->getSkin();
// add skin specific modules
$modules = $sk->getDefaultModules();
if ( !isset( $attribs['title'] )
&& isset( $row->ar_namespace )
- && isset( $row->ar_title ) ) {
-
+ && isset( $row->ar_title )
+ ) {
$attribs['title'] = Title::makeTitle( $row->ar_namespace, $row->ar_title );
}
// are changed (like in the screwed up test system) we will re-initialise the settings.
$globalContext = implode( '-', compact( 'wgAllowMicrodataAttributes', 'wgAllowImageTag' ) );
if ( !$staticInitialised || $staticInitialised != $globalContext ) {
-
$htmlpairsStatic = array( # Tags that must be closed
'b', 'bdi', 'del', 'i', 'ins', 'u', 'font', 'big', 'small', 'sub', 'sup', 'h1',
'h2', 'h3', 'h4', 'h5', 'h6', 'cite', 'code', 'em', 's',
}
public function show() {
-
$this->page->unprotect();
}
}
*/
protected function validateLimit( $paramName, &$value, $min, $max, $botMax = null, $enforceLimits = false ) {
if ( !is_null( $min ) && $value < $min ) {
-
$msg = $this->encodeParamName( $paramName ) . " may not be less than $min (set to $value)";
$this->warnOrDie( $msg, $enforceLimits );
$value = $min;
wfDeprecated( __METHOD__, '1.25' );
$params = $this->getFinalParams( ApiBase::GET_VALUES_FOR_HELP );
if ( $params ) {
-
$paramsDescription = $this->getFinalParamDescription();
$msg = '';
$paramPrefix = "\n" . str_repeat( ' ', 24 );
$key = $nt->getPrefixedDBkey();
if ( $this->isBadLink( $key ) || $nt->isExternal() ) {
-
return 0;
}
$id = $this->getGoodLinkID( $key );
if ( $id != 0 ) {
-
return $id;
}
if ( $key === '' ) {
-
return 0;
}
public function readJSONFile( $fileName ) {
if ( !is_readable( $fileName ) ) {
-
return array();
}
$json = file_get_contents( $fileName );
if ( $json === false ) {
-
return array();
}
} elseif ( !ChangesList::userCan( $rcObj, Revision::DELETED_TEXT, $this->getUser() ) ) {
$link = '<span class="history-deleted">' . $rcObj->timestamp . '</span> ';
} else {
-
$link = Linker::linkKnown(
$rcObj->getTitle(),
$rcObj->timestamp,
$text = $with->getNativeData();
if ( strval( $sectionId ) === '' ) {
-
return $with; # XXX: copy first?
}
*/
public function getSkin() {
if ( $this->skin === null ) {
-
$skin = null;
Hooks::run( 'RequestContextCreateSkin', array( $this, &$skin ) );
$factory = SkinFactory::getDefaultInstance();
# Now we have an explicit index into the servers array
$conn = $this->openConnection( $i, $wiki );
if ( !$conn ) {
-
return $this->reportConnectionError();
}
$this->mCacheHit = true;
// Check if the diff should be hidden from this user
if ( !$this->loadRevisionData() ) {
-
return false;
} elseif ( $this->mOldRev &&
!$this->mOldRev->userCan( Revision::DELETED_TEXT, $this->getUser() )
) {
-
return false;
} elseif ( $this->mNewRev &&
!$this->mNewRev->userCan( Revision::DELETED_TEXT, $this->getUser() )
) {
-
return false;
}
// Short-circuit
if ( $this->mOldRev === false || ( $this->mOldRev && $this->mNewRev
&& $this->mOldRev->getID() == $this->mNewRev->getID() )
) {
-
return '';
}
// Cacheable?
// Loadtext is permission safe, this just clears out the diff
if ( !$this->loadText() ) {
-
return false;
}
$tempFile1 = fopen( $tempName1, "w" );
if ( !$tempFile1 ) {
-
return false;
}
$tempFile2 = fopen( $tempName2, "w" );
if ( !$tempFile2 ) {
-
return false;
}
fwrite( $tempFile1, $otext );
public function getSha1Base36( $recache = false ) {
if ( $this->sha1Base36 !== null && !$recache ) {
-
return $this->sha1Base36;
}
break; // got it
}
if ( $attempt >= 5 ) {
-
return null; // give up
}
}
$attr['class'] = $this->mClass;
}
+ $attrLabel = array( 'for' => $this->mID );
+ if ( isset( $attr['title'] ) ) {
+ // propagate tooltip to label
+ $attrLabel['title'] = $attr['title'];
+ }
+
$chkLabel = Xml::check( $this->mName, $value, $attr )
. ' '
- . Html::rawElement( 'label', array( 'for' => $this->mID ), $this->mLabel );
+ . Html::rawElement( 'label', $attrLabel, $this->mLabel );
if ( $wgUseMediaWikiUIEverywhere || $this->mParent instanceof VFormHTMLForm ) {
$chkLabel = Html::rawElement(
*/
function loadDataFromRequest( $request ) {
if ( $request->getCheck( $this->mName ) ) {
-
$list = $request->getText( $this->mName );
$text = $request->getText( $this->mName . '-other' );
* @since 1.22
*/
final public function getSiblingQueuesWithJobs( array $types ) {
-
return $this->doGetSiblingQueuesWithJobs( $types );
}
* @since 1.22
*/
final public function getSiblingQueueSizes( array $types ) {
-
return $this->doGetSiblingQueueSizes( $types );
}
// If revision deleted, exit immediately
if ( $file->isDeleted( File::DELETED_FILE ) ) {
-
return array();
}
} elseif ( $this->reader->namespaceURI == self::NS_SVG
&& $this->reader->nodeType == XMLReader::ELEMENT
) {
-
$sysLang = $this->reader->getAttribute( 'systemLanguage' );
if ( !is_null( $sysLang ) && $sysLang !== '' ) {
// See http://www.w3.org/TR/SVG/struct.html#SystemLanguageAttribute
// Validate structures.
list( $ns, $tag ) = explode( ' ', $elm, 2 );
if ( isset( $this->items[$ns][$tag]['validate'] ) ) {
-
$info =& $this->items[$ns][$tag];
$finalName = isset( $info['map_name'] )
? $info['map_name'] : $tag;
// for each found variants, figure out link holders and replace
foreach ( $varRes as $s ) {
-
$variantTitle = Title::makeTitle( $s->page_namespace, $s->page_title );
$varPdbk = $variantTitle->getPrefixedDBkey();
$vardbk = $variantTitle->getDBkey();
# SUBST
if ( !$found ) {
-
$substMatch = $this->mSubstWords->matchStartAndRemove( $part1 );
# Possibilities for substMatch: "subst", "safesubst" or FALSE
# Parser functions
if ( !$found ) {
-
$colonPos = strpos( $part1, ':' );
if ( $colonPos !== false ) {
$func = substr( $part1, 0, $colonPos );
$cacheable = ( $wgPreprocessorCacheThreshold !== false
&& strlen( $text ) > $wgPreprocessorCacheThreshold );
if ( $cacheable ) {
-
$cacheKey = wfMemcKey( 'preprocess-xml', md5( $text ), $flags );
$cacheValue = $wgMemc->get( $cacheKey );
if ( $cacheValue ) {
&& strlen( $text ) > $wgPreprocessorCacheThreshold;
if ( $cacheable ) {
-
$cacheKey = wfMemcKey( 'preprocess-hash', md5( $text ), $flags );
$cacheValue = $wgMemc->get( $cacheKey );
if ( $cacheValue ) {
$pages = $this->getPages( $context );
$key = implode( '|', array_keys( $pages ) );
if ( !isset( $this->titleInfo[$key] ) ) {
-
$this->titleInfo[$key] = array();
$batch = new LinkBatch;
foreach ( $pages as $titleText => $options ) {
$context->setTitle( $page->getPageTitle( $par ) );
}
} elseif ( !$page->isIncludable() ) {
-
return false;
}
if ( $exportall ) {
$history = WikiExporter::FULL;
} else {
-
$pageSet = array(); // Inverted index of all pages to look up
// Split up and normalize input
* Return HTML to put just before the results.
*/
function getPageHeader() {
-
return Xml::openElement(
'form',
array( 'id' => 'specialmimesearch', 'method' => 'get', 'action' => wfScript() )
'name' => 'invert',
'label-message' => 'invert',
'default' => $nsinvert,
- 'tooltip' => $this->msg( 'tooltip-invert' )->text(),
+ 'tooltip' => 'invert',
),
'tagFilter' => array(
'type' => 'tagfilter',
* @return string
*/
function formatRow( $row ) {
-
$title = Title::makeTitleSafe( $row->pt_namespace, $row->pt_title );
if ( !$title ) {
-
return Html::rawElement(
'li',
array(),
* If there was no filename or a zero size given, give up quick.
*/
if ( $this->isEmptyFile() ) {
-
return array( 'status' => self::EMPTY_FILE );
}
*/
$maxSize = self::getMaxUploadSize( $this->getSourceType() );
if ( $this->mFileSize > $maxSize ) {
-
return array(
'status' => self::FILE_TOO_LARGE,
'max' => $maxSize,
*/
$verification = $this->verifyFile();
if ( $verification !== true ) {
-
return array(
'status' => self::VERIFICATION_ERROR,
'details' => $verification
*/
$result = $this->validateName();
if ( $result !== true ) {
-
return $result;
}
if ( !Hooks::run( 'UploadVerification',
array( $this->mDestName, $this->mTempPath, &$error ) )
) {
-
return array( 'status' => self::HOOK_ABORTED, 'error' => $error );
}
wfDebug( "mime: <$mime> extension: <{$this->mFinalExtension}>\n" );
global $wgMimeTypeBlacklist;
if ( $this->checkFileExtension( $mime, $wgMimeTypeBlacklist ) ) {
-
return array( 'filetype-badmime', $mime );
}
$ieTypes = $magic->getIEMimeTypes( $this->mTempPath, $chunk, $extMime );
foreach ( $ieTypes as $ieType ) {
if ( $this->checkFileExtension( $ieType, $wgMimeTypeBlacklist ) ) {
-
return array( 'filetype-bad-ie-mime', $ieType );
}
}
$status = $this->verifyPartialFile();
if ( $status !== true ) {
-
return $status;
}
if ( $wgVerifyMimeType ) {
# XXX: Missing extension will be caught by validateName() via getTitle()
if ( $this->mFinalExtension != '' && !$this->verifyExtension( $mime, $this->mFinalExtension ) ) {
-
return array( 'filetype-mime-mismatch', $this->mFinalExtension, $mime );
}
}
if ( $this->mFinalExtension == 'svg' || $mime == 'image/svg+xml' ) {
$svgStatus = $this->detectScriptInSvg( $this->mTempPath, false );
if ( $svgStatus !== false ) {
-
return $svgStatus;
}
}
Hooks::run( 'UploadVerifyFile', array( $this, $mime, &$status ) );
if ( $status !== true ) {
-
return $status;
}
$mime = $this->mFileProps['file-mime'];
$status = $this->verifyMimeType( $mime );
if ( $status !== true ) {
-
return $status;
}
# check for htmlish code and javascript
if ( !$wgDisableUploadScriptChecks ) {
if ( self::detectScript( $this->mTempPath, $mime, $this->mFinalExtension ) ) {
-
return array( 'uploadscripted' );
}
if ( $this->mFinalExtension == 'svg' || $mime == 'image/svg+xml' ) {
$svgStatus = $this->detectScriptInSvg( $this->mTempPath, true );
if ( $svgStatus !== false ) {
-
return $svgStatus;
}
}
$errors = $zipStatus->getErrorsArray();
$error = reset( $errors );
if ( $error[0] !== 'zip-wrong-format' ) {
-
return $error;
}
}
if ( $this->mJavaDetected ) {
-
return array( 'uploadjava' );
}
}
# Scan the uploaded file for viruses
$virus = $this->detectVirus( $this->mTempPath );
if ( $virus ) {
-
return array( 'uploadvirus', $virus );
}
$chunk = strtolower( $chunk );
if ( !$chunk ) {
-
return false;
}
# check for HTML doctype
if ( preg_match( "/<!DOCTYPE *X?HTML/i", $chunk ) ) {
-
return true;
}
// PHP/expat will interpret the given encoding in the xml declaration (bug 47304)
if ( $extension == 'svg' || strpos( $mime, 'image/svg' ) === 0 ) {
if ( self::checkXMLEncodingMissmatch( $file ) ) {
-
return true;
}
}