Example #1
0
 public function doList(LJL_Request $input, LJL_Response $output)
 {
     $page = $input->get('page') ? intval($input->get('page')) : 1;
     $cate = $input->get('cate');
     $articleList = array();
     //与搜索标签方法融合
     $tag = $input->get('tag') ? urldecode(trim($input->get('tag'))) : urldecode(trim($input->get('keyword')));
     if ($cate === 'meinv') {
         $arr = array('清纯美女', '美女', '性感美女', '模特', '美女写真', '长腿美女', '大胸美女', '校花');
         shuffle($arr);
         $url = 'http://image.baidu.com/search/index?tn=baiduimage&word=' . array_pop($arr);
         //$url = 'https://www.baidu.com';
         $content = file_get_contents($url);
         preg_match_all('/hoverURL\\"\\:\\"(.*?)\\"/is', $content, $mathes);
         shuffle($mathes[1]);
         $outArr = array_slice($mathes[1], 1, 5);
         foreach ((array) $outArr as $key => $src) {
             $articleList[$key]['src'] = $src;
         }
         exit(json_encode($articleList));
     }
     //文章列表
     $articleList = Helper_Blog::getArticleList(array('page' => $page, 'pageSize' => $this->pageSize, 'fields' => array('id', 'firstImgId', 'title', 'descript'), 'cate' => $cate, 'tag' => $tag));
     if (is_array($articleList)) {
         foreach ($articleList as $key => $val) {
             if (!$val['firstImgId']) {
                 $articleList[$key]['src'] = '';
                 continue;
             }
             $imgInfo = Helper_Blog::getPicInfo(array('picId' => $val['firstImgId']));
             $articleList[$key]['src'] = Helper_Blog::getPicWebPath(array('imgName' => $imgInfo['picName'], 'imgExt' => $imgInfo['picExt'], 'time' => $imgInfo['time'], 'rootdir' => UPLOAD_IMG_PATH . 'blog_' . APP_BLOG_NAME . '/', 'size' => '110x66_'));
         }
     }
     exit(json_encode($articleList));
 }
Example #2
0
 /**
  * 微信信息接口 http://www.zhbor.com/index.php?c=Api_Weixin&a=Weixin
  * 
  * 接口实现用户回复数字 返回数字对应的分类文章的url 关注微信 爱科技:hongbozxz
  */
 public function doWeixin(LJL_Request $input, LJL_Response $output)
 {
     $articleCate = self::_getCate();
     $db = Db_Blog::instance(null, 'blog_cui');
     // 		    $logPath = APP_PATH.'/Page/Api/log.php';
     // 		    file_put_contents($logPath, json_encode($db), FILE_APPEND);
     $resieveMsg = LJL_Api::run('Open.Weixin.receiveMsg', array('subscribeCallback' => 'subscribe'));
     $content = (string) $resieveMsg['Content'];
     // 		    echo LJL_Api::run('Open.Weixin.answerText',array(
     // 		        'content' => $content,
     // 		    ));die();
     //错误关键字 回复提示信息
     if (!is_numeric($content)) {
         if (mt_rand(0, 2)) {
             self::_robotAnswer($content);
         } else {
             self::_notice();
         }
     }
     $classid = substr($content, 0, 1);
     $page = substr($content, 1) ? substr($content, 1) : 1;
     //限制分类
     if ($classid > 7 || $classid < 1) {
         $this->_notice('分类在 1-7 之间');
     }
     $articleList = Helper_Blog::getArticleList(array('fields' => array('id', 'firstImgId', 'title', 'descript'), 'page' => $page, 'pageSize' => 5, 'cate' => $articleCate[$classid][0]));
     if ($articleList) {
         self::_articleList($articleList);
     } else {
         self::_noArticle($classid, $page);
     }
 }
