1.3 修复一些链接问题

This commit is contained in:
Kokororin 2016-10-08 10:20:09 +08:00
parent 6522cf22e7
commit c359f1b22c
3 changed files with 21 additions and 13 deletions

View File

@ -90,14 +90,6 @@ class Access_Extend
"bingbot",
);
public static function getInstance()
{
if (!(self::$_instance instanceof self)) {
self::$_instance = new self();
}
return self::$_instance;
}
public function parseUA($ua)
{
$os = null;

View File

@ -1,10 +1,10 @@
<?php
/**
* Typecho Access Plugin
* 获取访客信息
*
* @package Access
* @author Kokororin
* @version 1.2
* @version 1.3
* @link https://kotori.love
*/
class Access_Plugin implements Typecho_Plugin_Interface
@ -16,6 +16,7 @@ class Access_Plugin implements Typecho_Plugin_Interface
Helper::addPanel(1, self::$panel, 'Access控制台', 'Access插件控制台', 'subscriber');
Helper::addRoute("access_ip", "/access/ip.json", "Access_Action", 'ip');
Typecho_Plugin::factory('Widget_Archive')->header = array('Access_Plugin', 'start');
Typecho_Plugin::factory('admin/footer.php')->end = array('Access_Plugin', 'adminFooter');
return _t($msg);
}
@ -141,4 +142,19 @@ class Access_Plugin implements Typecho_Plugin_Interface
$db->query($db->insert('table.access')->rows($rows));
}
public static function adminFooter()
{
$url = $_SERVER['PHP_SELF'];
$filename = substr($url, strrpos($url, '/') + 1);
if ($filename == 'index.php') {
echo '<script>
$(document).ready(function() {
$("#start-link").append("<li><a href=\"';
Helper::options()->adminUrl('extending.php?panel=' . Access_Plugin::$panel);
echo '\">Access控制台</a></li>");
});
</script>';
}
}
}

View File

@ -3,7 +3,7 @@ include_once 'common.php';
include 'header.php';
include 'menu.php';
require dirname(__FILE__) . '/../Access.php';
$extend = Access_Extend::getInstance();
$extend = new Access_Extend();
?>
<link rel="stylesheet" href="<?php $options->pluginUrl('Access/lib/sweetalert/sweetalert.css')?>">
<div class="main">
@ -77,10 +77,10 @@ $extend = Access_Extend::getInstance();
<?php foreach ($extend->logs['list'] as $log): ?>
<tr id="<?php echo $log['id']; ?>">
<td><input type="checkbox" value="<?php echo $log['id']; ?>" name="id[]"/></td>
<td><a href="<?php echo str_replace("%23", "#", $log['url']); ?>"><?php echo urldecode(str_replace("%23", "#", $log['url'])); ?></a></td>
<td><a target="_blank" href="<?php echo str_replace("%23", "#", $log['url']); ?>"><?php echo urldecode(str_replace("%23", "#", $log['url'])); ?></a></td>
<td><a data-action="ua" href="#" title="<?php echo $log['ua'];?>"><?php echo $extend->parseUA($log['ua']); ?></a></td>
<td><a data-action="ip" data-ip="<?php echo $log['ip']; ?>" href="#"><?php echo $log['ip']; ?></a></td>
<td><a data-action="referer" href="#"><?php echo $log['referer']; ?></a></td>
<td><a target="_blank" data-action="referer" href="<?php echo $log['referer']; ?>"><?php echo $log['referer']; ?></a></td>
<td><?php echo date('Y-m-d H:i:s',$log['date']); ?></td>
</tr>
<?php endforeach; ?>