From: Aaron Schulz Date: Thu, 4 Sep 2008 19:32:58 +0000 (+0000) Subject: Clean up showIntro(): X-Git-Tag: 1.31.0-rc.0~45485 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/comptes/?a=commitdiff_plain;h=0b5ef72d92c7852715ae76439ab6146126fd3743;p=lhc%2Fweb%2Fwiklou.git Clean up showIntro(): * Tweak code style * Move exists() check to deletion log function * Document this fucking code --- diff --git a/includes/EditPage.php b/includes/EditPage.php index de414416c5..db9f671e85 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -683,30 +683,30 @@ class EditPage { */ protected function showIntro() { global $wgOut, $wgUser; - if( $this->suppressIntro ) + if( $this->suppressIntro ) { return; - + } # Show a warning message when someone creates/edits a user (talk) page but the user does not exists if( $this->mTitle->getNamespace() == NS_USER || $this->mTitle->getNamespace() == NS_USER_TALK ) { $parts = explode( '/', $this->mTitle->getText(), 2 ); $username = $parts[0]; $id = User::idFromName( $username ); $ip = User::isIP( $username ); - - if ( $id == 0 && !$ip ) { + if( $id == 0 && !$ip ) { $wgOut->wrapWikiMsg( '
$1
', array( 'userpage-userdoesnotexist', $username ) ); } } - + # Try to add a custom edit intro, or use the standard one if this is not possible. if( !$this->showCustomIntro() && !$this->mTitle->exists() ) { if( $wgUser->isLoggedIn() ) { $wgOut->wrapWikiMsg( '
$1
', 'newarticletext' ); } else { $wgOut->wrapWikiMsg( '
$1
', 'newarticletextanon' ); } - $this->showDeletionLog( $wgOut ); } + # Give a notice if the user is editing a deleted page... + $this->showDeletionLog( $wgOut ); } /** @@ -2346,19 +2346,23 @@ END * @param OutputPage $out */ protected function showDeletionLog( $out ) { - global $wgUser; - $loglist = new LogEventsList( $wgUser->getSkin(), $out ); - $pager = new LogPager( $loglist, 'delete', false, $this->mTitle->getPrefixedText() ); - if( $pager->getNumRows() > 0 ) { - $out->addHtml( '
' ); - $out->addWikiMsg( 'recreate-deleted-warn' ); - $out->addHTML( - $loglist->beginLogEventsList() . - $pager->getBody() . - $loglist->endLogEventsList() - ); - $out->addHtml( '
' ); + if( !$this->mTitle->exists() ) { + global $wgUser; + $loglist = new LogEventsList( $wgUser->getSkin(), $out ); + $pager = new LogPager( $loglist, 'delete', false, $this->mTitle->getPrefixedText() ); + if( $pager->getNumRows() > 0 ) { + $out->addHtml( '
' ); + $out->addWikiMsg( 'recreate-deleted-warn' ); + $out->addHTML( + $loglist->beginLogEventsList() . + $pager->getBody() . + $loglist->endLogEventsList() + ); + $out->addHtml( '
' ); + return true; + } } + return false; } /**