Beispiel #1
0
function JA_content_f($arr)
{
    $blogname = Option::get('blogname');
    //$url = BLOG_URL."?post=".$arr['logid'];
    $url = Url::log($arr['logid']);
    $name = "<a style=\"color:red;\" href=\"" . BLOG_URL . "\">" . $blogname . "</a>";
    ?>
  <p>
  版权所有:《<?php 
    echo $name;
    ?>
》 => 《<a href="<?php 
    echo $url;
    ?>
"><?php 
    echo $arr['log_title'];
    ?>
</a>》<br />
  本文地址:<a href="<?php 
    echo $url;
    ?>
"><?php 
    echo $url;
    ?>
</a><br />
  除非注明,文章均为 《<?php 
    echo $name;
    ?>
》 原创,欢迎转载!转载请注明本文地址,谢谢。<br />
  </p>
  <?php 
}
Beispiel #2
0
function sitemap_update_on_comment()
{
    global $sitemap_name;
    if (Option::get('ischkcomment') == 'n') {
        return;
    }
    $gid = isset($_POST['gid']) ? intval($_POST['gid']) : -1;
    $url = Url::log($gid);
    $lastmod = gmdate('c');
    $file = EMLOG_ROOT . '/' . $sitemap_name;
    $xml = file_get_contents($file);
    $xml = preg_replace("|<loc>" . preg_quote($url) . "<\\/loc>\n<lastmod>(.*?)<\\/lastmod>|i", "<loc>{$url}</loc>\n<lastmod>{$lastmod}</lastmod>", $xml);
    file_put_contents($file, $xml);
}
Beispiel #3
0
function archiver_db($condition = '')
{
    $DB = Database::getInstance();
    $sql = "SELECT gid, title, comnum, views FROM " . DB_PREFIX . "blog WHERE type='blog' and hide='n' {$condition}";
    $result = $DB->query($sql);
    $output = '';
    while ($row = $DB->fetch_array($result)) {
        $log_url = Url::log($row['gid']);
        $output .= '<li><a href="' . $log_url . '">' . $row['title'] . '</a> <span>(' . $row['comnum'] . '/' . $row['views'] . ')</span></li>';
    }
    $output = empty($output) ? '<li>暂无日志</li>' : $output;
    $output = '<ol class="archiver_item">' . $output . '</ol>';
    return $output;
}
Beispiel #4
0
/**
 * 获取文章信息
 *
 * @return array
 */
function getBlog($sortid = null)
{
    $rss_output_num = Option::get('rss_output_num');
    if ($rss_output_num == 0) {
        return array();
    }
    $DB = Database::getInstance();
    $sorts = Cache::getInstance()->readCache('sort');
    if (isset($sorts[$sortid])) {
        $sort = $sorts[$sortid];
        if ($sort['pid'] != 0 || empty($sort['children'])) {
            $subsql = "and sortid={$sortid}";
        } else {
            $sortids = array_merge(array($sortid), $sort['children']);
            $subsql = "and sortid in (" . implode(',', $sortids) . ")";
        }
    } else {
        $subsql = $sortid ? "and sortid={$sortid}" : '';
    }
    $sql = "SELECT * FROM " . DB_PREFIX . "blog  WHERE hide='n' and type='blog' {$subsql} ORDER BY date DESC limit 0," . $rss_output_num;
    $result = $DB->query($sql);
    $blog = array();
    while ($re = $DB->fetch_array($result)) {
        $re['id'] = $re['gid'];
        $re['title'] = htmlspecialchars($re['title']);
        $re['date'] = $re['date'];
        $re['content'] = $re['content'];
        if (!empty($re['password'])) {
            $re['content'] = '<p>[该文章已设置加密]</p>';
        } elseif (Option::get('rss_output_fulltext') == 'n') {
            if (!empty($re['excerpt'])) {
                $re['content'] = $re['excerpt'];
            } else {
                $re['content'] = extractHtmlData($re['content'], 330);
            }
            $re['content'] .= ' <a href="' . Url::log($re['id']) . '">阅读全文&gt;&gt;</a>';
        }
        $blog[] = $re;
    }
    return $blog;
}
Beispiel #5
0
 private function setData()
 {
     $CACHE = Cache::getInstance();
     $data = array();
     $lastCommentTime = $this->getLastCommentTime();
     $data[] = array('url' => BLOG_URL, 'lastmod' => time(), 'changefreq' => 'always', 'priority' => '1.0');
     //日志
     $query = $this->db->query("SELECT gid,date FROM " . DB_PREFIX . "blog WHERE type='blog' AND hide='n' ORDER BY date DESC");
     while ($row = $this->db->fetch_array($query)) {
         $lastmod = $this->comment_time && isset($lastCommentTime[$row['gid']]) ? $lastCommentTime[$row['gid']] : $row['date'];
         $data[] = array('url' => Url::log($row['gid']), 'lastmod' => $lastmod, 'changefreq' => $this->changefreq[0], 'priority' => $this->priority[0]);
     }
     //页面
     $query = $this->db->query("SELECT gid,date FROM " . DB_PREFIX . "blog WHERE type='page' AND hide='n' ORDER BY date DESC");
     while ($row = $this->db->fetch_array($query)) {
         $lastmod = $this->comment_time && isset($lastCommentTime[$row['gid']]) ? $lastCommentTime[$row['gid']] : $row['date'];
         $data[] = array('url' => Url::log($row['gid']), 'lastmod' => $lastmod, 'changefreq' => $this->changefreq[0], 'priority' => $this->priority[0]);
     }
     //分类
     foreach ($CACHE->readCache('sort') as $value) {
         $data[] = array('url' => Url::sort($value['sid']), 'lastmod' => time(), 'changefreq' => $this->changefreq[2], 'priority' => $this->priority[2]);
     }
     //标签
     foreach ($CACHE->readCache('tags') as $value) {
         $data[] = array('url' => Url::tag($value['tagurl']), 'lastmod' => time(), 'changefreq' => $this->changefreq[3], 'priority' => $this->priority[3]);
     }
     //碎语
     if (Option::get('istwitter') == 'y') {
         $newtws_cache = $CACHE->readCache('newtw');
         $data[] = array('url' => BLOG_URL . 't/', 'lastmod' => $newtws_cache[0]['date'], 'changefreq' => $this->changefreq[4], 'priority' => $this->priority[4]);
     }
     //归档
     foreach ($CACHE->readCache('record') as $value) {
         preg_match("/^([\\d]{4})([\\d]{2})\$/", $value['date'], $match);
         $days = getMonthDayNum($match[2], $match[1]);
         $lastmod = emStrtotime($value['date'] . '01') + 3600 * 24 * $days;
         $data[] = array('url' => Url::record($value['date']), 'lastmod' => $lastmod, 'changefreq' => $this->changefreq[5], 'priority' => $this->priority[5]);
     }
     $this->data = $data;
 }
