}
return false;
}
+
+ /*
+ * Return the full url of something relative to $wgScriptPath or root
+ */
+ static function makeFullURL( $url ) {
+ global $wgServer, $wgScriptPath;
+
+ // This is a full url
+ if ( strpos( $url, '://' ) !== false ) return $url;
+
+ // This is a relative path
+ if ( substr( $url, 0, 1 ) != '/' )
+ $url = $wgScriptPath.'/'.$url;
+
+ return $wgServer.$url;
+ }
}
} else {
$file = wfFindFile( $title );
if ( $file && $file->exists() ) {
- $wgOut->redirect( $file->getURL() );
+ // Force a real 30x so the real url is always exposed
+ $wgOut->redirect( Http::makeFullURL( $file->getURL() ) );
} else {
$wgOut->setStatusCode( 404 );
$cform = new FilepathForm( $title );
$thumb = $f->getThumbnail($this->urlwidth, $this->urlheight);
if($thumb)
{
- $vals['thumburl'] = $thumb->getURL();
+ $vals['thumburl'] = Http::makeFullUrl( $thumb->getURL() );
$vals['thumbwidth'] = $thumb->getWidth();
$vals['thumbheight'] = $thumb->getHeight();
}
}
- $vals['url'] = $f->getURL();
+ $vals['url'] = Http::makeFullUrl( $f->getURL() );
}
if($this->fld_comment)
$vals['comment'] = $f->getDescription();