Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -1154,8 +1154,15 @@ |
1155 | 1155 | } |
1156 | 1156 | $nav_urls['specialpages'] = array( 'href' => self::makeSpecialUrl( 'Specialpages' ) ); |
1157 | 1157 | |
1158 | | - // default permalink to being off, will override it as required below. |
| 1158 | + $nav_urls['print'] = false; |
1159 | 1159 | $nav_urls['permalink'] = false; |
| 1160 | + $nav_urls['whatlinkshere'] = false; |
| 1161 | + $nav_urls['recentchangeslinked'] = false; |
| 1162 | + $nav_urls['trackbacklink'] = false; |
| 1163 | + $nav_urls['contributions'] = false; |
| 1164 | + $nav_urls['log'] = false; |
| 1165 | + $nav_urls['blockip'] = false; |
| 1166 | + $nav_urls['emailuser'] = false; |
1160 | 1167 | |
1161 | 1168 | // A print stylesheet is attached to all pages, but nobody ever |
1162 | 1169 | // figures that out. :) Add a link... |
— | — | @@ -1182,72 +1189,50 @@ |
1183 | 1190 | array( &$this, &$nav_urls, &$revid, &$revid ) ); |
1184 | 1191 | } |
1185 | 1192 | |
1186 | | - if( $this->getTitle()->getNamespace() != NS_SPECIAL ) { |
1187 | | - $wlhTitle = SpecialPage::getTitleFor( 'Whatlinkshere', $this->thispage ); |
| 1193 | + if ( $out->isArticleRelated() ) { |
1188 | 1194 | $nav_urls['whatlinkshere'] = array( |
1189 | | - 'href' => $wlhTitle->getLocalUrl() |
| 1195 | + 'href' => SpecialPage::getTitleFor( 'Whatlinkshere', $this->thispage )->getLocalUrl() |
1190 | 1196 | ); |
1191 | | - if( $this->getTitle()->getArticleId() ) { |
1192 | | - $rclTitle = SpecialPage::getTitleFor( 'Recentchangeslinked', $this->thispage ); |
| 1197 | + if ( $this->getTitle()->getArticleId() ) { |
1193 | 1198 | $nav_urls['recentchangeslinked'] = array( |
1194 | | - 'href' => $rclTitle->getLocalUrl() |
| 1199 | + 'href' => SpecialPage::getTitleFor( 'Recentchangeslinked', $this->thispage )->getLocalUrl() |
1195 | 1200 | ); |
1196 | | - } else { |
1197 | | - $nav_urls['recentchangeslinked'] = false; |
1198 | 1201 | } |
1199 | | - if( $wgUseTrackbacks ) |
| 1202 | + if ( $wgUseTrackbacks ) { |
1200 | 1203 | $nav_urls['trackbacklink'] = array( |
1201 | 1204 | 'href' => $out->getTitle()->trackbackURL() |
1202 | 1205 | ); |
| 1206 | + } |
1203 | 1207 | } |
1204 | 1208 | |
1205 | 1209 | $user = $this->getRelevantUser(); |
1206 | 1210 | if ( $user ) { |
1207 | | - $id = $user->getID(); |
1208 | | - $ip = $user->isAnon(); |
1209 | 1211 | $rootUser = $user->getName(); |
1210 | | - } else { |
1211 | | - $id = 0; |
1212 | | - $ip = false; |
1213 | | - $rootUser = null; |
1214 | | - } |
1215 | 1212 | |
1216 | | - if( $id || $ip ) { # both anons and non-anons have contribs list |
1217 | 1213 | $nav_urls['contributions'] = array( |
1218 | 1214 | 'href' => self::makeSpecialUrlSubpage( 'Contributions', $rootUser ) |
1219 | 1215 | ); |
1220 | 1216 | |
1221 | | - if( $id ) { |
| 1217 | + if ( $user->isLoggedIn() ) { |
1222 | 1218 | $logPage = SpecialPage::getTitleFor( 'Log' ); |
1223 | 1219 | $nav_urls['log'] = array( |
1224 | | - 'href' => $logPage->getLocalUrl( |
1225 | | - array( |
1226 | | - 'user' => $rootUser |
1227 | | - ) |
1228 | | - ) |
| 1220 | + 'href' => $logPage->getLocalUrl( array( 'user' => $rootUser ) ) |
1229 | 1221 | ); |
1230 | | - } else { |
1231 | | - $nav_urls['log'] = false; |
1232 | 1222 | } |
1233 | 1223 | |
1234 | 1224 | if ( $this->getUser()->isAllowed( 'block' ) ) { |
1235 | 1225 | $nav_urls['blockip'] = array( |
1236 | 1226 | 'href' => self::makeSpecialUrlSubpage( 'Block', $rootUser ) |
1237 | 1227 | ); |
1238 | | - } else { |
1239 | | - $nav_urls['blockip'] = false; |
1240 | 1228 | } |
1241 | | - } else { |
1242 | | - $nav_urls['contributions'] = false; |
1243 | | - $nav_urls['log'] = false; |
1244 | | - $nav_urls['blockip'] = false; |
| 1229 | + |
| 1230 | + if ( $this->showEmailUser( $user ) ) { |
| 1231 | + $nav_urls['emailuser'] = array( |
| 1232 | + 'href' => self::makeSpecialUrlSubpage( 'Emailuser', $rootUser ) |
| 1233 | + ); |
| 1234 | + } |
1245 | 1235 | } |
1246 | | - $nav_urls['emailuser'] = false; |
1247 | | - if( $this->showEmailUser( $id ) ) { |
1248 | | - $nav_urls['emailuser'] = array( |
1249 | | - 'href' => self::makeSpecialUrlSubpage( 'Emailuser', $rootUser ) |
1250 | | - ); |
1251 | | - } |
| 1236 | + |
1252 | 1237 | wfProfileOut( __METHOD__ ); |
1253 | 1238 | return $nav_urls; |
1254 | 1239 | } |
— | — | @@ -1441,16 +1426,16 @@ |
1442 | 1427 | wfProfileIn( __METHOD__ ); |
1443 | 1428 | |
1444 | 1429 | $toolbox = array(); |
1445 | | - if ( $this->data['notspecialpage'] ) { |
| 1430 | + if ( $this->data['nav_urls']['whatlinkshere'] ) { |
1446 | 1431 | $toolbox['whatlinkshere'] = $this->data['nav_urls']['whatlinkshere']; |
1447 | 1432 | $toolbox['whatlinkshere']['id'] = 't-whatlinkshere'; |
1448 | | - if ( $this->data['nav_urls']['recentchangeslinked'] ) { |
1449 | | - $toolbox['recentchangeslinked'] = $this->data['nav_urls']['recentchangeslinked']; |
1450 | | - $toolbox['recentchangeslinked']['msg'] = 'recentchangeslinked-toolbox'; |
1451 | | - $toolbox['recentchangeslinked']['id'] = 't-recentchangeslinked'; |
1452 | | - } |
1453 | 1433 | } |
1454 | | - if( isset( $this->data['nav_urls']['trackbacklink'] ) && $this->data['nav_urls']['trackbacklink'] ) { |
| 1434 | + if ( $this->data['nav_urls']['recentchangeslinked'] ) { |
| 1435 | + $toolbox['recentchangeslinked'] = $this->data['nav_urls']['recentchangeslinked']; |
| 1436 | + $toolbox['recentchangeslinked']['msg'] = 'recentchangeslinked-toolbox'; |
| 1437 | + $toolbox['recentchangeslinked']['id'] = 't-recentchangeslinked'; |
| 1438 | + } |
| 1439 | + if ( $this->data['nav_urls']['trackbacklink'] ) { |
1455 | 1440 | $toolbox['trackbacklink'] = $this->data['nav_urls']['trackbacklink']; |
1456 | 1441 | $toolbox['trackbacklink']['id'] = 't-trackbacklink'; |
1457 | 1442 | } |
— | — | @@ -1471,7 +1456,7 @@ |
1472 | 1457 | $toolbox[$special]['id'] = "t-$special"; |
1473 | 1458 | } |
1474 | 1459 | } |
1475 | | - if ( !empty( $this->data['nav_urls']['print']['href'] ) ) { |
| 1460 | + if ( $this->data['nav_urls']['print'] ) { |
1476 | 1461 | $toolbox['print'] = $this->data['nav_urls']['print']; |
1477 | 1462 | $toolbox['print']['rel'] = 'alternate'; |
1478 | 1463 | $toolbox['print']['msg'] = 'printableversion'; |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -929,7 +929,11 @@ |
930 | 930 | } |
931 | 931 | |
932 | 932 | function showEmailUser( $id ) { |
933 | | - $targetUser = User::newFromId( $id ); |
| 933 | + if ( $id instanceof User ) { |
| 934 | + $targetUser = $id; |
| 935 | + } else { |
| 936 | + $targetUser = User::newFromId( $id ); |
| 937 | + } |
934 | 938 | return $this->getUser()->canSendEmail() && # the sending user must have a confirmed email address |
935 | 939 | $targetUser->canReceiveEmail(); # the target user must have a confirmed email address and allow emails from users |
936 | 940 | } |