Beispiel #6
0
 /**
  * 前台获取文章列表
  *
  * @param string $condition
  * @param int $page
  * @param int $perPageNum
  * @return array
  */
 function getLogsForHome($condition = '', $page = 1, $perPageNum)
 {
     $start_limit = !empty($page) ? ($page - 1) * $perPageNum : 0;
     $limit = $perPageNum ? "LIMIT {$start_limit}, {$perPageNum}" : '';
     $sql = "SELECT * FROM " . DB_PREFIX . "blog WHERE type='blog' and hide='n' and checked='y' {$condition} {$limit}";
     $res = $this->db->query($sql);
     $logs = array();
     while ($row = $this->db->fetch_array($res)) {
         $row['log_title'] = htmlspecialchars(trim($row['title']));
         $row['log_url'] = Url::log($row['gid']);
         $row['logid'] = $row['gid'];
         $cookiePassword = isset($_COOKIE['em_logpwd_' . $row['gid']]) ? addslashes(trim($_COOKIE['em_logpwd_' . $row['gid']])) : '';
         if (!empty($row['password']) && $cookiePassword != $row['password']) {
             $row['excerpt'] = '<p>[该文章已设置加密,请点击标题输入密码访问]</p>';
         } else {
             if (!empty($row['excerpt'])) {
                 $row['excerpt'] .= '<p class="readmore"><a href="' . Url::log($row['logid']) . '">阅读全文&gt;&gt;</a></p>';
             }
         }
         $row['log_description'] = empty($row['excerpt']) ? breakLog($row['content'], $row['gid']) : $row['excerpt'];
         $row['attachment'] = '';
         $row['tag'] = '';
         $row['tbcount'] = 0;
         //兼容未删除引用的模板
         $logs[] = $row;
     }
     return $logs;
 }
Beispiel #7
0
 /**
  * 获取导航链接
  */
 static function navi($type, $typeId, $url)
 {
     $sorts = Cache::getInstance()->readCache('sort');
     switch ($type) {
         case Navi_Model::navitype_custom:
         case Navi_Model::navitype_home:
         case Navi_Model::navitype_t:
         case Navi_Model::navitype_admin:
             $url = $url;
             break;
         case Navi_Model::navitype_sort:
             $url = Url::sort($typeId);
             break;
         case Navi_Model::navitype_page:
             $url = Url::log($typeId);
             break;
         default:
             $url = (strpos($url, 'http') === 0 ? '' : BLOG_URL) . $url;
             break;
     }
     return $url;
 }
Beispiel #8
0
function neighbor_log($neighborLog)
{
    extract($neighborLog);
    ?>
	<?php 
    if ($prevLog) {
        ?>
		<span class="article_prev_log">上一篇 <a href="<?php 
        echo Url::log($prevLog['gid']);
        ?>
"><?php 
        echo $prevLog['title'];
        ?>
</a></span>
	<?php 
    }
    ?>
	<?php 
    if ($nextLog) {
        ?>
		<span class="article_next_log"><a href="<?php 
        echo Url::log($nextLog['gid']);
        ?>
"><?php 
        echo $nextLog['title'];
        ?>
</a> 下一篇</span>
	<?php 
    }
}
Beispiel #9
0
function neighbor_log($neighborLog)
{
    extract($neighborLog);
    ?>
	<?php 
    if ($prevLog) {
        ?>
	<i class="fa fa-long-arrow-left fa-lg"></i> <a href="<?php 
        echo Url::log($prevLog['gid']);
        ?>
"><?php 
        echo $prevLog['title'];
        ?>
</a>
	<?php 
    }
    ?>
	<?php 
    if ($nextLog && $prevLog) {
        ?>
		|
	<?php 
    }
    ?>
	<?php 
    if ($nextLog) {
        ?>
		 <a href="<?php 
        echo Url::log($nextLog['gid']);
        ?>
"><?php 
        echo $nextLog['title'];
        ?>
</a><i class="fa fa-long-arrow-right fa-lg"></i>
	<?php 
    }
}
Beispiel #10
0
<form action="page.php?action=operate_page" method="post" name="form_page" id="form_page">
  <table class="table table-striped table-bordered table-hover dataTable no-footer">
    <thead>
      <tr>
        <th width="461" colspan="2"><b>标题</b></th>
        <th width="140"><b>模板</b></th>
        <th width="50" class="tdcenter"><b>评论</b></th>
        <th width="140"><b>时间</b></th>
      </tr>
    </thead>
    <tbody>
    <?php 