Example #3
0
 /**
  * 个人站首页
  */
 public function doDefault(LJL_Request $input, LJL_Response $output)
 {
     LJL_Http::setExpires(3600);
     #设置缓存时间
     $page = $input->get('page') ? intval($input->get('page')) : 1;
     //文章列表
     $articleList = Helper_Blog::getArticleList(array('page' => $page, 'pageSize' => $this->pageSize, 'fields' => array('id', 'firstImgId', 'title', 'descript')));
     $articleCount = Helper_Blog::getArticleList(array('isCount' => 1));
     //分页相关
     $totalPage = ceil($articleCount / $this->pageSize);
     $pageStr = Libs_Global_Page::getPageString(array('page' => $page, 'pageTotal' => $totalPage, 'urlClass' => 'Blog_Plugin_Urls', 'urlFunc' => 'getIndexUrl', 'args' => array('page' => $page)));
     $cateList = LJL_Config::get('Blog_' . ucfirst(APP_BLOG_NAME) . '_Cate', 'CATE');
     //面包屑导航
     $nav[0]['title'] = '首页';
     $pageTitle = $page > 1 ? '-第' . $page . '页' : '';
     //首页展示图片
     $showImgs = '';
     $imgStrFile = '/tmp/' . APP_BLOG_NAME . '.php';
     if (file_exists($imgStrFile) && $page < 2) {
         $imgStr = file_get_contents($imgStrFile);
         $imgArr = json_decode($imgStr);
         $showImgs = '<div id="img-scroll">';
         foreach ((array) $imgArr as $key => $urlsrc) {
             $active = $key === 0 ? 'class="active"' : '';
             $us = explode('#', $urlsrc);
             $showImgs .= '<a target="_blank" href="' . $us[0] . '"><img ' . $active . ' src="' . $us[1] . '"></a>';
         }
         $showImgs .= '</div>';
     }
     //seo
     $output->seoArr = array('title' => BLOG_SEO_TITTLE . $pageTitle . ' | 最红博 ');
     $output->nav = $nav;
     $output->cate = '';
     $output->tag = '';
     $output->cateList = $cateList;
     $output->pageStr = $pageStr;
     $output->articleList = $articleList;
     $output->showImgs = $showImgs;
     $output->header = $output->fetchCol("Part/Main/Header");
     $output->footer = $output->fetchCol("Part/Main/Footer");
     $output->navbarTpl = $output->fetchCol("Part/Navbar");
     $output->leftsideCate = $output->fetchCol("Part/LeftsideCate");
     $output->navGuideTpl = $output->fetchCol("Part/Navguide");
     $output->newArticleTpl = $output->fetchCol("Part/NewArticle");
     $output->searchTpl = $output->fetchCol("Part/Search");
     $output->setTemplate('List');
 }
Example #4
0
 private function makeDetailPage($database, $catekey)
 {
     if (!$catekey) {
         return;
     }
     Db_Blog::instance(null, $database);
     $website = substr($database, 5);
     //获取文章总数
     $count = Helper_Blog::getArticleList(array('isCount' => 1));
     $page = 1;
     $pageSize = 100;
     $totalPage = ceil($count / $pageSize);
     while ($totalPage >= $page) {
         $articleInfo = Helper_Blog::getArticleList(array('page' => $page, 'pageSize' => $pageSize, 'fields' => array('id'), 'isPublished' => 1, 'cate' => $catekey));
         if ($articleInfo) {
             foreach ($articleInfo as $val) {
                 $this->stobj->urlItem('http://' . $website . '.' . MAIN_PAGE . '/article/' . $val['id'] . '.html');
             }
         }
         $page++;
         if ($page * $pageSize % 5000 == 0) {
             //每5000条生成新的sitemap文件
             $this->saveasSiemap($database, $catekey, $page);
         }
         if ($page % 10 === 0) {
             //每10页sleep
             sleep(1);
         }
     }
     $this->saveasSiemap($database, $catekey);
 }
