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 ){
31 $this->outputHeader();
33 $out = $this->getOutput();
34 $pager = new NewFilesPager( $this->getContext(), $par );
36 if ( !$this->including() ) {
37 $out->addHTML( $pager->buildHTMLForm() );
39 $out->addHTML( $pager->getBody() );
40 if ( !$this->including() ) {
41 $out->addHTML( $pager->getNavigationBar() );
48 * @ingroup SpecialPage Pager
50 class NewFilesPager
extends ReverseChronologicalPager
{
57 function __construct( IContextSource
$context, $par = null ) {
58 $this->like
= $context->getRequest()->getText( 'like' );
59 $this->showbots
= $context->getRequest()->getBool( 'showbots' , 0 );
61 parent
::__construct( $context );
64 function getQueryInfo() {
66 $conds = $jconds = array();
67 $tables = array( 'image' );
69 if( !$this->showbots
) {
70 $tables[] = 'user_groups';
71 $conds[] = 'ug_group IS NULL';
72 $jconds['user_groups'] = array(
75 'ug_group' => User
::getGroupsWithPermission( 'bot' ),
81 if( !$wgMiserMode && $this->like
!== null ){
82 $dbr = wfGetDB( DB_SLAVE
);
83 $likeObj = Title
::newFromURL( $this->like
);
84 if( $likeObj instanceof Title
){
85 $like = $dbr->buildLike( $dbr->anyString(), strtolower( $likeObj->getDBkey() ), $dbr->anyString() );
86 $conds[] = "LOWER(img_name) $like";
93 'join_conds' => $jconds,
100 function getIndexField(){
101 return 'img_timestamp';
104 function getStartBody(){
105 $this->gallery
= new ImageGallery();
108 function getEndBody(){
109 return $this->gallery
->toHTML();
112 function formatRow( $row ) {
113 $name = $row->img_name
;
114 $user = User
::newFromId( $row->img_user
);
116 $title = Title
::makeTitle( NS_FILE
, $name );
117 $ul = Linker
::link( $user->getUserpage(), $user->getName() );
122 . htmlspecialchars( $this->getLanguage()->timeanddate( $row->img_timestamp
, true ) )
127 protected function getHTMLFormFields() {
133 'label-message' => 'newimages-label',
138 'label' => wfMessage( 'showhidebots', wfMsg( 'show' ) ),
139 'name' => 'showbots',
144 unset( $fields['like'] );
150 protected function getHTMLFormLegend() {
151 return 'newimages-legend';
154 protected function getHTMLFormSubmit() {