3 * Implements Special:Newimages
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
21 * @ingroup SpecialPage
23 class SpecialNewFiles
extends IncludableSpecialPage
{
25 public function __construct(){
26 parent
::__construct( 'Newimages' );
29 public function execute( $par ){
33 $this->outputHeader();
35 $pager = new NewFilesPager( $par );
37 $form = $pager->getForm();
39 $form->displayForm( '' );
40 $wgOut->addHTML( $pager->getBody() . $pager->getNavigationBar() );
46 * @ingroup SpecialPage Pager
48 class NewFilesPager
extends ReverseChronologicalPager
{
50 function __construct( $par = null ) {
51 global $wgRequest, $wgUser;
53 $this->like
= $wgRequest->getText( 'like' );
54 $this->showbots
= $wgRequest->getBool( 'showbots' , 0 );
55 $this->skin
= $wgUser->getSkin();
57 parent
::__construct();
60 function getQueryInfo() {
62 $conds = $jconds = array();
63 $tables = array( 'image' );
65 if( !$this->showbots
) {
66 $tables[] = 'user_groups';
67 $conds[] = 'ug_group IS NULL';
68 $jconds['user_groups'] = array(
71 'ug_group' => User
::getGroupsWithPermission( 'bot' ),
77 if( !$wgMiserMode && $this->like
!== null ){
78 $dbr = wfGetDB( DB_SLAVE
);
79 $likeObj = Title
::newFromURL( $this->like
);
80 if( $likeObj instanceof Title
){
81 $like = $dbr->buildLike( $dbr->anyString(), strtolower( $likeObj->getDBkey() ), $dbr->anyString() );
82 $conds[] = "LOWER(img_name) $like";
89 'join_conds' => $jconds,
96 function getIndexField(){
97 return 'img_timestamp';
100 function getStartBody(){
101 $this->gallery
= new ImageGallery();
104 function getEndBody(){
105 return $this->gallery
->toHTML();
108 function formatRow( $row ) {
111 $name = $row->img_name
;
112 $user = User
::newFromId( $row->img_user
);
114 $title = Title
::newFromText( $name, NS_FILE
);
115 $ul = $this->skin
->link( $user->getUserpage(), $user->getName() );
120 . htmlspecialchars( $wgLang->timeanddate( $row->img_timestamp
, true ) )
126 global $wgRequest, $wgMiserMode;
131 'label-message' => 'newimages-label',
136 'label' => wfMessage( 'showhidebots', wfMsg( 'show' ) ),
137 'name' => 'showbots',
138 # 'default' => $wgRequest->getBool( 'showbots', 0 ),
142 'default' => $wgRequest->getText( 'limit' ),
147 'default' => $wgRequest->getText( 'offset' ),
153 unset( $fields['like'] );
156 $form = new HTMLForm( $fields );
157 $form->setTitle( $this->getTitle() );
158 $form->setSubmitText( wfMsg( 'ilsubmit' ) );
159 $form->setMethod( 'get' );
160 $form->setWrapperLegend( wfMsg( 'newimages-legend' ) );