Initial import

This commit is contained in:
2026-06-04 11:13:34 +01:00
commit 563d9cc96d
143 changed files with 10572 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
<?php
class PDFController {
public static function download($_request, $id, $type, $filename) {
$rev = new Revision($id);
$path = $rev->path();
$rev->downloads++;
$rev->last_download = time();
$rev->save();
$disp = "attachment";
$mime = "application/octet-stream";
$file = null;
switch ($type) {
case "view":
$file = new PDF($path . "/doc.pdf");
break;
case "download":
$file = new PDF($path . "/doc.pdf");
$file->force_download();
break;
case "viewocr":
$file = new PDF($path . "/ocr.pdf");
break;
case "downloadocr":
$file = new PDF($path . "/ocr.pdf");
$file->force_download();
break;
}
$file->fake_filename($filename);
if ($file == null) {
return [404, "Not Found 1"];
}
if (!$file->exists()) {
return [404, "Not Found 2"];
}
$file->set_header("link", "<" . Config::get("URL") . "/pdf/" . $id . "/download/" . $filename . '>; rel="canonical"');
return $file;
}
public static function get_page($id, $page) {
$rev = new Revision($id);
$page = $rev->get_page($page, 150);
if ($page) {
return $page;
}
return [404, "Not Found"];
}
}