Exemple #1
0
 /**
  * 父类的Validate
  */
 public function baseValidate(LJL_Request $input, LJL_Response $output)
 {
     //获取静态文件路径
     $output->_SFP = LJL_Config::get(APP_NAME . "_App", 'staticPath');
     //不是爬虫
     if (!LJL_Http::isRobot()) {
         //防止恶意刷新
         if ($input->cookie('whatareyou')) {
             echo 'what are you 弄啥嘞! ……robot-like';
             die;
         }
         if ($input->cookie('emithsulf') || setcookie('emithsulf', API_Item_Security_Algos::fastEncode(array('value' => 1)), SYSTEM_TIME + 3, '/')) {
             if (API_Item_Security_Algos::fastDecode(array('value' => $input->cookie('emithsulf'))) > 10) {
                 setcookie('whatareyou', 'ekil-tobor', SYSTEM_TIME + 120, '/');
             }
             $nowNum = API_Item_Security_Algos::fastDecode(array('value' => $input->cookie('emithsulf'))) + 1;
             setcookie('emithsulf', API_Item_Security_Algos::fastEncode(array('value' => $nowNum)), SYSTEM_TIME + 3, '/');
         }
     }
     //登录验证
     // 	    if($input->cookie('blog_ckid') && $input->cookie('blog_username')) {
     // 	        if(false === Blog_Plugin_Common::loginAuth($input->cookie('blog_ckid'), $input->cookie('blog_username'))) {
     // 	            echo '非法。。。登录。。。';die();
     // 	        }
     // 	    }
     return true;
 }
Exemple #2
0
 public function doCatejson(LJL_Request $input, LJL_Response $output)
 {
     $cateList = LJL_Config::get('Blog_' . ucfirst(APP_BLOG_NAME) . '_Cate', 'CATE');
     $cateList['meinv'] = array('美女');
     foreach ($cateList as $cate => $val) {
         $cateList[$cate]['url'] = self::getListUrl(array('cate' => $cate));
     }
     exit(json_encode($cateList));
 }
Exemple #3
0
 private function makeListPage($database)
 {
     $website = substr($database, 5);
     $cate = LJL_Config::get('Blog_' . ucfirst($website) . '_Cate', 'CATE');
     foreach ((array) $cate as $catekey => $val) {
         $this->stobj->urlItem('http://' . $website . '.' . MAIN_PAGE . '/list/' . $catekey . '/1/', '0.8');
         $this->makeDetailPage($database, $catekey);
     }
 }
Exemple #4
0
 private function ubbReplace($str)
 {
     $facePath = LJL_Config::get(APP_NAME . "_App", 'staticPath') . 'images/face';
     $str = str_replace("<", '&lt;', $str);
     $str = str_replace(">", '&gt;', $str);
     $str = str_replace("\n", '<br/>', $str);
     $str = preg_replace("[\\[/表情([0-9]*)\\]]", "<img src=\"{$facePath}/\$1.gif\" />", $str);
     return $str;
 }
Exemple #5
0
 /**
  * 发布
  * 每天凌晨发布
  * 执行方式: php index.php server --c=Publish --a=Publisharticle
  */
 public function doPublisharticle(LJL_Request $input)
 {
     $db = Db_Blog::instance(null, $this->website);
     $cateArr = LJL_Config::get('Blog_Share_Cate', 'CATE');
     foreach ($cateArr as $cate => $val) {
         $this->cate = $cate;
         $this->tags = $this->getTag($cate);
         //echo $this->tags;die;
         $articleList = $this->getUnPublishList(1, $this->pnum);
         $this->publish($articleList);
         echo $cate . ' is publish over~' . PHP_EOL;
         sleep(1);
     }
     exit;
 }
Exemple #6
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');
 }
Exemple #7
0
 public function doDefault(LJL_Request $input, LJL_Response $output)
 {
     $articleId = $input->get('articleid');
     $articleInfo = Helper_Blog::getArticleInfo(array('articleId' => $articleId, 'fileds' => array('cate', 'title', 'source', 'tags', 'content')));
     $picInfo = Helper_Blog::getPicInfo(array('articleId' => $articleId));
     $picArr = array();
     if (is_array($picInfo)) {
         foreach ($picInfo as $key => $val) {
             $picArr[$key] = Helper_Blog::getPicWebPath(array('imgName' => $val['picName'], 'imgExt' => $val['picExt'], 'time' => $val['time'], 'rootdir' => UPLOAD_IMG_PATH . 'blog_' . APP_BLOG_NAME . '/'));
         }
     }
     $output->cate = LJL_Config::get('Blog_' . ucfirst(APP_BLOG_NAME) . '_Cate', 'CATE');
     $output->articleId = $articleId;
     $output->articleInfo = $articleInfo;
     $output->picArr = $picArr;
     $output->setTemplate('Admin');
 }
