Convert whitespaces to tabulations
authorAntoine Musso <hashar@users.mediawiki.org>
Sat, 21 Apr 2007 14:44:56 +0000 (14:44 +0000)
committerAntoine Musso <hashar@users.mediawiki.org>
Sat, 21 Apr 2007 14:44:56 +0000 (14:44 +0000)
13 files changed:
includes/AjaxDispatcher.php
includes/AjaxFunctions.php
includes/EditPage.php
includes/ImageQueryPage.php
includes/Revision.php
includes/SearchEngine.php
includes/Skin.php
includes/SpecialDeadendpages.php
includes/SpecialFewestrevisions.php
includes/SpecialListusers.php
includes/SpecialLongpages.php
includes/SpecialPopularpages.php
includes/SpecialUndelete.php

index 570931c..90f68ec 100644 (file)
@@ -1,7 +1,8 @@
 <?php
 
-if( !defined( 'MEDIAWIKI' ) )
-        die( 1 );
+if( !defined( 'MEDIAWIKI' ) ) {
+       die( 1 );
+}
 
 if ( ! $wgUseAjax ) {
        die( 1 );
index 98b674f..86f853d 100644 (file)
@@ -5,8 +5,9 @@
  * @addtogroup Ajax
  */
 
-if( !defined( 'MEDIAWIKI' ) )
-        die( 1 );
+if( !defined( 'MEDIAWIKI' ) ) {
+       die( 1 );
+}
 
 /**
  * Function converts an Javascript escaped string back into a string with
@@ -18,40 +19,39 @@ if( !defined( 'MEDIAWIKI' ) )
  * @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;
 }
 
 /**
index bd40200..b0695ea 100644 (file)
@@ -107,13 +107,13 @@ class EditPage {
                                        $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 ) {
@@ -294,7 +294,7 @@ class EditPage {
                global $wgOut, $wgUser, $wgRequest, $wgTitle;
                global $wgEmailConfirmToEdit;
 
-               if ( ! wfRunHooks( 'AlternateEdit', array( &$this  ) ) )
+               if ( ! wfRunHooks( 'AlternateEdit', array( &$this ) ) )
                        return;
 
                $fname = 'EditPage::edit';
@@ -813,7 +813,7 @@ class EditPage {
                }
 
                #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 );
@@ -881,7 +881,7 @@ class EditPage {
                $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();
@@ -947,9 +947,9 @@ class EditPage {
                                $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 );
index c49b487..93f090a 100644 (file)
@@ -25,19 +25,20 @@ class ImageQueryPage extends QueryPage {
                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
         *
@@ -51,7 +52,7 @@ class ImageQueryPage extends QueryPage {
                        ? new Image( $title )
                        : null;
        }
-       
+
        /**
         * Get additional HTML to be shown in a results' cell
         *
index 84debfa..71f214e 100644 (file)
@@ -10,8 +10,8 @@ class Revision {
        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.
index be04380..24795ba 100644 (file)
@@ -244,9 +244,9 @@ class SearchEngine {
         * @param string $title
         * @abstract
         */
-    function updateTitle( $id, $title ) {
+       function updateTitle( $id, $title ) {
                // no-op
-    }
+       }
 }
 
 
index 83b5440..74a570c 100644 (file)
@@ -431,7 +431,7 @@ var wgAjaxWatch = {
 
                wfProfileOut( __METHOD__ );
                return $s;
-    }
+       }
 
        /**
         * Return html code that include User stylesheets
index 0f8cbe5..48d27ad 100644 (file)
@@ -36,7 +36,7 @@ class DeadendPagesPage extends PageQueryPage {
                return false;
        }
 
-    /**
+       /**
         * @return string an sqlquery
         */
        function getSQL() {
@@ -47,7 +47,7 @@ class DeadendPagesPage extends PageQueryPage {
        "WHERE pl_from IS NULL " .
        "AND page_namespace = 0 " .
        "AND page_is_redirect = 0";
-    }
+       }
 }
 
 /**
@@ -55,11 +55,11 @@ class DeadendPagesPage extends PageQueryPage {
  */
 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 );
 }
 
 ?>
index 849438f..4c0cd68 100644 (file)
@@ -1,22 +1,22 @@
 <?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;
        }
@@ -24,7 +24,7 @@ class FewestrevisionsPage extends QueryPage {
        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,
@@ -35,9 +35,9 @@ class FewestrevisionsPage extends QueryPage {
                        GROUP BY 1,2,3
                        HAVING COUNT(*) > 1";
        }
-       
+
        function sortDescending() {
-       return false;
+               return false;
        }
 
        function formatResult( $skin, $result ) {
index 39ac000..4249843 100644 (file)
@@ -76,14 +76,14 @@ class UsersPager extends AlphabeticPager {
                                '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 )
@@ -94,7 +94,7 @@ class UsersPager extends AlphabeticPager {
                } else {
                        $groups = '';
                }
-               
+
                return '<li>' . wfSpecialList( $name, $groups ) . '</li>';
        }
 
@@ -164,7 +164,7 @@ class UsersPager extends AlphabeticPager {
                        $query['username'] = $this->requestedUser;
                return $query;
        }
-       
+
        /**
         * Get a list of groups the specified user belongs to
         *
@@ -181,8 +181,8 @@ class UsersPager extends AlphabeticPager {
                        $dbr->freeResult( $res );
                }
                return $groups;
-       }       
-       
+       }
+
        /**
         * Format a link to a group description page
         *
@@ -195,7 +195,6 @@ class UsersPager extends AlphabeticPager {
                        $cache[$group] = User::makeGroupLinkHtml( $group, User::getGroupMember( $group ) );
                return $cache[$group];
        }
-       
 }
 
 /**
@@ -221,7 +220,8 @@ function wfSpecialListusers( $par = null ) {
        } else {
                $s .=   '<p>' . wfMsgHTML('listusers-noresult') . '</p>';
        };
-        $wgOut->addHTML( $s );
+
+       $wgOut->addHTML( $s );
 }
 
 ?>
index af9daa7..4065988 100644 (file)
@@ -22,13 +22,12 @@ class LongPagesPage extends ShortPagesPage {
 /**
  * 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 );
 }
 
 ?>
index d5d6aee..cd2f60e 100644 (file)
@@ -59,11 +59,11 @@ class PopularPagesPage extends QueryPage {
  * 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 );
 }
 
 ?>
index bd99caf..5b9225e 100644 (file)
@@ -11,7 +11,7 @@
  * Constructor
  */
 function wfSpecialUndelete( $par ) {
-    global $wgRequest;
+       global $wgRequest;
 
        $form = new UndeleteForm( $wgRequest, $par );
        $form->execute();