add readbook
This commit is contained in:
@@ -5,7 +5,7 @@ function api_pricehash($hash){
|
||||
|
||||
$pricesql = "
|
||||
SELECT
|
||||
`price_id`, `pricename`, `BeginDate`, `category_id`, `pages`
|
||||
`price_id`, `pricename`, `BeginDate`, `category_id`, `pages`, `pdf`, `html`
|
||||
FROM
|
||||
`price`
|
||||
WHERE
|
||||
|
||||
@@ -12,10 +12,13 @@ if (isset($_SERVER['HTTP_HOST']))
|
||||
else
|
||||
define('SITEPATH', dirname(__FILE__));
|
||||
|
||||
if (SITE == 'http://klan.argumenti.ru/')
|
||||
if (SITE == 'http://klan.argumenti.ru/'){
|
||||
define('PDFSOURCE', '/vhosts/an/httpdocs/pub/files/pdf/pdf/');
|
||||
else
|
||||
define('PDFSOURCE', SITEPATH.'pub/source/');
|
||||
define('HTMLSOURCE', '/vhosts/an/httpdocs/pub/files/html/');
|
||||
}
|
||||
else {
|
||||
define('PDFSOURCE', SITEPATH.'pub/source/');
|
||||
}
|
||||
|
||||
define('PDFPATH', '/pub/files/pdf/');
|
||||
define('PGPATH', '/pub/files/pages/');
|
||||
|
||||
@@ -40,6 +40,7 @@ function endparagraf($html, $pos){
|
||||
function convert2html($xfile){
|
||||
|
||||
if (!file_exists($xfile)){
|
||||
echo 'file not found';
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -48,8 +49,10 @@ function convert2html($xfile){
|
||||
$result = str_replace('</body>', '', $xhtml);
|
||||
$result = str_replace('</html>', '', $xhtml);
|
||||
|
||||
//$start_style =(strpos('<style>', $result))
|
||||
|
||||
if ($pos = strpos('<body', $result)){
|
||||
$result = substr($result, $pos+1);
|
||||
$result = substr($result, $pos-1);
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
||||
@@ -225,6 +225,11 @@ function read_kuri($hash, $page = 0, $promo = false, $version = null){
|
||||
}
|
||||
|
||||
|
||||
if ($price['html'] = '.html'){
|
||||
return readbook_kuri($hash, $page = 1);
|
||||
}
|
||||
|
||||
|
||||
if ($version == null){
|
||||
|
||||
$detect = new Mobile_Detect;
|
||||
@@ -312,11 +317,6 @@ function readtext_kuri($hash, $page = 1, $promo = 'no'){
|
||||
$baseurl = '/readtext/'.$hash.'/';
|
||||
$endurl = "$baseurl$count";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$title = $price['pricename'];
|
||||
$newcurr = strtotime($price['BeginDate']);
|
||||
$full_ver_url = SITE."read/$hash/$page/$promo/pdf";
|
||||
@@ -389,20 +389,35 @@ function initpageurls($page, $count, $baseurl){
|
||||
|
||||
|
||||
|
||||
function epub_kuri($page = 1){
|
||||
function readbook_kuri($hash, $page = 1){
|
||||
|
||||
require (APPPATH.'functions/xhtmltransform.php');
|
||||
$dir = APPPATH.'pub/ops/';
|
||||
|
||||
$price = api_pricehash($hash);
|
||||
|
||||
if (!isset($price['price_id'])){
|
||||
return 'page not found';
|
||||
}
|
||||
|
||||
$file = HTMLSOURCE.$price['price_id'].'.'.$price['html'];
|
||||
|
||||
|
||||
$limit = 4000;
|
||||
$count = 20;
|
||||
|
||||
|
||||
$htmlfile = APPPATH.'pub/html/furer.html';
|
||||
|
||||
|
||||
$html = convert2html($dir.'toc.xhtml');
|
||||
$html .= convert2html($dir.'chapter-1.xhtml');
|
||||
$html = convert2html($htmlfile);
|
||||
$razmer = strlen($html);
|
||||
|
||||
$count = $razmer / $limit;
|
||||
|
||||
// $html .= convert2html($dir.'chapter-1.xhtml');
|
||||
$pagehtml = pagehtml($html, $page, $limit);
|
||||
|
||||
$baseurl = SITE.'/epub/';
|
||||
$baseurl = SITE.'/readbook/'.$hash.'/';
|
||||
$endurl = $baseurl.$count;
|
||||
|
||||
$nextpage = $page + 1;
|
||||
@@ -411,8 +426,7 @@ function epub_kuri($page = 1){
|
||||
$prevpage = $page - 1;
|
||||
$prevurl = $baseurl.$prevpage;
|
||||
|
||||
$title = 'Млечин - Тайна фюрера';
|
||||
|
||||
$title = $price['pricename'];
|
||||
|
||||
$tempcontent = VIEWPATH.'epub.phtml'; //подшаблон
|
||||
include VIEWPATH.'layout.phtml'; //центральный шаблон
|
||||
|
||||
Reference in New Issue
Block a user