r61145 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61144‎ | r61145 | r61146 >
Date:18:19, 16 January 2010
Author:ashley
Status:deferred
Tags:
Comment:
SocialProfile: general cleanup
Modified paths:
  • /trunk/extensions/SocialProfile/SystemGifts/SpecialSystemGiftManagerLogo.php (modified) (history)
  • /trunk/extensions/SocialProfile/SystemGifts/SpecialViewSystemGifts.php (modified) (history)
  • /trunk/extensions/SocialProfile/UserRelationship/SpecialAddRelationship.php (modified) (history)
  • /trunk/extensions/SocialProfile/UserRelationship/SpecialRemoveRelationship.php (modified) (history)
  • /trunk/extensions/SocialProfile/UserRelationship/SpecialViewRelationships.php (modified) (history)
  • /trunk/extensions/SocialProfile/UserStats/EditCount.php (modified) (history)
  • /trunk/extensions/SocialProfile/UserStats/SpecialUpdateEditCounts.php (modified) (history)
  • /trunk/extensions/SocialProfile/UserStats/TopFansByStat.php (modified) (history)
  • /trunk/extensions/SocialProfile/UserStats/TopFansRecent.php (modified) (history)
  • /trunk/extensions/SocialProfile/UserStats/TopUsers.php (modified) (history)
  • /trunk/extensions/SocialProfile/UserStats/UserStats.i18n.php (modified) (history)
  • /trunk/extensions/SocialProfile/UserStats/UserStatsClass.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SocialProfile/SystemGifts/SpecialSystemGiftManagerLogo.php
