1
0
Code Issues Pull Requests Projects Releases Wiki Activity GitHub Gitee

插件代码上传

This commit is contained in:
2022-01-26 02:20:35 +08:00
commit 86848dbde0
58 changed files with 2231 additions and 0 deletions

53
plugin/spider/include.php Normal file
View File

@@ -0,0 +1,53 @@
<?php
$table['zxd_ctrlcenter_spider'] = '%pre%zxd_ctrlcenter_spider';
$datainfo['zxd_ctrlcenter_spider'] = array(
'ID'=>array('Spider_ID','integer','',0),
'Name'=>array('Spider_Name','string',20,''),
'IP'=>array('Spider_IP','string',15,''),
'DateTime'=>array('Spider_DateTime','integer','',0),
'Url'=>array('Spider_Url','string',250,''),
'Status'=>array('Spider_Status','integer','',1),
);
function zxd_ctrlcenter_spider_SubMenu($id){
$arySubMenu = array(
0 => array('基本设置', 'config', 'left', false),
1 => array('查看记录', 'spider', 'left', false),
);
foreach($arySubMenu as $k => $v){
echo '<a href="?plugin=spider&act='.$v[1].'"><span class="m-'.$v[2].' '.($id==$v[1]?'m-now':'').'">'.$v[0].'</span></a>';
}
}
class zxd_ctrlcenter_spider extends Base{
function __construct() {
global $zbp;
parent::__construct($zbp->table['zxd_ctrlcenter_spider'], $zbp->datainfo['zxd_ctrlcenter_spider']);
$this->DateTime = time();
}
public function Time($s='Y-m-d H:i:s'){
return date($s,(int)$this->DateTime);
}
}
function zxd_ctrlcenter_spider_CreateTable() {
global $zbp;
if ($zbp->db->ExistTable($GLOBALS['table']['zxd_ctrlcenter_spider']) == false) {
$s = $zbp->db->sql->CreateTable($GLOBALS['table']['zxd_ctrlcenter_spider'], $GLOBALS['datainfo']['zxd_ctrlcenter_spider']);
$zbp->db->QueryMulit($s);
}
}
function zxd_ctrlcenter_spider_DelTable() {
global $zbp;
if ($zbp->db->ExistTable($zbp->table['zxd_ctrlcenter_spider']) == true) {
$s = $zbp->db->sql->DelTable($zbp->table['zxd_ctrlcenter_spider']);
$zbp->db->QueryMulit($s);
}
}

BIN
plugin/spider/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

111
plugin/spider/main.php Normal file
View File