Example #5
0
 public function DoList(LJL_Request $input, LJL_Response $output)
 {
     $page = $input->get('page');
     $articleId = $input->get('articleid');
     if ($page <= 1) {
         $page = 1;
     }
     $articleList = Helper_Blog::getArticleList(array('page' => $page, 'pageSize' => $this->pageSize, 'fields' => array(), 'isPublished' => 0, 'articleid' => $articleId));
     $articleCount = Helper_Blog::getArticleList(array('isCount' => 1, 'isPublished' => 0, 'articleid' => $articleId));
     //分页相关
     $totalPage = ceil($articleCount / $this->pageSize);
     $pageStr = Libs_Global_Page::getPageString(array('page' => $page, 'pageTotal' => $totalPage, 'urlClass' => 'Blog_Plugin_Urls', 'urlFunc' => 'getAdminListUrl', 'args' => array('page' => $page)));
     //默认showimg
     $putDir = '/tmp/' . APP_BLOG_NAME . '.php';
     $outimg = '';
     if (file_exists($putDir)) {
         $imgArr = json_decode(file_get_contents($putDir));
         foreach ((array) $imgArr as $img) {
             $outimg .= "\n" . $img;
         }
     }
     $output->imgStr = $outimg;
     $output->articleid = $articleId;
     $output->pageStr = $pageStr;
     $output->articleList = $articleList;
     $output->setTemplate('AdminList');
 }
Example #6
0
<?php

