add automaxpages

This commit is contained in:
Andrey Kuvshinov
2020-04-28 22:24:58 +03:00
parent c92457b901
commit 925ef570cf

View File

@@ -41,7 +41,8 @@ function read_kuri($hash, $page = 1, $scale = 1.5, $promo = false){
} }
$namefile = $hash.'.pdf'; $namefile = $hash.'.pdf';
$pgfile = PGDIR.$hash.'/'.$hash.'-'.$page.'.pdf'; $basepg = PGDIR.$hash.'/'.$hash.'-';
$pgfile = $basepg.$page.'.pdf';
$cachefile = PDFDIR.$namefile; $cachefile = PDFDIR.$namefile;
if (file_exists($cachefile)){ if (file_exists($cachefile)){
@@ -56,16 +57,7 @@ function read_kuri($hash, $page = 1, $scale = 1.5, $promo = false){
$pdfile = '/pages/'.$hash.'/'.$hash.'-'.$page.'.pdf'; $pdfile = '/pages/'.$hash.'/'.$hash.'-'.$page.'.pdf';
$pagenum = 1; $pagenum = 1;
} }
elseif (file_exists($cachefile)){
$pdfile = '/pdf/'.$namefile;
$pagenum = $page;
}
else {
$pdfile = $fullpdf;
$pagenum = $page;
}
if ($page > 1 or $promo){ if ($page > 1 or $promo){
$fullpdf = $pdfile; $fullpdf = $pdfile;
$downtitle = 'Если по какой-то причине у вас не загрузилась страница ниже, то нажмите сюда, чтобы скачать pdf'; $downtitle = 'Если по какой-то причине у вас не загрузилась страница ниже, то нажмите сюда, чтобы скачать pdf';
@@ -78,7 +70,6 @@ function read_kuri($hash, $page = 1, $scale = 1.5, $promo = false){
$id = $price['price_id']; $id = $price['price_id'];
$maxpage = 24;
$title = $price['pricename']; $title = $price['pricename'];
if ($promo){ if ($promo){
@@ -90,9 +81,9 @@ function read_kuri($hash, $page = 1, $scale = 1.5, $promo = false){
$baseurl = "/read/$hash/"; $baseurl = "/read/$hash/";
} }
if ($page < $maxpage){ $nextpage = $page + 1;
$nextpage = $page + 1; if (file_exists($basepg.$nextpage.'.pdf')){
$nexturl = "$baseurl$nextpage"; $nexturl = "$baseurl$nextpage";
} }
if ($page > 1) { if ($page > 1) {
@@ -103,7 +94,6 @@ function read_kuri($hash, $page = 1, $scale = 1.5, $promo = false){
$tempcontent = VIEWPATH.'anpdf2.phtml'; //подшаблон $tempcontent = VIEWPATH.'anpdf2.phtml'; //подшаблон
include VIEWPATH.'layout.phtml'; //центральный шаблон include VIEWPATH.'layout.phtml'; //центральный шаблон
} }
function text_kuri(){ function text_kuri(){