http://www.mediawiki.org/wiki/Special:Code/MediaWiki/92737
Revision: 92737 Author: ashley Date: 2011-07-21 07:49:27 +0000 (Thu, 21 Jul 2011) Log Message: ----------- SocialProfile: follow-up to r91854: *actually register the special page *define an undefined variable *make page titles less US-centric *run numbers through Language::formatNum() Modified Paths: -------------- trunk/extensions/SocialProfile/SocialProfile.alias.php trunk/extensions/SocialProfile/SocialProfile.php trunk/extensions/SocialProfile/UserStats/GenerateTopUsersReport.php Modified: trunk/extensions/SocialProfile/SocialProfile.alias.php =================================================================== --- trunk/extensions/SocialProfile/SocialProfile.alias.php 2011-07-21 07:40:07 UTC (rev 92736) +++ trunk/extensions/SocialProfile/SocialProfile.alias.php 2011-07-21 07:49:27 UTC (rev 92737) @@ -12,6 +12,7 @@ $specialPageAliases['en'] = array( 'AddRelationship' => array( 'AddRelationship' ), 'EditProfile' => array( 'EditProfile' ), + 'GenerateTopUsersReport' => array( 'GenerateTopUsersReport' ), 'PopulateUserProfiles' => array( 'PopulateUserProfiles' ), 'RemoveAvatar' => array( 'RemoveAvatar' ), 'RemoveRelationship' => array( 'RemoveRelationship' ), Modified: trunk/extensions/SocialProfile/SocialProfile.php =================================================================== --- trunk/extensions/SocialProfile/SocialProfile.php 2011-07-21 07:40:07 UTC (rev 92736) +++ trunk/extensions/SocialProfile/SocialProfile.php 2011-07-21 07:49:27 UTC (rev 92737) @@ -24,6 +24,8 @@ $wgExtensionAliasesFiles['SocialProfile'] = $dir . 'SocialProfile.alias.php'; // Classes to be autoloaded +$wgAutoloadClasses['GenerateTopUsersReport'] = $dir . 'UserStats/GenerateTopUsersReport.php'; + $wgAutoloadClasses['SpecialAddRelationship'] = $dir . 'UserRelationship/SpecialAddRelationship.php'; $wgAutoloadClasses['SpecialBoardBlast'] = $dir . 'UserBoard/SpecialSendBoardBlast.php'; $wgAutoloadClasses['SpecialEditProfile'] = $dir . 'UserProfile/SpecialEditProfile.php'; @@ -55,6 +57,7 @@ // New special pages $wgSpecialPages['AddRelationship'] = 'SpecialAddRelationship'; $wgSpecialPages['EditProfile'] = 'SpecialEditProfile'; +$wgSpecialPages['GenerateTopUsersReport'] = 'GenerateTopUsersReport'; $wgSpecialPages['PopulateUserProfiles'] = 'SpecialPopulateUserProfiles'; $wgSpecialPages['RemoveAvatar'] = 'RemoveAvatar'; $wgSpecialPages['RemoveRelationship'] = 'SpecialRemoveRelationship'; Modified: trunk/extensions/SocialProfile/UserStats/GenerateTopUsersReport.php =================================================================== --- trunk/extensions/SocialProfile/UserStats/GenerateTopUsersReport.php 2011-07-21 07:40:07 UTC (rev 92736) +++ trunk/extensions/SocialProfile/UserStats/GenerateTopUsersReport.php 2011-07-21 07:49:27 UTC (rev 92737) @@ -81,12 +81,13 @@ $user_count = $wgRequest->getInt( 'user_count', 10 ); - // @todo FIXME: this is rather US-specific... if( $period == 'weekly' ) { - $period_title = date( 'm/d/Y', strtotime( '-1 week' ) ) . '-' . - date( 'm/d/Y', time() ); + $period_title = $wgContLang->date( wfTimestamp( TS_MW, strtotime( '-1 week' ) ) ) . + '-' . $wgContLang->date( wfTimestampNow() ); } elseif ( $period == 'monthly' ) { - $period_title = date( 'M Y', strtotime( '-1 month' ) ); + $date = getdate(); // It's a PHP core function + $period_title = $wgContLang->getMonthName( $date['mon'] - 1 ) . + ' ' . $date['year']; } $dbw = wfGetDB( DB_MASTER ); @@ -99,6 +100,8 @@ array( 'ORDER BY' => 'up_points DESC', 'LIMIT' => $user_count ) ); + $last_rank = 0; + // Initial run is a special case if ( $dbw->numRows( $res ) <= 0 ) { // For the initial run, everybody's a winner! @@ -201,7 +204,7 @@ "user-stats-{$period}-win-congratulations", array( 'parsemag', 'content' ), $winner_count, - $wgUserStatsPointValues["points_winner_{$period}"] + $wgContLang->formatNum( $wgUserStatsPointValues["points_winner_{$period}"] ) ) . "\n\n"; $pageContent .= "=={$winners}==\n\n<br />\n"; @@ -213,7 +216,7 @@ 'user-stats-report-row', $user['rank'], $user['user_name'], - number_format( $user['points'] ) + $wgContLang->formatNum( $user['points'] ) ) . "\n\n"; $out .= "<div class=\"top-fan-row\"> @@ -223,7 +226,7 @@ $out .= '<span class="top-fan-points">' . wfMsgWikiHtml( 'user-stats-report-points', - number_format( $user['points'] ) + $wgContLang->formatNum( $user['points'] ) ) . '</span> </div>'; } _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs