add Dockerfile

This commit is contained in:
Andrey Kuvshinov
2020-05-08 13:22:22 +03:00
parent e7696b44cf
commit 797ebaa707
11 changed files with 120 additions and 100 deletions

View File

@@ -1,9 +1,5 @@
<?php
ini_set('display_errors','off');
error_reporting(E_ALL);
function anpromo_kuri($page = 1, $scale = 1){
// $pdfile = 'https://argumenti.ru/templinks/md5files/f9598f88e667146d50d106eeedbd74c1.pdf';
@@ -136,6 +132,7 @@ function promo_kuri($hash, $page = 1, $scale = 2, $promo = false){
$id = $price['price_id'];
$pdfile = "/file/$hash";
$maxpage = 32;
if ($page > 1)
$title = $price['pricename']."- $page";
else
@@ -159,4 +156,41 @@ function promo_kuri($hash, $page = 1, $scale = 2, $promo = false){
include ('anpdf2.phtml');
}
function pdfscan_kuri(){
$pdfsql = "SELECT price_id, pricehash FROM price WHERE category_id = 1";
$path = '~/vhosts/anpdf/pub/files/pages/';
echo exec('whoami');
$pdfs = dbl_get($pdfsql);
foreach($pdfs as $pdf){
$pagedir = $path.$pdf['pricehash'];
if(!is_dir($pagedir)) {
mkdir($pagedir);
$cmd = 'docker run --name pdftk -it --rm \
--user $(id -u):$(id -g) \
-v "$PDFDIR:/workdir/pdf" \
-v "$OUTDIR:/workdir/pages" \
-w "/workdir" \
masterforweb/pdftk pdftk "pdf/$file" burst output "pages/${name}/${name}-%1d.pdf';
}
}
}

View File

@@ -1,7 +1,7 @@
<?php
function addclient_kuri(){
function addclient(){
$buys = db_get("SELECT `buy_id`, `buy_email`, `date_start` FROM `anbuy`");
@@ -51,7 +51,7 @@ function addclient_kuri(){
}
function addclientid_kuri(){
function addclientid(){
$buys = db_get("SELECT `buy_id`, `buy_email` FROM `anbuy` WHERE `client_id` = 0");
@@ -82,42 +82,42 @@ function addcard($id, $date) {
function mybooks_kuri($clienthash, $page = 1){
$limit = 25;
$client = api_client_kuri($clienthash);
$baseurl = SITE."mybooks/$clienthash/";
if (!$client) {
echo 'Пользователь не найден';
return;
}
$items = api_arch($page);
foreach ($items as $item){
if ($item['price_id'] = 486){ //ищем подписку = доступ на весь архив
$all = True;
break;
}
}
$items = clientbuys_kuri($client['client_id'], $page);
$count = $items['count'];
if ($all){
$books = api_arch($page);
if ($page > 1)
$title = "Архив номеров - $page";
else
$title = "Архив номеров";
$tempcontent = VIEWPATH.'allbooks.phtml';
include VIEWPATH.'layout.phtml';
if ($count > $limit){
$pages = ceil($count / $limit);
}
if ($page > 1) {
$title = "Моя библиотека - страница $page";
$prevpage = $page - 1 ;
$prevurl = $baseurl.$prevpage;
}
else {
$books = $items;
}
$title = "Моя библиотека";
}
//$books = clientbooks_kuri($client['client_id']);
if ($pages > $page){
$nextpage = $page + 1;
$nexturl = $baseurl.$nextpage;
$endurl = $baseurl.$pages;
}
$tempcontent = VIEWPATH.'allbooks.phtml';
include VIEWPATH.'layout.phtml';
// print_r($books);
}