<?php
-if( !defined( 'MEDIAWIKI' ) )
- die( 1 );
+if( !defined( 'MEDIAWIKI' ) ) {
+ die( 1 );
+}
if ( ! $wgUseAjax ) {
die( 1 );
* @addtogroup Ajax
*/
-if( !defined( 'MEDIAWIKI' ) )
- die( 1 );
+if( !defined( 'MEDIAWIKI' ) ) {
+ die( 1 );
+}
/**
* Function converts an Javascript escaped string back into a string with
* @return string
*/
function js_unescape($source, $iconv_to = 'UTF-8') {
- $decodedStr = '';
- $pos = 0;
- $len = strlen ($source);
- while ($pos < $len) {
- $charAt = substr ($source, $pos, 1);
- if ($charAt == '%') {
- $pos++;
- $charAt = substr ($source, $pos, 1);
- if ($charAt == 'u') {
- // we got a unicode character
- $pos++;
- $unicodeHexVal = substr ($source, $pos, 4);
- $unicode = hexdec ($unicodeHexVal);
- $decodedStr .= code2utf($unicode);
- $pos += 4;
- }
- else {
- // we have an escaped ascii character
- $hexVal = substr ($source, $pos, 2);
- $decodedStr .= chr (hexdec ($hexVal));
- $pos += 2;
- }
- }
- else {
- $decodedStr .= $charAt;
- $pos++;
- }
- }
-
- if ($iconv_to != "UTF-8") {
- $decodedStr = iconv("UTF-8", $iconv_to, $decodedStr);
- }
-
- return $decodedStr;
+ $decodedStr = '';
+ $pos = 0;
+ $len = strlen ($source);
+
+ while ($pos < $len) {
+ $charAt = substr ($source, $pos, 1);
+ if ($charAt == '%') {
+ $pos++;
+ $charAt = substr ($source, $pos, 1);
+ if ($charAt == 'u') {
+ // we got a unicode character
+ $pos++;
+ $unicodeHexVal = substr ($source, $pos, 4);
+ $unicode = hexdec ($unicodeHexVal);
+ $decodedStr .= code2utf($unicode);
+ $pos += 4;
+ } else {
+ // we have an escaped ascii character
+ $hexVal = substr ($source, $pos, 2);
+ $decodedStr .= chr (hexdec ($hexVal));
+ $pos += 2;
+ }
+ } else {
+ $decodedStr .= $charAt;
+ $pos++;
+ }
+ }
+
+ if ($iconv_to != "UTF-8") {
+ $decodedStr = iconv("UTF-8", $iconv_to, $decodedStr);
+ }
+
+ return $decodedStr;
}
/**
$undorev = Revision::newFromId($undo);
$oldrev = $undorev ? $undorev->getPrevious() : null;
}
-
+
#Sanity check, make sure it's the right page.
# Otherwise, $text will be left as-is.
if ( !is_null($undorev) && !is_null($oldrev) && $undorev->getPage()==$oldrev->getPage() && $undorev->getPage()==$this->mArticle->getID() ) {
$undorev_text = $undorev->getText();
- $oldrev_text = $oldrev->getText();
- $currev_text = $text;
+ $oldrev_text = $oldrev->getText();
+ $currev_text = $text;
#No use doing a merge if it's just a straight revert.
if ( $currev_text != $undorev_text ) {
global $wgOut, $wgUser, $wgRequest, $wgTitle;
global $wgEmailConfirmToEdit;
- if ( ! wfRunHooks( 'AlternateEdit', array( &$this ) ) )
+ if ( ! wfRunHooks( 'AlternateEdit', array( &$this ) ) )
return;
$fname = 'EditPage::edit';
}
#And a similar thing for new sections
- if( $this->section == 'new' && !$this->allowBlankSummary && $wgUser->getOption( 'forceeditsummary' ) ) {
+ if( $this->section == 'new' && !$this->allowBlankSummary && $wgUser->getOption( 'forceeditsummary' ) ) {
if (trim($this->summary) == '') {
$this->missingSummary = true;
wfProfileOut( $fname );
$this->summary = '';
$this->textbox1 = $this->getContent(false);
if ($this->textbox1 === false) return false;
-
+
if ( !$this->mArticle->exists() && $this->mArticle->mTitle->getNamespace() == NS_MEDIAWIKI )
$this->textbox1 = wfMsgWeirdKey( $this->mArticle->mTitle->getText() );
wfProxyCheck();
$wgOut->addWikiText( wfMsg( 'missingsummary' ) );
}
- if( $this->missingSummary && $this->section == 'new' ) {
- $wgOut->addWikiText( wfMsg( 'missingcommentheader' ) );
- }
+ if( $this->missingSummary && $this->section == 'new' ) {
+ $wgOut->addWikiText( wfMsg( 'missingcommentheader' ) );
+ }
if( !$this->hookError == '' ) {
$wgOut->addWikiText( $this->hookError );
if( $num > 0 ) {
$gallery = new ImageGallery();
$gallery->useSkin( $skin );
-
+
# $res might contain the whole 1,000 rows, so we read up to
# $num [should update this to use a Pager]
for( $i = 0; $i < $num && $row = $dbr->fetchObject( $res ); $i++ ) {
$image = $this->prepareImage( $row );
- if( $image instanceof Image )
+ if( $image instanceof Image ) {
$gallery->add( $image, $this->getCellHtml( $row ) );
+ }
}
-
+
$out->addHtml( $gallery->toHtml() );
}
}
-
+
/**
* Prepare an image object given a result row
*
? new Image( $title )
: null;
}
-
+
/**
* Get additional HTML to be shown in a results' cell
*
const DELETED_TEXT = 1;
const DELETED_COMMENT = 2;
const DELETED_USER = 4;
- const DELETED_RESTRICTED = 8;
-
+ const DELETED_RESTRICTED = 8;
+
/**
* Load a page revision from a given revision ID number.
* Returns null if no such revision can be found.
* @param string $title
* @abstract
*/
- function updateTitle( $id, $title ) {
+ function updateTitle( $id, $title ) {
// no-op
- }
+ }
}
wfProfileOut( __METHOD__ );
return $s;
- }
+ }
/**
* Return html code that include User stylesheets
return false;
}
- /**
+ /**
* @return string an sqlquery
*/
function getSQL() {
"WHERE pl_from IS NULL " .
"AND page_namespace = 0 " .
"AND page_is_redirect = 0";
- }
+ }
}
/**
*/
function wfSpecialDeadendpages() {
- list( $limit, $offset ) = wfCheckLimits();
+ list( $limit, $offset ) = wfCheckLimits();
- $depp = new DeadendPagesPage();
+ $depp = new DeadendPagesPage();
- return $depp->doQuery( $offset, $limit );
+ return $depp->doQuery( $offset, $limit );
}
?>
<?php
/**
- * Special page for listing the articles with the fewest revisions.
- *
+ * Special page for listing the articles with the fewest revisions.
+ *
* @package MediaWiki
* @addtogroup SpecialPage
- * @author Martin Drashkov
+ * @author Martin Drashkov
*/
class FewestrevisionsPage extends QueryPage {
function getName() {
return 'Fewestrevisions';
}
-
+
function isExpensive() {
return true;
}
-
+
function isSyndicated() {
return false;
}
function getSql() {
$dbr = wfGetDB( DB_SLAVE );
list( $revision, $page ) = $dbr->tableNamesN( 'revision', 'page' );
-
+
return "SELECT 'Fewestrevisions' as type,
page_namespace as namespace,
page_title as title,
GROUP BY 1,2,3
HAVING COUNT(*) > 1";
}
-
+
function sortDescending() {
- return false;
+ return false;
}
function formatResult( $skin, $result ) {
'MAX(ug_group) AS singlegroup'),
'options' => array('GROUP BY' => 'user_name'),
'conds' => $conds
- );
-
+ );
+
}
function formatRow( $row ) {
$userPage = Title::makeTitle( NS_USER, $row->user_name );
$name = $this->getSkin()->makeLinkObj( $userPage, htmlspecialchars( $userPage->getText() ) );
-
+
if( $row->numgroups > 1 || ( $this->requestedGroup && $row->numgroups == 1 ) ) {
$list = array();
foreach( self::getGroups( $row->user_id ) as $group )
} else {
$groups = '';
}
-
+
return '<li>' . wfSpecialList( $name, $groups ) . '</li>';
}
$query['username'] = $this->requestedUser;
return $query;
}
-
+
/**
* Get a list of groups the specified user belongs to
*
$dbr->freeResult( $res );
}
return $groups;
- }
-
+ }
+
/**
* Format a link to a group description page
*
$cache[$group] = User::makeGroupLinkHtml( $group, User::getGroupMember( $group ) );
return $cache[$group];
}
-
}
/**
} else {
$s .= '<p>' . wfMsgHTML('listusers-noresult') . '</p>';
};
- $wgOut->addHTML( $s );
+
+ $wgOut->addHTML( $s );
}
?>
/**
* constructor
*/
-function wfSpecialLongpages()
-{
- list( $limit, $offset ) = wfCheckLimits();
+function wfSpecialLongpages() {
+ list( $limit, $offset ) = wfCheckLimits();
- $lpp = new LongPagesPage();
+ $lpp = new LongPagesPage();
- $lpp->doQuery( $offset, $limit );
+ $lpp->doQuery( $offset, $limit );
}
?>
* Constructor
*/
function wfSpecialPopularpages() {
- list( $limit, $offset ) = wfCheckLimits();
+ list( $limit, $offset ) = wfCheckLimits();
- $ppp = new PopularPagesPage();
+ $ppp = new PopularPagesPage();
- return $ppp->doQuery( $offset, $limit );
+ return $ppp->doQuery( $offset, $limit );
}
?>
* Constructor
*/
function wfSpecialUndelete( $par ) {
- global $wgRequest;
+ global $wgRequest;
$form = new UndeleteForm( $wgRequest, $par );
$form->execute();