1.2 增加来源页

This commit is contained in:
Kokororin 2016-08-01 15:00:23 +08:00
parent 8120a03b8b
commit 067ca1485c
6 changed files with 1124 additions and 169 deletions

View File

@ -13,6 +13,7 @@ class Access_Extend
public $title;
public $logs = array();
public $overview = array();
public $referer = array();
public function __construct()
{
@ -23,12 +24,10 @@ class Access_Extend
$this->request = Typecho_Request::getInstance();
$this->pageSize = $this->config->pageSize;
$this->isDrop = $this->config->isDrop;
if ($this->pageSize == null || $this->isDrop == null)
{
if ($this->pageSize == null || $this->isDrop == null) {
throw new Typecho_Plugin_Exception('请先设置插件!');
}
switch ($this->request->get('action'))
{
switch ($this->request->get('action')) {
case 'logs':
default:
$this->action = 'logs';
@ -39,6 +38,7 @@ class Access_Extend
$this->action = 'overview';
$this->title = '访问概览';
$this->parseOverview();
$this->parseReferer();
break;
}
}
@ -92,8 +92,7 @@ class Access_Extend
public static function getInstance()
{
if (!(self::$_instance instanceof self))
{
if (!(self::$_instance instanceof self)) {
self::$_instance = new self();
}
return self::$_instance;
@ -102,131 +101,71 @@ class Access_Extend
public function parseUA($ua)
{
$os = null;
if ($this->isSpider($ua))
{
if ($this->isSpider($ua)) {
$os = '爬虫';
}
elseif (preg_match('/Windows NT 6.0/i', $ua))
{
} elseif (preg_match('/Windows NT 6.0/i', $ua)) {
$os = "Windows Vista";
}
elseif (preg_match('/Windows NT 6.1/i', $ua))
{
} elseif (preg_match('/Windows NT 6.1/i', $ua)) {
$os = "Windows 7";
}
elseif (preg_match('/Windows NT 6.2/i', $ua))
{
} elseif (preg_match('/Windows NT 6.2/i', $ua)) {
$os = "Windows 8";
}
elseif (preg_match('/Windows NT 6.3/i', $ua))
{
} elseif (preg_match('/Windows NT 6.3/i', $ua)) {
$os = "Windows 8.1";
}
elseif (preg_match('/Windows NT 10.0/i', $ua))
{
} elseif (preg_match('/Windows NT 10.0/i', $ua)) {
$os = "Windows 10";
}
elseif (preg_match('/Windows NT 5.1/i', $ua))
{
} elseif (preg_match('/Windows NT 5.1/i', $ua)) {
$os = "Windows XP";
}
elseif (preg_match('/Windows NT 5.2/i', $ua) && preg_match('/Win64/i', $ua))
{
} elseif (preg_match('/Windows NT 5.2/i', $ua) && preg_match('/Win64/i', $ua)) {
$os = "Windows XP 64 bit";
}
elseif (preg_match('/Android ([0-9.]+)/i', $ua, $matches))
{
} elseif (preg_match('/Android ([0-9.]+)/i', $ua, $matches)) {
$os = "Android " . $matches[1];
}
elseif (preg_match('/iPhone OS ([_0-9]+)/i', $ua, $matches))
{
} elseif (preg_match('/iPhone OS ([_0-9]+)/i', $ua, $matches)) {
$os = 'iPhone ' . $matches[1];
}
elseif (preg_match('/Ubuntu/i', $ua, $matches))
{
} elseif (preg_match('/Ubuntu/i', $ua, $matches)) {
$os = 'Ubuntu ';
}
elseif (preg_match('/Mac OS X ([0-9_]+)/i', $ua, $matches))
{
$os = 'Mac OS ' . $matches[1];
}
elseif (preg_match('/Linux/i', $ua, $matches))
{
} elseif (preg_match('/Mac OS X ([0-9_]+)/i', $ua, $matches)) {
$os = 'Mac OS X ' . $matches[1];
} elseif (preg_match('/Linux/i', $ua, $matches)) {
$os = 'Linux';
}
else
{
} else {
$os = '未知';
}
if ($this->isSpider($ua))
{
if ($this->isSpider($ua)) {
$browser = '爬虫';
}
elseif (preg_match('#(Camino|Chimera)[ /]([a-zA-Z0-9.]+)#i', $ua, $matches))
{
} elseif (preg_match('#(Camino|Chimera)[ /]([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = 'Camino ' . $matches[2];
}
elseif (preg_match('#SE 2([a-zA-Z0-9.]+)#i', $ua, $matches))
{
} elseif (preg_match('#SE 2([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = '搜狗浏览器 2' . $matches[1];
}
elseif (preg_match('#360([a-zA-Z0-9.]+)#i', $ua, $matches))
{
} elseif (preg_match('#360([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = '360浏览器 ' . $matches[1];
}
elseif (preg_match('#Maxthon( |\/)([a-zA-Z0-9.]+)#i', $ua, $matches))
{
} elseif (preg_match('#Maxthon( |\/)([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = 'Maxthon ' . $matches[2];
}
elseif (preg_match('#Chrome/([a-zA-Z0-9.]+)#i', $ua, $matches))
{
} elseif (preg_match('#Chrome/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = 'Chrome ' . $matches[1];
}
elseif (preg_match('#XiaoMi/MiuiBrowser/([0-9.]+)#i', $ua, $matches))
{
} elseif (preg_match('#XiaoMi/MiuiBrowser/([0-9.]+)#i', $ua, $matches)) {
$browser = '小米浏览器 ' . $matches[1];
}
elseif (preg_match('#Safari/([a-zA-Z0-9.]+)#i', $ua, $matches))
{
} elseif (preg_match('#Safari/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = 'Safari ' . $matches[1];
}
elseif (preg_match('#opera mini#i', $ua))
{
} elseif (preg_match('#opera mini#i', $ua)) {
preg_match('#Opera/([a-zA-Z0-9.]+)#i', $ua, $matches);
$browser = 'Opera Mini ' . $matches[1];
}
elseif (preg_match('#Opera.([a-zA-Z0-9.]+)#i', $ua, $matches))
{
} elseif (preg_match('#Opera.([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = 'Opera ' . $matches[1];
}
elseif (preg_match('#TencentTraveler ([a-zA-Z0-9.]+)#i', $ua, $matches))
{
} elseif (preg_match('#TencentTraveler ([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = '腾讯TT浏览器 ' . $matches[1];
}
elseif (preg_match('#UCWEB([a-zA-Z0-9.]+)#i', $ua, $matches))
{
} elseif (preg_match('#UCWEB([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = 'UCWEB ' . $matches[1];
}
elseif (preg_match('#MSIE ([a-zA-Z0-9.]+)#i', $ua, $matches))
{
} elseif (preg_match('#MSIE ([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = 'Internet Explorer ' . $matches[1];
}
elseif (preg_match('#Trident#', $ua, $matches))
{
} elseif (preg_match('#Trident#', $ua, $matches)) {
$browser = 'Internet Explorer 11';
}
elseif (preg_match('#Edge/12.0#i', $ua, $matches))
{
} elseif (preg_match('#Edge/12.0#i', $ua, $matches)) {
//win10中spartan浏览器
$browser = 'Spartan';
}
elseif (preg_match('#(Firefox|Phoenix|Firebird|BonEcho|GranParadiso|Minefield|Iceweasel)/([a-zA-Z0-9.]+)#i', $ua, $matches))
{
} elseif (preg_match('#(Firefox|Phoenix|Firebird|BonEcho|GranParadiso|Minefield|Iceweasel)/([a-zA-Z0-9.]+)#i', $ua, $matches)) {
$browser = 'Firefox ' . $matches[2];
}
else
{
} else {
$browser = '未知';
}
return $os . " / " . $browser;
@ -235,19 +174,14 @@ class Access_Extend
public function isSpider($ua)
{
$ua = strtolower($ua);
if (!empty($ua))
{
foreach ($this->spiderArray as $val)
{
if (!empty($ua)) {
foreach ($this->spiderArray as $val) {
$str = strtolower($val);
if (strpos($ua, $str) !== false)
{
if (strpos($ua, $str) !== false) {
return true;
}
}
}
else
{
} else {
return false;
}
}
@ -255,13 +189,11 @@ class Access_Extend
protected function getWhere($type)
{
$where_str = '';
foreach ($this->spiderArray as $value)
{
foreach ($this->spiderArray as $value) {
$where_str .= "ua {1} LIKE " . "'%{$value}%' {2} ";
}
$where_str = rtrim($where_str, '{2} ');
switch ($type)
{
switch ($type) {
case 1:
$where = str_replace('{1}', 'NOT', $where_str);
$where = str_replace('{2}', 'and', $where);
@ -294,6 +226,12 @@ class Access_Extend
$this->logs['page'] = $pager->show();
}
protected function parseReferer()
{
$this->referer['url'] = $this->db->fetchAll("SELECT DISTINCT referer, COUNT(*) as count FROM {$this->table} GROUP BY referer ORDER BY count DESC LIMIT {$this->pageSize}");
$this->referer['domain'] = $this->db->fetchAll("SELECT DISTINCT referer_domain, COUNT(*) as count FROM {$this->table} GROUP BY referer_domain ORDER BY count DESC LIMIT {$this->pageSize}");
}
protected function parseOverview()
{
@ -306,8 +244,7 @@ class Access_Extend
$this->overview['uv']['yesterday']['total'] = 0;
$this->overview['pv']['yesterday']['total'] = 0;
for ($i = 0; $i < 24; $i++)
{
for ($i = 0; $i < 24; $i++) {
$today = date("Y-m-d");
$start = strtotime(date("{$today} {$i}:00:00"));
$end = strtotime(date("{$today} {$i}:59:59"));
@ -319,8 +256,7 @@ class Access_Extend
$this->overview['pv']['today']['total'] += $this->overview['pv']['today']['hours'][$i];
}
for ($i = 0; $i < 24; $i++)
{
for ($i = 0; $i < 24; $i++) {
$yesterday = date("Y-m-d", time() - 24 * 60 * 60);
$start = strtotime(date("{$yesterday} {$i}:00:00"));
$end = strtotime(date("{$yesterday} {$i}:59:59"));
@ -348,12 +284,9 @@ class Access_Extend
{
$obj = json_encode($array);
$obj = str_replace("\"", "'", $obj);
if ($quote)
{
if ($quote) {
return $obj;
}
else
{
} else {
return str_replace("'", '', $obj);
}
}

View File

@ -19,19 +19,11 @@ class Access_Action implements Widget_Interface_Do
{
}
public function ipip()
public function ip()
{
$ip = $this->request->get('ip');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.ipip.net/ip.html');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query(array('ip' => $ip)));
curl_setopt($ch, CURLOPT_REFERER, 'http://www.ipip.net/ip.html');
$result = curl_exec($ch);
curl_close($ch);
echo $result;
$response = file_get_contents('http://ip.taobao.com/service/getIpInfo.php?ip=' . $ip);
exit($response);
}
}

View File

@ -4,7 +4,7 @@
*
* @package Access
* @author Kokororin
* @version 1.1
* @version 1.2
* @link https://kotori.love
*/
class Access_Plugin implements Typecho_Plugin_Interface
@ -14,7 +14,7 @@ class Access_Plugin implements Typecho_Plugin_Interface
{
$msg = Access_Plugin::install();
Helper::addPanel(1, self::$panel, 'Access控制台', 'Access插件控制台', 'subscriber');
Helper::addRoute("access_ipip", "/access/i/ipip", "Access_Action", 'ipip');
Helper::addRoute("access_ip", "/access/ip.json", "Access_Action", 'ip');
Typecho_Plugin::factory('Widget_Archive')->header = array('Access_Plugin', 'start');
return _t($msg);
}
@ -23,14 +23,13 @@ class Access_Plugin implements Typecho_Plugin_Interface
{
$config = Typecho_Widget::widget('Widget_Options')->plugin('Access');
$isDrop = $config->isDrop;
if ($isDrop == 0)
{
if ($isDrop == 0) {
$db = Typecho_Db::get();
$prefix = $db->getPrefix();
$db->query("DROP TABLE `" . $prefix . "access`", Typecho_Db::WRITE);
}
Helper::removePanel(1, self::$panel);
Helper::removeRoute("access_ipip");
Helper::removeRoute("access_ip");
}
public static function config(Typecho_Widget_Helper_Form $form)
@ -53,8 +52,8 @@ class Access_Plugin implements Typecho_Plugin_Interface
public static function install()
{
if (substr(trim(dirname(__FILE__), '/'), -6) != 'Access')
{
$configLink = '<a href="' . Helper::options()->adminUrl . 'options-plugin.php?config=Access' . '">请设置</a>';
if (substr(trim(dirname(__FILE__), '/'), -6) != 'Access') {
throw new Typecho_Plugin_Exception('插件目录名必须为Access');
}
$installDb = Typecho_Db::get();
@ -66,6 +65,8 @@ class Access_Plugin implements Typecho_Plugin_Interface
`ua` varchar(255) default NULL,
`url` varchar(64) default NULL,
`ip` varchar(16) default NULL,
`referer` varchar(255) default NULL,
`referer_domain` varchar(100) default NULL,
`date` int(10) unsigned default '0',
PRIMARY KEY (`id`)
) ENGINE=MYISAM DEFAULT CHARSET=%charset%;";
@ -73,27 +74,20 @@ class Access_Plugin implements Typecho_Plugin_Interface
$scripts = str_replace('%charset%', 'utf8', $scripts);
$scripts = explode(';', $scripts);
try {
foreach ($scripts as $script)
{
foreach ($scripts as $script) {
$script = trim($script);
if ($script)
{
if ($script) {
$installDb->query($script, Typecho_Db::WRITE);
}
}
return '成功创建数据表,插件启用成功';
}
catch (Typecho_Db_Exception $e)
{
return '成功创建数据表,插件启用成功,' . $configLink;
} catch (Typecho_Db_Exception $e) {
$code = $e->getCode();
if (('Mysql' == $type && $code == (1050 || '42S01')))
{
if (('Mysql' == $type && $code == (1050 || '42S01'))) {
$script = 'SELECT * from `' . $prefix . 'access`';
$installDb->query($script, Typecho_Db::READ);
return '数据表已存在,插件启用成功';
}
else
{
return '数据表已存在,插件启用成功,' . $configLink;
} else {
throw new Typecho_Plugin_Exception('数据表建立失败,插件启用失败。错误号:' . $code);
}
}
@ -102,16 +96,14 @@ class Access_Plugin implements Typecho_Plugin_Interface
public static function hasLogin()
{
$cookieUid = Typecho_Cookie::get('__typecho_uid');
if (null !== $cookieUid)
{
if (null !== $cookieUid) {
$db = Typecho_Db::get();
$user = $db->fetchRow($db->select()->from('table.users')
->where('uid = ?', intval($cookieUid))
->limit(1));
$cookieAuthCode = Typecho_Cookie::get('__typecho_authCode');
if ($user && Typecho_Common::hashValidate($user['authCode'], $cookieAuthCode))
{
if ($user && Typecho_Common::hashValidate($user['authCode'], $cookieAuthCode)) {
return true;
}
Typecho_Cookie::delete('__typecho_uid');
@ -122,8 +114,7 @@ class Access_Plugin implements Typecho_Plugin_Interface
public static function start()
{
if (self::hasLogin())
{
if (self::hasLogin()) {
return;
}
$config = Typecho_Widget::widget('Widget_Options')->plugin('Access');
@ -131,8 +122,7 @@ class Access_Plugin implements Typecho_Plugin_Interface
$request = Typecho_Request::getInstance();
$ip = $request->getIp();
$url = $_SERVER['REQUEST_URI'];
if ($ip == null)
{
if ($ip == null) {
$ip = 'UnKnow';
}
$options = Typecho_Widget::widget('Widget_Options');
@ -144,6 +134,8 @@ class Access_Plugin implements Typecho_Plugin_Interface
'ua' => $request->getAgent(),
'url' => $url,
'ip' => $ip,
'referer' => $request->getReferer(),
'referer_domain' => parse_url($request->getReferer(), PHP_URL_HOST),
'date' => $gtime,
);
$db->query($db->insert('table.access')->rows($rows));

932
lib/sweetalert/sweetalert.css Executable file
View File

@ -0,0 +1,932 @@
body.stop-scrolling {
height: 100%;
overflow: hidden; }
.sweet-overlay {
background-color: black;
/* IE8 */
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";
/* IE8 */
background-color: rgba(0, 0, 0, 0.4);
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
display: none;
z-index: 10000; }
.sweet-alert {
background-color: white;
font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
width: 478px;
padding: 17px;
border-radius: 5px;
text-align: center;
position: fixed;
left: 50%;
top: 50%;
margin-left: -256px;
margin-top: -200px;
overflow: hidden;
display: none;
z-index: 99999; }
@media all and (max-width: 540px) {
.sweet-alert {
width: auto;
margin-left: 0;
margin-right: 0;
left: 15px;
right: 15px; } }
.sweet-alert h2 {
color: #575757;
font-size: 30px;
text-align: center;
font-weight: 600;
text-transform: none;
position: relative;
margin: 25px 0;
padding: 0;
line-height: 40px;
display: block; }
.sweet-alert p {
color: #797979;
font-size: 16px;
text-align: center;
font-weight: 300;
position: relative;
text-align: inherit;
float: none;
margin: 0;
padding: 0;
line-height: normal; }
.sweet-alert fieldset {
border: none;
position: relative; }
.sweet-alert .sa-error-container {
background-color: #f1f1f1;
margin-left: -17px;
margin-right: -17px;
overflow: hidden;
padding: 0 10px;
max-height: 0;
webkit-transition: padding 0.15s, max-height 0.15s;
transition: padding 0.15s, max-height 0.15s; }
.sweet-alert .sa-error-container.show {
padding: 10px 0;
max-height: 100px;
webkit-transition: padding 0.2s, max-height 0.2s;
transition: padding 0.25s, max-height 0.25s; }
.sweet-alert .sa-error-container .icon {
display: inline-block;
width: 24px;
height: 24px;
border-radius: 50%;
background-color: #ea7d7d;
color: white;
line-height: 24px;
text-align: center;
margin-right: 3px; }
.sweet-alert .sa-error-container p {
display: inline-block; }
.sweet-alert .sa-input-error {
position: absolute;
top: 29px;
right: 26px;
width: 20px;
height: 20px;
opacity: 0;
-webkit-transform: scale(0.5);
transform: scale(0.5);
-webkit-transform-origin: 50% 50%;
transform-origin: 50% 50%;
-webkit-transition: all 0.1s;
transition: all 0.1s; }
.sweet-alert .sa-input-error::before, .sweet-alert .sa-input-error::after {
content: "";
width: 20px;
height: 6px;
background-color: #f06e57;
border-radius: 3px;
position: absolute;
top: 50%;
margin-top: -4px;
left: 50%;
margin-left: -9px; }
.sweet-alert .sa-input-error::before {
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg); }
.sweet-alert .sa-input-error::after {
-webkit-transform: rotate(45deg);
transform: rotate(45deg); }
.sweet-alert .sa-input-error.show {
opacity: 1;
-webkit-transform: scale(1);
transform: scale(1); }
.sweet-alert input {
width: 100%;
box-sizing: border-box;
border-radius: 3px;
border: 1px solid #d7d7d7;
height: 43px;
margin-top: 10px;
margin-bottom: 17px;
font-size: 18px;
box-shadow: inset 0px 1px 1px rgba(0, 0, 0, 0.06);
padding: 0 12px;
display: none;
-webkit-transition: all 0.3s;
transition: all 0.3s; }
.sweet-alert input:focus {
outline: none;
box-shadow: 0px 0px 3px #c4e6f5;
border: 1px solid #b4dbed; }
.sweet-alert input:focus::-moz-placeholder {
transition: opacity 0.3s 0.03s ease;
opacity: 0.5; }
.sweet-alert input:focus:-ms-input-placeholder {
transition: opacity 0.3s 0.03s ease;
opacity: 0.5; }
.sweet-alert input:focus::-webkit-input-placeholder {
transition: opacity 0.3s 0.03s ease;
opacity: 0.5; }
.sweet-alert input::-moz-placeholder {
color: #bdbdbd; }
.sweet-alert input:-ms-input-placeholder {
color: #bdbdbd; }
.sweet-alert input::-webkit-input-placeholder {
color: #bdbdbd; }
.sweet-alert.show-input input {
display: block; }
.sweet-alert .sa-confirm-button-container {
display: inline-block;
position: relative; }
.sweet-alert .la-ball-fall {
position: absolute;
left: 50%;
top: 50%;
margin-left: -27px;
margin-top: 4px;
opacity: 0;
visibility: hidden; }
.sweet-alert button {
background-color: #8CD4F5;
color: white;
border: none;
box-shadow: none;
font-size: 17px;
font-weight: 500;
-webkit-border-radius: 4px;
border-radius: 5px;
padding: 10px 32px;
margin: 26px 5px 0 5px;
cursor: pointer; }
.sweet-alert button:focus {
outline: none;
box-shadow: 0 0 2px rgba(128, 179, 235, 0.5), inset 0 0 0 1px rgba(0, 0, 0, 0.05); }
.sweet-alert button:hover {
background-color: #7ecff4; }
.sweet-alert button:active {
background-color: #5dc2f1; }
.sweet-alert button.cancel {
background-color: #C1C1C1; }
.sweet-alert button.cancel:hover {
background-color: #b9b9b9; }
.sweet-alert button.cancel:active {
background-color: #a8a8a8; }
.sweet-alert button.cancel:focus {
box-shadow: rgba(197, 205, 211, 0.8) 0px 0px 2px, rgba(0, 0, 0, 0.0470588) 0px 0px 0px 1px inset !important; }
.sweet-alert button[disabled] {
opacity: .6;
cursor: default; }
.sweet-alert button.confirm[disabled] {
color: transparent; }
.sweet-alert button.confirm[disabled] ~ .la-ball-fall {
opacity: 1;
visibility: visible;
transition-delay: 0s; }
.sweet-alert button::-moz-focus-inner {
border: 0; }
.sweet-alert[data-has-cancel-button=false] button {
box-shadow: none !important; }
.sweet-alert[data-has-confirm-button=false][data-has-cancel-button=false] {
padding-bottom: 40px; }
.sweet-alert .sa-icon {
width: 80px;
height: 80px;
border: 4px solid gray;
-webkit-border-radius: 40px;
border-radius: 40px;
border-radius: 50%;
margin: 20px auto;
padding: 0;
position: relative;
box-sizing: content-box; }
.sweet-alert .sa-icon.sa-error {
border-color: #F27474; }
.sweet-alert .sa-icon.sa-error .sa-x-mark {
position: relative;
display: block; }
.sweet-alert .sa-icon.sa-error .sa-line {
position: absolute;
height: 5px;
width: 47px;
background-color: #F27474;
display: block;
top: 37px;
border-radius: 2px; }
.sweet-alert .sa-icon.sa-error .sa-line.sa-left {
-webkit-transform: rotate(45deg);
transform: rotate(45deg);
left: 17px; }
.sweet-alert .sa-icon.sa-error .sa-line.sa-right {
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
right: 16px; }
.sweet-alert .sa-icon.sa-warning {
border-color: #F8BB86; }
.sweet-alert .sa-icon.sa-warning .sa-body {
position: absolute;
width: 5px;
height: 47px;
left: 50%;
top: 10px;
-webkit-border-radius: 2px;
border-radius: 2px;
margin-left: -2px;
background-color: #F8BB86; }
.sweet-alert .sa-icon.sa-warning .sa-dot {
position: absolute;
width: 7px;
height: 7px;
-webkit-border-radius: 50%;
border-radius: 50%;
margin-left: -3px;
left: 50%;
bottom: 10px;
background-color: #F8BB86; }
.sweet-alert .sa-icon.sa-info {
border-color: #C9DAE1; }
.sweet-alert .sa-icon.sa-info::before {
content: "";
position: absolute;
width: 5px;
height: 29px;
left: 50%;
bottom: 17px;
border-radius: 2px;
margin-left: -2px;
background-color: #C9DAE1; }
.sweet-alert .sa-icon.sa-info::after {
content: "";
position: absolute;
width: 7px;
height: 7px;
border-radius: 50%;
margin-left: -3px;
top: 19px;
background-color: #C9DAE1; }
.sweet-alert .sa-icon.sa-success {
border-color: #A5DC86; }
.sweet-alert .sa-icon.sa-success::before, .sweet-alert .sa-icon.sa-success::after {
content: '';
-webkit-border-radius: 40px;
border-radius: 40px;
border-radius: 50%;
position: absolute;
width: 60px;
height: 120px;
background: white;
-webkit-transform: rotate(45deg);
transform: rotate(45deg); }
.sweet-alert .sa-icon.sa-success::before {
-webkit-border-radius: 120px 0 0 120px;
border-radius: 120px 0 0 120px;
top: -7px;
left: -33px;
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
-webkit-transform-origin: 60px 60px;
transform-origin: 60px 60px; }
.sweet-alert .sa-icon.sa-success::after {
-webkit-border-radius: 0 120px 120px 0;
border-radius: 0 120px 120px 0;
top: -11px;
left: 30px;
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg);
-webkit-transform-origin: 0px 60px;
transform-origin: 0px 60px; }
.sweet-alert .sa-icon.sa-success .sa-placeholder {
width: 80px;
height: 80px;
border: 4px solid rgba(165, 220, 134, 0.2);
-webkit-border-radius: 40px;
border-radius: 40px;
border-radius: 50%;
box-sizing: content-box;
position: absolute;
left: -4px;
top: -4px;
z-index: 2; }
.sweet-alert .sa-icon.sa-success .sa-fix {
width: 5px;
height: 90px;
background-color: white;
position: absolute;
left: 28px;
top: 8px;
z-index: 1;
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg); }
.sweet-alert .sa-icon.sa-success .sa-line {
height: 5px;
background-color: #A5DC86;
display: block;
border-radius: 2px;
position: absolute;
z-index: 2; }
.sweet-alert .sa-icon.sa-success .sa-line.sa-tip {
width: 25px;
left: 14px;
top: 46px;
-webkit-transform: rotate(45deg);
transform: rotate(45deg); }
.sweet-alert .sa-icon.sa-success .sa-line.sa-long {
width: 47px;
right: 8px;
top: 38px;
-webkit-transform: rotate(-45deg);
transform: rotate(-45deg); }
.sweet-alert .sa-icon.sa-custom {
background-size: contain;
border-radius: 0;
border: none;
background-position: center center;
background-repeat: no-repeat; }
/*
* Animations
*/
@-webkit-keyframes showSweetAlert {
0% {
transform: scale(0.7);
-webkit-transform: scale(0.7); }
45% {
transform: scale(1.05);
-webkit-transform: scale(1.05); }
80% {
transform: scale(0.95);
-webkit-transform: scale(0.95); }
100% {
transform: scale(1);
-webkit-transform: scale(1); } }
@keyframes showSweetAlert {
0% {
transform: scale(0.7);
-webkit-transform: scale(0.7); }
45% {
transform: scale(1.05);
-webkit-transform: scale(1.05); }
80% {
transform: scale(0.95);
-webkit-transform: scale(0.95); }
100% {
transform: scale(1);
-webkit-transform: scale(1); } }
@-webkit-keyframes hideSweetAlert {
0% {
transform: scale(1);
-webkit-transform: scale(1); }
100% {
transform: scale(0.5);
-webkit-transform: scale(0.5); } }
@keyframes hideSweetAlert {
0% {
transform: scale(1);
-webkit-transform: scale(1); }
100% {
transform: scale(0.5);
-webkit-transform: scale(0.5); } }
@-webkit-keyframes slideFromTop {
0% {
top: 0%; }
100% {
top: 50%; } }
@keyframes slideFromTop {
0% {
top: 0%; }
100% {
top: 50%; } }
@-webkit-keyframes slideToTop {
0% {
top: 50%; }
100% {
top: 0%; } }
@keyframes slideToTop {
0% {
top: 50%; }
100% {
top: 0%; } }
@-webkit-keyframes slideFromBottom {
0% {
top: 70%; }
100% {
top: 50%; } }
@keyframes slideFromBottom {
0% {
top: 70%; }
100% {
top: 50%; } }
@-webkit-keyframes slideToBottom {
0% {
top: 50%; }
100% {
top: 70%; } }
@keyframes slideToBottom {
0% {
top: 50%; }
100% {
top: 70%; } }
.showSweetAlert[data-animation=pop] {
-webkit-animation: showSweetAlert 0.3s;
animation: showSweetAlert 0.3s; }
.showSweetAlert[data-animation=none] {
-webkit-animation: none;
animation: none; }
.showSweetAlert[data-animation=slide-from-top] {
-webkit-animation: slideFromTop 0.3s;
animation: slideFromTop 0.3s; }
.showSweetAlert[data-animation=slide-from-bottom] {
-webkit-animation: slideFromBottom 0.3s;
animation: slideFromBottom 0.3s; }
.hideSweetAlert[data-animation=pop] {
-webkit-animation: hideSweetAlert 0.2s;
animation: hideSweetAlert 0.2s; }
.hideSweetAlert[data-animation=none] {
-webkit-animation: none;
animation: none; }
.hideSweetAlert[data-animation=slide-from-top] {
-webkit-animation: slideToTop 0.4s;
animation: slideToTop 0.4s; }
.hideSweetAlert[data-animation=slide-from-bottom] {
-webkit-animation: slideToBottom 0.3s;
animation: slideToBottom 0.3s; }
@-webkit-keyframes animateSuccessTip {
0% {
width: 0;
left: 1px;
top: 19px; }
54% {
width: 0;
left: 1px;
top: 19px; }
70% {
width: 50px;
left: -8px;
top: 37px; }
84% {
width: 17px;
left: 21px;
top: 48px; }
100% {
width: 25px;
left: 14px;
top: 45px; } }
@keyframes animateSuccessTip {
0% {
width: 0;
left: 1px;
top: 19px; }
54% {
width: 0;
left: 1px;
top: 19px; }
70% {
width: 50px;
left: -8px;
top: 37px; }
84% {
width: 17px;
left: 21px;
top: 48px; }
100% {
width: 25px;
left: 14px;
top: 45px; } }
@-webkit-keyframes animateSuccessLong {
0% {
width: 0;
right: 46px;
top: 54px; }
65% {
width: 0;
right: 46px;
top: 54px; }
84% {
width: 55px;
right: 0px;
top: 35px; }
100% {
width: 47px;
right: 8px;
top: 38px; } }
@keyframes animateSuccessLong {
0% {
width: 0;
right: 46px;
top: 54px; }
65% {
width: 0;
right: 46px;
top: 54px; }
84% {
width: 55px;
right: 0px;
top: 35px; }
100% {
width: 47px;
right: 8px;
top: 38px; } }
@-webkit-keyframes rotatePlaceholder {
0% {
transform: rotate(-45deg);
-webkit-transform: rotate(-45deg); }
5% {
transform: rotate(-45deg);
-webkit-transform: rotate(-45deg); }
12% {
transform: rotate(-405deg);
-webkit-transform: rotate(-405deg); }
100% {
transform: rotate(-405deg);
-webkit-transform: rotate(-405deg); } }
@keyframes rotatePlaceholder {
0% {
transform: rotate(-45deg);
-webkit-transform: rotate(-45deg); }
5% {
transform: rotate(-45deg);
-webkit-transform: rotate(-45deg); }
12% {
transform: rotate(-405deg);
-webkit-transform: rotate(-405deg); }
100% {
transform: rotate(-405deg);
-webkit-transform: rotate(-405deg); } }
.animateSuccessTip {
-webkit-animation: animateSuccessTip 0.75s;
animation: animateSuccessTip 0.75s; }
.animateSuccessLong {
-webkit-animation: animateSuccessLong 0.75s;
animation: animateSuccessLong 0.75s; }
.sa-icon.sa-success.animate::after {
-webkit-animation: rotatePlaceholder 4.25s ease-in;
animation: rotatePlaceholder 4.25s ease-in; }
@-webkit-keyframes animateErrorIcon {
0% {
transform: rotateX(100deg);
-webkit-transform: rotateX(100deg);
opacity: 0; }
100% {
transform: rotateX(0deg);
-webkit-transform: rotateX(0deg);
opacity: 1; } }
@keyframes animateErrorIcon {
0% {
transform: rotateX(100deg);
-webkit-transform: rotateX(100deg);
opacity: 0; }
100% {
transform: rotateX(0deg);
-webkit-transform: rotateX(0deg);
opacity: 1; } }
.animateErrorIcon {
-webkit-animation: animateErrorIcon 0.5s;
animation: animateErrorIcon 0.5s; }
@-webkit-keyframes animateXMark {
0% {
transform: scale(0.4);
-webkit-transform: scale(0.4);
margin-top: 26px;
opacity: 0; }
50% {
transform: scale(0.4);
-webkit-transform: scale(0.4);
margin-top: 26px;
opacity: 0; }
80% {
transform: scale(1.15);
-webkit-transform: scale(1.15);
margin-top: -6px; }
100% {
transform: scale(1);
-webkit-transform: scale(1);
margin-top: 0;
opacity: 1; } }
@keyframes animateXMark {
0% {
transform: scale(0.4);
-webkit-transform: scale(0.4);
margin-top: 26px;
opacity: 0; }
50% {
transform: scale(0.4);
-webkit-transform: scale(0.4);
margin-top: 26px;
opacity: 0; }
80% {
transform: scale(1.15);
-webkit-transform: scale(1.15);
margin-top: -6px; }
100% {
transform: scale(1);
-webkit-transform: scale(1);
margin-top: 0;
opacity: 1; } }
.animateXMark {
-webkit-animation: animateXMark 0.5s;
animation: animateXMark 0.5s; }
@-webkit-keyframes pulseWarning {
0% {
border-color: #F8D486; }
100% {
border-color: #F8BB86; } }
@keyframes pulseWarning {
0% {
border-color: #F8D486; }
100% {
border-color: #F8BB86; } }
.pulseWarning {
-webkit-animation: pulseWarning 0.75s infinite alternate;
animation: pulseWarning 0.75s infinite alternate; }
@-webkit-keyframes pulseWarningIns {
0% {
background-color: #F8D486; }
100% {
background-color: #F8BB86; } }
@keyframes pulseWarningIns {
0% {
background-color: #F8D486; }
100% {
background-color: #F8BB86; } }
.pulseWarningIns {
-webkit-animation: pulseWarningIns 0.75s infinite alternate;
animation: pulseWarningIns 0.75s infinite alternate; }
@-webkit-keyframes rotate-loading {
0% {
transform: rotate(0deg); }
100% {
transform: rotate(360deg); } }
@keyframes rotate-loading {
0% {
transform: rotate(0deg); }
100% {
transform: rotate(360deg); } }
/* Internet Explorer 9 has some special quirks that are fixed here */
/* The icons are not animated. */
/* This file is automatically merged into sweet-alert.min.js through Gulp */
/* Error icon */
.sweet-alert .sa-icon.sa-error .sa-line.sa-left {
-ms-transform: rotate(45deg) \9; }
.sweet-alert .sa-icon.sa-error .sa-line.sa-right {
-ms-transform: rotate(-45deg) \9; }
/* Success icon */
.sweet-alert .sa-icon.sa-success {
border-color: transparent\9; }
.sweet-alert .sa-icon.sa-success .sa-line.sa-tip {
-ms-transform: rotate(45deg) \9; }
.sweet-alert .sa-icon.sa-success .sa-line.sa-long {
-ms-transform: rotate(-45deg) \9; }
/*!
* Load Awesome v1.1.0 (http://github.danielcardoso.net/load-awesome/)
* Copyright 2015 Daniel Cardoso <@DanielCardoso>
* Licensed under MIT
*/
.la-ball-fall,
.la-ball-fall > div {
position: relative;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box; }
.la-ball-fall {
display: block;
font-size: 0;
color: #fff; }
.la-ball-fall.la-dark {
color: #333; }
.la-ball-fall > div {
display: inline-block;
float: none;
background-color: currentColor;
border: 0 solid currentColor; }
.la-ball-fall {
width: 54px;
height: 18px; }
.la-ball-fall > div {
width: 10px;
height: 10px;
margin: 4px;
border-radius: 100%;
opacity: 0;
-webkit-animation: ball-fall 1s ease-in-out infinite;
-moz-animation: ball-fall 1s ease-in-out infinite;
-o-animation: ball-fall 1s ease-in-out infinite;
animation: ball-fall 1s ease-in-out infinite; }
.la-ball-fall > div:nth-child(1) {
-webkit-animation-delay: -200ms;
-moz-animation-delay: -200ms;
-o-animation-delay: -200ms;
animation-delay: -200ms; }
.la-ball-fall > div:nth-child(2) {
-webkit-animation-delay: -100ms;
-moz-animation-delay: -100ms;
-o-animation-delay: -100ms;
animation-delay: -100ms; }
.la-ball-fall > div:nth-child(3) {
-webkit-animation-delay: 0ms;
-moz-animation-delay: 0ms;
-o-animation-delay: 0ms;
animation-delay: 0ms; }
.la-ball-fall.la-sm {
width: 26px;
height: 8px; }
.la-ball-fall.la-sm > div {
width: 4px;
height: 4px;
margin: 2px; }
.la-ball-fall.la-2x {
width: 108px;
height: 36px; }
.la-ball-fall.la-2x > div {
width: 20px;
height: 20px;
margin: 8px; }
.la-ball-fall.la-3x {
width: 162px;
height: 54px; }
.la-ball-fall.la-3x > div {
width: 30px;
height: 30px;
margin: 12px; }
/*
* Animation
*/
@-webkit-keyframes ball-fall {
0% {
opacity: 0;
-webkit-transform: translateY(-145%);
transform: translateY(-145%); }
10% {
opacity: .5; }
20% {
opacity: 1;
-webkit-transform: translateY(0);
transform: translateY(0); }
80% {
opacity: 1;
-webkit-transform: translateY(0);
transform: translateY(0); }
90% {
opacity: .5; }
100% {
opacity: 0;
-webkit-transform: translateY(145%);
transform: translateY(145%); } }
@-moz-keyframes ball-fall {
0% {
opacity: 0;
-moz-transform: translateY(-145%);
transform: translateY(-145%); }
10% {
opacity: .5; }
20% {
opacity: 1;
-moz-transform: translateY(0);
transform: translateY(0); }
80% {
opacity: 1;
-moz-transform: translateY(0);
transform: translateY(0); }
90% {
opacity: .5; }
100% {
opacity: 0;
-moz-transform: translateY(145%);
transform: translateY(145%); } }
@-o-keyframes ball-fall {
0% {
opacity: 0;
-o-transform: translateY(-145%);
transform: translateY(-145%); }
10% {
opacity: .5; }
20% {
opacity: 1;
-o-transform: translateY(0);
transform: translateY(0); }
80% {
opacity: 1;
-o-transform: translateY(0);
transform: translateY(0); }
90% {
opacity: .5; }
100% {
opacity: 0;
-o-transform: translateY(145%);
transform: translateY(145%); } }
@keyframes ball-fall {
0% {
opacity: 0;
-webkit-transform: translateY(-145%);
-moz-transform: translateY(-145%);
-o-transform: translateY(-145%);
transform: translateY(-145%); }
10% {
opacity: .5; }
20% {
opacity: 1;
-webkit-transform: translateY(0);
-moz-transform: translateY(0);
-o-transform: translateY(0);
transform: translateY(0); }
80% {
opacity: 1;
-webkit-transform: translateY(0);
-moz-transform: translateY(0);
-o-transform: translateY(0);
transform: translateY(0); }
90% {
opacity: .5; }
100% {
opacity: 0;
-webkit-transform: translateY(145%);
-moz-transform: translateY(145%);
-o-transform: translateY(145%);
transform: translateY(145%); } }

1
lib/sweetalert/sweetalert.min.js vendored Executable file

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@ include 'menu.php';
require dirname(__FILE__) . '/../Access.php';
$extend = Access_Extend::getInstance();
?>
<link rel="stylesheet" href="<?php $options->pluginUrl('Access/lib/sweetalert/sweetalert.css')?>">
<div class="main">
<div class="body container">
<div class="typecho-page-title">
@ -56,10 +56,11 @@ $extend = Access_Extend::getInstance();
<table class="typecho-list-table">
<colgroup>
<col width="5"/>
<col width="30%"/>
<col width="20%"/>
<col width="25%"/>
<col width=""/>
<col width=""/>
<col width="18%"/>
<col width="20%"/>
<col width="15%"/>
</colgroup>
<thead>
<tr>
@ -67,6 +68,7 @@ $extend = Access_Extend::getInstance();
<th><?php _e('受访地址'); ?></th>
<th><?php _e('UA'); ?></th>
<th><?php _e('IP地址'); ?></th>
<th><?php _e('Referer'); ?></th>
<th><?php _e('日期'); ?></th>
</tr>
</thead>
@ -77,7 +79,8 @@ $extend = Access_Extend::getInstance();
<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 data-action="ua" href="#" title="<?php echo $log['ua'];?>"><?php echo $extend->parseUA($log['ua']); ?></a></td>
<td><a data-action="ip" target="_blank" href="<?php echo rtrim(Helper::options()->index, '/').'/access/i/ipip';?>?ip=<?php echo $log['ip'];?>"><?php echo $log['ip']; ?></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><?php echo date('Y-m-d H:i:s',$log['date']); ?></td>
</tr>
<?php endforeach; ?>
@ -120,7 +123,7 @@ $extend = Access_Extend::getInstance();
<div class="col-mb-12 typecho-list">
<h4 class="typecho-list-table-title">总记录表格</h4>
<h4 class="typecho-list-table-title">访问数表格</h4>
<div class="typecho-table-wrap">
<table class="typecho-list-table">
@ -161,6 +164,62 @@ $extend = Access_Extend::getInstance();
</table>
</div>
<h4 class="typecho-list-table-title">来源域名</h4>
<div class="typecho-table-wrap">
<table class="typecho-list-table">
<colgroup>
<col width="10%"/>
<col width="10%"/>
<col width="80%"/>
</colgroup>
<thead>
<tr>
<th>排名</th>
<th>次数</th>
<th>来源域名</th>
</tr>
</thead>
<tbody>
<?php foreach ($extend->referer['domain'] as $key => $value):?>
<tr>
<td><?php echo $key +1 ?></td>
<td><?php echo $value['count']?></td>
<td><?php echo $value['referer_domain']?></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
<h4 class="typecho-list-table-title">来源页</h4>
<div class="typecho-table-wrap">
<table class="typecho-list-table">
<colgroup>
<col width="10%"/>
<col width="10%"/>
<col width="80%"/>
</colgroup>
<thead>
<tr>
<th>排名</th>
<th>次数</th>
<th>来源URL</th>
</tr>
</thead>
<tbody>
<?php foreach ($extend->referer['url'] as $key => $value):?>
<tr>
<td><?php echo $key +1 ?></td>
<td><?php echo $value['count']?></td>
<td><?php echo $value['referer']?></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>
<h4 class="typecho-list-table-title">今日图表</h4>
<div class="typecho-table-wrap" id="chart">
@ -184,12 +243,60 @@ include 'table-js.php';
<script type="text/javascript">
$(document).ready(function() {
$('a[data-action="ua"]').click(function() {
alert($.trim($(this).attr('title')));
swal({
title: "User-Agent",
text: $.trim($(this).attr('title')),
type: "info",
confirmButtonText: "OK"
});
return false;
});
$('a[data-action="ip"]').click(function() {
swal({
title: "IP查询中...",
text: '正在请求Taobao API...',
type: "info",
confirmButtonText: "OK"
});
$.ajax({
url: '<?php echo rtrim(Helper::options()->index, '/').'/access/ip.json';?>',
method: 'get',
dataType: 'json',
data: {ip: $(this).data('ip')},
success: function(data) {
if (data.code == 0){
swal({
title: "IP查询成功",
text: data.data.country + data.data.area + data.data.city + data.data.country + data.data.isp,
type: "info",
confirmButtonText: "OK"
});
} else {
swal({
title: "IP查询失败",
text: '接口返回状态码错误',
type: "info",
confirmButtonText: "OK"
});
}
},
error: function() {
swal({
title: "IP查询失败",
text: '网络异常或PHP环境配置异常',
type: "info",
confirmButtonText: "OK"
});
}
});
});
});
</script>
<script src="<?php $options->pluginUrl('Access/lib/sweetalert/sweetalert.min.js')?>"></script>
<?php if($extend->action == 'overview'):?>
<script src="<?php $options->pluginUrl('Access/lib/highcharts/js/highcharts.js')?>"></script>
<script src="<?php $options->pluginUrl('Access/lib/highcharts/js/modules/exporting.js')?>"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#chart').highcharts({
@ -237,8 +344,6 @@ $(document).ready(function() {
});
</script>
<script src="<?php $options->pluginUrl('Access/lib/highcharts/js/highcharts.js')?>"></script>
<script src="<?php $options->pluginUrl('Access/lib/highcharts/js/modules/exporting.js')?>"></script>
<?php endif;?>
<?php
include 'footer.php';