if ($pages) {
    foreach ($pages as $key => $value) {
        if (empty($navibar[$value['gid']]['url'])) {
            $navibar[$value['gid']]['url'] = Url::log($value['gid']);
        }
        $isHide = $value['hide'] == 'y' ? '<font color="red"> - 草稿</font>' : '<a href="' . $navibar[$value['gid']]['url'] . '" target="_blank" title="查看页面"><img src="./views/images/vlog.gif" align="absbottom" border="0" /></a>';
        ?>
     <tr>
        <td width="21"><input type="checkbox" name="page[]" value="<?php 
        echo $value['gid'];
        ?>
" class="ids" /></td>
        <td width="440">
        <a href="page.php?action=mod&id=<?php 
        echo $value['gid'];
        ?>
"><?php 
        echo $value['title'];
        ?>
                       <span class="right hide-on-small-only">|</span>
                    <?php 
    }
    ?>
                <?php 
}
?>
                &nbsp;
            </div>
            <div class="col s12 m6 truncate right-align">
                <?php 
if ($nextLog) {
    ?>
                    <i>下一篇:&nbsp;</i>
                    <a class="light teal-text text-darken-2" href="<?php 
    echo Url::log($nextLog['gid']);
    ?>
">
                        <?php 
    echo $nextLog['title'];
    ?>
                    </a>
                <?php 
}
?>
            </div>
        </div>
        <div class="comments padding-top">
            <?php 
