X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialNewimages.php;h=583d4f9e7c27df1c323d2d494c9adb970a80a876;hb=2d250f636ae3bd88f9f221fea4a95f41cdfa60da;hp=12dae8b8db78deb8eb56dcc5b56e17d3355f84ad;hpb=662bd0fe9db07639a09574d22fddbcf270a657c5;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialNewimages.php b/includes/specials/SpecialNewimages.php index 12dae8b8db..583d4f9e7c 100644 --- a/includes/specials/SpecialNewimages.php +++ b/includes/specials/SpecialNewimages.php @@ -34,6 +34,7 @@ class SpecialNewFiles extends IncludableSpecialPage { $this->outputHeader(); $out = $this->getOutput(); + $out->addModules( 'mediawiki.special.newFiles' ); $this->addHelpLink( 'Help:New images' ); $opts = new FormOptions(); @@ -44,6 +45,8 @@ class SpecialNewFiles extends IncludableSpecialPage { $opts->add( 'hidepatrolled', false ); $opts->add( 'limit', 50 ); $opts->add( 'offset', '' ); + $opts->add( 'start', '' ); + $opts->add( 'end', '' ); $opts->fetchValuesFromRequest( $this->getRequest() ); @@ -51,6 +54,19 @@ class SpecialNewFiles extends IncludableSpecialPage { $opts->setValue( is_numeric( $par ) ? 'limit' : 'like', $par ); } + // If start date comes after end date chronologically, swap them. + // They are swapped in the interface by JS. + $start = $opts->getValue( 'start' ); + $end = $opts->getValue( 'end' ); + if ( $start !== '' && $end !== '' && $start > $end ) { + $temp = $end; + $end = $start; + $start = $temp; + + $opts->setValue( 'start', $start, true ); + $opts->setValue( 'end', $end, true ); + } + $opts->validateIntBounds( 'limit', 0, 500 ); $this->opts = $opts; @@ -105,6 +121,18 @@ class SpecialNewFiles extends IncludableSpecialPage { 'default' => $this->opts->getValue( 'offset' ), 'name' => 'offset', ], + + 'start' => [ + 'type' => 'date', + 'label-message' => 'date-range-from', + 'name' => 'start', + ], + + 'end' => [ + 'type' => 'date', + 'label-message' => 'date-range-to', + 'name' => 'end', + ], ]; if ( $this->getConfig()->get( 'MiserMode' ) ) {