Beispiel #1
0
					<span><i class="fa fa-eye"></i> <?php 
echo $views;
?>
次浏览</span>
					<span><i class="fa fa fa-folder-open"></i> <?php 
blog_sort($logid);
?>
</span>
					<?php 
echo editflg($logid, $author);
?>
				</div>
			</header>
			<article class="article_content">
				<?php 
echo handleContent($log_content);
#日志正文
echo blog_att($logid);
#附件格式化
?>
				<div class="article_copy">转载请注明本文标题和链接:《<a href="<?php 
echo Url::log($logid);
?>
"><?php 
echo $log_title;
?>
</a>》</div>
			</article>
			<footer class="article_footer">
				<div class="article_share bdsharebuttonbox">
					<strong>分享到:</strong>
Beispiel #2
0
 public function indexAction()
 {
     //获取相关用于检索的参数
     //分类
     $category = get("category", "txt") ? trim(get("category", "txt")) : "";
     //归档
     $archive = get("archive", "txt") ? trim(get("archive", "txt")) : "";
     //标签
     $tag = get("tag", "txt") ? trim(get("tag", "txt")) : "";
     //获取文章列表
     $where = $logList = array();
     $where['status'] = \Admin\Article\Type\Status::STATUS_ENABLE;
     $where['member_id'] = 1;
     //检索
     if (!empty($category)) {
         $where['category'] = $category;
     }
     if (!empty($archive)) {
         preg_match("/^(\\d{4})年(\\d{1,2})月\$/", $archive, $result);
         $where['time?>='] = "{$result['1']}-{$result['2']}-01 00:00:00";
         $where['time?<'] = "{$result['1']}-" . ($result[2] + 1) . "-01 00:00:00";
     }
     if (!empty($tag)) {
         $tagRow = db()->Table('article_tag')->getRow(array('tagname' => $tag))->done();
         //getRow
         if ($tagRow) {
             $where['id'] = explode(",", $tagRow['gid']);
         }
     }
     $count = db()->Table('article')->getAll($where)->order("istop desc")->count()->done();
     //getAll
     $page = new \System\Library\Page($count);
     if ($page->isShow) {
         $showPage = $page->show();
         // 分页显示输出
     } else {
         $showPage = "";
     }
     // 进行分页数据查询
     $all = db()->Table('article')->getAll($where)->limit($page->firstRow, $page->listRows)->order("istop desc")->done();
     foreach ($all as $k => $v) {
         $logList[$k]['title'] = htmlspecialchars(trim($v['title']));
         $logList[$k]['id'] = $v['id'];
         $logList[$k]['url'] = $this->getView()->log($v['id']);
         $cookiePassword = cookie('xtt_logpwd_' . $v['id']) ? addslashes(trim(cookie('xtt_logpwd_' . $v['id']))) : '';
         $excerpt = empty($v['excerpt']) ? breakLog($v['content'], $v['id']) : $v['excerpt'];
         $excerpt = mb_substr(strip_tags($excerpt), 0, 60);
         $logList[$k]['excerpt'] = $v['excerpt'] = $excerpt;
         if (!empty($v['password']) && $cookiePassword != $v['password']) {
             $logList[$k]['excerpt'] = '<p>[该日志已设置加密,请点击标题输入密码访问]</p>';
         } else {
             if (!empty($v['excerpt'])) {
                 $logList[$k]['excerpt'] .= '<p class="readmore"><a href="' . $this->getView()->log($v['id']) . '">阅读全文&gt;&gt;</a></p>';
             }
         }
         $logList[$k]['thumbnail'] = $v['thumbnail'];
         $logList[$k]['time'] = $v['time'];
         $logList[$k]['author'] = member($v['member_id']);
         $model = new \Home\Model\homeModel();
         $logList[$k]['category'] = $model->getArticleCategory($v['category']);
         $tag = new \Admin\Model\articleModel();
         //获取该文章标签
         $tags = $tag->getTags($v['id'], true);
         if ($tags) {
             $logList[$k]['tags'] = explode(",", $tags);
         }
         $logList[$k]['comment_num'] = $v['comment_num'];
         $logList[$k]['view_num'] = $v['view_num'];
         $logList[$k]['istop'] = $v['istop'];
         $logList[$k]['content'] = handleContent($v['content']);
     }
     $this->getView()->assign(array('articleAll' => $logList, 'show' => $showPage));
     $this->getView()->display();
 }