include View::getView('modules/comments');
?>
Beispiel #12
0
function neighbor_log($neighborLog)
{
    extract($neighborLog);
    ?>
	<?php 
    if ($prevLog) {
        ?>
	&laquo; <a href="<?php 
        echo Url::log($prevLog['gid']);
        ?>
"><?php 
        echo $prevLog['title'];
        ?>
</a>
	<?php 
    }
    ?>
	<?php 
    if ($nextLog && $prevLog) {
        ?>
		|
	<?php 
    }
    ?>
	<?php 
    if ($nextLog) {
        ?>
		 <a href="<?php 
        echo Url::log($nextLog['gid']);
        ?>
"><?php 
        echo $nextLog['title'];
        ?>
</a>&raquo;
	<?php 
    }
}
Beispiel #13
0
$Sql = "SELECT `gid`,`date`,`comnum`,`views` FROM `" . DB_PREFIX . "blog` WHERE `type` = 'blog' AND `hide` = 'n'";
$res = $DbModel->query($Sql);
while ($row = $DbModel->fetch_array($res)) {
    $cache = array();
    $cache['loc'] = Url::log($row['gid']);
    $cache['lastmod'] = date('Y-m-d', $row['date']);
    $cache['changefreq'] = 'daily';
    $cache['priority'] = $row['views'] <= 500 || $row['comnum'] < 1 ? '0.9' : '1.0';
    $XMLData[] = $cache;
}
#独立页面
$Sql = "SELECT `gid`,`date`,`comnum`,`views` FROM `" . DB_PREFIX . "blog` WHERE `type` = 'page' AND `hide` = 'n'";
$res = $DbModel->query($Sql);
while ($row = $DbModel->fetch_array($res)) {
    $cache = array();
    $cache['loc'] = Url::log($row['gid']);
    $cache['lastmod'] = date('Y-m-d', $row['date']);
    $cache['changefreq'] = 'daily';
    $cache['priority'] = $row['views'] <= 500 || $row['comnum'] < 1 ? '0.9' : '1.0';
    $XMLData[] = $cache;
}
#归档
foreach ($RecordArr as $key => $value) {
    $cache = array();
    $cache['loc'] = Url::record($value['date']);
    $cache['changefreq'] = 'Weekly';
    $cache['priority'] = '0.3';
    $XMLData[] = $cache;
}
#关键词
foreach ($TagsArr as $key => $value) {
Beispiel #14
0
function neighbor_log($neighborLog)
{
    extract($neighborLog);
    ?>
<div class="zan-page bs-example">
<ul class="pager">
<?php 
    if ($prevLog) {
        ?>
<li class="previous"><a href="<?php 
        echo Url::log($prevLog['gid']);
        ?>
" title="上一篇《<?php 
        echo $prevLog['title'];
        ?>
》">上一篇</a></li><br/>
 <?php 
    } else {
        ?>
  <li class="previous"><a title="上一篇:噢~这是最新的文章了">下一篇</a></li><br/>
<?php 
    }
    if ($nextLog && $prevLog) {
    }
    if ($nextLog) {
        ?>
<li class="next"><a href="<?php 
        echo Url::log($nextLog['gid']);
        ?>
" title="下一篇《<?php 
        echo $nextLog['title'];
        ?>
》">下一篇</a></li>
<?php 
    } else {
        ?>
  <li class="next"><a title="下一篇:没错,这就是小站第一篇文章">下一篇</a></li>
<?php 
    }
    ?>
</ul>
</div>
<?php 
}
Beispiel #15
0
function kl_sendmail_put_reply_mail($commentId, $reply)
{
    global $userData;
    include EMLOG_ROOT . '/content/plugins/kl_sendmail/kl_sendmail_config.php';
    if (KL_IS_REPLY_MAIL == 'Y') {
        $DB = Database::getInstance();
        $blogname = Option::get('blogname');
        $Comment_Model = new Comment_Model();
        $commentArray = $Comment_Model->getOneComment($commentId);
        extract($commentArray);
        $subject = "您在【{$blogname}】发表的评论收到了回复";
        if (strpos($mail, '@139.com') === false) {
            $emBlog = new Log_Model();
            $logData = $emBlog->getOneLogForHome($gid);
            $log_title = $logData['log_title'];
            $content = "{$poster},您好:<br /><br />您之前在《{$log_title}》发表的的评论:<br />{$comment}<br /><br />{$userData['username']}给您的回复:<br />{$reply}<br /><br /><strong>您可以点击<a href=\"" . Url::log($gid) . "#{$cid}\" target=\"_blank\">查看该日志</a></strong><br /><br /><strong>感谢您对<a href=\"" . BLOG_URL . "\" target=\"_blank\">{$blogname}</a>的关注,欢迎<a href=\"" . BLOG_URL . "rss.php\">订阅本站</a></strong><br /><br />";
        } else {
            $content = $reply;
        }
        if ($mail != '') {
            kl_sendmail_do(KL_MAIL_SMTP, KL_MAIL_PORT, KL_MAIL_SENDEMAIL, KL_MAIL_PASSWORD, $mail, $subject, $content, $blogname);
        }
    } else {
        return;
    }
}
Beispiel #16
0
function neighbor_log($neighborLog)
{
    extract($neighborLog);
    ?>
	<?php 
    if ($prevLog) {
        ?>
	<div class="nav-previous">
	<a href="<?php 
        echo Url::log($prevLog['gid']);
        ?>
"><span class="meta-nav">←</span> <?php 
        echo $prevLog['title'];
        ?>
</a>
	</div>
	<?php 
    }
    ?>
	<?php 
    if ($nextLog) {
        ?>
	<div class="nav-next">
		<a href="<?php 
        echo Url::log($nextLog['gid']);
        ?>
"><?php 
        echo $nextLog['title'];
        ?>
 <span class="meta-nav">→</span></a>
	</div>
	<?php 
    }
}
Beispiel #17
0
function neighbor_log($neighborLog)
{
    extract($neighborLog);
    ?>
	<?php 
    if ($prevLog) {
        ?>
	上一篇: <a href="<?php 
        echo Url::log($prevLog['gid']);
        ?>
"><?php 
        echo $prevLog['title'];
        ?>
</a>
	<?php 
    }
    ?>
	<?php 
    if ($nextLog && $prevLog) {
        ?>
    <br />
	<?php 
    }
    ?>
	<?php 
    if ($nextLog) {
        ?>
	下一篇: <a href="<?php 
        echo Url::log($nextLog['gid']);
        ?>
"><?php 
        echo $nextLog['title'];
        ?>
</a>
	<?php 
    }
}
Beispiel #18
0
/**
 * 相关日志插件的功能集合到J3中;related_log插件没有用了 模板中也不再埋入相关日志加载点
 * @param  array $logData 文章显示时的文章数据
 * @return array
 */
function getRelatedLog($logData)
{
    global $CACHE;
    $logid = $logData['logid'];
    $sortid = $logData['sortid'];
    $sortType = _g('related_log_sort_type');
    $sortBy = _g('related_log_sort_by');
    $countNum = _g('related_log_count');
    #DbModel
    $DbModel = Database::getInstance();
    $sql = "SELECT gid,title,date FROM " . DB_PREFIX . "blog WHERE hide='n' AND type='blog'";
    #排序类别的sql拼装
    if ($sortType == 'tags') {
        $log_cache_tags = $CACHE->readCache('logtags');
        // dump($log_cache_tags[$logid]);
        $TagModel = new Tag_Model();
        $log_id_str = '0';
        foreach ($log_cache_tags[$logid] as $key => $val) {
            $log_id_str .= ',' . $TagModel->getTagByName($val['tagname']);
        }
        $log_id_str = implode(',', array_unique(explode(',', ltrim($log_id_str, '0,'))));
        $sql .= " AND gid!={$logid} AND gid IN ({$log_id_str})";
    } else {
        $sql .= " AND gid!={$logid} AND sortid={$sortid}";
    }
    #排序规则
    switch ($sortBy) {
        case 'viewDesc':
            $sql .= " ORDER BY views DESC";
            break;
        case 'viewASC':
            $sql .= " ORDER BY views ASC";
            break;
        case 'comnuDesc':
            $sql .= " ORDER BY comnum DESC";
            break;
        case 'comnuASC':
            $sql .= " ORDER BY comnum ASC";
            break;
        default:
            #按索引键随机降序或升序多读出几行 随后使用php随机处理,不再在mysql中使用rand函数
            if (mt_rand(1, 10) >= 5) {
                $sql .= " ORDER BY gid DESC";
            } else {
                $sql .= " ORDER BY gid ASC";
            }
            break;
    }
    #结果条数限制
    if ($sortBy == 'random') {
        $sliceLen = $countNum;
        $countNum = $countNum * 2;
        #随机的情况多一倍的数据出来
    }
    $sql .= " LIMIT 0,{$countNum}";
    $relatedLogs = array();
    $res = $DbModel->query($sql);
    while ($row = $DbModel->fetch_array($res)) {
        $row['gid'] = intval($row['gid']);
        $row['title'] = htmlspecialchars($row['title']);
        $row['time'] = date('Y-m-d', $row['date']);
        $relatedLogs[] = $row;
    }
    if (!$relatedLogs) {
        return '';
        #没有相关日志数据
    }
    #随机处理
    if ($sortBy == 'random') {
        shuffle($relatedLogs);
        #打乱数组,引用传值函数
        $relatedLogs = array_slice($relatedLogs, 0, $sliceLen);
    }
    // dump($relatedLogs);
    $relatedString = '<div class="article_related"><h3>相关推荐</h3><ul>';
    foreach ($relatedLogs as $key => $val) {
        $relatedString .= '<li><a href="' . Url::log($val['gid']) . '">' . $val['title'] . '</a><time>' . $val['time'] . '</time></li>';
    }
    return $relatedString . '</ul></div>';
}
Beispiel #19
0
/**
 * 文章分割
 *
 * @param string $content 文章内容
 * @param int $lid 文章id
 */
function breakLog($content, $lid)
{
    $a = explode('[break]', $content, 2);
    if (!empty($a[1])) {
        $a[0] .= '<p class="readmore"><a href="' . Url::log($lid) . '">阅读全文&gt;&gt;</a></p>';
    }
    return $a[0];
}
Beispiel #20
0
 
            <?php 
        if (ROLE == ROLE_ADMIN) {
            ?>
<a href="javascript: em_confirm('<?php 
            echo $value['ip'];
            ?>
', 'commentbyip', '<?php 
            echo LoginAuth::genToken();
            ?>
');" title="删除来自该IP的所有评论" class="care">(X)</a><?php 
        }
        ?>
</td>
        <td><a href="<?php 
        echo Url::log($value['gid']);
        ?>
" target="_blank" title="查看该文章"><?php 
        echo $value['title'];
        ?>
</a></td>
     </tr>
	<?php 
    }
} else {
    ?>
	  <tr><td class="tdcenter" colspan="4">还没有收到评论</td></tr>
	<?php 
}
?>
	</tbody>
