{
set_time_limit(0);
/** @var FluidbookPublication $book */
- $book = FluidbookPublication::withoutGlobalScopes()->where('cid', $cid)->first();
+
+ $e = explode('-', $cid);
+ if (count($e) == 2) {
+ $book = FluidbookPublication::withoutGlobalScopes()->where('id', $e[0])->where('cid', $e[1])->first();
+ } else {
+ $book = FluidbookPublication::withoutGlobalScopes()->where('cid', $cid)->first();
+ }
// Return the file
return XSendFileController::sendfileNoCache($this->getPDFComplex($book, $range, $print));
}
// Paths init
$baseDocument = $this->getPDFComplexBaseDocument($book);
$destDir = Files::mkdir($book->protected_path('fluidbookpublication/cache/exportpdf/' . $book->id));
- $fname = md5($baseDocument) . '-' . md5(implode(',%ù', $range) . ($print ? '1' : '0')) . '.pdf';
+ $fname = Files::hashFileAttributes($baseDocument) . '-' . md5(implode(',%ù', $range) . ($print ? '1' : '0')) . '.pdf';
$destFile = $destDir . '/' . $fname;
// If result exists, don't make the pdf again
public function getPDFComplexBaseDocument($book, $force = false)
{
- global $core;
$mode = $force ? $force : $book->bookmarkUsePDF;
/** @var $book FluidbookPublication */
$wid = $book->getAssetDir();
default:
break;
}
+
if (!$res || !file_exists($res) || is_dir($res)) {
$res = Files::firstThatExists($book->getPDFDir() . 'original.pdf', $book->getPDFDir() . 'normal.pdf');
}