Index: trunk/extensions/Tasks/Tasks.body.php |
— | — | @@ -702,7 +702,7 @@ |
703 | 703 | return true; |
704 | 704 | } |
705 | 705 | |
706 | | - global $wgOut, $action, $wgRequest, $wgUser; |
| 706 | + global $wgOut, $wgRequest, $wgUser; |
707 | 707 | $out = ''; |
708 | 708 | $tasks = array(); |
709 | 709 | $wgOut->addLink(array( |
— | — | @@ -731,7 +731,7 @@ |
732 | 732 | |
733 | 733 | # And ... out! |
734 | 734 | $returnto = $wgRequest->getVal( 'returnto' ); |
735 | | - if( $this->isValidRedirect( $returnto ) ) { |
| 735 | + if( $this->isValidRedirect( $title, $returnto ) ) { |
736 | 736 | # Forward to other page |
737 | 737 | $wgOut->redirect( $returnto ); |
738 | 738 | |
— | — | @@ -753,13 +753,12 @@ |
754 | 754 | * @param string $url |
755 | 755 | * @return bool |
756 | 756 | */ |
757 | | - function isValidRedirect( $url ) { |
| 757 | + function isValidRedirect( $title, $url ) { |
758 | 758 | if( $url == '' ) { |
759 | 759 | return false; |
760 | 760 | } |
761 | 761 | |
762 | | - global $wgTitle; |
763 | | - $url1 = $wgTitle->getFullURL(); |
| 762 | + $url1 = $title->getFullURL(); |
764 | 763 | $url1 = explode( '/', $url1 ); |
765 | 764 | $url1 = $url1[0] . '/' . $url1[1] .'/' . $url1[2]; |
766 | 765 | $url2 = explode( '/', $url ); |
Index: trunk/extensions/Tasks/Tasks.hooks.php |
— | — | @@ -115,18 +115,24 @@ |
116 | 116 | * Display in sidebar |
117 | 117 | */ |
118 | 118 | public static function onSkinTemplateToolboxEnd( &$tpl ) { # Checked for HTML and MySQL insertion attacks |
119 | | - global $wgTitle; |
120 | | - if( $wgTitle->isTalkPage() ) { |
| 119 | + if ( method_exists( $tpl, 'getSkin' ) ) { |
| 120 | + $title = $tpl->getSkin()->getTitle(); |
| 121 | + } else { |
| 122 | + global $wgTitle; |
| 123 | + $title = $wgTitle; |
| 124 | + } |
| 125 | + |
| 126 | + if( $title->isTalkPage() ) { |
121 | 127 | # No talk pages please |
122 | 128 | return true; |
123 | 129 | } |
124 | | - if( $wgTitle->getNamespace() < 0 ) { |
| 130 | + if( $title->getNamespace() < 0 ) { |
125 | 131 | # No special pages please |
126 | 132 | return true; |
127 | 133 | } |
128 | 134 | |
129 | 135 | $st = new SpecialTasks; |
130 | | - $tasks = $st->get_open_task_list( $wgTitle, true ); |
| 136 | + $tasks = $st->get_open_task_list( $title, true ); |
131 | 137 | if( count( $tasks ) == 0 ) { |
132 | 138 | # No tasks |
133 | 139 | return true; |
— | — | @@ -269,13 +275,15 @@ |
270 | 276 | * @return bool true to continue running other hooks, false to abort operation |
271 | 277 | */ |
272 | 278 | public static function onSkinTemplateNavigation( $skin, &$content_actions ) { # Checked for HTML and MySQL insertion attacks |
273 | | - global $wgTitle, $wgRequest; |
| 279 | + global $wgRequest; |
274 | 280 | |
275 | | - if( $wgTitle->isTalkPage() ) { |
| 281 | + $title = $skin->getTitle(); |
| 282 | + |
| 283 | + if( $title->isTalkPage() ) { |
276 | 284 | # No talk pages please |
277 | 285 | return true; |
278 | 286 | } |
279 | | - if( $wgTitle->getNamespace() < 0 ) { |
| 287 | + if( $title->getNamespace() < 0 ) { |
280 | 288 | # No special pages please |
281 | 289 | return true; |
282 | 290 | } |
— | — | @@ -283,7 +291,7 @@ |
284 | 292 | $content_actions['actions']['tasks'] = array( |
285 | 293 | 'class' => ($wgRequest->getVal( 'action', 'view' ) == 'tasks') ? 'selected' : false, |
286 | 294 | 'text' => wfMsgHTML('tasks_tab'), |
287 | | - 'href' => $wgTitle->getLocalUrl( 'action=tasks' ) |
| 295 | + 'href' => $title->getLocalUrl( 'action=tasks' ) |
288 | 296 | ); |
289 | 297 | return true; |
290 | 298 | } |