HOTFIX, if page contains invalid links, return empty string instead of failing
authorJens Frank <jeluf@users.mediawiki.org>
Sun, 30 May 2004 11:44:13 +0000 (11:44 +0000)
committerJens Frank <jeluf@users.mediawiki.org>
Sun, 30 May 2004 11:44:13 +0000 (11:44 +0000)
includes/Skin.php

index ca7aed5..fcee456 100644 (file)
@@ -1908,14 +1908,20 @@ class Skin {
 
        function makeMediaLinkObj( $nt, $alt = "" )
        {
-               $name = $nt->getDBKey();
-               $url = Image::wfImageUrl( $name );
-               if ( empty( $alt ) ) {
-                       $alt = preg_replace( '/\.(.+?)^/', '', $name );
+               if ( ! defined( $nt ) )
+               {
+                       ### HOTFIX. Instead of breaking, return empry string.
+                       $s = $alt;
+               } else {
+                       $name = $nt->getDBKey();
+                       $url = Image::wfImageUrl( $name );
+                       if ( empty( $alt ) ) {
+                               $alt = preg_replace( '/\.(.+?)^/', '', $name );
+                       }
+       
+                       $u = htmlspecialchars( $url );
+                       $s = "<a href=\"{$u}\" class='internal' title=\"{$alt}\">{$alt}</a>";
                }
-
-               $u = htmlspecialchars( $url );
-               $s = "<a href=\"{$u}\" class='internal' title=\"{$alt}\">{$alt}</a>";
                return $s;
        }