http://www.mediawiki.org/wiki/Special:Code/MediaWiki/65636
Revision: 65636 Author: siebrand Date: 2010-04-28 21:36:20 +0000 (Wed, 28 Apr 2010) Log Message: ----------- stylize.php, trailing whitespace removed Modified Paths: -------------- trunk/extensions/ChangeAuthor/CHANGELOG trunk/extensions/ChangeAuthor/ChangeAuthor.body.php trunk/extensions/ChangeAuthor/ChangeAuthor.i18n.php trunk/extensions/ChangeAuthor/ChangeAuthor.php trunk/extensions/ChangeAuthor/LEESMIJ trunk/extensions/ChangeAuthor/README Modified: trunk/extensions/ChangeAuthor/CHANGELOG =================================================================== --- trunk/extensions/ChangeAuthor/CHANGELOG 2010-04-28 21:30:06 UTC (rev 65635) +++ trunk/extensions/ChangeAuthor/CHANGELOG 2010-04-28 21:36:20 UTC (rev 65636) @@ -1,2 +1,3 @@ == Changes since 1.0 == -* Fixed buggy message handling by making ChangeAuthor::loadMessages() the static function it's supposed to be. \ No newline at end of file +* Fixed buggy message handling by making ChangeAuthor::loadMessages() the static + function it's supposed to be. Modified: trunk/extensions/ChangeAuthor/ChangeAuthor.body.php =================================================================== --- trunk/extensions/ChangeAuthor/ChangeAuthor.body.php 2010-04-28 21:30:06 UTC (rev 65635) +++ trunk/extensions/ChangeAuthor/ChangeAuthor.body.php 2010-04-28 21:36:20 UTC (rev 65636) @@ -15,8 +15,9 @@ * Written for the Bokt Wiki <http://www.bokt.nl/wiki/> by Roan Kattouw <roan.katt...@home.nl> * For information how to install and use this extension, see the README file. */ + # Alert the user that this is not a valid entry point to MediaWiki if they try to access the extension file directly. -if( !defined( 'MEDIAWIKI' ) ) { +if ( !defined( 'MEDIAWIKI' ) ) { echo <<<EOT To install the ChangeAuthor extension, put the following line in LocalSettings.php: require_once( "\$IP/extensions/ChangeAuthor/ChangeAuthor.setup.php" ); @@ -49,39 +50,39 @@ $this->setHeaders(); // Check permissions - if( !$this->userCanExecute( $wgUser ) ) { + if ( !$this->userCanExecute( $wgUser ) ) { $this->displayRestrictionError(); return; } $wgOut->setPageTitle( wfMsg( 'changeauthor-title' ) ); - if( !is_null( $par ) ) { + if ( !is_null( $par ) ) { $obj = $this->parseTitleOrRevID( $par ); - if( $obj instanceof Title ) { - if( $obj->exists() ) { + if ( $obj instanceof Title ) { + if ( $obj->exists() ) { $wgOut->addHTML( $this->buildRevisionList( $obj ) ); } else { $wgOut->addHTML( $this->buildInitialForm( wfMsg( 'changeauthor-nosuchtitle', $obj->getPrefixedText() ) ) ); } return; - } elseif( $obj instanceof Revision ) { + } elseif ( $obj instanceof Revision ) { $wgOut->addHTML( $this->buildOneRevForm( $obj ) ); return; } } $action = $wgRequest->getVal( 'action' ); - if( $wgRequest->wasPosted() && $action == 'change' ) { + if ( $wgRequest->wasPosted() && $action == 'change' ) { $arr = $this->parseChangeRequest(); - if( !is_array( $arr ) ) { + if ( !is_array( $arr ) ) { $targetPage = $wgRequest->getVal( 'targetpage' ); - if( !is_null( $targetPage ) ) { + if ( !is_null( $targetPage ) ) { $wgOut->addHTML( $this->buildRevisionList( Title::newFromURL( $targetPage ), $arr ) ); return; } $targetRev = $wgRequest->getVal( 'targetrev' ); - if( !is_null( $targetRev ) ) { + if ( !is_null( $targetRev ) ) { $wgOut->addHTML( $this->buildOneRevForm( Revision::newFromId( $targetRev ), $arr ) ); return; } @@ -92,15 +93,15 @@ } return; } - if( $wgRequest->wasPosted() && $action == 'list' ) { + if ( $wgRequest->wasPosted() && $action == 'list' ) { $obj = $this->parseTitleOrRevID( $wgRequest->getVal( 'pagename-revid' ) ); - if( $obj instanceof Title ) { - if( $obj->exists() ) { + if ( $obj instanceof Title ) { + if ( $obj->exists() ) { $wgOut->addHTML( $this->buildRevisionList( $obj ) ); } else { $wgOut->addHTML( $this->buildInitialForm( wfMsg( 'changeauthor-nosuchtitle', $obj->getPrefixedText() ) ) ); } - } elseif( $obj instanceof Revision ) { + } elseif ( $obj instanceof Revision ) { $wgOut->addHTML( $this->buildOneRevForm( $obj ) ); } return; @@ -115,10 +116,10 @@ */ private function parseTitleOrRevID( $str ) { $retval = false; - if( is_numeric( $str ) ) { + if ( is_numeric( $str ) ) { $retval = Revision::newFromID( $str ); } - if( !$retval ) { + if ( !$retval ) { $retval = Title::newFromURL( $str ); } return $retval; @@ -139,7 +140,7 @@ $retval .= Xml::inputLabel( wfMsg( 'changeauthor-pagename-or-revid' ), 'pagename-revid', 'pagename-revid' ); $retval .= Xml::submitButton( wfMsg( 'changeauthor-pagenameform-go' ) ); - if( $errMsg != '' ) { + if ( $errMsg != '' ) { $retval .= Xml::openElement( 'p' ) . Xml::openElement( 'b' ); $retval .= Xml::element( 'font', array( 'color' => 'red' ), $errMsg ); $retval .= Xml::closeElement( 'b' ) . Xml::closeElement( 'p' ); @@ -161,7 +162,7 @@ */ private function buildRevisionLine( $rev, $title, $isFirst = false, $isLast = false ) { // Build curlink - if( $isFirst ) { + if ( $isFirst ) { $curLink = wfMsgExt( 'cur', 'escape' ); } else { $curLink = $this->skin->makeKnownLinkObj( $title, @@ -169,7 +170,7 @@ "oldid={$rev->getId()}&diff=cur" ); } - if( $isLast ) { + if ( $isLast ) { $lastLink = wfMsgExt( 'last', 'escape' ); } else { $lastLink = $this->skin->makeKnownLinkObj( $title, @@ -180,7 +181,7 @@ // Build oldid link global $wgLang; $date = $wgLang->timeanddate( wfTimestamp( TS_MW, $rev->getTimestamp() ), true ); - if( $rev->userCan( Revision::DELETED_TEXT ) ) { + if ( $rev->userCan( Revision::DELETED_TEXT ) ) { $link = $this->skin->makeKnownLinkObj( $title, $date, "oldid={$rev->getId()}" ); } else { $link = $date; @@ -191,8 +192,8 @@ $userBox = Xml::input( "user-new-{$rev->getId()}", 50, $wgRequest->getVal( "user-{$rev->getId()}", $rev->getUserText() ) ); $userText = Xml::hidden( "user-old-{$rev->getId()}", $rev->getUserText() ) . $rev->getUserText(); - if( !is_null( $size = $rev->getSize() ) ) { - if( $size == 0 ) { + if ( !is_null( $size = $rev->getSize() ) ) { + if ( $size == 0 ) { $stxt = wfMsgHtml( 'historyempty' ); } else { $stxt = wfMsgHtml( 'historysize', $wgLang->formatNum( $size ) ); @@ -223,10 +224,10 @@ array( 'ORDER BY' => 'rev_timestamp DESC', 'LIMIT' => 50 ) ); $revs = array(); - while( ( $r = $dbr->fetchObject( $res ) ) ) { + while ( ( $r = $dbr->fetchObject( $res ) ) ) { $revs[] = new Revision( $r ); } - if( empty( $revs ) ) { + if ( empty( $revs ) ) { // That's *very* weird return wfMsg( 'changeauthor-weirderror' ); } @@ -237,14 +238,14 @@ $retval .= Xml::hidden( 'targetpage', $title->getPrefixedDBkey() ); $retval .= Xml::openElement( 'fieldset' ); $retval .= Xml::element( 'p', array(), wfMsg( 'changeauthor-explanation-multi' ) ); - $retval .= Xml::inputLabel( wfMsg( 'changeauthor-comment'), 'comment', 'comment', 50); + $retval .= Xml::inputLabel( wfMsg( 'changeauthor-comment' ), 'comment', 'comment', 50 ); $retval .= Xml::submitButton( wfMsgExt( 'changeauthor-changeauthors-multi', array( 'parsemag', 'escape' ), count( $revs ) ) ); - if( $errMsg != '' ) { + if ( $errMsg != '' ) { $retval .= Xml::openElement( 'p' ) . Xml::openElement( 'b' ); $retval .= Xml::element( 'font', array( 'color' => 'red' ), $errMsg ); $retval .= Xml::closeElement( 'b' ) . Xml::closeElement( 'p' ); @@ -252,7 +253,7 @@ $retval .= Xml::element( 'h2', array(), $title->getPrefixedText() ); $retval .= Xml::openElement( 'ul' ); $count = count( $revs ); - foreach( $revs as $i => $rev ) { + foreach ( $revs as $i => $rev ) { $retval .= $this->buildRevisionLine( $rev, $title, ( $i == 0 ), ( $i == $count - 1 ) ); } $retval .= Xml::closeElement( 'ul' ); @@ -277,7 +278,7 @@ $retval .= Xml::element( 'p', array(), wfMsg( 'changeauthor-explanation-single' ) ); $retval .= Xml::inputLabel( wfMsg( 'changeauthor-comment' ), 'comment', 'comment' ); $retval .= Xml::submitButton( wfMsg( 'changeauthor-changeauthors-single' ) ); - if( $errMsg != '' ) { + if ( $errMsg != '' ) { $retval .= Xml::openElement( 'p' ) . Xml::openElement( 'b' ); $retval .= Xml::element( 'font', array( 'color' => 'red' ), $errMsg ); $retval .= Xml::closeElement( 'b' ) . Xml::closeElement( 'p' ); @@ -299,27 +300,27 @@ global $wgRequest; $vals = $wgRequest->getValues(); $retval = array(); - foreach( $vals as $name => $val ) { - if( substr( $name, 0, 9 ) != 'user-new-' ) { + foreach ( $vals as $name => $val ) { + if ( substr( $name, 0, 9 ) != 'user-new-' ) { continue; } $revid = substr( $name, 9 ); - if( !is_numeric( $revid ) ) { + if ( !is_numeric( $revid ) ) { continue; } $new = User::newFromName( $val, false ); - if( !$new ) { // Can this even happen? + if ( !$new ) { // Can this even happen? return wfMsg( 'changeauthor-invalid-username', $val ); } - if( $new->getId() == 0 && $val != 'MediaWiki default' && !User::isIP( $new->getName() ) ) { + if ( $new->getId() == 0 && $val != 'MediaWiki default' && !User::isIP( $new->getName() ) ) { return wfMsg( 'changeauthor-nosuchuser', $val ); } $old = User::newFromName( $wgRequest->getVal( "user-old-$revid" ), false ); - if( !$old->getName() ) { + if ( !$old->getName() ) { return wfMsg( 'changeauthor-invalidform' ); } - if( $old->getName() != $new->getName() ) { + if ( $old->getName() != $new->getName() ) { $retval[$revid] = array( $old, $new ); } } @@ -336,7 +337,7 @@ $dbw->begin(); $editcounts = array(); // Array to keep track of EC mutations; key=userid, value=mutation $log = new LogPage( 'changeauth' ); - foreach( $authors as $id => $users ) { + foreach ( $authors as $id => $users ) { $dbw->update( 'revision', /* SET */array( @@ -360,11 +361,11 @@ $editcounts[$users[1]->getId()]++; $editcounts[$users[0]->getId()]--; } - foreach( $editcounts as $userid => $mutation ) { - if( $mutation == 0 || $userid == 0 ) { + foreach ( $editcounts as $userid => $mutation ) { + if ( $mutation == 0 || $userid == 0 ) { continue; } - if( $mutation > 0 ) { + if ( $mutation > 0 ) { $mutation = "+$mutation"; } $dbw->update( @@ -373,7 +374,7 @@ array( 'user_id' => $userid ), __METHOD__ ); - if( $dbw->affectedRows() == 0 ) { + if ( $dbw->affectedRows() == 0 ) { // Let's have mercy on those who don't have a proper DB server // (but not enough to spare their master) $count = $dbw->selectField( @@ -392,5 +393,4 @@ } $dbw->commit(); } - -} \ No newline at end of file +} Modified: trunk/extensions/ChangeAuthor/ChangeAuthor.i18n.php =================================================================== --- trunk/extensions/ChangeAuthor/ChangeAuthor.i18n.php 2010-04-28 21:30:06 UTC (rev 65635) +++ trunk/extensions/ChangeAuthor/ChangeAuthor.i18n.php 2010-04-28 21:36:20 UTC (rev 65636) @@ -15,8 +15,9 @@ * Written for the Bokt Wiki <http://www.bokt.nl/wiki/> by Roan Kattouw <roan.katt...@home.nl> * For information how to install and use this extension, see the README file. */ + # Alert the user that this is not a valid entry point to MediaWiki if they try to access the extension file directly. -if( !defined( 'MEDIAWIKI' ) ) { +if ( !defined( 'MEDIAWIKI' ) ) { echo <<<EOT To install the ChangeAuthor extension, put the following line in LocalSettings.php: require_once( "\$IP/extensions/ChangeAuthor/ChangeAuthor.setup.php" ); @@ -423,8 +424,8 @@ 'changeauthor-nosuchuser' => 'L\'usuari "$1" no existeix.', 'changeauthor-revview' => 'Revisió número $1 de $2', 'changeauthor-nosuchtitle' => 'No hi ha cap pàgina anomenada "$1".', - 'changeauthor-weirderror' => "Ha ocorregut un error poc comú. -Si us plau, intenteu-ho de nou. + 'changeauthor-weirderror' => "Ha ocorregut un error poc comú. +Si us plau, intenteu-ho de nou. Si l'error persisteix, és probable que la base de dades estigui avariada.", 'changeauthor-invalidform' => 'Useu el formulari de la [[Special:ChangeAuthor|pàgina especial]] adient.', 'changeauthor-success' => 'La vostra petició ha estat processada satisfactòriament.', @@ -1397,7 +1398,7 @@ 'changeauthor-pagenameform-go' => 'പോകൂ', 'changeauthor-comment' => 'അഭിപ്രായം:', 'changeauthor-changeauthors-multi' => 'ലേഖകരെ മാറ്റുക', - 'changeauthor-explanation-multi' => "ഈ താൾ ഉപയോഗിച്ച് താങ്കൾക്ക് ഒരു പതിപ്പിന്റെ ലേഖകനെ മാറ്റാവുന്നതാണ്. + 'changeauthor-explanation-multi' => "ഈ താൾ ഉപയോഗിച്ച് താങ്കൾക്ക് ഒരു പതിപ്പിന്റെ ലേഖകനെ മാറ്റാവുന്നതാണ്. താഴെയുള്ള പട്ടികയിൽ ഒന്നോ അതിലധികമോ ഉപയോക്തൃനാമങ്ങൾ മാറ്റിയിട്ട്, അഭിപ്രായം രേഖപ്പെടുത്തിയതിനു ശേഷം (നിർബന്ധമില്ല), 'ലേഖകരെ മാറ്റുക' എന്ന ബട്ടൺ ഞെക്കുക.", 'changeauthor-changeauthors-single' => 'ലേഖകനെ മാറ്റുക', 'changeauthor-explanation-single' => "ഈ ഫോം ഉപയോഗിച്ച് ഒരു പതിപ്പിന്റെ ലേഖകനെ താങ്കൾക്ക് മാറ്റാവുന്നതാണ്. താഴെയുള്ള ഫോമിൽ ഉപയോക്തൃനാമം മാറ്റി, ലേഖകനെ മാറ്റാനുള്ള കാരണവും രേഖപ്പെടുത്തി (നിർബന്ധമില്ല), 'ലേഖകനെ മാറ്റുക' എന്ന ബട്ടൺ ഞെക്കുക.", @@ -1520,7 +1521,7 @@ 'changeauthor-pagenameform-go' => 'Gå', 'changeauthor-comment' => 'Kommentar:', 'changeauthor-changeauthors-multi' => 'Endra {{PLURAL:$1|forfattar|forfattarar}}', - 'changeauthor-explanation-multi' => 'Med dette skjemaet kan du endra kven som blir oppgjeve som forfattar til versjonar. + 'changeauthor-explanation-multi' => 'Med dette skjemaet kan du endra kven som blir oppgjeve som forfattar til versjonar. Endra eitt eller fleire av brukarnamna i lista nedanfor, legg til ein (valfri) kommentar og trykk knappen «Endra forfattar(ar)».', 'changeauthor-changeauthors-single' => 'Endra forfattar', 'changeauthor-explanation-single' => 'Med dette skjemaet kan du endra på kven som blir oppgjeve som forfattaren til ein versjon. Endra brukarnamnet nedanfor, legg til ein (valfri) kommentar, og trykk på knappen «Endra forfattar».', @@ -1740,8 +1741,8 @@ 'changeauthor-nosuchuser' => 'Utilizador "$1" não existe.', 'changeauthor-revview' => 'Revisão #$1 de $2', 'changeauthor-nosuchtitle' => 'Não existe nenhuma página chamada "$1".', - 'changeauthor-weirderror' => 'Ocorreu um erro muito estranho. -Por favor, tente o seu pedido de novo. + 'changeauthor-weirderror' => 'Ocorreu um erro muito estranho. +Por favor, tente o seu pedido de novo. Se este erro persistir, provavelmente a base de dados não está em boas condições.', 'changeauthor-invalidform' => 'Por favor, utilize o formulário fornecido pela [[Special:ChangeAuthor|página especial]] em vez de um formulário personalizado.', 'changeauthor-success' => 'O seu pedido foi processado com sucesso.', @@ -2394,4 +2395,3 @@ 'changeauthor-logentry' => '更改[[$1]]修訂版本$2的作者從 $3 到 $4', 'changeauthor-logpagename' => '作者更改日誌', ); - Modified: trunk/extensions/ChangeAuthor/ChangeAuthor.php =================================================================== --- trunk/extensions/ChangeAuthor/ChangeAuthor.php 2010-04-28 21:30:06 UTC (rev 65635) +++ trunk/extensions/ChangeAuthor/ChangeAuthor.php 2010-04-28 21:36:20 UTC (rev 65636) @@ -8,7 +8,7 @@ * @file * @ingroup Extensions * @author Roan Kattouw <roan.katt...@home.nl> - * @copyright Copyright © 2007 Roan Kattouw + * @copyright Copyright © 2007 Roan Kattouw * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License * * An extension that allows changing the author of a revision @@ -16,7 +16,7 @@ * For information how to install and use this extension, see the README file. */ # Alert the user that this is not a valid entry point to MediaWiki if they try to access the extension file directly. -if( !defined( 'MEDIAWIKI' ) ) { +if ( !defined( 'MEDIAWIKI' ) ) { echo <<<EOT To install the ChangeAuthor extension, put the following line in LocalSettings.php: require_once( "\$IP/extensions/ChangeAuthor/ChangeAuthor.php" ); @@ -35,7 +35,7 @@ ); // Set up the new special page -$dir = dirname(__FILE__) . '/'; +$dir = dirname( __FILE__ ) . '/'; $wgExtensionMessagesFiles['ChangeAuthor'] = $dir . 'ChangeAuthor.i18n.php'; $wgExtensionAliasesFiles['ChangeAuthor'] = $dir . 'ChangeAuthor.alias.php'; $wgAutoloadClasses['ChangeAuthor'] = $dir . 'ChangeAuthor.body.php'; Modified: trunk/extensions/ChangeAuthor/LEESMIJ =================================================================== --- trunk/extensions/ChangeAuthor/LEESMIJ 2010-04-28 21:30:06 UTC (rev 65635) +++ trunk/extensions/ChangeAuthor/LEESMIJ 2010-04-28 21:36:20 UTC (rev 65636) @@ -18,7 +18,7 @@ Deze extensie maakt het mogelijk om de auteur van een bewerking naderhand te veranderen. Zo kan een verandering door Piet veranderd worden zodat het lijkt alsof Klaas hem gemaakt heeft. Natuurlijk kunnen niet alle gebruikers dit doen, en worden alle veranderingen bijgehouden in een logboek. 2. VERANDERAUTEUR DOWNLOADEN -U kunt een .tar.gz bestand downloaden op http://www.mediawiki.org/wiki/Special:ExtensionDistributor/ChangeAuthor . +U kunt een .tar.gz bestand downloaden op http://www.mediawiki.org/wiki/Special:ExtensionDistributor/ChangeAuthor . 3. INSTALLATIE Download de .tar.gz genoemd onder (2.) en pak hem uit in /pad/naar/uw/wiki/extensions . Open dan LocalSettings.php, en voeg de volgende regel toe aan het einde: @@ -73,4 +73,4 @@ VeranderAuteur wordt momenteel beheerd door Roan Kattouw. Indien u vragen hebt, klachten, idee\xEBn voor nieuwe mogelijkheden, een fout gevonden hebt, of een andere reden hebt om contact op te nemen met de beheerder, stuur dan uw e-mails naar roan.katt...@home.nl en noem "ChangeAuthor" in het onderwerp. In het Nederlands geschreven e-mails zijn ook welkom. 9. DANKWOORD -VeranderAuteur is geschreven voor de Bokt Wiki <http://www.bokt.nl/wiki/> door Roan Kattouw <roan.katt...@home.nl> \ No newline at end of file +VeranderAuteur is geschreven voor de Bokt Wiki <http://www.bokt.nl/wiki/> door Roan Kattouw <roan.katt...@home.nl> Modified: trunk/extensions/ChangeAuthor/README =================================================================== --- trunk/extensions/ChangeAuthor/README 2010-04-28 21:30:06 UTC (rev 65635) +++ trunk/extensions/ChangeAuthor/README 2010-04-28 21:36:20 UTC (rev 65636) @@ -19,7 +19,7 @@ This extension allows for changing the author of a revision, e.g. an edit made by Alice can be changed to look like it was made by Bob instead. Of course, only privileged users can do this, and all changes are logged. 2. WHERE TO GET CHANGEAUTHOR -You can download a tarball at http://www.mediawiki.org/wiki/Special:ExtensionDistributor/ChangeAuthor . +You can download a tarball at http://www.mediawiki.org/wiki/Special:ExtensionDistributor/ChangeAuthor . 3. INSTALLATION Download the tarball mentioned in section 2, and extract it in /path/to/your/wiki/extensions . Open LocalSettings.php and add the following line at the end: @@ -45,7 +45,7 @@ $wgGroupPermissions['groupname']['changeauthor'] = true; to LocalSettings.php (replace 'groupname' with the name of your custom group). -NOTE: If a user is in multiple groups, they will be able to use ChangeAuthor even if that's allowed for only one of those groups. E.g.: if group A can't use ChangeAuthor but group B can, a user in both group A and B will be allowed to use ChangeAuthor. +NOTE: If a user is in multiple groups, they will be able to use ChangeAuthor even if that's allowed for only one of those groups. E.g.: if group A can't use ChangeAuthor but group B can, a user in both group A and B will be allowed to use ChangeAuthor. 4B. CREATING A NEW GROUP You can also create a separate group for users who can use ChangeAuthor. To do this, add the following line to LocalSettings.php: @@ -75,4 +75,4 @@ ChangeAuthor is currently maintained by Roan Kattouw. If you have any questions, complaints, feature requests, found a bug, or any other reason to contact the maintainer, please send your e-mails to roan.katt...@home.nl and mention "ChangeAuthor" in the subject. 10. CREDITS -ChangeAuthor was written for the Bokt Wiki <http://www.bokt.nl/wiki/> by Roan Kattouw <roan.katt...@home.nl> \ No newline at end of file +ChangeAuthor was written for the Bokt Wiki <http://www.bokt.nl/wiki/> by Roan Kattouw <roan.katt...@home.nl> _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs