Wikia code/includes/specials/SpecialNewimages.php

--- D:\Programming\SVN\mediawiki\branches\REL1_16\phase3\includes\specials\SpecialNewimages.php	2011-07-18 22:31:17.819336000 +0100
+++ D:\Programming\SVN\wikia\trunk\includes\specials\SpecialNewimages.php	2011-08-17 15:28:16.468750000 +0100
@@ -6,7 +6,11 @@
  */
 
 function wfSpecialNewimages( $par, $specialPage ) {
-	global $wgUser, $wgOut, $wgLang, $wgRequest, $wgMiserMode;
+	global $wgUser, $wgOut, $wgLang, $wgRequest, $wgMiserMode, $wgUseWikiaNewFiles, $wgEnableWikiaPhotoGalleryExt;
+	global $wmu;
+
+	if ($wgUseWikiaNewFiles && $wgEnableWikiaPhotoGalleryExt)
+		return wfSpecialWikiaNewFiles( $par, $specialPage );
 
 	$wpIlMatch = $wgRequest->getText( 'wpIlMatch' );
 	$dbr = wfGetDB( DB_SLAVE );
@@ -89,6 +93,10 @@
 		$sql .= $hidebotsql;
 		$where[] = 'ug_group IS NULL';
 	}
+
+	// hook by Wikia, Bartek Lapinski 26.03.2009, for videos and stuff
+	wfRunHooks( 'SpecialNewImages::beforeQuery', array( &$where ) );
+
 	if( count( $where ) ) {
 		$sql .= ' WHERE ' . $dbr->makeList( $where, LIST_AND );
 	}
@@ -136,6 +144,8 @@
 		$lastTimestamp = $timestamp;
 	}
 
+	wfRunHooks( 'SpecialNewImages::beforeDisplay', array( &$images, &$gallery, &$limit ) );
+
 	$titleObj = SpecialPage::getTitleFor( 'Newimages' );
 	$action = $titleObj->getLocalURL( $hidebots ? '' : 'hidebots=0' );
 	if ( $shownav && !$wgMiserMode ) {
@@ -236,6 +245,7 @@
 		$wgOut->addHTML( $prevnext );
 
 	if( count( $images ) ) {
+		$wmu['gallery'] = $gallery;
 		$wgOut->addHTML( $gallery->toHTML() );
 		if ($shownav)
 			$wgOut->addHTML( $prevnext );