You should have received a copy of the GNU Affero General Public License along with BookReader. If not, see <http://www.gnu.org/licenses/>. */ require_once 'BookReaderImages.inc.php'; function BRfatal($message) { header("HTTP/1.0 404 Not Found"); header("Content-type: text/plain"); print $message; die(-1); } $allowedPages = array('title', 'cover', 'cover0', 'preview'); $allowedPattern = '#^(' . join('|', $allowedPages) . ')#'; $page = $_REQUEST['page']; if (preg_match($allowedPattern, $page)) { // Return image data $bri = new BookReaderImages(); try { $bri->serveLookupRequest($_REQUEST); } catch (Exception $e) { header("HTTP/1.0 404 Not Found"); header("Content-type: text/plain"); print "Error serving request:\n"; print " " . $e->getMessage() . "\n\n"; print "Debugging information:\n"; echo $e->getTraceAsString(); } } else { BRfatal("Bad or no page specified"); }
the Free Software Foundation, either version 3 of the License, or (at your option) any later version. BookReader is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with BookReader. If not, see <http://www.gnu.org/licenses/>. */ require_once '../datanode/BookReaderImages.inc.php'; try { switch ($_REQUEST['test']) { case 'pageparse': $bri = new BookReaderImages(); ok('text/javascript'); print json_encode($bri->parsePageRequest($_REQUEST['value'], $_REQUEST['bookPrefix'])); break; default: ok('text/html'); print "<html><head><title>BookReader Tests</title></head>"; print "<body>"; print "<h1>Available tests</h1>"; print "<pre>"; print "<a href='BookReaderTest.php?test=pageparse&value=cover_r4.jpg'>pageparse</a> value bookPrefix"; print "</body>"; print "</html>"; break; } } catch (Exception $e) {