add routes anpdf.php
This commit is contained in:
164
app/routes/anpdf.php
Normal file
164
app/routes/anpdf.php
Normal file
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
|
||||
|
||||
ini_set('display_errors','off');
|
||||
error_reporting(E_ALL);
|
||||
|
||||
function anpromo_kuri($page = 1, $scale = 1.5){
|
||||
|
||||
// $pdfile = 'https://argumenti.ru/templinks/md5files/f9598f88e667146d50d106eeedbd74c1.pdf';
|
||||
$pdfile = '/pub/files/promo.pdf';
|
||||
$maxpage = 32;
|
||||
$title = 'Номер 12(706)';
|
||||
$baseurl = '/';
|
||||
|
||||
if ($page < $maxpage){
|
||||
$nextpage = $page + 1;
|
||||
$nexturl = "/anpromo/$nextpage";
|
||||
}
|
||||
|
||||
if ($page > 1) {
|
||||
$prevpage = $page - 1;
|
||||
$prevurl = "/anpromo/$prevpage";
|
||||
}
|
||||
|
||||
include ('anpdf2.phtml');
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function read_kuri($hash, $page = 1, $scale = 1.5, $promo = false){
|
||||
|
||||
$price = db_get("SELECT `price_id`, `pricename` FROM `price` WHERE `pricehash` = '$hash' LIMIT 1");
|
||||
|
||||
if (!isset($price['price_id'])){
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
echo "file not found";
|
||||
return False;
|
||||
}
|
||||
|
||||
$namefile = $hash.'.pdf';
|
||||
$pgfile = PGDIR.$hash.'/'.$hash.'-'.$page.'.pdf';
|
||||
$cachefile = PDFDIR.$namefile;
|
||||
|
||||
if (file_exists($cachefile)){
|
||||
$fullpdf = '/pdf/'.$namefile;
|
||||
}
|
||||
else {
|
||||
$fullpdf = '/file/'.$hash;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (file_exists($pgfile)){
|
||||
$pdfile = '/pages/'.$hash.'/'.$hash.'-'.$page.'.pdf';
|
||||
|
||||
if ($page > 1 or $promo){
|
||||
$fullpdf = $pdfile;
|
||||
$downtitle = 'Если, по какой-то причине у вас не загрузилась страница ниже, то нажмите сюда, чтобы скачать pdf';
|
||||
}
|
||||
else {
|
||||
$downtitle = 'Если, по какой-то причине у вас не загрузилось издание ниже, то нажмите сюда, чтобы скачать pdf';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
$pagenum = 1;
|
||||
}
|
||||
elseif (file_exists($cachefile)){
|
||||
$pdfile = '/pdf/'.$namefile;
|
||||
$pagenum = $page;
|
||||
}
|
||||
else {
|
||||
$pdfile = $fullpdf;
|
||||
$pagenum = $page;
|
||||
}
|
||||
|
||||
$id = $price['price_id'];
|
||||
$maxpage = 24;
|
||||
$title = $price['pricename'];
|
||||
|
||||
if ($promo){
|
||||
$filedown = True;
|
||||
$baseurl = "/promo/$hash/";
|
||||
|
||||
}
|
||||
else {
|
||||
$filedown = True;
|
||||
$baseurl = "/read/$hash/";
|
||||
}
|
||||
|
||||
if ($page < $maxpage){
|
||||
$nextpage = $page + 1;
|
||||
$nexturl = "$baseurl$nextpage";
|
||||
}
|
||||
|
||||
if ($page > 1) {
|
||||
$prevpage = $page - 1;
|
||||
$prevurl = "$baseurl$prevpage";
|
||||
}
|
||||
|
||||
$tempcontent = VIEWPATH.'anpdf2.phtml'; //подшаблон
|
||||
include VIEWPATH.'layout.phtml'; //центральный шаблон
|
||||
|
||||
|
||||
}
|
||||
|
||||
function text_kuri(){
|
||||
|
||||
$id = 659286;
|
||||
|
||||
$news = file_get_contents(API.'id/'.$id);
|
||||
print_r($news);
|
||||
|
||||
$tempcontent = VIEWPATH.'anpdf.phtml';
|
||||
include VIEWPATH.'layout.phtml';
|
||||
|
||||
|
||||
|
||||
//view( 'views/antext.phtml',['news'=> $news] );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
function promo_kuri($hash, $page = 1, $scale = 2, $promo = false){
|
||||
|
||||
return read_kuri($hash, $page, $scale, true);
|
||||
|
||||
$price = db_get("SELECT `price_id`, `pricename` FROM `price` WHERE `pricehash` = '$hash' LIMIT 1");
|
||||
|
||||
if (!isset($price['price_id'])){
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
echo "file not found";
|
||||
return False;
|
||||
}
|
||||
|
||||
$id = $price['price_id'];
|
||||
$pdfile = "/file/$hash";
|
||||
$maxpage = 32;
|
||||
$title = $price['pricename'];
|
||||
|
||||
if (!$promo)
|
||||
$filedown = False;
|
||||
|
||||
$baseurl = "/promo/$hash/";
|
||||
|
||||
if ($page < $maxpage){
|
||||
$nextpage = $page + 1;
|
||||
$nexturl = "$baseurl$nextpage";
|
||||
}
|
||||
|
||||
if ($page > 1) {
|
||||
$prevpage = $page - 1;
|
||||
$prevurl = "$baseurl$prevpage";
|
||||
}
|
||||
|
||||
include ('anpdf2.phtml');
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user