@@ -204,7 +204,7 @@
205205 if ( ( $this->mUploadSize > 102400 ) ) {
206206 # TODO: Format $wgUploadSizeWarning to something that looks better than the raw byte
207207 # value, perhaps add GB,MB and KB suffixes?
208 - $warning .= '<li>' . wfMsg( 'largefile', 102400, $this->mUploadSize ) . '</li>';
 208+ $warning .= '<li>' . wfMsg( 'largefile', 102400, $this->mUploadSize ) . '</li>';
209209 }
210210 if ( $this->mUploadSize == 0 ) {
211211 $warning .= '<li>' . wfMsg( 'emptyfile' ) . '</li>';
Index: trunk/extensions/SocialProfile/SystemGifts/SpecialViewSystemGifts.php
@@ -78,13 +78,13 @@
7979 */
8080 $output .= $wgOut->setPageTitle( wfMsg( 'ga-title', $rel->user_name ) );
8181
82 - $output .= '<div class="back-links">
83 - ' . wfMsg( 'ga-back-link', $wgUser->getUserPage()->escapeFullURL(), $rel->user_name ) . '
84 - </div>';
 82+ $output .= '<div class="back-links">'
 83+ . wfMsg( 'ga-back-link', $wgUser->getUserPage()->escapeFullURL(), $rel->user_name ) .
 84+ '</div>';
8585
86 - $output .= '<div class="ga-count">
87 - ' . wfMsgExt( 'ga-count', 'parsemag', $rel->user_name, $total ) . '
88 - </div>';
 86+ $output .= '<div class="ga-count">'
 87+ . wfMsgExt( 'ga-count', 'parsemag', $rel->user_name, $total ) .
 88+ '</div>';
8989
9090 // Safelinks
9191 $view_system_gift_link = SpecialPage::getTitleFor( 'ViewSystemGift' );
Index: trunk/extensions/SocialProfile/UserStats/TopFansRecent.php
@@ -25,7 +25,9 @@
2626 $wgOut->addExtensionStyle( $wgScriptPath . '/extensions/SocialProfile/UserStats/TopList.css' );
2727 $period = $wgRequest->getVal( 'period' );
2828
29 - if ( !$period ) $period = 'weekly';
 29+ if ( !$period ) {
 30+ $period = 'weekly';
 31+ }
3032
3133 if ( $period == 'weekly' ) {
3234 $wgOut->setPageTitle( wfMsg( 'user-stats-weekly-title' ) );
@@ -56,7 +58,7 @@
5759 __METHOD__,
5860 $params
5961 );
60 - while ( $row = $dbr->fetchObject( $res ) ) {
 62+ foreach ( $res as $row ) {
6163 $user_list[] = array(
6264 'user_id' => $row->up_user_id,
6365 'user_name' => $row->up_user_name,
@@ -67,8 +69,8 @@
6870 }
6971
7072 // Top nav bar
71 - $top_title = Title::makeTitle( NS_SPECIAL, 'TopUsers' );
72 - $recent_title = Title::makeTitle( NS_SPECIAL, 'TopUsersRecent' );
 73+ $top_title = SpecialPage::getTitleFor( 'TopUsers' );
 74+ $recent_title = SpecialPage::getTitleFor( 'TopUsersRecent' );
7375
7476 $out .= '<div class="top-fan-nav">
7577 <h1>' . wfMsg( 'top-fans-by-points-nav-header' ) . '</h1>
@@ -114,8 +116,8 @@
115117 $out .= '<div class="top-fan-row">
116118 <span class="top-fan-num">' . $x . '.</span>
117119 <span class="top-fan">
118 - <img src="' . $wgUploadPath . '/avatars/' . $commentIcon . '" alt="" border="" />
119 - <a href="' . $user_title->escapeFullURL() . '" >' . $user['user_name'] . '</a>
 120+ <img src="' . $wgUploadPath . '/avatars/' . $commentIcon . '" alt="" border="" />
 121+ <a href="' . $user_title->escapeFullURL() . '" >' . $user['user_name'] . '</a>
120122 </span>';
121123
122124 $out .= '<span class="top-fan-points"><b>' . number_format( $user['points'] ) . '</b> ' . wfMsg( 'top-fans-points' ) . '</span>';
Index: trunk/extensions/SocialProfile/UserStats/UserStats.i18n.php
@@ -9,7 +9,8 @@
1010 $messages = array();
1111
1212 /** English
13 - * @author Wikia, Inc.
 13+ * @author Aaron Wright
 14+ * @author David Pean
1415 */
1516 $messages['en'] = array(
1617 'user-stats-alltime-title' => 'All-time most points',
Index: trunk/extensions/SocialProfile/UserStats/EditCount.php
@@ -35,13 +35,14 @@
3636 in_array( $wgTitle->getNamespace(), $wgNamespacesForEditPoints )
3737 ) {
3838 $dbr = wfGetDB( DB_MASTER );
39 - $res = $dbr->select( 'revision',
 39+ $res = $dbr->select(
 40+ 'revision',
4041 array( 'rev_user_text', 'rev_user', 'COUNT(*) AS the_count' ),
4142 array( 'rev_page' => $article->getID(), 'rev_user <> 0' ),
4243 __METHOD__,
4344 array( 'GROUP BY' => 'rev_user_text' )
4445 );
45 - while ( $row = $dbr->fetchObject( $res ) ) {
 46+ foreach ( $res as $row ) {
4647 $stats = new UserStatsTrack( $row->rev_user, $row->rev_user_text );
4748 $stats->decStatField( 'edit', $row->the_count );
4849 }
@@ -61,13 +62,14 @@
6263 in_array( $title->getNamespace(), $wgNamespacesForEditPoints )
6364 ) {
6465 $dbr = wfGetDB( DB_MASTER );
65 - $res = $dbr->select( 'revision',
 66+ $res = $dbr->select(
 67+ 'revision',
6668 array( 'rev_user_text', 'rev_user', 'COUNT(*) AS the_count' ),
6769 array( 'rev_page' => $title->getArticleID(), 'rev_user <> 0' ),
6870 __METHOD__,
6971 array( 'GROUP BY' => 'rev_user_text' )
7072 );
71 - while ( $row = $dbr->fetchObject( $res ) ) {
 73+ foreach ( $res as $row ) {
7274 $stats = new UserStatsTrack( $row->rev_user, $row->rev_user_text );
7375 $stats->incStatField( 'edit', $row->the_count );
7476 }
Index: trunk/extensions/SocialProfile/UserStats/TopFansByStat.php
@@ -64,7 +64,7 @@
6565 __METHOD__,
6666 $params
6767 );
68 - while ( $row = $dbr->fetchObject( $res ) ) {
 68+ foreach ( $res as $row ) {
6969 $user_list[] = array(
7070 'user_id' => $row->stats_user_id,
7171 'user_name' => $row->stats_user_name,
@@ -130,12 +130,12 @@
131131 $out .= '<div class="top-fan-row">
132132 <span class="top-fan-num">' . $x . '.</span>
133133 <span class="top-fan">
134 - <img src="' . $wgUploadPath . '/avatars/' . $commentIcon . '" alt="" border="" />
135 - <a href="' . $user_title->escapeFullURL() . '">' . $user_name . '</a>
 134+ <img src="' . $wgUploadPath . '/avatars/' . $commentIcon . '" alt="" border="" />
 135+ <a href="' . $user_title->escapeFullURL() . '">' . $user_name . '</a>
136136 </span>
137 - <span class="top-fan-points"><b>' . $statistics_row . '</b> ' . $lowercase_statistics_name . '</span>';
138 - $out .= '<div class="cleared"></div>';
139 - $out .= '</div>';
 137+ <span class="top-fan-points"><b>' . $statistics_row . '</b> ' . $lowercase_statistics_name . '</span>
 138+ <div class="cleared"></div>
 139+ </div>';
140140 $x++;
141141 }
142142 $out .= '</div><div class="cleared"></div>';
Index: trunk/extensions/SocialProfile/UserStats/UserStatsClass.php
@@ -1,6 +1,7 @@
22 <?php
3 -if ( !defined( 'MEDIAWIKI' ) )
 3+if ( !defined( 'MEDIAWIKI' ) ) {
44 die();
 5+}
56 /**
67 * Four classes for tracking users' social activity
78 * UserStatsTrack: main class, used by most other SocialProfile components
@@ -119,13 +120,15 @@
120121 */
121122 function addStatRecord() {
122123 $dbw = wfGetDB( DB_MASTER );
123 - $dbw->insert( 'user_stats',
 124+ $dbw->insert(
 125+ 'user_stats',
124126 array(
125127 'stats_year_id' => 0,
126128 'stats_user_id' => $this->user_id,
127129 'stats_user_name' => $this->user_name,
128130 'stats_total_points' => 1000
129 - ), __METHOD__
 131+ ),
 132+ __METHOD__
130133 );
131134 }
132135
@@ -144,7 +147,8 @@
145148 global $wgUser, $wgMemc, $wgSystemGifts, $wgUserStatsTrackWeekly, $wgUserStatsTrackMonthly, $wgUserStatsPointValues;
146149 if ( !$wgUser->isAllowed( 'bot' ) && !$wgUser->isAnon() && $this->stats_fields[$field] ) {
147150 $dbw = wfGetDB( DB_MASTER );
148 - $dbw->update( 'user_stats',
 151+ $dbw->update(
 152+ 'user_stats',
149153 array( $this->stats_fields[$field] . '=' . $this->stats_fields[$field] . "+{$val}" ),
150154 array( 'stats_user_id' => $this->user_id ),
151155 __METHOD__
@@ -164,7 +168,12 @@
165169 }
166170
167171 if ( $wgSystemGifts ) {
168 - $s = $dbw->selectRow( 'user_stats', array( $this->stats_fields[$field] ), array( 'stats_user_id' => $this->user_id ), __METHOD__ );
 172+ $s = $dbw->selectRow(
 173+ 'user_stats',
 174+ array( $this->stats_fields[$field] ),
 175+ array( 'stats_user_id' => $this->user_id ),
 176+ __METHOD__
 177+ );
169178 $stat_field = $this->stats_fields[$field];
170179 $field_count = $s->$stat_field;
171180
@@ -194,7 +203,8 @@
195204 global $wgUser, $wgUserStatsTrackWeekly, $wgUserStatsTrackMonthly;
196205 if ( !$wgUser->isAllowed( 'bot' ) && !$wgUser->isAnon() && $this->stats_fields[$field] ) {
197206 $dbw = wfGetDB( DB_MASTER );
198 - $dbw->update( 'user_stats',
 207+ $dbw->update(
 208+ 'user_stats',
199209 array( $this->stats_fields[$field] . '=' . $this->stats_fields[$field] . "-{$val}" ),
200210 array( 'stats_user_id' => $this->user_id ),
201211 __METHOD__
@@ -307,9 +317,11 @@
308318 $ctgTitle = $ctgTitle->getDBkey();
309319 $dbw = wfGetDB( DB_MASTER );
310320 $sql = "UPDATE {$dbw->tableName( 'user_stats' )} SET stats_opinions_created=";
311 - $sql .= "(SELECT count(*) AS CreatedOpinions FROM {$dbw->tableName( 'page' )} INNER JOIN {$dbw->tableName( 'categorylinks' )} ON page_id = cl_from WHERE (cl_to) = " . $dbw->addQuotes( $ctgTitle ) . " ";
312 - $sql .= ")";
313 - $sql .= " WHERE stats_user_id = " . $this->user_id;
 321+ $sql .= "(SELECT count(*) AS CreatedOpinions FROM {$dbw->tableName( 'page' )}
 322+ INNER JOIN {$dbw->tableName( 'categorylinks' )} ON page_id = cl_from
 323+ WHERE (cl_to) = " . $dbw->addQuotes( $ctgTitle ) . ' ';
 324+ $sql .= ')';
 325+ $sql .= ' WHERE stats_user_id = ' . $this->user_id;
314326
315327 $res = $dbw->query( $sql, __METHOD__ );
316328
@@ -327,9 +339,9 @@
328340 $sql = "UPDATE {$dbw->tableName( 'user_stats' )} SET stats_opinions_published = ";
329341 $sql .= "(SELECT count(*) AS PromotedOpinions FROM {$dbw->tableName( 'page' )} INNER JOIN {$dbw->tableName( 'categorylinks' )} ON page_id = cl_from
330342 INNER JOIN published_page ON page_id=published_page_id
331 - WHERE (cl_to) = " . $dbw->addQuotes( $ctgTitle ) . " AND published_type=1 " . " " . $timeSQL;
332 - $sql .= ")";
333 - $sql .= " WHERE stats_user_id = " . $this->user_id;
 343+ WHERE (cl_to) = " . $dbw->addQuotes( $ctgTitle ) . ' AND published_type=1';
 344+ $sql .= ')';
 345+ $sql .= ' WHERE stats_user_id = ' . $this->user_id;
334346 $res = $dbw->query( $sql, __METHOD__ );
335347
336348 $this->clearCache();
@@ -397,7 +409,7 @@
398410 $dbw = wfGetDB( DB_MASTER );
399411 $sql = "UPDATE LOW_PRIORITY {$dbw->tableName( 'user_stats' )} SET stats_referrals_completed=
400412 (SELECT COUNT(*) AS thecount FROM {$dbw->tableName( 'user_register_track' )} WHERE
401 - ur_user_id_referral = {$this->user_id} AND ur_user_name_referral<>'DNL'
 413+ ur_user_id_referral = {$this->user_id}
402414 )
403415 WHERE stats_user_id = {$this->user_id} ";
404416
@@ -407,7 +419,8 @@
408420
409421 public function updateWeeklyPoints( $points ) {
410422 $dbw = wfGetDB( DB_MASTER );
411 - $res = $dbw->select( 'user_points_weekly',
 423+ $res = $dbw->select(
 424+ 'user_points_weekly',
412425 'up_user_id',
413426 array( "up_user_id = {$this->user_id}" ),
414427 __METHOD__
@@ -417,7 +430,8 @@
418431 if ( !$row ) {
419432 $this->addWeekly();
420433 }
421 - $dbw->update( 'user_points_weekly',
 434+ $dbw->update(
 435+ 'user_points_weekly',
422436 array( 'up_points=up_points+' . $points ),
423437 array( 'up_user_id' => $this->user_id ),
424438 __METHOD__
@@ -426,17 +440,20 @@
427441
428442 public function addWeekly() {
429443 $dbw = wfGetDB( DB_MASTER );
430 - $dbw->insert( 'user_points_weekly',
 444+ $dbw->insert(
 445+ 'user_points_weekly',
431446 array(
432447 'up_user_id' => $this->user_id,
433448 'up_user_name' => $this->user_name
434 - ), __METHOD__
 449+ ),
 450+ __METHOD__
435451 );
436452 }
437453
438454 public function updateMonthlyPoints( $points ) {
439455 $dbw = wfGetDB( DB_MASTER );
440 - $res = $dbw->select( 'user_points_monthly',
 456+ $res = $dbw->select(
 457+ 'user_points_monthly',
441458 'up_user_id',
442459 array( "up_user_id = {$this->user_id}" ),
443460 __METHOD__
@@ -446,7 +463,8 @@
447464 $this->addMonthly();
448465 }
449466
450 - $dbw->update( 'user_points_monthly',
 467+ $dbw->update(
 468+ 'user_points_monthly',
451469 array( 'up_points=up_points+' . $points ),
452470 array( 'up_user_id' => $this->user_id ),
453471 __METHOD__
@@ -455,11 +473,13 @@
456474
457475 public function addMonthly() {
458476 $dbw = wfGetDB( DB_MASTER );
459 - $dbw->insert( 'user_points_monthly',
 477+ $dbw->insert(
 478+ 'user_points_monthly',
460479 array(
461480 'up_user_id' => $this->user_id,
462481 'up_user_name' => $this->user_name
463 - ), __METHOD__
 482+ ),
 483+ __METHOD__
464484 );
465485 }
466486
@@ -483,7 +503,8 @@
484504 }
485505
486506 $dbw = wfGetDB( DB_MASTER );
487 - $res = $dbw->select( 'user_stats',
 507+ $res = $dbw->select(
 508+ 'user_stats',
488509 '*',
489510 array( "stats_user_id = {$this->user_id}" ),
490511 __METHOD__
@@ -511,7 +532,8 @@
512533 }
513534 }
514535
515 - $dbw->update( 'user_stats',
 536+ $dbw->update(
 537+ 'user_stats',
516538 array( 'stats_total_points' => $new_total_points ),
517539 array( 'stats_user_id' => $this->user_id ),
518540 __METHOD__
@@ -779,8 +801,14 @@
780802 public function getLevelName() { return $this->level_name; }
781803 public function getLevelNumber() { return $this->level_number; }
782804 public function getNextLevelName() { return $this->next_level_name; }
783 - public function getPointsNeededToAdvance() { return number_format( $this->next_level_points_needed ); }
784 - public function getLevelMinimum() { return $this->levels[$this->level_name]; }
 805+
 806+ public function getPointsNeededToAdvance() {
 807+ return number_format( $this->next_level_points_needed );
 808+ }
 809+
 810+ public function getLevelMinimum() {
 811+ return $this->levels[$this->level_name];
 812+ }
785813 }
786814
787815 /**
@@ -819,7 +847,8 @@
820848 public function track_email( $type, $count, $page_title = '' ) {
821849 if ( $this->user_id > 0 ) {
822850 $dbw = wfGetDB( DB_MASTER );
823 - $dbw->insert( 'user_email_track',
 851+ $dbw->insert(
 852+ 'user_email_track',
824853 array(
825854 'ue_user_id' => $this->user_id,
826855 'ue_user_name' => $this->user_name,
@@ -827,7 +856,8 @@
828857 'ue_count' => $count,
829858 'ue_page_title' => $page_title,
830859 'ue_date' => date( 'Y-m-d H:i:s' ),
831 - ), __METHOD__
 860+ ),
 861+ __METHOD__
832862 );
833863 }
834864 }
Index: trunk/extensions/SocialProfile/UserStats/TopUsers.php
@@ -50,7 +50,7 @@
5151 $params
5252 );
5353 $loop = 0;
54 - while ( $row = $dbr->fetchObject( $res ) ) {
 54+ foreach ( $res as $row ) {
5555 $user = User::newFromId( $row->stats_user_id );
5656 if ( !$user->isBlocked() ) {
5757 $user_list[] = array(
@@ -60,12 +60,14 @@
6161 );
6262 $loop++;
6363 }
64 - if ( $loop >= 50 ) break;
 64+ if ( $loop >= 50 ) {
 65+ break;
 66+ }
6567 }
6668 $wgMemc->set( $key, $user_list, 60 * 5 );
6769 }
6870
69 - $recent_title = Title::makeTitle( NS_SPECIAL, 'TopUsersRecent' );
 71+ $recent_title = SpecialPage::getTitleFor( 'TopUsersRecent' );
7072
7173 $out = '<div class="top-fan-nav">
7274 <h1>' . wfMsg( 'top-fans-by-points-nav-header' ) . '</h1>
@@ -80,7 +82,7 @@
8183 }
8284
8385 // Build nav of stats by category based on MediaWiki:Topfans-by-category
84 - $by_category_title = Title::makeTitle( NS_SPECIAL, 'TopFansByStatistic' );
 86+ $by_category_title = SpecialPage::getTitleFor( 'TopFansByStatistic' );
8587
8688 $lines = explode( "\n", wfMsgForContent( 'topfans-by-category' ) );
8789
@@ -95,7 +97,7 @@
9698 $line = explode( '|' , trim( $line, '* ' ), 2 );
9799 $stat = $line[0];
98100 $link_text = $line[1];
99 - $out .= "<p> <a href=\"" . $by_category_title->escapeFullURL( "stat={$stat}" ) . "\">{$link_text}</a></p>";
 101+ $out .= '<p> <a href="' . $by_category_title->escapeFullURL( "stat={$stat}" ) . "\">{$link_text}</a></p>";
100102 }
101103 }
102104
@@ -121,8 +123,9 @@
122124 }
123125
124126 $out .= "<div class=\"top-fan-row\">
125 - <span class=\"top-fan-num\">{$x}.</span><span class=\"top-fan\">
126 - <img src='{$wgUploadPath}/avatars/" . $commentIcon . "' alt='' border='' /> <a href='" . $user_title->escapeFullURL() . "' >" . $user['user_name'] . '</a>
 127+ <span class=\"top-fan-num\">{$x}.</span>
 128+ <span class=\"top-fan\">
 129+ <img src='{$wgUploadPath}/avatars/" . $commentIcon . "' alt='' border='' /> <a href='" . $user_title->escapeFullURL() . "'>" . $user['user_name'] . '</a>
127130 </span>';
128131
129132 $out .= '<span class="top-fan-points"><b>' . number_format( $user['points'] ) . '</b> ' . wfMsg( 'top-fans-points' ) . '</span>';
Index: trunk/extensions/SocialProfile/UserStats/SpecialUpdateEditCounts.php
@@ -41,8 +41,8 @@
4242 array( 'GROUP BY' => 'rev_user_text' ),
4343 array( 'page' => array( 'INNER JOIN', 'page_id = rev_page' ) )
4444 );
45 - while ( $row = $dbw->fetchObject( $res ) ) {
4645
 46+ foreach ( $res as $row ) {
4747 $user = User::newFromId( $row->rev_user );
4848 $user->loadFromId();
4949
@@ -59,18 +59,21 @@
6060 __METHOD__
6161 );
6262 if ( !$s->stats_user_id ) {
63 - $dbw->insert( 'user_stats',
 63+ $dbw->insert(
 64+ 'user_stats',
6465 array(
6566 'stats_year_id' => 0,
6667 'stats_user_id' => $row->rev_user,
6768 'stats_user_name' => $row->rev_user_text,
6869 'stats_total_points' => 1000
69 - ), __METHOD__
 70+ ),
 71+ __METHOD__
7072 );
7173 }
7274 $wgOut->addHTML( "<p>Updating {$row->rev_user_text} with {$edit_count} edits</p>" );
7375
74 - $dbw->update( 'user_stats',
 76+ $dbw->update(
 77+ 'user_stats',
7578 array( 'stats_edit_count = ' . $edit_count ),
7679 array( 'stats_user_id' => $row->rev_user ),
7780 __METHOD__
@@ -80,7 +83,6 @@
8184 // clear stats cache for current user
8285 $key = wfMemcKey( 'user', 'stats', $row->rev_user );
8386 $wgMemc->delete( $key );
84 -
8587 }
8688 }
8789
@@ -97,14 +99,15 @@
98100 global $wgUserLevels;
99101 $wgUserLevels = '';
100102
101 - $res = $dbr->select( 'user_stats',
 103+ $res = $dbr->select(
 104+ 'user_stats',
102105 array( 'stats_user_id', 'stats_user_name', 'stats_total_points' ),
103106 array(),
104107 __METHOD__,
105108 array( 'ORDER BY' => 'stats_user_name' )
106109 );
107110 $out = '';
108 - while ( $row = $dbr->fetchObject( $res ) ) {
 111+ foreach ( $res as $row ) {
109112 $x++;
110113 $stats = new UserStatsTrack( $row->stats_user_id, $row->stats_user_name );
111114 $stats->updateTotalPoints();
Index: trunk/extensions/SocialProfile/UserRelationship/SpecialAddRelationship.php
@@ -47,13 +47,15 @@
4848 $this->user_name_to = $usertitle->getText();
4949 $this->user_id_to = User::idFromName( $this->user_name_to );
5050 $this->relationship_type = $wgRequest->getVal( 'rel_type' );
51 - if ( !$this->relationship_type || !is_numeric( $this->relationship_type ) ) $this->relationship_type = 1;
 51+ if ( !$this->relationship_type || !is_numeric( $this->relationship_type ) ) {
 52+ $this->relationship_type = 1;
 53+ }
5254
5355 if ( ( $wgUser->getID() == $this->user_id_to ) && ( $wgUser->getID() != 0 ) ) {
5456 $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) );
55 - $out .= '<div class="relationship-error-message">
56 - ' . wfMsg( 'ur-add-error-message-yourself' ) . '
57 - </div>
 57+ $out .= '<div class="relationship-error-message">'
 58+ . wfMsg( 'ur-add-error-message-yourself' ) .
 59+ '</div>
5860 <div>
5961 <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' />';
6062 if ( $wgUser->isLoggedIn() ) {
@@ -65,9 +67,9 @@
6668
6769 } elseif ( $wgUser->isBlocked() ) {
6870 $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) );
69 - $out .= '<div class="relationship-error-message">
70 - ' . wfMsg( 'ur-add-error-message-blocked' ) . '
71 - </div>
 71+ $out .= '<div class="relationship-error-message">'
 72+ . wfMsg( 'ur-add-error-message-blocked' ) .
 73+ '</div>
7274 <div>
7375 <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' />';
7476 if ( $wgUser->isLoggedIn() ) {
@@ -79,9 +81,9 @@
8082
8183 } elseif ( $this->user_id_to == 0 ) {
8284 $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) );
83 - $out .= '<div class="relationship-error-message">
84 - ' . wfMsg( 'ur-add-error-message-no-user' ) . '
85 - </div>
 85+ $out .= '<div class="relationship-error-message">'
 86+ . wfMsg( 'ur-add-error-message-no-user' ) .
 87+ '</div>
8688 <div>
8789 <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' />';
8890 if ( $wgUser->isLoggedIn() ) {
@@ -155,9 +157,9 @@
156158
157159 $out = '';
158160 $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) );
159 - $out .= '<div class="relationship-error-message">
160 - ' . $error . '
161 - </div>
 161+ $out .= '<div class="relationship-error-message">'
 162+ . $error .
 163+ '</div>
162164 <div>
163165 <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' />
164166 <input type="button" class="site-button" value="' . wfMsg( 'ur-login' ) . '" size="20" onclick="window.location=\'' . $login_link->escapeFullURL() . '\'" />';
@@ -230,12 +232,12 @@
231233 $form .= "<form action=\"\" method=\"post\" enctype=\"multipart/form-data\" name=\"form1\">
232234 <div class=\"relationship-action\">
233235 {$avatar_img}
234 - " . $add . '
235 - <div class="cleared"></div>
 236+ " . $add .
 237+ '<div class="cleared"></div>
236238 </div>
237 - <div class="relationship-textbox-title">
238 - ' . wfMsg( 'ur-add-personal-message' ) . '
239 - </div>
 239+ <div class="relationship-textbox-title">'
 240+ . wfMsg( 'ur-add-personal-message' ) .
 241+ '</div>
240242 <textarea name="message" id="message" rows="3" cols="50"></textarea>
241243 <div class="relationship-buttons">
242244 <input type="button" class="site-button" value="' . $button . '" size="20" onclick="document.form1.submit()" />
Index: trunk/extensions/SocialProfile/UserRelationship/SpecialRemoveRelationship.php
@@ -59,9 +59,9 @@
6060 $out = '';
6161 if ( $wgUser->getID() == $this->user_id_to ) {
6262 $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) );
63 - $out .= '<div class="relationship-error-message">
64 - ' . wfMsg( 'ur-remove-error-message-remove-yourself' ) . '
65 - </div>
 63+ $out .= '<div class="relationship-error-message">'
 64+ . wfMsg( 'ur-remove-error-message-remove-yourself' ) .
 65+ '</div>
6666 <div>
6767 <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" size="20" onclick=\'window.location="index.php?title=' . wfMsgForContent( 'mainpage' ) . '"\' />';
6868 if ( $wgUser->isLoggedIn() ) {
@@ -72,9 +72,9 @@
7373 $wgOut->addHTML( $out );
7474 } elseif ( $this->relationship_type == false ) {
7575 $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) );
76 - $out .= '<div class="relationship-error-message">
77 - ' . wfMsg( 'ur-remove-error-message-no-relationship', $this->user_name_to ) . '
78 - </div>
 76+ $out .= '<div class="relationship-error-message">'
 77+ . wfMsg( 'ur-remove-error-message-no-relationship', $this->user_name_to ) .
 78+ '</div>
7979 <div>
8080 <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' />';
8181 if ( $wgUser->isLoggedIn() ) {
@@ -98,9 +98,9 @@
9999 $wgOut->addHTML( $out );
100100 } elseif ( $wgUser->getID() == 0 ) {
101101 $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) );
102 - $out .= '<div class="relationship-error-message">
103 - ' . $error . '
104 - </div>
 102+ $out .= '<div class="relationship-error-message">'
 103+ . $error .
 104+ '</div>
105105 <div>
106106 <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" size="20" onclick=\'window.location="index.php?title="' . wfMsgForContent( 'mainpage' ) . '"\' />';
107107 if ( $wgUser->isLoggedIn() ) {
@@ -162,8 +162,8 @@
163163 $form .= "<form action=\"\" method=\"post\" enctype=\"multipart/form-data\" name=\"form1\">
164164 <div class=\"relationship-action\">
165165 {$avatar_img}
166 - " . $remove . '
167 - <div class="relationship-buttons">
 166+ " . $remove .
 167+ '<div class="relationship-buttons">
168168 <input type="hidden" name="user" value="' . addslashes( $this->user_name_to ) . '" />
169169 <input type="button" class="site-button" value="' . wfMsg( 'ur-remove' ) . '" size="20" onclick="document.form1.submit()" />
170170 <input type="button" class="site-button" value="' . wfMsg( 'ur-cancel' ) . '" size="20" onclick="history.go(-1)" />
Index: trunk/extensions/SocialProfile/UserRelationship/SpecialViewRelationships.php
@@ -78,9 +78,9 @@
7979 */
8080 if ( $user_id == 0 ) {
8181 $wgOut->setPageTitle( wfMsg( 'ur-error-title' ) );
82 - $out .= '<div class="relationship-error-message">
83 - ' . wfMsg( 'ur-error-message-no-user' ) . '
84 - </div>
 82+ $out .= '<div class="relationship-error-message">'
 83+ . wfMsg( 'ur-error-message-no-user' ) .
 84+ '</div>
8585 <div class="relationship-request-buttons">
8686 <input type="button" class="site-button" value="' . wfMsg( 'ur-main-page' ) . '" onclick=\'window.location="index.php?title=' . wfMsgForContent( 'mainpage' ) . '"\' />';
8787 if ( $wgUser->isLoggedIn() ) {
@@ -169,7 +169,7 @@
170170 '<a href="' . $add_relationship_link->escapeFullURL( 'user=' . $user_safe . '&rel_type=2' ) . '">' . wfMsg( 'ur-add-foe' ) . '</a>',
171171 ''
172172 ) );
173 - } else if ( $user_name == $wgUser->getName() ) {
 173+ } elseif ( $user_name == $wgUser->getName() ) {
174174 $output .= '<a href="' . $remove_relationship_link->escapeFullURL( 'user=' . $user_safe ) . '">' . $rem . '</a>';
175175 $output .= wfMsgExt( 'pipe-separator', 'escapenoentities' );
176176 }
@@ -201,9 +201,15 @@
202202 $output .= '<a href="' . $page_link->escapeFullURL( 'user=' . $user_name . '&rel_type=' . $rel_type . '&page=' . ( $page - 1 ) ) . '">' . wfMsg( 'ur-previous' ) . '</a> ';
203203 }
204204
205 - if ( ( $total % $per_page ) != 0 ) $numofpages++;
206 - if ( $numofpages >= 9 && $page < $total ) $numofpages = 9 + $page;
207 - if ( $numofpages >= ( $total / $per_page ) ) $numofpages = ( $total / $per_page ) + 1;
 205+ if ( ( $total % $per_page ) != 0 ) {
 206+ $numofpages++;
 207+ }
 208+ if ( $numofpages >= 9 && $page < $total ) {
 209+ $numofpages = 9 + $page;
 210+ }
 211+ if ( $numofpages >= ( $total / $per_page ) ) {
 212+ $numofpages = ( $total / $per_page ) + 1;
 213+ }
208214
209215 for ( $i = 1; $i <= $numofpages; $i++ ) {
210216 if ( $i == $page ) {

Status & tagging log