diff --git a/app/api/apicontent.php b/app/api/apicontent.php index a027743..0858caf 100644 --- a/app/api/apicontent.php +++ b/app/api/apicontent.php @@ -29,7 +29,7 @@ function apipage_kuri($price_id, $page = 1){ $newsql = " SELECT - news_id, title, text, img + news_id, title, text, img FROM `news` WHERE diff --git a/app/composer.json b/app/composer.json index 01eed2b..747bdf8 100644 --- a/app/composer.json +++ b/app/composer.json @@ -3,7 +3,8 @@ "require": { "php":">=5.3.0", "masterforweb/kuri":"dev-master", - "masterforweb/db_lite":"dev-master" + "masterforweb/db_lite":"dev-master", + "mobiledetect/mobiledetectlib": "^2.8" }, "repositories":[ diff --git a/app/routes/anpdf.php b/app/routes/anpdf.php index 5bfeb6c..0d35ca7 100644 --- a/app/routes/anpdf.php +++ b/app/routes/anpdf.php @@ -177,7 +177,7 @@ function bookmark_set($hash, $page){ -function promo_kuri($hash, $page = 0, $promo = true){ +function promo_kuri($hash, $page = 0, $promo = true, $device = null){ # test url http://klan.dv/promo/bac343b41b357fdc8243373a429caa62 (742.pdf source) @@ -194,10 +194,11 @@ function promo_kuri($hash, $page = 0, $promo = true){ if ($page == 0){ // не читал ли ранее $page = 1; //если нет страницы то первая if ($bookmark !== false and $bookmark > 1){ - return promo_kuri($hash, $bookmark, $promo); + return promo_kuri($hash, $bookmark, $prom, $device); } } + //устанавливаем закладку bookmark_set($hash, $page); @@ -222,6 +223,20 @@ function promo_kuri($hash, $page = 0, $promo = true){ $count = $price['pages']; } + if ($device == null){ + $detect = new Mobile_Detect; + if ( $detect->isMobile() ) { + $device = 'mobile'; + } + else + $device = 'desktop'; + } + + + //мобильная версия + if ($device == 'mobile') + return readtext_kuri($hash, $page); + $pdfile = $data['pdfpgurl']; $fullpdf = $data['pdfurl']; @@ -277,7 +292,7 @@ function promo_kuri($hash, $page = 0, $promo = true){ } -function textpdf_kuri($hash, $page = 1){ +function readtext_kuri($hash, $page = 1){ $price = api_pricehash($hash); @@ -285,7 +300,24 @@ function textpdf_kuri($hash, $page = 1){ return 'page not found'; } + $count = $price['pages']; + $baseurl = '/readtext/'.$hash.'/'; + $endurl = "$baseurl$count"; + + + if ($count > $page){ + $nextpage = $page + 1; + $nexturl = $baseurl.$nextpage; + } + + if ($page > 1) { + $prevpage = $page - 1; + $prevurl = $baseurl.$prevpage; + } + $title = $price['pricename']; + $newcurr = strtotime($price['BeginDate']); + $content = apipage_kuri($price['price_id'], $page); diff --git a/app/views/antext.phtml b/app/views/antext.phtml index fb112a2..9ca71f0 100644 --- a/app/views/antext.phtml +++ b/app/views/antext.phtml @@ -1,12 +1,37 @@ + + + + + +
Данная страница недоступна в мобильной версии
+Перейдите на следующую страницу
+ + + + + diff --git a/app/views/blocks/pgtextnav.phtml b/app/views/blocks/pgtextnav.phtml new file mode 100644 index 0000000..41aa7ed --- /dev/null +++ b/app/views/blocks/pgtextnav.phtml @@ -0,0 +1,33 @@ +