ConfirmEdit: Fix use of $wgTitle, should fix bug 15420
authorRoan Kattouw <catrope@users.mediawiki.org>
Fri, 5 Sep 2008 14:57:42 +0000 (14:57 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Fri, 5 Sep 2008 14:57:42 +0000 (14:57 +0000)
ConfirmEdit_body.php

index 9e451ab1f88423245c91481c4367b80502bb399d..99c7a728aadef24ac168ce0feff53bfaac4da3b4 100644 (file)
@@ -318,8 +318,8 @@ class SimpleCaptcha {
                        } else {
                                // Get link changes in the slowest way known to man
                                $oldtext = $this->loadText( $editPage, $section );
                        } else {
                                // Get link changes in the slowest way known to man
                                $oldtext = $this->loadText( $editPage, $section );
-                               $oldLinks = $this->findLinks( $oldtext );
-                               $newLinks = $this->findLinks( $newtext );
+                               $oldLinks = $this->findLinks( $editPage, $oldtext );
+                               $newLinks = $this->findLinks( $editPage, $newtext );
                        }
 
                        $unknownLinks = array_filter( $newLinks, array( &$this, 'filterLink' ) );
                        }
 
                        $unknownLinks = array_filter( $newLinks, array( &$this, 'filterLink' ) );
@@ -647,12 +647,12 @@ class SimpleCaptcha {
         * @param string $text
         * @return array of strings
         */
         * @param string $text
         * @return array of strings
         */
-       function findLinks( $text ) {
-               global $wgParser, $wgTitle, $wgUser;
+       function findLinks( &$editpage, $text ) {
+               global $wgParser, $wgUser;
 
                $options = new ParserOptions();
 
                $options = new ParserOptions();
-               $text = $wgParser->preSaveTransform( $text, $wgTitle, $wgUser, $options );
-               $out = $wgParser->parse( $text, $wgTitle, $options );
+               $text = $wgParser->preSaveTransform( $text, $editpage->mTitle, $wgUser, $options );
+               $out = $wgParser->parse( $text, $editpage->mTitle, $options );
 
                return array_keys( $out->getExternalLinks() );
        }
 
                return array_keys( $out->getExternalLinks() );
        }