Beispiel #21
0
 /**
  * 查询出指定分页的指定邮箱的20条评论
  * @param string $mail
  * @return object
  */
 public function select($mail)
 {
     if (!Juser_is_mail($mail)) {
         return false;
     }
     if (empty($this->Options['page'])) {
         $this->Options['page'] = 1;
     }
     $lb = ($this->Options['page'] - 1) * 10;
     $selectSql = "SELECT {$this->tableField} FROM `{$this->tableName}` WHERE `mail`='{$mail}' ORDER BY `cid` DESC LIMIT {$lb},10";
     $result = $this->query($selectSql);
     if ($result) {
         foreach ($result as $key => $value) {
             $value['log_url'] = Url::log($value['gid']) . '#comment-' . $value['cid'];
             $articleInfo = $this->getLogInfo($value['gid']);
             if ($articleInfo) {
                 #合并文章信息
                 $value = array_merge($value, $articleInfo);
                 $result[$key] = $value;
             } else {
                 #不存在文章 不显示该评论
                 unset($result[$key]);
             }
         }
     }
     return $result;
 }
Beispiel #22
0
 function addComment($name, $content, $mail, $url, $imgcode, $blogId, $pid)
 {
     $ipaddr = getIp();
     $utctimestamp = time();
     if ($pid != 0) {
         $comment = $this->getOneComment($pid);
         $content = '@' . addslashes($comment['poster']) . ':' . $content;
     }
     $ischkcomment = Option::get('ischkcomment');
     $hide = ROLE == ROLE_VISITOR ? $ischkcomment : 'n';
     $sql = 'INSERT INTO ' . DB_PREFIX . "comment (date,poster,gid,comment,mail,url,hide,ip,pid)\n                VALUES ('{$utctimestamp}','{$name}','{$blogId}','{$content}','{$mail}','{$url}','{$hide}','{$ipaddr}','{$pid}')";
     $ret = $this->db->query($sql);
     $cid = $this->db->insert_id();
     $CACHE = Cache::getInstance();
     if ($hide == 'n') {
         $this->db->query('UPDATE ' . DB_PREFIX . "blog SET comnum = comnum + 1 WHERE gid='{$blogId}'");
         $CACHE->updateCache(array('sta', 'comment'));
         doAction('comment_saved', $cid);
         emDirect(Url::log($blogId) . '#' . $cid);
     } else {
         $CACHE->updateCache('sta');
         doAction('comment_saved', $cid);
         emMsg('评论发表成功,请等待管理员审核', Url::log($blogId));
     }
 }
