This is giving me a syntax error. It looks gross this way, but I can't think of any...
[lhc/web/wiklou.git] / includes / SpecialNewimages.php
index b41ff56..f81a70f 100644 (file)
@@ -8,7 +8,7 @@
  *
  */
 function wfSpecialNewimages( $par, $specialPage ) {
-       global $wgUser, $wgOut, $wgLang, $wgRequest, $wgGroupPermissions;
+       global $wgUser, $wgOut, $wgLang, $wgRequest, $wgGroupPermissions, $wgMiserMode;
 
        $wpIlMatch = $wgRequest->getText( 'wpIlMatch' );
        $dbr = wfGetDB( DB_SLAVE );
@@ -74,23 +74,23 @@ function wfSpecialNewimages( $par, $specialPage ) {
 
        $where = array();
        $searchpar = '';
-       if ( $wpIlMatch != '' ) {
+       if ( $wpIlMatch != '' && !$wgMiserMode) {
                $nt = Title::newFromUrl( $wpIlMatch );
                if($nt ) {
                        $m = $dbr->strencode( strtolower( $nt->getDBkey() ) );
                        $m = str_replace( '%', "\\%", $m );
                        $m = str_replace( '_', "\\_", $m );
-                       $where[] = "LCASE(img_name) LIKE '%{$m}%'";
+                       $where[] = "LOWER(img_name) LIKE '%{$m}%'";
                        $searchpar = '&wpIlMatch=' . urlencode( $wpIlMatch );
                }
        }
 
        $invertSort = false;
        if( $until = $wgRequest->getVal( 'until' ) ) {
-               $where[] = 'img_timestamp < ' . $dbr->timestamp( $until );
+               $where[] = "img_timestamp < '" . $dbr->timestamp( $until ) . "'";
        }
        if( $from = $wgRequest->getVal( 'from' ) ) {
-               $where[] = 'img_timestamp >= ' . $dbr->timestamp( $from );
+               $where[] = "img_timestamp >= '" . $dbr->timestamp( $from ) . "'";
                $invertSort = true;
        }
        $sql='SELECT img_size, img_name, img_user, img_user_text,'.
@@ -135,10 +135,9 @@ function wfSpecialNewimages( $par, $specialPage ) {
                $ut = $s->img_user_text;
 
                $nt = Title::newFromText( $name, NS_IMAGE );
-               $img = new Image( $nt );
                $ul = $sk->makeLinkObj( Title::makeTitle( NS_USER, $ut ), $ut );
 
-               $gallery->add( $img, "$ul<br />\n<i>".$wgLang->timeanddate( $s->img_timestamp, true )."</i><br />\n" );
+               $gallery->add( $nt, "$ul<br />\n<i>".$wgLang->timeanddate( $s->img_timestamp, true )."</i><br />\n" );
 
                $timestamp = wfTimestamp( TS_MW, $s->img_timestamp );
                if( empty( $firstTimestamp ) ) {
@@ -157,7 +156,7 @@ function wfSpecialNewimages( $par, $specialPage ) {
        $sub = wfMsg( 'ilsubmit' );
        $titleObj = SpecialPage::getTitleFor( 'Newimages' );
        $action = $titleObj->escapeLocalURL( $hidebots ? '' : 'hidebots=0' );
-       if ($shownav) {
+       if ($shownav && !$wgMiserMode) {
                $wgOut->addHTML( "<form id=\"imagesearch\" method=\"post\" action=\"" .
                  "{$action}\">" .
                        Xml::input( 'wpIlMatch', 20, $wpIlMatch ) . ' ' .
@@ -205,4 +204,4 @@ function wfSpecialNewimages( $par, $specialPage ) {
        }
 }
 
-?>
+