Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -510,7 +510,7 @@ |
511 | 511 | * @private |
512 | 512 | */ |
513 | 513 | function buildPersonalUrls() { |
514 | | - global $wgOut, $wgRequest; |
| 514 | + global $wgOut, $wgRequest, $wgUser, $wgLang; |
515 | 515 | |
516 | 516 | $title = $wgOut->getTitle(); |
517 | 517 | $pageurl = $title->getLocalURL(); |
— | — | @@ -531,8 +531,32 @@ |
532 | 532 | 'active' => ( $this->userpageUrlDetails['href'] == $pageurl ) |
533 | 533 | ); |
534 | 534 | $usertalkUrlDetails = $this->makeTalkUrlDetails( $this->userpage ); |
| 535 | + if ( $wgUser->getNewtalk() ) { |
| 536 | + # do not show "(!)" text when we are viewing our |
| 537 | + # own talk page |
| 538 | + if( !$title->equals( $wgUser->getTalkPage() ) ) { |
| 539 | + $field = ( $wgUser->getID() == 0 )? 'user_ip' : 'user_id'; |
| 540 | + $id = ( $wgUser->getID() == 0 )? $wgUser->getName() : $wgUser->getID(); |
| 541 | + |
| 542 | + $db = wfGetDB( DB_SLAVE ); |
| 543 | + $query = $db->select( 'user_newtalk', $field, array( $field => $id ) ); |
| 544 | + $num = $db->numRows( $query ); |
| 545 | + |
| 546 | + $text = '('.$wgLang->formatNum( $num ).')'; |
| 547 | + |
| 548 | + # disable caching |
| 549 | + $wgOut->setSquidMaxage( 0 ); |
| 550 | + $wgOut->enableClientCache( false ); |
| 551 | + } |
| 552 | + else { |
| 553 | + $text = ''; |
| 554 | + } |
| 555 | + } |
| 556 | + else { |
| 557 | + $text = ''; |
| 558 | + } |
535 | 559 | $personal_urls['mytalk'] = array( |
536 | | - 'text' => wfMsg( 'mytalk' ), |
| 560 | + 'text' => wfMsg( 'mytalk' ).$text, |
537 | 561 | 'href' => &$usertalkUrlDetails['href'], |
538 | 562 | 'class' => $usertalkUrlDetails['exists'] ? false : 'new', |
539 | 563 | 'active' => ( $usertalkUrlDetails['href'] == $pageurl ) |