Beispiel #23
0
function plugin_setting_view()
{
    $DB = MySql::getInstance();
    $ActMe = isset($_GET['downAct']) ? addslashes($_GET['downAct']) : NULL;
    $Page = isset($_GET['page']) ? intval($_GET['page']) : 1;
    $DownList = DownloadMe_Ret("SQL");
    $File_Unu = 0;
    $File_Out = 0;
    $File_Web = 0;
    $Page_Num = 12;
    if (!empty($DownList['File'])) {
        foreach ($DownList['File'] as $Key => $Val) {
            $Set = $Val['download'] ? unserialize($Val['download']) : array("statis" => 0, "hide" => false, "web" => false);
            $Val['md5'] = $Val['blogid'] . '-' . $Val['aid'];
            if ($Set['hide'] === true) {
                $File_Out++;
            }
            if ($Set['web'] === true) {
                $File_Web++;
            }
            if (DownloadMe_File($Val['filepath']) === false && $Set['web'] !== true) {
                $File_Unu++;
            }
            if (!empty($ActMe) && $ActMe == "web" && $Set['web'] === true) {
                $ListEcho[] = $Val;
            }
            if (!empty($ActMe) && $ActMe == "out" && $Set['hide'] === true) {
                $ListEcho[] = $Val;
            }
            if (!empty($ActMe) && $ActMe == "unu" && DownloadMe_File($Val['filepath']) === false && $Set['web'] !== true) {
                $ListEcho[] = $Val;
            }
            if (empty($ActMe)) {
                $ListEcho[] = $Val;
            }
        }
    }
    $PageMe = pagination(count($ListEcho), $Page_Num, $Page, './plugin.php?plugin=download' . ($ActMe ? '&downAct=' . $ActMe : '') . '&page=');
    ?>
<div class="DownloadMe">
	<div class="Title"><b>附件管理</b> - 就是这么方便!
  	<div class="navMe">
      <a title="外链附件"href="./plugin.php?plugin=download&downAct=web" class="urlimg <?php 
    echo $ActMe == 'unu' ? 'strong' : '';
    ?>
">
      ( <font class="File_Unu"><?php 
    echo $File_Web;
    ?>
</font> )</a>
      <a title="异常附件" href="./plugin.php?plugin=download&downAct=unu" class="unu <?php 
    echo $ActMe == 'unu' ? 'strong' : '';
    ?>
">
      ( <font class="File_Unu"><?php 
    echo $File_Unu;
    ?>
</font> )</a>
      <a title="暂停下载" href="./plugin.php?plugin=download&downAct=out" class="out <?php 
    echo $ActMe == 'out' ? 'strong' : '';
    ?>
">
      ( <font class="File_Out"><?php 
    echo $File_Out;
    ?>
</font> )</a>
      <a title="全部附件" href="./plugin.php?plugin=download" class="anImg start <?php 
    echo empty($ActMe) ? 'strong' : '';
    ?>
">
      ( <font class="File_All"><?php 
    echo count($DownList['File']);
    ?>
</font> )</a>
      <a href="./plugin.php?plugin=download&downAct=gov" class="anImg config <?php 
    echo $ActMe == 'gov' ? 'strong' : '';
    ?>
">
      设置</a>
      <a href="javascript:FileActMe('UpCache');" class="anImg cache">缓存</a>
      <a href="javascript:VersionMe();" class="anImg upload">更新</a>
    </div>
  </div>
  <form action="" method="post" enctype="application/x-www-form-urlencoded">
	<div class="List">
    <div class="notes">注:
    <?php 
    echo empty($ActMe) ? '在删除日志时关联附件也会被删除' : '';
    ?>
    <?php 
    echo $ActMe == 'out' ? '文章页面输出附件列表时, 暂停下载的附件将会被剔除 (不输出) ..' : '';
    ?>
    <?php 
    echo $ActMe == 'unu' ? '不存在实体文件, 只存在数据库关联的附件..' : '';
    ?>
    <?php 
    echo $ActMe == 'gov' ? '停用此插件后配置将有可能会被清空!(取决于缓存文件 "downloadMeData_Inc.php")...' : '';
    ?>
    <?php 
    echo $ActMe == 'web' ? '网络上的共享附件,程序不会将附件下载到本地服务器中,只做下载点击的统计!' : '';
    ?>
    </div>
  <?php 
    if ($ActMe == "gov") {
        $Inc = DownloadMe_Ret("Inc");
        ?>
  <input name="DownloadMeGov" type="hidden" value="true" />
    <table width="100%" class="item_list">
      <thead>
        <tr>
          <th class="tdcenter"><b>设置</b></th>
          <th class="tdcenter"><b>说明</b></th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td><textarea name="echo_file" cols="50" rows="5"><?php 
        echo $Inc["file"] ? $Inc["file"] : ECHO_FILE_INC;
        ?>
</textarea></td>
          <td>
          前台输出附件列表时输出的格式,( Html代码 ) 可用参数:<br>
          [url] : 隐链接。[path] : 明链接。[nameSub] : 截取后的附件名<br>
          [name] : 完整附件名。[tong] : 下载统计。[time] : 上传时间。[size] : 文件大小<br>
          注:<font class="redMe">只有<strong>[url] 隐链接</strong>才能被统计!</font>
          </td>
        </tr>
        <tr>
          <td><textarea name="echo_wrap" cols="50" rows="3"><?php 
        echo $Inc["wrap"] ? $Inc["wrap"] : '';
        ?>
</textarea></td>
          <td>
          前台输出附件列表包裹代码,( Html代码 ) 可用参数:<br>
          [list] : 附件列表<br>
          这个参数会把附件列表包裹起来,(用于自定义CSS)。
          </td>
        </tr>
        <tr>
          <td>
          	<label><input name="echo_mov" type="radio" value="0" <?php 
        echo empty($Inc["mov"]) ? 'checked' : '';
        ?>
 />钩子输出模式</label>
            <label><input name="echo_mov" type="radio" value="1" <?php 
        echo $Inc["mov"] == 1 ? 'checked' : '';
        ?>
 />日志输出模式</label>
          </td>
          <td>
          	日志输出模式需要修改前台正在使用的模版文件"module.php"的 blog_att() 功能类<br>
            将其替换成 " <font class="redMe">function blog_att($blogid){ doAction('baby_blog_atts',$blogid); }</font> "<br>
          	如果不想修改模板文件,那么就选择钩子模式吧,<br>
          </td>
        </tr>
        <tr>
          <td>
          	<label><input name="echo_down" type="radio" value="0" <?php 
        echo empty($Inc["down"]) ? 'checked' : '';
        ?>
 />重新打开博客时</label>
            <label><input name="echo_down" type="radio" value="1" <?php 
        echo $Inc["down"] == 1 ? 'checked' : '';
        ?>
 />24小时</label>
            <label><input name="echo_down" type="radio" value="2" <?php 
        echo $Inc["down"] == 2 ? 'checked' : '';
        ?>
 />每IP</label>
          </td>
        	<td>客户下载某个附件后设置时间段内重复下载同一附件只统计一次,(IP过滤)<br>IP缓存数据 "downloadMeData_Gip.php"</td>
        </tr>
        <tr>
          <td>
					<label><input name="echo_img" type="radio" value="0" <?php 
        echo empty($Inc["img"]) ? 'checked' : '';
        ?>
 />直接输出图片</label>
					<label><input name="echo_img" type="radio" value="1" <?php 
        echo $Inc["img"] == 1 ? 'checked' : '';
        ?>
 />仍然以附件形式输出</label>
					</td>
          <td>图片类型附件的输出方法</td>
				</tr>
        <tr>
          <td>
					<label><input name="echo_key" type="radio" value="0" <?php 
        echo empty($Inc["key"]) ? 'checked' : '';
        ?>
 />关闭下载验证</label>
					<label><input name="echo_key" type="radio" value="1" <?php 
        echo $Inc["key"] == 1 ? 'checked' : '';
        ?>
 />打开下载验证</label>
					</td>
          <td>前台下载附件是否需要输入验证码</td>
				</tr>
        <tr>
          <td>
					<label><input name="echo_rob" type="radio" value="0" <?php 
        echo empty($Inc["rob"]) ? 'checked' : '';
        ?>
 />关闭防盗链</label>
					<label><input name="echo_rob" type="radio" value="1" <?php 
        echo $Inc["rob"] == 1 ? 'checked' : '';
        ?>
 />打开防盗链</label>
					</td>
          <td>前台附件防盗链设置开关</td>
				</tr>
      </tbody>
    </table>
  <?php 
    } else {
        ?>
    <div class="normal">
      <table width="100%" border="0" cellpadding="0" cellspacing="0">
      	<thead>
          <tr>
            <th width="20"></th>
            <th>附件名</th>
            <th width="90">大小</th>
            <th width="70">统计</th>
            <th width="120">时间</th>
            <th width="18"></th>
            <th class="operate"></th>
          </tr>
      	</thead>
        <tbody>
        <?php 
        $ListNum = 0;
        for ($i = ($Page - 1) * $Page_Num; $i < $Page * $Page_Num; $i++) {
            if (!isset($ListEcho[$i])) {
                continue;
            }
            $Echo = $ListEcho[$i];
            $ListNum++;
            $Set = $Echo['download'] ? unserialize($Echo['download']) : array("statis" => 0, "hide" => false, "web" => false);
            $Onsel = $Set['web'] === true ? 'weburl' : (DownloadMe_File($Echo['filepath']) === false ? "onsels" : "onsel");
            $OnseR = array('weburl' => '外链附件', 'onsels' => '错误附件', 'onsel' => '正常附件');
            $Show = $Set['hide'] === true ? "hide" : "show";
            $BlogId = $Echo['blogid'];
            $BlogAr = $DownList['Log'][$BlogId];
            $BolgUrl = Url::log($BlogId);
            $BlogMe = '
					<a href="' . ($BlogAr[1] == 'n' ? $BolgUrl : 'write_log.php?action=edit&gid=' . $BlogId) . '" target="_blank" class="BlogUrl">' . ($BlogAr[0] ? $BlogAr[0] : '无标题') . ($BlogAr[1] == 'y' ? '( 草稿-未发布 )' : '') . '</a>';
            $CacheAid = unserialize($_SESSION['DownloadCacheAid']);
            if (is_array($CacheAid) === true) {
                $_SESt = $CacheAid['aid'] != $Echo['blogid'] && $CacheAid['t'] === false ? true : false;
            } else {
                $_SESt = true;
            }
            if ($_SESt === true) {
                echo '<tr class="BlogTitle trFile_' . $BlogId . '"><td></td><td colspan="6">Title: ' . $BlogMe . 'ID: <font class="redMe">' . $BlogId . '</font> <a title="增加外链附件" href="javascript:AddUrl(' . $BlogId . ');" class="addurl"></a></td></tr>';
                $_SESt = false;
            }
            $_SESSION['DownloadCacheAid'] = serialize(array('aid' => $Echo['blogid'], 't' => $_SESt));
            ?>
          <tr class="trFile_Edit trFile_<?php 
            echo $Echo['aid'];
            ?>
_<?php 
            echo $BlogId;
            ?>
">
            <td><input name="check[]" class="check" type="checkbox" value="<?php 
            echo $Echo['md5'];
            ?>
" /></td>
            <td class="name"><input name="filename" class="edit" type="text" value="<?php 
            echo $Echo['filename'];
            ?>
" size="55" /></td>
            <td>
						<?php 
            if ($Set['web'] === true && $Echo['filesize'] <= 0) {
                echo '<span class="hSize size_' . $Echo['md5'] . '" title="获取文件大小" onclick="AddUrl(\'' . $Echo['md5'] . '\',false)">' . changeFileSize($Echo['filesize']) . '</span>';
            } elseif ($Set['web'] === true && $Echo['filesize'] > 0) {
                echo '<span class="hSize upSize size_' . $Echo['md5'] . '" title="更新文件大小" onclick="AddUrl(\'' . $Echo['md5'] . '\',false)">' . changeFileSize($Echo['filesize']) . '</span>';
            } else {
                echo changeFileSize($Echo['filesize']);
            }
            ?>
						</td>
            <td><input name="statis" class="edit" type="text" value="<?php 
            echo $Set['statis'];
            ?>
" size="3" /></td>
            <td><?php 
            echo date('Y-m-d H:i', $Echo['addtime']);
            ?>
</td>
            <td><span class="imganMe <?php 
            echo $Onsel;
            ?>
" title="<?php 
            echo $OnseR[$Onsel];
            ?>
"></span></td>
            <td class="operate">
            	<a href="javascript:FileMove('<?php 
            echo $Echo['md5'];
            ?>
');" class="imganMe global" title="移动"></a>
              <a href="<?php 
            echo $Echo['filepath'];
            ?>
" target="_blank" class="imganMe vlog" title="下载"></a>
              <a href="javascript:FileActMe('Switch','<?php 
            echo $Echo['md5'];
            ?>
');" class="imganMe <?php 
            echo $Show;
            ?>
" title="暂停/开启"></a>
              <a href="javascript:FileActMe('Dell','<?php 
            echo $Echo['md5'];
            ?>
');" class="imganMe dell" title="删除"></a>
            </td>
          </tr>
        <?php 
        }
        if ($ListNum <= 0) {
            ?>
          <tr>
            <td width="20"></td>
            <td colspan="6" style="color:red;"> G_G"… 没有找到!。。。</td>
          </tr>
        <?php 
        }
        ?>
        </tbody>
      </table>
    </div>
  <?php 
    }
    ?>
  </div>
  <input name="reset" type="reset" style="display:none;" />
  </form>
  <div class="PageMe">
    <?php 
    if ($ActMe != "gov") {
        ?>
  	<div class="an">
    	<a href="javascript:checkMe(true);">全选</a>
    	<a href="javascript:checkMe(false);">反选</a>
    	<a class="EditMe" href="javascript:FileActMe('Edit');">修改</a>
      <a class="ResetMe" href="javascript:FileActMe('Reset');">重置</a>
    	<a href="javascript:FileActMe('Switch');">暂停/开启下载</a>
    	<a href="javascript:FileActMe('Dell');">删除选中</a>
    </div>
  	<?php 
        echo $PageMe;
        ?>
    <?php 
    } else {
        ?>
  	<div class="an">
    	<a href="javascript:FileActMe('Gov');">修改</a>
      <a class="ResetMe" href="javascript:FileActMe('Reset');">重置</a>
    </div>
    <?php 
    }
    ?>
  </div>
</div>
<?php 
}
Beispiel #24
0
function blog_cover($blogid, &$cover_img, $w, $h)
{
    $db = MySql::getInstance();
    $sql = "SELECT b.filepath,a.title,a.gid  FROM " . DB_PREFIX . "blog as a, " . DB_PREFIX . "attachment as b where  a.gid={$blogid} and b.blogid=a.gid ORDER BY b.addtime asc, thumfor DESC ";
    $ret = $db->query($sql);
    $row = $db->fetch_array($ret);
    if (!empty($row)) {
        $row['filepath'] = $row['filepath'] ? BLOG_URL . substr($row['filepath'], 3) : TEMPLATE_URL . 'image/logo.png';
        $row['title'] = htmlspecialchars($row['title']);
        $row['logurl'] = Url::log(intval($row['gid']));
        $cover_img = $row['filepath'];
        ?>
     <a href="<?php 
        echo $row['logurl'];
        ?>
" target="_blank"><img  width="<?php 
        echo $w;
        ?>
" height="<?php 
        echo $h;
        ?>
" src="<?php 
        echo $row['filepath'];
        ?>
" alt="<?php 
        echo $row['title'];
        ?>
" /></a>
<?php 
    }
}
Beispiel #25
0
/**
 * 文章分割
 *
 * @param string $content 文章内容
 * @param int $lid 文章id
 */
