Index: trunk/extensions/Collection/Collection.body.php |
— | — | @@ -736,7 +736,7 @@ |
737 | 737 | ); |
738 | 738 | } elseif ( substr( $line, 0, 1 ) == ':' ) { // article |
739 | 739 | $articleTitle = trim( substr( $line, 1 ) ); |
740 | | - if ( preg_match( '/\[\[:?(.*?)(\|(.*?))?\]\]/', $articleTitle, $match ) ) { |
| 740 | + if ( preg_match( '/^\[\[:?(.*?)(\|(.*?))?\]\]$/', $articleTitle, $match ) ) { |
741 | 741 | $articleTitle = $match[1]; |
742 | 742 | if ( isset( $match[3] ) ) { |
743 | 743 | $displayTitle = $match[3]; |
— | — | @@ -745,7 +745,7 @@ |
746 | 746 | } |
747 | 747 | $oldid = -1; |
748 | 748 | $currentVersion = 1; |
749 | | - } elseif ( preg_match( '/\[\{\{fullurl:(.*?)\|oldid=(.*?)\}\}\s+(.*?)\]/', $articleTitle, $match ) ) { |
| 749 | + } elseif ( preg_match( '/^\[\{\{fullurl:(.*?)\|oldid=(.*?)\}\}\s+(.*?)\]$/', $articleTitle, $match ) ) { |
750 | 750 | $articleTitle = $match[1]; |
751 | 751 | if ( isset( $match[3] ) ) { |
752 | 752 | $displayTitle = $match[3]; |
— | — | @@ -754,6 +754,8 @@ |
755 | 755 | } |
756 | 756 | $oldid = $match[2]; |
757 | 757 | $currentVersion = 0; |
| 758 | + } else { |
| 759 | + return null; |
758 | 760 | } |
759 | 761 | |
760 | 762 | $articleTitle = Title::newFromText( $articleTitle ); |
— | — | @@ -794,6 +796,7 @@ |
795 | 797 | |
796 | 798 | function loadCollection( $title, $append=false ) { |
797 | 799 | global $wgOut; |
| 800 | + |
798 | 801 | if ( is_null( $title ) ) { |
799 | 802 | $wgOut->showErrorPage( 'coll-notitle_title', 'coll-notitle_msg' ); |
800 | 803 | return; |
— | — | @@ -815,6 +818,8 @@ |
816 | 819 | $items = $collection['items']; |
817 | 820 | } |
818 | 821 | |
| 822 | + $article = new Article( $title ); |
| 823 | + |
819 | 824 | foreach( preg_split( '/[\r\n]+/', $article->getContent() ) as $line ) { |
820 | 825 | $item = $this->parseCollectionLine( $collection, $line, $append ); |
821 | 826 | if ( !is_null( $item ) ) { |