X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=BookReaderIA%2Finc%2FBookReader.inc;h=94f677335c7b6911568d98ac0c1d1be0589eb1c9;hb=9c27120483f991ca55ec8a6a0bfed2a819cd0c7c;hp=86d356358d0899d03c718705fb4a66fed60917f3;hpb=050e4a2a8055ef061b0d7d21562c23d138801ea5;p=bookreader.git
diff --git a/BookReaderIA/inc/BookReader.inc b/BookReaderIA/inc/BookReader.inc
index 86d3563..94f6773 100644
--- a/BookReaderIA/inc/BookReader.inc
+++ b/BookReaderIA/inc/BookReader.inc
@@ -1,8 +1,23 @@
+/*
+ * Copyright(c) 2008-2010 Internet Archive. Software license AGPL version 3.
+ *
+ * This file is part of BookReader. The full source code can be found at GitHub:
+ * http://github.com/openlibrary/bookreader
+ *
+ * Note: Edits to this file must pass through github. To submit a patch to this
+ * file please contact mang via http://github.com/mangtronix or mang at archive dot org
+ * Direct changes to this file may get clobbered when the code is synchronized
+ * from github.
+ */
+
class BookReader
{
+ // Operators recognized in BookReader download URLs
+ public static $downloadOperators = array('page');
+
// Returns true if can display the book in item with a given prefix (typically the item identifier)
public static function canDisplay($item, $prefix, $checkOldScandata = false)
{
@@ -19,12 +34,12 @@ class BookReader
// $$$ TODO add support for jpg and tar stacks
// https://bugs.edge.launchpad.net/gnubook/+bug/323003
// https://bugs.edge.launchpad.net/gnubook/+bug/385397
- $imageFormatRegex = '@' . preg_quote($prefix, '@') . '_(jp2|tif)\.zip$@';
+ $imageFormatRegex = '@' . preg_quote($prefix, '@') . '_(jp2|tif|jpg)\.(zip|tar)$@';
$baseLength = strlen($item->metadataGrabber->mainDir . '/');
foreach ($item->getFiles() as $location => $fileInfo) {
$filename = substr($location, $baseLength);
-
+
if ($checkOldScandata) {
if ($filename == 'scandata.xml' || $filename == 'scandata.zip') {
$foundScandata = $filename;
@@ -39,7 +54,7 @@ class BookReader
$foundImageStack = $filename;
}
}
-
+
if ($foundScandata && $foundImageStack) {
return true;
}
@@ -51,15 +66,18 @@ class BookReader
public static function findPrefix($urlPortion)
{
if (!preg_match('#[^/&?]+#', $urlPortion, $matches)) {
+ // URL portion was empty or started with /, &, or ? -- no item identifier
return false;
}
- $prefix = $matches[0]; // identifier
+ $prefix = $matches[0]; // item identifier
// $$$ Currently swallows the rest of the URL.
// If we want to support e.g. /stream/itemid/subdir/prefix/page/23 will need to adjust.
if (preg_match('#[^/&?]+/([^&?]+)#', $urlPortion, $matches)) {
- $prefix = $matches[1]; // sub prefix
+ // Match is everything after item identifier and slash, up to end or ? or &
+ // e.g. itemid/{match/these/parts}?foo=bar
+ $prefix = $matches[1]; // sub prefix --
}
return $prefix;
@@ -73,7 +91,7 @@ class BookReader
{
// Set title to default if not set
if (!$title) {
- $title = 'Bookreader';
+ $title = 'BookReader';
}
$id = $identifier;
@@ -81,7 +99,13 @@ class BookReader
// manually update with Launchpad version number at each checkin so that browsers
// do not use old cached version
// see https://bugs.launchpad.net/gnubook/+bug/330748
- $version = "0.9.18";
+ $version = "r28";
+
+ if (BookReader::getDevHost($server)) {
+ // On dev host - add time to force reload
+ // If debugging on IE, remove this line otherwise breakpoints will be invalid after reload
+ $version .= '_' . time();
+ }
if ("" == $id) {
echo "No identifier specified!";
@@ -94,6 +118,8 @@ class BookReader
+
+
echo $title; ?>
+
+
+
+ if ( !preg_match("/mobile/i", $_SERVER['HTTP_USER_AGENT']) ) { ?>
+
+
+ } /* mobile user agent */ ?>
-
+
- if ($uiMode == 'full') { ?>
-