@@ -0,0 +1,111 @@
<?php
$zbp->Load();
$action='root';
$act = '';
if (isset($_GET['act']) && $_GET['act']){$act = $_GET['act'] == "" ? 'config' : $_GET['act'];}
else $act = "config";
?>
<!--<script>alert(1);</script>-->
<link rel="stylesheet" type="text/css" href="plugin/spider/style.css"/>
<div class="SubMenu" style="overflow: initial;">
<?php zxd_ctrlcenter_spider_SubMenu($act);?>
</div>
<!--代码-->
<?php if ($act == 'config' || $act == ''){ ?>
<?php
if(isset($_POST['viewconut'])) {
$zbp->Config('zxd_ctrlcenter') -> plugin_spider_viewconut = $_POST['viewconut'];
$zbp->Config('zxd_ctrlcenter') -> plugin_spider_spiders = $_POST['spiders'];
$zbp->SaveConfig('zxd_ctrlcenter');
$zbp->SetHint('good');
Redirect('./main.php?&plugin=spider&act=config');
}
?>
<p style="color: red;">如果下面两个文本框默认状态下是空白的,没有内容,说明插件升级不完全,将【控制中心】插件关闭后再开启一次即可。关闭插件不会丢失其他子插件配置。</p>
<form method="post">
<table class="tb-set" width="100%">
<tr>
<td align="right"><b>显示篇数:</b></td>
<td><input type="text" class="txt" name="viewconut" value="<?php echo $zbp->Config('zxd_ctrlcenter') -> plugin_spider_viewconut; ?>" /></td>
</tr>
<tr>
<td align="right"><b>蜘蛛列表:</b><br />格式:蜘蛛名称,显示名称。<br />多个用“|”分隔,如Baiduspider,Baidu|Googlebot,Google。</td>
<td><textarea class="txt txt-lar" name="spiders"><?php echo $zbp->Config('zxd_ctrlcenter') -> plugin_spider_spiders; ?></textarea></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="submit" value="保存" /></td>
</tr>
</table>
<!-- CSRF -->
<?php if (function_exists('CheckIsRefererValid')) {echo '<input type="hidden" name="csrfToken" value="' . $zbp->GetCSRFToken() . '">';}?>
</form>
<p>模拟百度抓取查看插件效果:<a href="https://tools.aizhan.com/rb/" target="_blank">点击前往</a><br />输入要检测的网页URL如您的Z-Blog网站首页<?=$GLOBALS['bloghost']; ?>。</p>
<br />
【备注】
<p>1. 本插件可与【流年岁月】的【来访蜘蛛统计】同时开启,但无必要,且数据不互通,建议只开启一个。同时开启相当于每个插件分别记录,互不干扰。</p>
<p>2. 右上角清除设置和关闭插件均不会清空统计结果如需删除或清空统计结果请登录后台数据库删除表【表前缀_zxd_ctrlcenter_spider】。再次使用本【蜘蛛来访统计】子插件需要关闭【控制中心】插件然后再次打开以创建新表。</p>
<p>3. 本插件与爱站网无任何利益关系,提供上方的跳转将连接仅为方便测试插件是否能正常工作。对于该站点,本插件作者不保证服务始终可用,也不承担因此引发的任何问题。</p>
<br />
【默认设置】
<p>如果您不小心修改了上方文本框中的内容,可以将下方参数复制到上方文本框并保存以恢复默认设置。</p>
<p>显示篇数20</p>
<p>蜘蛛列表Baiduspider,Baidu|Googlebot,Google|Sosospider,SoSo|YoudaoBot,YouDao|bingbot,Bing|Sogou web spider,SoGou|Yahoo! Slurp,Yahoo|Alexa,Alexa|360Spider,So</p>
<br />
<?php } if ($act == 'spider') {
echo '<table border="1" class="tableFull tableBorder tableBorder-thcenter">';
echo '<tr>
<th> ID </th>
<th> 蜘蛛名称 </th>
<th> 蜘蛛IP </th>
<th> 抓取时间 </th>
<th> 抓取地址 </th>
<th> 抓取状态 </th>
</tr>';
$p = new Pagebar('{%host%}zb_users/plugin/zxd_ctrlcenter/main.php?plugin=spider&act=spider{&page=%page%}',false);
$p->PageCount = $zbp->Config('zxd_ctrlcenter') -> plugin_spider_viewconut;
$p->PageNow = (int)GetVars('page','GET')==0?1:(int)GetVars('page','GET');
$p->PageBarCount = $zbp->pagebarcount;
$select = array('*');
$where = array();
$order = array('Spider_ID'=>'DESC');
$limit = array(($p->PageNow-1) * $p->PageCount,$p->PageCount);
$option = array('pagebar'=>$p);
error_reporting(0); // 屏蔽掉可能出现的 Undefined index: ZC_MYSQL_ENGINE 提示
$sql = $zbp->db->sql->Select($zbp->table['zxd_ctrlcenter_spider'], $select, $where, $order, $limit, $option);
$array = $zbp->GetListType('zxd_ctrlcenter_spider',$sql);
foreach ($array as $key => $value) {
echo '<tr>';
echo '<td class="td5">' . $value->ID . '</td>';
echo '<td class="td5">' . $value->Name . '</td>';
echo '<td class="td5">' . $value->IP . '</td>';
echo '<td class="td20">' .$value->Time() . '</td>';
echo '<td><a href="'.$value->Url.'" target="_blank">' .$value->Url . '</a></td>';
echo '<td class="td5">' . $value->Status . '</td>';
echo '</tr>';
}
echo '</table>';
echo '<hr/><p class="pagebar">';
foreach ($p->buttons as $key => $value) {
echo '<a href="'. $value .'">' . $key . '</a>&nbsp;&nbsp;' ;
}
echo '</p>';
} ?>

