add Dockerfile
This commit is contained in:
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
|
||||
function api_client_kuri($hash){
|
||||
|
||||
$sql = "SELECT client_id FROM `clients` WHERE `clienthash` = '$hash' LIMIT 1 ";
|
||||
$client = db_get($sql);
|
||||
|
||||
if (isset($client['client_id']))
|
||||
return $client;
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function clientbooks_kuri($client_id){
|
||||
|
||||
$buysql = "SELECT * FROM anbuy WHERE client_id = '$client_id' AND `buy_status` = '1'";
|
||||
echo $buysql;
|
||||
$buys = db_get($buysql);
|
||||
|
||||
|
||||
|
||||
return $buys;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//весь активный архив
|
||||
function api_arch($page = 1){
|
||||
|
||||
$limit = 25;
|
||||
|
||||
/** $scount = "
|
||||
SELECT COUNT(price.price_id) AS count
|
||||
FROM price
|
||||
WHERE category_id = 1
|
||||
LIMIT 1";
|
||||
|
||||
$count = db_get($scount);*
|
||||
*/
|
||||
|
||||
|
||||
$pricesql = "SELECT price_id, pricehash, pricename, priceimg FROM price WHERE category_id = 1 ORDER BY price_id DESC LIMIT $limit";
|
||||
|
||||
if ($page > 1){
|
||||
$offset = $limit * ($page -1);
|
||||
$pricesql .= " OFFSET $offset";
|
||||
}
|
||||
|
||||
$items = db_get($pricesql);
|
||||
|
||||
foreach ($items as $item){
|
||||
$item['pic'] = IMGSRV."price/180x280/{$item['price_id']}.{$item['priceimg']}";
|
||||
$result[] = $item;
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
@@ -3,7 +3,8 @@
|
||||
"require": {
|
||||
"php":">=5.3.0",
|
||||
"masterforweb/kuri":"dev-master",
|
||||
"masterforweb/db_lite":"dev-master"
|
||||
"masterforweb/db_lite":"dev-master",
|
||||
"mikehaertl/php-pdftk": "^0.8.0"
|
||||
},
|
||||
"repositories":[
|
||||
|
||||
@@ -17,4 +18,4 @@
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
|
||||
ini_set('display_errors','on');
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
|
||||
|
||||
if (isset($_SERVER['HTTP_HOST']))
|
||||
define('SITE', 'http://'.$_SERVER['HTTP_HOST'].'/');
|
||||
@@ -13,6 +14,7 @@ else
|
||||
|
||||
define('PDFDIR', '/vhosts/anpdf/app/pub/files/pdf/');
|
||||
define('PGDIR', '/vhosts/anpdf/app/pub/files/pages/');
|
||||
define('APPPATH', SITEPATH);
|
||||
define('VIEWPATH', SITEPATH.'views/');
|
||||
define('API', 'http://api.argumenti.ru/');
|
||||
define('IMGSRV', 'https://imgurl.argumenti.ru/');
|
||||
|
||||
@@ -7,12 +7,13 @@ require 'confg.php';
|
||||
require 'routes/price.php';
|
||||
require 'routes/client.php';
|
||||
require 'routes/anpdf.php';
|
||||
require 'routes/auth.php';
|
||||
|
||||
#api
|
||||
require 'api/client.php';
|
||||
require 'api/apiclient.php';
|
||||
|
||||
_kuri();
|
||||
|
||||
function index_kuri(){
|
||||
anpromo_kuri();
|
||||
echo 'index';
|
||||
}
|
||||
@@ -114,6 +114,10 @@ h1 {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
.book_small{
|
||||
position:relative;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 560px) {
|
||||
#brand_title, #page_title {
|
||||
font-size: .8em;
|
||||
|
||||
@@ -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';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,8 @@
|
||||
|
||||
<div id="pdfprogress">Идет обращение к серверу...</div>
|
||||
|
||||
<canvas id="the-canvas"></canvas>
|
||||
<canvas id="the-canvas">
|
||||
</canvas>
|
||||
<script>startpdfviewer(newcurr);</script>
|
||||
<div id="stuff-bar">
|
||||
<div id="zoomnav">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<title>Еженедельник Аргументы Недели - <?=$title?></title>
|
||||
<script src="/pub/scripts/pdf.min.js"></script>
|
||||
<script src="/pub/scripts/anviewer.js?ver=43"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/pub/css/an.css?ver=36">
|
||||
<link rel="stylesheet" type="text/css" href="/pub/css/an.css?ver=37">
|
||||
<link rel="icon" type="image/ico" href="https://argumenti.ru/favicon.ico">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="/pub/fontawesome/css/all.css">
|
||||
|
||||
Reference in New Issue
Block a user