From 280c227403b72a16b67f906d36e7576959f494c9 Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Tue, 11 May 2010 21:37:10 +0000 Subject: [PATCH] Further followup to r66168 Fixup rest per Roans comments, though, not exactly as he wrote ;) --- includes/api/ApiQueryFilearchive.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/includes/api/ApiQueryFilearchive.php b/includes/api/ApiQueryFilearchive.php index d1ec13b381..6444687057 100644 --- a/includes/api/ApiQueryFilearchive.php +++ b/includes/api/ApiQueryFilearchive.php @@ -123,17 +123,19 @@ class ApiQueryFilearchive extends ApiQueryBase { while ( $row = $db->fetchObject( $res ) ) { if ( ++$count > $limit ) { // We've reached the one extra which shows that there are additional pages to be had. Stop here... + // TODO: Security issue - if the user has no right to view next title, it will still be shown $this->setContinueEnumParameter( 'from', $this->keyToTitle( $row->fa_name ) ); break; } $file = array(); $file['name'] = $row->fa_name; + if ( $fld_sha1 ) { - $file['sha1'] = $row->fa_storage_key; + $file['sha1'] = wfBaseConvert( $row->fa_storage_key, 36, 16, 40 ); } if ( $fld_timestamp ) { - $file['timestamp'] = $row->fa_timestamp; + $file['timestamp'] = wfTimestamp( TS_ISO_8601, $row->fa_timestamp ); } if ( $fld_user ) { $file['user'] = $row->fa_user; @@ -149,7 +151,7 @@ class ApiQueryFilearchive extends ApiQueryBase { $file['description'] = $row->fa_description; } if ( $fld_metadata ){ - $file['metadata'] = $row->fa_metadata; + $file['metadata'] = $row->fa_metadata ? ApiQueryImageInfo::processMetaData( unserialize( $row->fa_metadata ), $result ) : null; } if ( $fld_bitdepth ){ $file['bitdepth'] = $row->fa_bitdepth; @@ -158,7 +160,11 @@ class ApiQueryFilearchive extends ApiQueryBase { $file['mime'] = "$row->fa_major_mime/$row->fa_minor_mime"; } - $result->addValue( array( 'query', $this->getModuleName() ), null, $file ); + $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $file ); + if ( !$fit ) { + $this->setContinueEnumParameter( 'from', $this->keyToTitle( $row->fa_name ) ); + break; + } } $db->freeResult( $res ); -- 2.20.1