Index: trunk/phase3/includes/Article.php |
— | — | @@ -98,24 +98,22 @@ |
99 | 99 | $title = Title::makeTitle( NS_FILE, $title->getDBkey() ); |
100 | 100 | } |
101 | 101 | |
102 | | - $article = null; |
103 | | - wfRunHooks( 'ArticleFromTitle', array( &$title, &$article ) ); |
104 | | - if ( $article ) { |
105 | | - $article->setContext( $context ); |
106 | | - return $article; |
| 102 | + $page = null; |
| 103 | + wfRunHooks( 'ArticleFromTitle', array( &$title, &$page ) ); |
| 104 | + if ( !$page ) { |
| 105 | + switch( $title->getNamespace() ) { |
| 106 | + case NS_FILE: |
| 107 | + $page = new ImagePage( $title ); |
| 108 | + break; |
| 109 | + case NS_CATEGORY: |
| 110 | + $page = new CategoryPage( $title ); |
| 111 | + break; |
| 112 | + default: |
| 113 | + $page = new Article( $title ); |
| 114 | + } |
107 | 115 | } |
108 | | - |
109 | | - switch( $title->getNamespace() ) { |
110 | | - case NS_FILE: |
111 | | - $page = new ImagePage( $title ); |
112 | | - break; |
113 | | - case NS_CATEGORY: |
114 | | - $page = new CategoryPage( $title ); |
115 | | - break; |
116 | | - default: |
117 | | - $page = new Article( $title ); |
118 | | - } |
119 | 116 | $page->setContext( $context ); |
| 117 | + |
120 | 118 | return $page; |
121 | 119 | } |
122 | 120 | |
— | — | @@ -1685,9 +1683,9 @@ |
1686 | 1684 | foreach ( $tbs as $o ) { |
1687 | 1685 | $rmvtxt = ""; |
1688 | 1686 | |
1689 | | - if ( $wgOut->getUser()->isAllowed( 'trackback' ) ) { |
| 1687 | + if ( $this->getContext()->getUser()->isAllowed( 'trackback' ) ) { |
1690 | 1688 | $delurl = $this->mTitle->getFullURL( "action=deletetrackback&tbid=" . |
1691 | | - $o->tb_id . "&token=" . urlencode( $wgOut->getUser()->editToken() ) ); |
| 1689 | + $o->tb_id . "&token=" . urlencode( $this->getContext()->getUser()->editToken() ) ); |
1692 | 1690 | $rmvtxt = wfMsg( 'trackbackremove', htmlspecialchars( $delurl ) ); |
1693 | 1691 | } |
1694 | 1692 | |
— | — | @@ -2688,7 +2686,7 @@ |
2689 | 2687 | global $wgOut, $wgRequest; |
2690 | 2688 | |
2691 | 2689 | $confirm = $wgRequest->wasPosted() && |
2692 | | - $wgOut->getUser()->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ); |
| 2690 | + $this->getContext()->getUser()->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ); |
2693 | 2691 | |
2694 | 2692 | $this->DeleteReasonList = $wgRequest->getText( 'wpDeleteReasonList', 'other' ); |
2695 | 2693 | $this->DeleteReason = $wgRequest->getText( 'wpReason' ); |
— | — | @@ -2703,7 +2701,7 @@ |
2704 | 2702 | } |
2705 | 2703 | |
2706 | 2704 | # Flag to hide all contents of the archived revisions |
2707 | | - $suppress = $wgRequest->getVal( 'wpSuppress' ) && $wgOut->getUser()->isAllowed( 'suppressrevision' ); |
| 2705 | + $suppress = $wgRequest->getVal( 'wpSuppress' ) && $this->getContext()->getUser()->isAllowed( 'suppressrevision' ); |
2708 | 2706 | |
2709 | 2707 | # This code desperately needs to be totally rewritten |
2710 | 2708 | |
— | — | @@ -2715,7 +2713,7 @@ |
2716 | 2714 | } |
2717 | 2715 | |
2718 | 2716 | # Check permissions |
2719 | | - $permission_errors = $this->mTitle->getUserPermissionsErrors( 'delete', $wgOut->getUser() ); |
| 2717 | + $permission_errors = $this->mTitle->getUserPermissionsErrors( 'delete', $this->getContext()->getUser() ); |
2720 | 2718 | |
2721 | 2719 | if ( count( $permission_errors ) > 0 ) { |
2722 | 2720 | $wgOut->showPermissionsErrorPage( $permission_errors ); |
— | — | @@ -2762,7 +2760,7 @@ |
2763 | 2761 | if ( $confirm ) { |
2764 | 2762 | $this->doDelete( $reason, $suppress ); |
2765 | 2763 | |
2766 | | - if ( $wgRequest->getCheck( 'wpWatch' ) && $wgOut->getUser()->isLoggedIn() ) { |
| 2764 | + if ( $wgRequest->getCheck( 'wpWatch' ) && $this->getContext()->getUser()->isLoggedIn() ) { |
2767 | 2765 | $this->doWatch(); |
2768 | 2766 | } elseif ( $this->mTitle->userIsWatching() ) { |
2769 | 2767 | $this->doUnwatch(); |
— | — | @@ -2899,7 +2897,7 @@ |
2900 | 2898 | |
2901 | 2899 | wfRunHooks( 'ArticleConfirmDelete', array( $this, $wgOut, &$reason ) ); |
2902 | 2900 | |
2903 | | - if ( $wgOut->getUser()->isAllowed( 'suppressrevision' ) ) { |
| 2901 | + if ( $this->getContext()->getUser()->isAllowed( 'suppressrevision' ) ) { |
2904 | 2902 | $suppress = "<tr id=\"wpDeleteSuppressRow\"> |
2905 | 2903 | <td></td> |
2906 | 2904 | <td class='mw-input'><strong>" . |
— | — | @@ -2910,7 +2908,7 @@ |
2911 | 2909 | } else { |
2912 | 2910 | $suppress = ''; |
2913 | 2911 | } |
2914 | | - $checkWatch = $wgOut->getUser()->getBoolOption( 'watchdeletion' ) || $this->mTitle->userIsWatching(); |
| 2912 | + $checkWatch = $this->getContext()->getUser()->getBoolOption( 'watchdeletion' ) || $this->mTitle->userIsWatching(); |
2915 | 2913 | |
2916 | 2914 | $form = Xml::openElement( 'form', array( 'method' => 'post', |
2917 | 2915 | 'action' => $this->mTitle->getLocalURL( 'action=delete' ), 'id' => 'deleteconfirm' ) ) . |
— | — | @@ -2943,7 +2941,7 @@ |
2944 | 2942 | </tr>"; |
2945 | 2943 | |
2946 | 2944 | # Disallow watching if user is not logged in |
2947 | | - if ( $wgOut->getUser()->isLoggedIn() ) { |
| 2945 | + if ( $this->getContext()->getUser()->isLoggedIn() ) { |
2948 | 2946 | $form .= " |
2949 | 2947 | <tr> |
2950 | 2948 | <td></td> |
— | — | @@ -2965,10 +2963,10 @@ |
2966 | 2964 | </tr>" . |
2967 | 2965 | Xml::closeElement( 'table' ) . |
2968 | 2966 | Xml::closeElement( 'fieldset' ) . |
2969 | | - Html::hidden( 'wpEditToken', $wgOut->getUser()->editToken() ) . |
| 2967 | + Html::hidden( 'wpEditToken', $this->getContext()->getUser()->editToken() ) . |
2970 | 2968 | Xml::closeElement( 'form' ); |
2971 | 2969 | |
2972 | | - if ( $wgOut->getUser()->isAllowed( 'editinterface' ) ) { |
| 2970 | + if ( $this->getContext()->getUser()->isAllowed( 'editinterface' ) ) { |
2973 | 2971 | $title = Title::makeTitle( NS_MEDIAWIKI, 'Deletereason-dropdown' ); |
2974 | 2972 | $link = Linker::link( |
2975 | 2973 | $title, |