Exemple #8
0
 public function doDefault(LJL_Request $input, LJL_Response $output)
 {
     //http://hongbo.com/index.php?c=detail&a=default&articleid=67
     LJL_Http::setExpires(3600);
     #设置缓存时间
     $articleId = $input->get('articleid');
     $articleInfo = Helper_Blog::getArticleInfo(array('articleId' => $articleId, 'fileds' => array('firstImgId', 'cate', 'title', 'descript', 'tags', 'source', 'insertTime', 'view', 'content')));
     if (count($articleInfo) < 5) {
         LJL_Http::send404Header();
         $output->setTemplate('404');
         return;
     }
     $articleInfo['id'] = $articleId;
     $articleTags = explode(',', $articleInfo['tags']);
     $cateList = LJL_Config::get('Blog_' . ucfirst(APP_BLOG_NAME) . '_Cate', 'CATE');
     $prevNext = Helper_Blog::getPreNextArticle(array('articleId' => $articleId, 'fileds' => array('id', 'title')));
     $prevNext = $this->formatPrevNext($prevNext);
     //面包屑导航
     $nav[0]['title'] = '首页';
     $nav[0]['url'] = WWW_WEB;
     $nav[1]['title'] = $cateList[$articleInfo['cate']][0];
     $nav[1]['url'] = Blog_Plugin_Urls::getListUrl(array('cate' => $articleInfo['cate']));
     $nav[2]['title'] = $articleInfo['title'];
     //seo
     $output->seoArr = array('title' => $articleInfo['title'] . ' - ' . BLOG_SEO_TITTLE . ' | 最红博', 'description' => $articleInfo['descript'], 'keywords' => implode(',', $articleTags));
     $output->cateList = $cateList;
     $output->articleInfo = $articleInfo;
     $output->articleTags = $articleTags;
     $output->prevNext = $prevNext;
     $output->nav = $nav;
     $output->cate = $articleInfo['cate'];
     $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->commentTpl = $output->fetchCol("Part/Comment");
     $output->searchTpl = $output->fetchCol("Part/Search");
     $output->setTemplate('Detail');
 }
Exemple #9
0
 public function validate(LJL_Request $input, LJL_Response $output)
 {
     // 	    LJL_Api::run("Image.Util.downImg" , array(
     // 	        'file' 	   =>'/www/LJL/Html/Blogstaticfile/1.png',
     // 	    ));
     // 	    die;
     $output->Items = LJL_Config::get('Icloud_Items');
     //指定方法
     $output->showFunName = $input->showFunName = $input->get("showFunName");
     $input->funName = $output->funName = $input->post("funName");
     //指定模块
     $output->moduleName = $input->moduleName = $input->get("moduleName") ? $input->get("moduleName") : $input->post("moduleName");
     #从配置中读取相关模块所属下的方法
     if (!$input->moduleName) {
         return true;
     }
     $output->helperCfgArr = $this->helperCfgArr = LJL_Config::get('Icloud_Items_' . $input->moduleName);
     if ($input->funName || $input->showFunName) {
         $output->funParamArr = $output->showFunName ? $output->helperCfgArr[$output->showFunName] : $output->helperCfgArr[$output->funName];
     }
     return true;
 }
Exemple #10
0
 public function validate(LJL_Request $input, LJL_Response $output)
 {
     //var_dump($input);
     #从配置中读取相关Helper配置
     $output->helperCfgArr = $this->helperCfgArr = LJL_Config::get('Tools_Helper_' . LJL_FAPP, 'MANAGE');
     $output->dopost = $input->dopost = (int) $input->post("dopost");
     $input->funName = '';
     if ($input->dopost) {
         $output->funName = $input->funName = $input->post("funName");
     }
     #指定方法
     $output->showFunName = $input->funName ? $input->funName : $input->get("showFunName");
     $helpCfgArr2 = array();
     foreach ($this->helperCfgArr as $groupName => $cfgArr) {
         $helpCfgArr2 = array_merge($helpCfgArr2, $cfgArr);
     }
     $output->helpCfgArr2 = $helpCfgArr2;
     //var_dump($helpCfgArr2);die;
     if ($output->showFunName) {
         $output->funParamArr = $helpCfgArr2[$output->showFunName];
     }
     return true;
 }
