sanitize inputs
[bookreader.git] / BookReaderIA / datanode / BookReaderImages.php
1 <?php
2
3 /*
4 Copyright(c) 2008-2010 Internet Archive. Software license AGPL version 3.
5
6 This file is part of BookReader.  The full source code can be found at GitHub:
7 http://github.com/openlibrary/bookreader
8
9 The canonical short name of an image type is the same as in the MIME type.
10 For example both .jpeg and .jpg are considered to have type "jpeg" since
11 the MIME type is "image/jpeg".
12
13     BookReader is free software: you can redistribute it and/or modify
14     it under the terms of the GNU Affero General Public License as published by
15     the Free Software Foundation, either version 3 of the License, or
16     (at your option) any later version.
17
18     BookReader is distributed in the hope that it will be useful,
19     but WITHOUT ANY WARRANTY; without even the implied warranty of
20     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21     GNU Affero General Public License for more details.
22
23     You should have received a copy of the GNU Affero General Public License
24     along with BookReader.  If not, see <http://www.gnu.org/licenses/>.
25 */
26
27 // Include BookReaderImages class definition
28 require_once('BookReaderImages.inc.php');
29
30 // Serve request
31 $bri = new BookReaderImages();
32 try {
33     if ($_REQUEST['page']) {
34         // Need to lookup metadata
35         $bri->serveLookupRequest($_REQUEST);
36     } else {
37         // Request should be fully qualified - no lookup needed
38         $bri->serveRequest($_REQUEST);
39     }
40 } catch (Exception $e) {
41     header("HTTP/1.0 404 Not Found");
42     header("Content-type: text/plain");
43     
44     print "Error serving request:\n";
45     print "  " . $e->getMessage() . "\n\n";
46     print "Debugging information:\n";
47     echo $e->getTraceAsString();
48 }
49
50 ?>