View File

@@ -0,0 +1,3 @@
<?php
$PluginTitle = "蜘蛛来访统计";
$PluginShortTitle = "蜘蛛来访";

View File

@@ -0,0 +1,34 @@
<?php
if(!empty($_GET['include'])&&$_GET['include']=="c_system_base"){
// 单独打开时需要引入这个,不然$zbp未定义
include_once '../../../../../../zb_system/function/c_system_base.php';
}
global $zbp;
if(empty($_GET['action']))
$status_action = "";
else
$status_action = $_GET['action'];
$Close = '<script>window.close(); window.opener.location.reload(); </script>';
switch ($status_action) {
case 'chk':
$pluginstatus = $zbp->Config('zxd_ctrlcenter') -> plugin_spider_Enable;
break;
case 'enb':
$zbp->Config('zxd_ctrlcenter') -> plugin_spider_Enable = true;
$zbp->SaveConfig('zxd_ctrlcenter');
echo $Close;
break;
case 'dis':
$zbp->Config('zxd_ctrlcenter') -> plugin_spider_Enable = false;
$zbp->SaveConfig('zxd_ctrlcenter');
echo $Close;
break;
default:
$pluginstatus = $zbp->Config('zxd_ctrlcenter') -> plugin_spider_Enable;
break;
}
?>

38
plugin/spider/plugin.xml Normal file
View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<plugin version="php">
<id>SpiderStatistics</id>
<name>来访蜘蛛统计张小弟之家修改修复开发模式下部分站点报Notice错误的Bug并添加CSRF保护使用更安全</name>
<url>http://www.fengwensheng.com</url>
<note>来访蜘蛛统计,统计来访蜘蛛</note>
<description>来访蜘蛛统计,统计来访蜘蛛</description>
<path>main.php?act=config</path>
<include>include.php</include>
<level>1</level>
<author>
<name>流年岁月</name>
<email>372664700@qq.com</email>
<url>http://www.fengwensheng.com/</url>
</author>
<source>
<name></name>
<email></email>
<url></url>
</source>
<adapted>140614</adapted>
<version>1.3</version>
<pubdate>2014-08-26</pubdate>
<modified>2015-03-17</modified>
<price>0</price>
<advanced>
<dependency></dependency>
<rewritefunctions></rewritefunctions>
<conflict></conflict>
</advanced>
<sidebars>
<sidebar1></sidebar1>
<sidebar2></sidebar2>
<sidebar3></sidebar3>
<sidebar4></sidebar4>
<sidebar5></sidebar5>
</sidebars>
</plugin>

70
plugin/spider/style.css Normal file
View File

@@ -0,0 +1,70 @@
/**
* @Description: 在线QQ悬浮插件
* @Author: Liuzp
* @Author URL: http://www.liuzp.com
*/
.com-hd{
margin: 20px 0 15px;
}
.com-hd b{
font-size:16px;
color:#333;
font-family:'Microsoft Yahei';
}
.tb-set{
border-collapse: collapse;
}
.tb-set tr td{
padding: 10px 5px;
border: 1px solid #e0e0e0;
}
.tb-set tr td input, .tb-set tr td img{
margin:0 auto;
vertical-align: middle;
}
.tb-set tr td b{
color: #666;
}
.tb-set tr td .sel{
height:17px;
border:1px solid #ccc;
border-radius:5px;
outline: none;
color:#333;
padding:3px 1px;
}
.tb-set tr td .sel select{
border:none;
outline:none;
width:120px;
}
.tb-set tr td .txt{
width:240px;
height:18px;
border:1px solid #ccc;
line-height:23px;
border-radius:5px;
outline: none;
color:#333;
padding:3px 0 2px 5px;
}
.tb-set tr td .txt-lar{
width:450px;
height:100px;
border:1px solid #ccc;
line-height:15px;
}
.tb-set tr td .txt-sho{
width:150px;
}