Allow GET or POST
[bookreader.git] / BookReaderIA / datanode / BookReaderGetTextWrapper.php
1 <?
2
3 /*
4 Copyright(c)2008-2010 Internet Archive. Software license AGPL version 3.
5
6 This file is part of BookReader.
7
8     BookReader is free software: you can redistribute it and/or modify
9     it under the terms of the GNU Affero General Public License as published by
10     the Free Software Foundation, either version 3 of the License, or
11     (at your option) any later version.
12
13     BookReader is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     GNU Affero General Public License for more details.
17
18     You should have received a copy of the GNU Affero General Public License
19     along with BookReader.  If not, see <http://www.gnu.org/licenses/>.
20     
21     The BookReader source is hosted at http://github.com/openlibrary/bookreader/
22 */
23
24 //$env = 'LD_LIBRARY_PATH=/petabox/sw/lib/lxml/lib PYTHONPATH=/petabox/sw/lib/lxml/lib/python2.5/site-packages:$PYTHONPATH';
25
26 checkPrivs($_GET['path']);
27
28 $path     = escapeshellarg($_GET['path']);
29 $page     = escapeshellarg($_GET['page']);
30 $callback = escapeshellarg($_GET['callback']);
31
32 header('Content-Type: application/javascript');
33 passthru("python BookReaderGetText.py $path $page $callback");
34
35 function checkPrivs($filename) {
36     if (!is_readable($filename)) {        
37         header('HTTP/1.1 403 Forbidden');
38         exit(0);
39     }
40 }
41 ?>