function breakLog($content, $lid)
{
    $ret = explode('[break]', $content, 2);
    if (!empty($ret[1])) {
        $ret[0] .= '<p class="readmore"><a href="' . Url::log($lid) . '">阅读全文&gt;&gt;</a></p>';
        return $ret[0];
    } elseif (Option::get('isexcerpt') == 'y') {
        return subString(trim(strip_tags($content)), 0, Option::get('excerpt_subnum')) . '<p class="readmore"><a href="' . Url::log($lid) . '">阅读全文&gt;&gt;</a></p>';
    } else {
        return $content;
    }
}
Beispiel #26
0
?>
</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>
					<a class="bds_qzone" data-cmd="qzone"></a>
					<a class="bds_tsina" data-cmd="tsina"></a>
					<a class="bds_weixin bdsm" data-cmd="weixin"></a>
					<a class="bds_tqq" data-cmd="tqq"></a>
					<a class="bds_sqq bdsm" data-cmd="sqq"></a>
					<a class="bds_renren" data-cmd="renren"></a>
Beispiel #27
0
function neighbor_log($neighborLog)
{
    extract($neighborLog);
    ?>
	<?php 
    if ($prevLog) {
        ?>
	<li>PRE: <a href="<?php 
        echo Url::log($prevLog['gid']);
        ?>
"><?php 
        echo $prevLog['title'];
        ?>
</a></li>
	<?php 
    }
    ?>
	<?php 
    if ($nextLog && $prevLog) {
        ?>
		
	<?php 
    }
    ?>
	<?php 
    if ($nextLog) {
        ?>
		<li>NEXT: <a href="<?php 
        echo Url::log($nextLog['gid']);
        ?>
"><?php 
        echo $nextLog['title'];
        ?>
</a></li>
	<?php 
    }
}