7 function wfSpecialFilepath( $par ) {
8 global $wgRequest, $wgOut;
10 $file = isset( $par ) ?
$par : $wgRequest->getText( 'file' );
12 $title = Title
::newFromText( $file, NS_IMAGE
);
14 if ( ! $title instanceof Title ||
$title->getNamespace() != NS_IMAGE
) {
15 $cform = new FilepathForm( $title );
18 $file = wfFindFile( $title );
19 if ( $file && $file->exists() ) {
20 $wgOut->redirect( $file->getURL() );
22 $wgOut->setStatusCode( 404 );
23 $cform = new FilepathForm( $title );
30 * @ingroup SpecialPage
35 function FilepathForm( &$title ) {
36 $this->mTitle
=& $title;
40 global $wgOut, $wgTitle, $wgScript;
43 Xml
::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'specialfilepath' ) ) .
44 Xml
::openElement( 'fieldset' ) .
45 Xml
::element( 'legend', null, wfMsg( 'filepath' ) ) .
46 Xml
::hidden( 'title', $wgTitle->getPrefixedText() ) .
47 Xml
::inputLabel( wfMsg( 'filepath-page' ), 'file', 'file', 25, is_object( $this->mTitle
) ?
$this->mTitle
->getText() : '' ) . ' ' .
48 Xml
::submitButton( wfMsg( 'filepath-submit' ) ) . "\n" .
49 Xml
::closeElement( 'fieldset' ) .
50 Xml
::closeElement( 'form' )