followup r91869: validate id chars for incoming prefs tabs in hash ([\w-]+ is suffici...
[mediawiki.git] / includes / ImageQueryPage.php
blobf46974b216050a709a3050d54df547c2362a58ca
1 <?php
3 /**
4 * Variant of QueryPage which uses a gallery to output results, thus
5 * suited for reports generating images
7 * @ingroup SpecialPage
8 * @author Rob Church <robchur@gmail.com>
9 */
10 abstract class ImageQueryPage extends QueryPage {
12 /**
13 * Format and output report results using the given information plus
14 * OutputPage
16 * @param $out OutputPage to print to
17 * @param $skin Skin: user skin to use [unused]
18 * @param $dbr DatabaseBase (read) connection to use
19 * @param $res Integer: result pointer
20 * @param $num Integer: number of available result rows
21 * @param $offset Integer: paging offset
23 protected function outputResults( $out, $skin, $dbr, $res, $num, $offset ) {
24 if( $num > 0 ) {
25 $gallery = new ImageGallery();
27 # $res might contain the whole 1,000 rows, so we read up to
28 # $num [should update this to use a Pager]
29 for( $i = 0; $i < $num && $row = $dbr->fetchObject( $res ); $i++ ) {
30 $namespace = isset( $row->namespace ) ? $row->namespace : NS_FILE;
31 $title = Title::makeTitleSafe( $namespace, $row->title );
32 if ( $title instanceof Title && $title->getNamespace() == NS_FILE ) {
33 $gallery->add( $title, $this->getCellHtml( $row ) );
37 $out->addHTML( $gallery->toHtml() );
41 // Gotta override this since it's abstract
42 function formatResult( $skin, $result ) { }
44 /**
45 * Get additional HTML to be shown in a results' cell
47 * @param $row Object: result row
48 * @return String
50 protected function getCellHtml( $row ) {
51 return '';