Exemple #11
0
 /**
  * 更新 最新最热 博文列表  每个博主下各抽取5条,最新的、最热的
  * 推荐的文章也是依据这个表,会依据 表中的推荐权重字段
  */
 private function updateTopNewBlog($database)
 {
     $db = Db_Blog::instance(null, $database);
     //最新5篇
     $newList = Helper_Blog::getArticleList(array('pageSize' => 5, 'isPublished' => 1, 'fields' => array('id', 'view', 'cate', 'title', 'descript', 'insertTime'), 'order' => 'order by insertTime desc'));
     //最热5篇
     $hotList = Helper_Blog::getArticleList(array('pageSize' => 5, 'isPublished' => 1, 'fields' => array('id', 'view', 'cate', 'title', 'descript', 'insertTime'), 'order' => 'order by view desc'));
     if (is_array($newList) && is_array($hotList)) {
         $newHotList = array_merge($newList, $hotList);
         $webSite = str_replace('blog_', '', $database);
         foreach ($newHotList as $articleInfo) {
             //查询推荐权重
             $isRecommend = Helper_Blogconfig::getArticleInfo(array('articleId' => $articleInfo['id'], 'webSite' => $webSite, 'fileds' => array('isRecommend')));
             $isRecommend = $isRecommend['isRecommend'] ? $isRecommend['isRecommend'] : 0;
             Helper_Blogconfig::insertHotnew(array('insertData' => array('webSite' => $webSite, 'articleId' => $articleInfo['id'], 'title' => $articleInfo['title'], 'descript' => $articleInfo['descript'], 'cate' => $articleInfo['cate'], 'cateVal' => LJL_Config::get('Blog_' . ucfirst($webSite) . '_Cate', 'CATE')[$articleInfo['cate']][0], 'view' => $articleInfo['view'], 'score' => $articleInfo['view'], 'publishTime' => $articleInfo['insertTime'], 'isRecommend' => $isRecommend)));
         }
     }
     echo $database . ' hot and new blog publish over' . PHP_EOL;
 }
Exemple #12
0
 private function _fulltextSearch($input, $output)
 {
     LJL_Http::setExpires(3600);
     #设置缓存时间
     $tag = $keyword = trim($input->get('keyword'));
     $page = $input->get('page') ? intval($input->get('page')) : 1;
     $start = ($page - 1) * $this->pageSize;
     $query = array('q' => $keyword ? $keyword : '*', 'wt' => 'json', 'rows' => $this->pageSize, 'start' => $start, 'hl' => 'true', 'hl.fl' => 'title,descript', "hl.simple.pre" => '<font color="red">', "hl.simple.post" => '</font>');
     $solrServer = LJL_Config::get('Blog_Solr', 'SOLR');
     $url = $solrServer['url'] . '/select?' . http_build_query($query);
     //echo $url;die;
     $solrRes = LJL_Http::curlPage(array('url' => $url, 'timeout' => 5));
     $searchRes = json_decode($solrRes, true);
     //var_dump($searchRes);
     $cateList = LJL_Config::get('Blog_' . ucfirst(APP_BLOG_NAME) . '_Cate', 'CATE');
     //文章列表
     $articleList = $searchRes['response']['docs'];
     $articleCount = $searchRes['response']['numFound'];
     $articleHl = $searchRes['highlighting'];
     unset($searchRes);
     //组织高亮部分
     //var_dump($articleHl);die;
     foreach ((array) $articleList as $akey => $aval) {
         if (key_exists($aval['id'], $articleHl)) {
             if (isset($articleHl[$aval['id']]['title'])) {
                 $articleList[$akey]['title'] = $articleHl[$aval['id']]['title'][0];
             }
             if (isset($articleHl[$aval['id']]['descript'])) {
                 $articleList[$akey]['descript'] = $articleHl[$aval['id']]['descript'][0];
             }
         }
     }
     //分页相关
     $totalPage = ceil($articleCount / $this->pageSize);
     $pageStr = Libs_Global_Page::getPageString(array('page' => $page, 'pageTotal' => $totalPage, 'urlClass' => 'Blog_Plugin_Urls', 'urlFunc' => 'getSearchUrl', 'args' => array('type' => $input->get('type'), 'keyword' => $keyword, 'page' => $page)));
     //获取各分类下tag标签
     if ($cateList) {
         $tagsArr = [];
         foreach ($cateList as $cateKey => $cateV) {
             $tagsArr[$cateKey] = Helper_Blog::getTags(array('cate' => $cateKey));
         }
     }
     //面包屑导航
     $nav[0]['title'] = '首页';
     $nav[0]['url'] = WWW_WEB;
     $nav[1]['title'] = $keyword;
     //seo
     $output->seoArr = array('title' => $keyword . '搜索-第' . $page . '页  - ' . BLOG_SEO_TITTLE . ' | 最红博 ');
     $output->tagsArr = $tagsArr;
     $output->tag = $keyword;
     $output->cate = '';
     $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');
 }