Comments
authorMichael Ang <mang@archive.org>
Tue, 20 Jul 2010 23:11:24 +0000 (23:11 +0000)
committerMichael Ang <mang@archive.org>
Tue, 20 Jul 2010 23:11:24 +0000 (23:11 +0000)
BookReaderIA/datanode/BookReaderImages.inc.php
BookReaderIA/datanode/BookReaderPreview.php
BookReaderIA/inc/BookReader.inc

index f6236ea..a5db859 100644 (file)
@@ -55,6 +55,9 @@ class BookReaderImages
     var $kduExpand = '/petabox/sw/bin/kdu_expand';
     
     /*
+     * Returns a page image when all parameters such as the image stack location are
+     * passed in.
+     * 
      * Approach:
      * 
      * Get info about requested image (input)
@@ -64,7 +67,6 @@ class BookReaderImages
      * Return image data
      * Clean up temporary files
      */
-     
      function serveRequest($requestEnv) {
         // Process some of the request parameters
         $zipPath  = $requestEnv['zip'];
index 7604f91..30b963f 100644 (file)
@@ -1,7 +1,8 @@
 <?
 /*
 
-Provides access to preview images of book.
+Provides access to preview images of book.  It is run with privileges and provides a reduced
+access wrapper around BookReaderImages.
 
 Michael Ang <http://github.com/mangtronix>
 
index 585ee1d..ae25c5c 100644 (file)
@@ -51,15 +51,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;