From cecb985bee3bdd252e1b8dc0bd500b37cd52be01 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 16 May 2007 20:58:53 +0000 Subject: Aktualisierung auf MediaWiki 1.10.0 Plugins angepasst und verbessert kleine Korrekturen am Design --- includes/LogPage.php | 56 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 7 deletions(-) (limited to 'includes/LogPage.php') diff --git a/includes/LogPage.php b/includes/LogPage.php index dd395126..af03bbba 100644 --- a/includes/LogPage.php +++ b/includes/LogPage.php @@ -21,7 +21,6 @@ /** * Contain log classes * - * @package MediaWiki */ /** @@ -29,7 +28,6 @@ * The logs are now kept in a table which is easier to manage and trim * than ever-growing wiki pages. * - * @package MediaWiki */ class LogPage { /* @access private */ @@ -44,7 +42,7 @@ class LogPage { * 'upload', 'move' * @param bool $rc Whether to update recent changes as well as the logging table */ - function LogPage( $type, $rc = true ) { + function __construct( $type, $rc = true ) { $this->type = $type; $this->updateRecentChanges = $rc; } @@ -55,7 +53,7 @@ class LogPage { global $wgUser; $fname = 'LogPage::saveContent'; - $dbw =& wfGetDB( DB_MASTER ); + $dbw = wfGetDB( DB_MASTER ); $uid = $wgUser->getID(); $this->timestamp = $now = wfTimestampNow(); @@ -119,7 +117,7 @@ class LogPage { } /** - * @fixme: handle missing log types + * @todo handle missing log types * @static */ function logHeader( $type ) { @@ -134,6 +132,10 @@ class LogPage { global $wgLang, $wgContLang, $wgLogActions; $key = "$type/$action"; + + if( $key == 'patrol/patrol' ) + return PatrolLog::makeActionText( $title, $params, $skin ); + if( isset( $wgLogActions[$key] ) ) { if( is_null( $title ) ) { $rv=wfMsg( $wgLogActions[$key] ); @@ -183,8 +185,13 @@ class LogPage { } } else { array_unshift( $params, $titleLink ); - if ( $translate && $key == 'block/block' ) { - $params[1] = $wgLang->translateBlockExpiry($params[1]); + if ( $key == 'block/block' ) { + if ( $translate ) { + $params[1] = $wgLang->translateBlockExpiry( $params[1] ); + } + $params[2] = isset( $params[2] ) + ? self::formatBlockFlags( $params[2] ) + : ''; } $rv = wfMsgReal( $wgLogActions[$key], $params, true, !$skin ); } @@ -241,6 +248,41 @@ class LogPage { return explode( "\n", $blob ); } } + + /** + * Convert a comma-delimited list of block log flags + * into a more readable (and translated) form + * + * @param $flags Flags to format + * @return string + */ + public static function formatBlockFlags( $flags ) { + $flags = explode( ',', trim( $flags ) ); + if( count( $flags ) > 0 ) { + for( $i = 0; $i < count( $flags ); $i++ ) + $flags[$i] = self::formatBlockFlag( $flags[$i] ); + return '(' . implode( ', ', $flags ) . ')'; + } else { + return ''; + } + } + + /** + * Translate a block log flag if possible + * + * @param $flag Flag to translate + * @return string + */ + public static function formatBlockFlag( $flag ) { + static $messages = array(); + if( !isset( $messages[$flag] ) ) { + $k = 'block-log-flags-' . $flag; + $msg = wfMsg( $k ); + $messages[$flag] = htmlspecialchars( wfEmptyMsg( $k, $msg ) ? $flag : $msg ); + } + return $messages[$flag]; + } + } ?> -- cgit v1.2.2