r105516 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105515‎ | r105516 | r105517 >
Date:04:58, 8 December 2011
Author:aaron
Status:ok
Tags:
Comment:
FU r105512: just always use thumb.php style errors
Modified paths:
  • /trunk/phase3/thumb.php (modified) (history)
  • /trunk/phase3/thumb_handler.php (modified) (history)

Diff [purge]

Index: trunk/phase3/thumb_handler.php
@@ -3,41 +3,6 @@
44 # Valid web server entry point
55 define( 'THUMB_HANDLER', true );
66
7 -if ( $_SERVER['REQUEST_URI'] === $_SERVER['SCRIPT_NAME'] ) {
8 - # Directly requesting this script is not a use case.
9 - # Instead of giving a thumbnail error, give a generic 404.
10 - wfDisplay404Error(); // go away, nothing to see here
11 -} else {
12 - # Execute thumb.php, having set THUMB_HANDLER so that
13 - # it knows to extract params from a thumbnail file URL.
14 - require( dirname( __FILE__ ) . '/thumb.php' );
15 -}
16 -
17 -/**
18 - * Print out a generic 404 error message
19 - *
20 - * @return void
21 - */
22 -function wfDisplay404Error() {
23 - header( 'HTTP/1.1 404 Not Found' );
24 - header( 'Content-Type: text/html;charset=utf-8' );
25 -
26 - $prot = isset( $_SERVER['HTTPS'] ) ? "https://" : "http://";
27 - $serv = strlen( $_SERVER['HTTP_HOST'] ) ? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
28 - $loc = $_SERVER["REQUEST_URI"];
29 -
30 - $encUrl = htmlspecialchars( $prot . $serv . $loc );
31 -
32 - // Looks like a typical apache2 error
33 - $standard_404 = <<<ENDTEXT
34 -<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
35 -<html><head>
36 -<title>404 Not Found</title>
37 -</head><body>
38 -<h1>Not Found</h1>
39 -<p>The requested URL $encUrl was not found on this server.</p>
40 -</body></html>
41 -ENDTEXT;
42 -
43 - print $standard_404;
44 -}
 7+# Execute thumb.php, having set THUMB_HANDLER so that
 8+# it knows to extract params from a thumbnail file URL.
 9+require( dirname( __FILE__ ) . '/thumb.php' );
Index: trunk/phase3/thumb.php
@@ -8,9 +8,9 @@
99 */
1010 define( 'MW_NO_OUTPUT_COMPRESSION', 1 );
1111 if ( isset( $_SERVER['MW_COMPILED'] ) ) {
12 - require ( 'phase3/includes/WebStart.php' );
 12+ require( 'phase3/includes/WebStart.php' );
1313 } else {
14 - require ( dirname( __FILE__ ) . '/includes/WebStart.php' );
 14+ require( dirname( __FILE__ ) . '/includes/WebStart.php' );
1515 }
1616
1717 // Don't use fancy mime detection, just check the file extension for jpg/gif/png

Follow-up revisions

RevisionCommit summaryAuthorDate
r114452r105516 decided to remove the space after require, making...platonides16:44, 23 March 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r105512FU r101117: removed cURL thumb handler code and made thumb_handler.php a thin...aaron03:43, 8 December 2011

Status & tagging log