From: Alexandre Emsenhuber Date: Sun, 9 Mar 2008 21:08:42 +0000 (+0000) Subject: * Use Linker::revComment() to format the comment X-Git-Tag: 1.31.0-rc.0~49185 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/modifier.php?a=commitdiff_plain;h=39e37b5c0b34c05e94ac7526ce1659ec1791d6f0;p=lhc%2Fweb%2Fwiklou.git * Use Linker::revComment() to format the comment * Don't allow users to see the lenght of the text if they can't see it * $fname -> __METHOD__ * wfElement() -> Xml::element() * some fixes in Article.php --- diff --git a/includes/Article.php b/includes/Article.php index f726184ff9..aa870931d5 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -2247,7 +2247,7 @@ class Article { 'ar_text_id' => 'rev_text_id', 'ar_text' => '\'\'', // Be explicit to appease 'ar_flags' => '\'\'', // MySQL's "strict mode"... - 'ar_len' => 'rev_len', + 'ar_len' => 'rev_len', 'ar_page_id' => 'page_id', 'ar_deleted' => $bitfield ), array( @@ -2690,7 +2690,7 @@ class Article { $sk = $wgUser->getSkin(); $lnk = $current ? wfMsg( 'currentrevisionlink' ) - : $lnk = $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'currentrevisionlink' ) ); + : $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'currentrevisionlink' ) ); $curdiff = $current ? wfMsg( 'diff' ) : $sk->makeKnownLinkObj( $this->mTitle, wfMsg( 'diff' ), 'diff=cur&oldid='.$oldid ); diff --git a/includes/PageHistory.php b/includes/PageHistory.php index 9550da65f6..5a946213ef 100644 --- a/includes/PageHistory.php +++ b/includes/PageHistory.php @@ -69,8 +69,7 @@ class PageHistory { /* Client cache fresh and headers sent, nothing more to do. */ return; - $fname = 'PageHistory::history'; - wfProfileIn( $fname ); + wfProfileIn( __METHOD__ ); /* * Setup page variables. @@ -89,7 +88,7 @@ class PageHistory { $feedType = $wgRequest->getVal( 'feed' ); if( $feedType ) { - wfProfileOut( $fname ); + wfProfileOut( __METHOD__ ); return $this->feed( $feedType ); } @@ -98,7 +97,7 @@ class PageHistory { */ if( !$this->mTitle->exists() ) { $wgOut->addWikiMsg( 'nohistory' ); - wfProfileOut( $fname ); + wfProfileOut( __METHOD__ ); return; } @@ -126,7 +125,7 @@ class PageHistory { $this->endHistoryList() . $pager->getNavigationBar() ); - wfProfileOut( $fname ); + wfProfileOut( __METHOD__ ); } /** @@ -240,12 +239,12 @@ class PageHistory { $s .= " $link"; $s .= ' '.$this->mSkin->revUserTools( $rev, true ); - + if( $row->rev_minor_edit ) { - $s .= ' ' . wfElement( 'span', array( 'class' => 'minor' ), wfMsg( 'minoreditletter') ); + $s .= ' ' . Xml::element( 'span', array( 'class' => 'minor' ), wfMsg( 'minoreditletter') ); } - if ( !is_null( $size = $rev->getSize() ) ) { + if ( !is_null( $size = $rev->getSize() ) && $rev->userCan( Revision::DELETED_TEXT ) ) { if ( $size == 0 ) $stxt = wfMsgHtml( 'historyempty' ); else @@ -253,19 +252,13 @@ class PageHistory { $s .= " $stxt"; } - #getComment is safe, but this is better formatted - if( $rev->isDeleted( Revision::DELETED_COMMENT ) ) { - $s .= " " . - wfMsgHtml( 'rev-deleted-comment' ) . ""; - } else { - $s .= $this->mSkin->revComment( $rev ); - } + $s .= $this->mSkin->revComment( $rev, false, true ); if ($notificationtimestamp && ($row->rev_timestamp >= $notificationtimestamp)) { $s .= ' ' . wfMsgHtml( 'updatedmarker' ) . ''; } #add blurb about text having been deleted - if( $row->rev_deleted & Revision::DELETED_TEXT ) { + if( $rev->isDeleted( Revision::DELETED_TEXT ) ) { $s .= ' ' . wfMsgHtml( 'deletedrev' ) . ''; } @@ -409,11 +402,11 @@ class PageHistory { function getLatestId() { if( is_null( $this->mLatestId ) ) { $id = $this->mTitle->getArticleID(); - $db = wfGetDB(DB_SLAVE); + $db = wfGetDB( DB_SLAVE ); $this->mLatestId = $db->selectField( 'page', "page_latest", array( 'page_id' => $id ), - 'PageHistory::getLatestID' ); + __METHOD__ ); } return $this->mLatestId; } @@ -424,8 +417,6 @@ class PageHistory { * used by the main UI but that's now handled by the pager. */ function fetchRevisions($limit, $offset, $direction) { - $fname = 'PageHistory::fetchRevisions'; - $dbr = wfGetDB( DB_SLAVE ); if ($direction == PageHistory::DIR_PREV) @@ -444,7 +435,7 @@ class PageHistory { 'revision', Revision::selectFields(), array_merge(array("rev_page=$page_id"), $offsets), - $fname, + __METHOD__, array('ORDER BY' => "rev_timestamp $dirs", 'USE INDEX' => 'page_timestamp', 'LIMIT' => $limit) ); @@ -459,7 +450,6 @@ class PageHistory { /** @todo document */ function getNotificationTimestamp() { global $wgUser, $wgShowUpdatedMarker; - $fname = 'PageHistory::getNotficationTimestamp'; if ($this->mNotificationTimestamp !== NULL) return $this->mNotificationTimestamp; @@ -476,7 +466,7 @@ class PageHistory { 'wl_title' => $this->mTitle->getDBkey(), 'wl_user' => $wgUser->getID() ), - $fname); + __METHOD__ ); // Don't use the special value reserved for telling whether the field is filled if ( is_null( $this->mNotificationTimestamp ) ) {