3 # Valid web server entry point
4 define( 'THUMB_HANDLER', true );
6 if ( $_SERVER['REQUEST_URI'] === $_SERVER['SCRIPT_NAME'] ) {
7 # Directly requesting this script is not a use case.
8 # Instead of giving a thumbnail error, give a generic 404.
9 wfDisplay404Error(); // go away, nothing to see here
11 # Execute thumb.php, having set THUMB_HANDLER so that
12 # it knows to extract params from a thumbnail file URL.
13 require( dirname( __FILE__
) . '/thumb.php' );
17 * Print out a generic 404 error message
21 function wfDisplay404Error() {
22 header( 'HTTP/1.1 404 Not Found' );
23 header( 'Content-Type: text/html;charset=utf-8' );
25 $prot = isset( $_SERVER['HTTPS'] ) ?
"https://" : "http://";
26 $serv = strlen( $_SERVER['HTTP_HOST'] ) ?
$_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME'];
27 $loc = $_SERVER["REQUEST_URI"];
29 $encUrl = htmlspecialchars( $prot . $serv . $loc );
31 // Looks like a typical apache2 error
32 $standard_404 = <<<ENDTEXT
33 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
35 <title>404 Not Found</title>
38 <p>The requested URL $encUrl was not found on this server.</p>