3 function wfSpecialFilepath( $par ) {
4 global $wgRequest, $wgOut;
6 $file = isset( $par ) ?
$par : $wgRequest->getText( 'file' );
8 $title = Title
::newFromText( $file, NS_IMAGE
);
10 if ( ! $title instanceof Title ||
$title->getNamespace() != NS_IMAGE
) {
11 $cform = new FilepathForm( $title );
14 $file = wfFindFile( $title );
15 if ( $file && $file->exists() ) {
16 $wgOut->redirect( $file->getURL() );
18 $wgOut->setStatusCode( 404 );
19 $cform = new FilepathForm( $title );
28 function FilepathForm( &$title ) {
29 $this->mTitle
=& $title;
33 global $wgOut, $wgTitle, $wgScript;
36 Xml
::openElement( 'form', array( 'method' => 'get', 'action' => $wgScript, 'id' => 'specialfilepath' ) ) .
37 Xml
::openElement( 'fieldset' ) .
38 Xml
::element( 'legend', null, wfMsg( 'filepath' ) ) .
39 Xml
::hidden( 'title', $wgTitle->getPrefixedText() ) .
40 Xml
::inputLabel( wfMsg( 'filepath-page' ), 'file', 'file', 25, is_object( $this->mTitle
) ?
$this->mTitle
->getText() : '' ) . ' ' .
41 Xml
::submitButton( wfMsg( 'filepath-submit' ) ) . "\n" .
42 Xml
::closeElement( 'fieldset' ) .
43 Xml
::closeElement( 'form' )