<?php
/*
* @Emlog大前端4.0
* @authors 小草 (blog.yesfree.pw)
* @date 2016-4-10
* @version 4.0
*/
if(!defined('EMLOG_ROOT')) {exit('error!');}
require_once View::getView('config');
global $arr_navico1;
$arr_navico1 = unserialize($arr_navico);
global $arr_sortico1;
$arr_sortico1 = unserialize($arr_sortico);
ini_set('date.timezone','Asia/Shanghai');
?>
<?php
//widget:blogger
function widget_blogger($title){
}?>
<?php
//widget:日历
function widget_calendar($title){ ?>
<div class="widget widget_calendar">
<div id="calendar_wrap" class="calendar_wrap">
<span class="icon"><i class="fa fa-calendar fa-fw"></i></span>
<h3><?php echo $title; ?></h3>
<div id="calendar" class="f_calendar">
</div>
<script>sendinfo('<?php echo Calendar::url(); ?>','calendar');</script>
</div></div>
<?php }?>
<?php
//widget:标签
function widget_tag($title){
global $CACHE;
$tag_cache = $CACHE->readCache('tags');?>
<div class="widget widget_ui_tags"><span class="icon"><i class="fa fa-tags"></i></span><h3><?php echo $title; ?>云</h3><div class="items">
<?php foreach($tag_cache as $value): ?>
<a href="<?php echo Url::tag($value['tagurl']); ?>"><?php echo $value['tagname']; ?> (<?php echo $value['usenum']; ?>)</a>
<?php endforeach; ?>
</div>
</div>
<?php }?>
<?php
//widget:分类
function widget_sort($title){
global $CACHE;
global $arr_sortico1;
$sort_cache = $CACHE->readCache('sort');
?>
<div class="widget widget_ui_sort"><h3 class="widget-title"><i class="fa fa-sort"></i><?php echo $title; ?></h3><div class="items"> <ul id="blogsort">
<?php
foreach($sort_cache as $value):
$sid=$value["sid"];
if ($value['pid'] != 0) continue;
?>
<li> <a title="<?php echo $value['lognum'] ?> 篇文章" href="<?php echo Url::sort($value['sid']); ?>"><i class="<?php if(empty($arr_sortico1[$sid])){echo "fa fa-code";}else{echo $arr_sortico1[$sid];}?>"></i> <?php echo $value['sortname']; ?></a> </li>
<?php endforeach; ?>
</ul> </div> </div>
<?php }?>
<?php
//widget:最新微语
function widget_twitter($title){
global $CACHE;
$newtws_cache = $CACHE->readCache('newtw');
$istwitter = Option::get('istwitter');
?>
<div class="widget widget_ui_textads widget_twitter"><a class="style01"><strong>最新微语</strong>
<?php //foreach($newtws_cache as $value): ?>
<br><br><font size="2" color="#999">
<?php echo comment2emoji($newtws_cache[0]['t']); ?>
</font><br><br>
<font color="#999"><?php echo smartDate($newtws_cache[0]['date']); ?></font>
<?php //endforeach; ?>
</a>
</div>
<?php }?>
<?php
//widget:最新评论
function widget_newcomm($title){
global $CACHE;
$com_cache = $CACHE->readCache('comment');
//取前6个评论
$com_cache_slice = array_slice($com_cache, 0,6);
if (!blog_tool_ishome()) return;#只在首页显示友链去掉双斜杠注释即可
?>
<div class="widget widget_ui_comments"> <span class="icon"><i class="fa fa-pencil-square-o"></i></span><h3> 最新评论</h3> <ul>
<?php
foreach($com_cache_slice as $value):
$url = Url::comment($value['gid'], $value['page'], $value['cid']);
$imgaa=myGravatar($value['mail']);
?>
<li><a href="<?php echo $url; ?>" title=""><img class="avatar avatar-50 photo avatar-default" height="50" width="50" src="<?php echo $imgaa; ?>" style="display: block;"> <strong><?php echo $value['name']; ?></strong> 说<br /><?php echo comment2emoji($value['content']); ?></a></li>
<?php endforeach; ?>
</ul> </div>
<?php }?>
<?php
//widget:最新文章
function widget_newlog($title){
$index_newlognum = Option::get('index_newlognum');?>
<div class="widget widget_ui_posts"><span class="icon"><i class="fa fa-pencil-square-o"></i></span><h3><?php echo $title; ?></h3><ul>
<?php
$db = MySql::getInstance();
$sql = $db->query ("SELECT * FROM ".DB_PREFIX."blog inner join ".DB_PREFIX."sort WHERE hide='n' AND type='blog' AND top='n' AND sortid=sid order by date DESC limit 0,$index_newlognum");
while($row = $db->fetch_array($sql)){ ?>
<li><a href="<?php echo Url::log($row['gid']);?>"><span class="thumbnail"><img class="thumb" src="<?php get_thum($row['gid']);?>" style="display: block;"></span><span class="text"><?php echo $row['title'];?></span><i class="fa fa-clock-o fa-fw"></i><span class="muted"><?php echo gmdate('Y-m-d', $row['date']);?></span></a></li>
<?php }?>
</ul></div>
<?php }?>
<?php
//widget:热门文章
function widget_hotlog($title){
$db = MySql::getInstance();
$hot_num = Option::get('index_hotlognum');
?>
<div class="widget widget_ui_posts "><span class="icon"><i class="fa fa-fire"></i></span><h3><?php echo $title; ?></h3><ul>
<?php
$sql = "SELECT gid,title,date,views,content FROM ".DB_PREFIX."blog inner join ".DB_PREFIX."sort WHERE hide='n' AND type='blog' AND date > $time - 30*24*60*60 AND top='n' AND sortid=sid order by `views` DESC limit $hot_num";
$list = $db->query($sql);
while($row = $db->fetch_array($list)){
?>
<li><a href="<?php echo Url::log($row['gid']);?>"><span class="thumbnail"><img class="thumb" src="<?php get_thum($row['gid']);?>" style="display: block;"></span><span class="text"><?php echo $row['title'];?></span><i class="fa fa-clock-o fa-fw"></i><span class="muted"><?php echo gmdate('Y-m-d', $row['date']);?></span></a></li>
<?php }?>
</ul></div>
<?php }?>
<?php
//widget:随机文章
function widget_random_log($title){
$db = MySql::getInstance();
$sj_num = Option::get('index_randlognum');
?>
<div class="widget widget_ui_posts widget_fix"><span class="icon"><i class="fa fa-pencil-square-o"></i></span><h3>猜你喜欢</h3><ul>
<?php
$sql = "SELECT gid,title,date,views,content FROM ".DB_PREFIX."blog ORDER BY RAND() LIMIT $sj_num";
$list = $db->query($sql);
while($row = $db->fetch_array($list)){
?>
<li><a href="<?php echo Url::log($row['gid']);?>"><span class="thumbnail"><img class="thumb" src="<?php get_thum($row['gid']);?>" style="display: block;"></span><span class="text"><?php echo $row['title'];?></span><i class="fa fa-clock-o fa-fw"></i><span class="muted"><?php echo gmdate('Y-m-d', $row['date']);?></span></a></li>
<?php }?>
</ul></div>
<?php }?>
<?php
//widget:搜索
function widget_search($title){ ?>
<?php } ?>
<?php
//widget:归档
function widget_archive($title){
global $CACHE;
$record_cache = $CACHE->readCache('record');
?>
<div class="widget widget_ui_tags"><span class="icon"><i class="fa fa-pencil"></i></span><h3><?php echo $title; ?>云</h3><div class="items">
<?php foreach($record_cache as $value): ?>
<a href="<?php echo Url::record($value['date']); ?>"><?php echo $value['record']; ?> (<?php echo $value['lognum']; ?>)</a>
<?php endforeach; ?>
</div>
</div>
<?php } ?>
<?php
//widget:自定义组件
function widget_custom_text($title, $content){ ?>
<div class="widget widget_ui_textads"><a class="style01" href="#"><strong><?php echo $title; ?></strong><h2></h2><p><?php echo $content; ?></p></a></div>
<?php } ?>
<?php
//widget:链接
function widget_link($title){
global $CACHE;
$link_cache = $CACHE->readCache('link');
if (!blog_tool_ishome()) return;#只在首页显示友链去掉双斜杠注释即可
?>
<div class="widget widget_links"><span class="icon"><i class="fa fa-link"></i></span> <h3> 友情链接</h3>
<ul>
<li><a href="http://www.tianyaseo.com/daohang/" title="博客导航" target="_blank"><i class="fa fa-link fa-fw"></i>博客导航</a></li>
<?php foreach($link_cache as $value): ?>
<li><a href="<?php echo $value['url']; ?>" title="<?php echo $value['des']; ?>" target="_blank"><i class="fa fa-link fa-fw"></i><?php echo $value['link']; ?></a></li>
<?php endforeach; ?></ul>
</div>
<?php }?>
<?php
//blog:导航
function blog_navi(){
global $CACHE;
global $arr_navico1;
$navi_cache = $CACHE->readCache('navi');
foreach($navi_cache as $num=>$value):
$id=$value[