Index: trunk/tools/upload-scripts/thumb-handler.php |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | if ( preg_match('!^(?:http://upload.wikimedia.org)?/([\w-]*)/([\w-]*)/thumb(/archive|)/\w/\w\w/([^/]*)/' . |
8 | 8 | '(page(\d*)-)*(\d*)px-([^/]*)$!', $uri, $matches ) ) |
9 | 9 | { |
10 | | - list( $all, $site, $lang, $filename, $pagefull, $pagenum, $size, $fn2 ) = $matches; |
| 10 | + list( $all, $site, $lang, $filename, $arch, $pagefull, $pagenum, $size, $fn2 ) = $matches; |
11 | 11 | $params = array( |
12 | 12 | 'f' => $filename, |
13 | 13 | 'width' => $size |
— | — | @@ -14,15 +14,21 @@ |
15 | 15 | if ( $pagenum ) { |
16 | 16 | $params['page'] = $pagenum; |
17 | 17 | } |
| 18 | + if ( $arch ) { |
| 19 | + $params['arch'] = 1; |
| 20 | + } |
18 | 21 | } elseif ( preg_match('!^(?:http://upload.wikimedia.org)?/([\w-]*)/([\w-]*)/thumb(/archive|)/\w/\w\w/([^/]*\.(?:(?i)ogg))/' . |
19 | 22 | '(mid|seek(?:=|%3D|%3d)\d+)-([^/]*)$!', $uri, $matches ) ) |
20 | 23 | { |
21 | | - list( $all, $site, $lang, $filename, $timeFull, $fn2 ) = $matches; |
| 24 | + list( $all, $site, $lang, $filename, $arch, $timeFull, $fn2 ) = $matches; |
22 | 25 | $params = array( 'f' => $filename ); |
23 | 26 | if ( $timeFull != 'mid' ) { |
24 | 27 | list( $seek, $thumbtime ) = explode( '=', urldecode( $timeFull ), 2 ); |
25 | 28 | $params['thumbtime'] = $thumbtime; |
26 | 29 | } |
| 30 | + if ( $arch ) { |
| 31 | + $params['arch'] = 1; |
| 32 | + } |
27 | 33 | } else { |
28 | 34 | # No, display standard 404 |
29 | 35 | header( 'X-Debug: no regex match' ); |
— | — | @@ -190,7 +196,7 @@ |
191 | 197 | if( preg_match( '!^(?:http://upload.wikimedia.org)?/([\w-]*)/([\w-]*)/thumb(/archive|)/(\w)/(\w\w)/([^/]*)/([^/]*)$!', |
192 | 198 | $url, $matches ) ) { |
193 | 199 | $parts = array_map( 'rawurldecode', $matches ); |
194 | | - list( $all, $site, $lang, $hash1, $hash2, $filename, $fn2 ) = $parts; |
| 200 | + list( $all, $site, $lang, $hash1, $arch, $hash2, $filename, $fn2 ) = $parts; |
195 | 201 | |
196 | 202 | $md5 = md5( $filename ); |
197 | 203 | if( $hash1 != substr( $md5, 0, 1 ) ) return false; |
— | — | @@ -206,7 +212,7 @@ |
207 | 213 | } |
208 | 214 | |
209 | 215 | if( $good ) { |
210 | | - $thumbPath = array( '', 'export', 'upload', $site, $lang, 'thumb', $hash1, $hash2, $filename, $fn2 ); |
| 216 | + $thumbPath = array( '', 'export', 'upload', $site, $lang, 'thumb', $arch, $hash1, $hash2, $filename, $fn2 ); |
211 | 217 | if ( !checkPathComponents( $thumbPath ) ) return false; |
212 | 218 | return implode( '/', $thumbPath ); |
213 | 219 | } |