$newList = Helper_Blog::getArticleList(array('fields' => array('id', 'title'), 'cate' => $cate, 'order' => 'order by id desc'));
//最近30天最热的
$fiveDayHot = SYSTEM_TIME - 30 * 24 * 3600;
$hotList = Helper_Blog::getArticleList(array('fields' => array('id', 'title'), 'cate' => $cate, 'order' => 'order by view desc', 'updateTime' => $fiveDayHot));
if (count($hotList) < 5) {
    $hotList = Helper_Blog::getArticleList(array('fields' => array('id', 'title'), 'cate' => $cate, 'order' => 'order by view desc'));
}
//最新评论文章
$newComments = Helper_Blog::getCommentsArticles(array('limit' => '10'));
$newCommentsList = array();
foreach ((array) $newComments as $aid) {
    $newCommentsList[] = Helper_Blog::getArticleList(array('fields' => array('id', 'title'), 'articleid' => $aid))[0];
}
if ($newList) {
    ?>
<div class="yard cm_mb" style="margin-top:10px;">
    <div class="ydtitle">
        <h3>
            <?php 
    if (!empty($cate)) {
        echo $cateList[$cate][0];
    }
    ?>
最新更新文章
        </h3>
    </div>
    <div class="ydcontent">
        <div style="margin-left: 2em" class="c5">
            <ul>
Example #7
0
 /**
  * 导入标签,如果指定了天数,则就从指定前几天,如果没有指定天数,则从上一次插入的时间开始
  * @param LJL_Request $input
  * @param unknown $database
  */
 private function importTag(LJL_Request $input, $database)
 {
     $db = Db_Blog::instance(null, $database);
     if ($input->get('day')) {
         $day = $input->get('day') ? $input->get('day') : 1;
         //默认1天
         $fromInsertTime = SYSTEM_TIME - $day * 24 * 3600;
     } else {
         $sql = "select updateTime from blog_tags order by id desc limit 1";
         $fromInsertTime = $db->getOne($sql);
         $fromInsertTime = $fromInsertTime ? $fromInsertTime : 0;
     }
     //获取总数
     $sql = "select count(*) from blog_article_info where isPublished=1 and updateTime>{$fromInsertTime}";
     $count = $db->getOne($sql);
     $page = 1;
     $pageSize = 100;
     $totalPage = ceil($count / $pageSize);
     while ($totalPage >= $page) {
         $articleInfo = Helper_Blog::getArticleList(array('page' => $page, 'pageSize' => $pageSize, 'fields' => array('id', 'cate', 'tags'), 'updateTime' => $fromInsertTime));
         if ($articleInfo) {
             foreach ($articleInfo as $val) {
                 if (!$val['tags']) {
                     continue;
                 }
                 $tagArr = explode(',', trim(trim($val['tags'], ' '), ','));
                 foreach ($tagArr as $tag) {
                     Helper_Blog::insertTag(array('insertData' => array('articleId' => $val['id'], 'cate' => $val['cate'], 'tag' => $tag, 'updateTime' => SYSTEM_TIME)));
                 }
             }
         }
         $page++;
     }
     echo $database . ' tags import over' . PHP_EOL;
 }
Example #8
0
 public function doDefault(LJL_Request $input, LJL_Response $output)
 {
     //http://cuihongbo.com/index.php?c=list&a=default&cate=php
     //http://cuihongbo.com/index.php?c=list&a=default&cate=php&tag=%E5%AE%89%E5%85%A8%E9%97%AE%E9%A2%98
     LJL_Http::setExpires(3600);
     #设置缓存时间
     $page = $input->get('page') ? intval($input->get('page')) : 1;
     $cate = $input->get('cate');
     //与搜索标签方法融合
     $tag = $input->get('tag') ? urldecode(trim($input->get('tag'))) : urldecode(trim($input->get('keyword')));
     $cateList = LJL_Config::get('Blog_' . ucfirst(APP_BLOG_NAME) . '_Cate', 'CATE');
     //文章列表
     $articleList = Helper_Blog::getArticleList(array('page' => $page, 'pageSize' => $this->pageSize, 'fields' => array('id', 'firstImgId', 'title', 'descript'), 'cate' => $cate, 'tag' => $tag));
     //var_dump(1111);die;
     $articleCount = Helper_Blog::getArticleList(array('isCount' => 1, 'cate' => $cate, 'tag' => $tag));
     //分页相关
     $totalPage = ceil($articleCount / $this->pageSize);
     if ($page > $totalPage && $page > 1) {
         LJL_Http::send404Header();
         $output->setTemplate('404');
         return;
     }
     $pageStr = Libs_Global_Page::getPageString(array('page' => $page, 'pageTotal' => $totalPage, 'urlClass' => 'Blog_Plugin_Urls', 'urlFunc' => 'getListUrl', 'args' => array('page' => $page, 'cate' => $cate, 'tag' => $tag)));
     //获取各分类下tag标签
     if ($cateList) {
         $tagsArr = [];
         foreach ($cateList as $cateKey => $cateV) {
             $tagsArr[$cateKey] = Helper_Blog::getTags(array('cate' => $cateKey, 'limit' => 40));
         }
     }
     //面包屑导航
     $nav[0]['title'] = '首页';
     $nav[0]['url'] = WWW_WEB;
     if (!$cate) {
         $nav[1]['title'] = $tag ? $tag : '全部';
     } else {
         $nav[1]['title'] = $cateList[$cate][0];
         if ($tag) {
             $nav[1]['url'] = Blog_Plugin_Urls::getListUrl(array('cate' => $cate));
             $nav[2]['title'] = $tag;
         }
     }
     $pageTitle = $page > 1 ? '-第' . $page . '页' : '';
     //seo
     $seoTitle = $cate ? $tag ? $cateList[$cate][0] . '分类 - ' . $tag . '标签' : $cateList[$cate][0] . '分类' : $tag . '标签';
     $output->seoArr = array('title' => $seoTitle . $pageTitle . ' - ' . BLOG_SEO_TITTLE . ' | 最红博 ');
     $output->tagsArr = $tagsArr;
     $output->cate = $cate;
     $output->tag = $tag;
     $output->nav = $nav;
     $output->cateList = $cateList;
     $output->pageStr = $pageStr;
     $output->articleList = $articleList;
     $output->header = $output->fetchCol("Part/Main/Header");
     $output->footer = $output->fetchCol("Part/Main/Footer");
     $output->navbarTpl = $output->fetchCol("Part/Navbar");
     $output->leftsideCate = $output->fetchCol("Part/LeftsideCate");
     $output->navGuideTpl = $output->fetchCol("Part/Navguide");
     $output->newArticleTpl = $output->fetchCol("Part/NewArticle");
     $output->searchTpl = $output->fetchCol("Part/Search");
     $output->setTemplate('List');
 }