Add files related to Internet Archive's implementation of fulltext search
[bookreader.git] / BookReaderIA / fulltext / abbyy_to_text.php
diff --git a/BookReaderIA/fulltext/abbyy_to_text.php b/BookReaderIA/fulltext/abbyy_to_text.php
new file mode 100644 (file)
index 0000000..c13f94f
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+$ia = escapeshellarg($_GET['ia']);
+$path = escapeshellarg($_GET['path']);
+$file = escapeshellarg($_GET['file']);
+
+$full = $_GET['path'] . '/' . $_GET['file'];
+if (!is_readable($full)) {
+    header("HTTP/1.1 403 Forbidden");
+    exit(0);
+}
+header('Content-type: text/plain');
+passthru("python extract_paragraphs.py $ia $path $file 2>&1");
+?>