remove crawler counts from admin/project-lawful
This commit is contained in:
parent
caa0a3a857
commit
96ae786bb0
@ -848,6 +848,14 @@ html, body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.keyvaluelist.bc_data {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
}
|
||||
.keyvaluelist.bc_data div {
|
||||
padding-left: 8px;
|
||||
padding-right: 8px;
|
||||
}
|
||||
.keyvaluelist div {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
@ -860,6 +868,9 @@ html, body {
|
||||
min-width: 500px;
|
||||
align-self: start;
|
||||
}
|
||||
.keyvaluelist .row_hover:hover {
|
||||
background-color: #E0E0FF;
|
||||
}
|
||||
|
||||
.kvl_100 div span:first-child {
|
||||
min-width: 100px;
|
||||
|
3
www/data/css/styles.min.css
vendored
3
www/data/css/styles.min.css
vendored
@ -162,9 +162,12 @@ html,body{margin:0;padding:0;height:100%}
|
||||
.admincontent .boxedcontent{margin-bottom:20px}
|
||||
.egg_ajaxOutput{display:flex;box-sizing:border-box;width:100%;align-self:center;margin-left:auto;margin-right:auto;resize:none;height:300px}
|
||||
.keyvaluelist{display:flex;flex-direction:column}
|
||||
.keyvaluelist.bc_data{padding-left:0;padding-right:0}
|
||||
.keyvaluelist.bc_data div{padding-left:8px;padding-right:8px}
|
||||
.keyvaluelist div{display:flex;flex-direction:row}
|
||||
.keyvaluelist div span{align-self:center}
|
||||
.keyvaluelist div span:first-child{font-weight:bold;min-width:500px;align-self:start}
|
||||
.keyvaluelist .row_hover:hover{background-color:#e0e0ff}
|
||||
.kvl_100 div span:first-child{min-width:100px}
|
||||
.kvl_200 div span:first-child{min-width:200px}
|
||||
.kvl_250 div span:first-child{min-width:250px}
|
||||
|
@ -25,6 +25,17 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
// transferred padding into div
|
||||
&.bc_data {
|
||||
padding-left: 0;
|
||||
padding-right: 0;
|
||||
|
||||
div {
|
||||
padding-left: 8px;
|
||||
padding-right: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
div {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
@ -35,6 +46,10 @@
|
||||
align-self: start;
|
||||
}
|
||||
}
|
||||
|
||||
.row_hover {
|
||||
&:hover { background-color: #E0E0FF }
|
||||
}
|
||||
}
|
||||
|
||||
.kvl_100 div span:first-child { min-width: 100px; }
|
||||
|
22
www/extern/crawler-detect/LICENSE
vendored
Normal file
22
www/extern/crawler-detect/LICENSE
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-2020 Mark Beech
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
76
www/extern/crawler-detect/README.md
vendored
Normal file
76
www/extern/crawler-detect/README.md
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
<p align="center"><a href="https://crawlerdetect.io/" target="_blank"><img src="https://cloud.githubusercontent.com/assets/340752/23082173/1bd1a396-f550-11e6-8aba-4d3c75edea2f.png" width="321" height="219" /></a><br><br>
|
||||
<a href="https://crawlerdetect.io/" target="_blank">crawlerdetect.io</a>
|
||||
<br><br>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/JayBizzle/Crawler-Detect/actions"><img alt="GitHub Workflow Status" src="https://img.shields.io/github/actions/workflow/status/JayBizzle/Crawler-Detect/test.yml?branch=master&style=flat-square"></a>
|
||||
<a href="https://packagist.org/packages/jaybizzle/crawler-detect"><img src="https://img.shields.io/packagist/dm/JayBizzle/Crawler-Detect.svg?style=flat-square" /></a>
|
||||
<a href="https://github.com/JayBizzle/Crawler-Detect"><img src="https://img.shields.io/badge/license-MIT-ff69b4.svg?style=flat-square" /></a>
|
||||
<a href="https://packagist.org/packages/jaybizzle/crawler-detect"><img src="https://img.shields.io/packagist/v/jaybizzle/Crawler-Detect.svg?style=flat-square" /></a>
|
||||
<a href="https://coveralls.io/github/JayBizzle/Crawler-Detect"><img src="https://img.shields.io/coveralls/JayBizzle/Crawler-Detect/master.svg?style=flat-square" /></a>
|
||||
</p>
|
||||
|
||||
## About CrawlerDetect
|
||||
|
||||
CrawlerDetect is a PHP class for detecting bots/crawlers/spiders via the `user agent` and `http_from` header. Currently able to detect 1,000's of bots/spiders/crawlers.
|
||||
|
||||
### Installation
|
||||
```
|
||||
composer require jaybizzle/crawler-detect
|
||||
```
|
||||
|
||||
### Usage
|
||||
```PHP
|
||||
use Jaybizzle\CrawlerDetect\CrawlerDetect;
|
||||
|
||||
$CrawlerDetect = new CrawlerDetect;
|
||||
|
||||
// Check the user agent of the current 'visitor'
|
||||
if($CrawlerDetect->isCrawler()) {
|
||||
// true if crawler user agent detected
|
||||
}
|
||||
|
||||
// Pass a user agent as a string
|
||||
if($CrawlerDetect->isCrawler('Mozilla/5.0 (compatible; Sosospider/2.0; +http://help.soso.com/webspider.htm)')) {
|
||||
// true if crawler user agent detected
|
||||
}
|
||||
|
||||
// Output the name of the bot that matched (if any)
|
||||
echo $CrawlerDetect->getMatches();
|
||||
```
|
||||
|
||||
### Contributing
|
||||
If you find a bot/spider/crawler user agent that CrawlerDetect fails to detect, please submit a pull request with the regex pattern added to the `$data` array in `Fixtures/Crawlers.php` and add the failing user agent to `tests/crawlers.txt`.
|
||||
|
||||
Failing that, just create an issue with the user agent you have found, and we'll take it from there :)
|
||||
|
||||
### Laravel Package
|
||||
If you would like to use this with Laravel, please see [Laravel-Crawler-Detect](https://github.com/JayBizzle/Laravel-Crawler-Detect)
|
||||
|
||||
### Symfony Bundle
|
||||
To use this library with Symfony 2/3/4, check out the [CrawlerDetectBundle](https://github.com/nicolasmure/CrawlerDetectBundle).
|
||||
|
||||
### YII2 Extension
|
||||
To use this library with the YII2 framework, check out [yii2-crawler-detect](https://github.com/AlikDex/yii2-crawler-detect).
|
||||
|
||||
### ES6 Library
|
||||
To use this library with NodeJS or any ES6 application based, check out [es6-crawler-detect](https://github.com/JefferyHus/es6-crawler-detect).
|
||||
|
||||
### Python Library
|
||||
To use this library in a Python project, check out [crawlerdetect](https://github.com/moskrc/CrawlerDetect).
|
||||
|
||||
### JVM Library (written in Java)
|
||||
To use this library in a JVM project (including Java, Scala, Kotlin, etc.), check out [CrawlerDetect](https://github.com/nekosoftllc/crawler-detect).
|
||||
|
||||
### .NET Library
|
||||
To use this library in a .net standard (including .net core) based project, check out [NetCrawlerDetect](https://github.com/gplumb/NetCrawlerDetect).
|
||||
|
||||
### Ruby Gem
|
||||
To use this library with Ruby on Rails or any Ruby-based application, check out [crawler_detect](https://github.com/loadkpi/crawler_detect) gem.
|
||||
|
||||
### Go Module
|
||||
To use this library with Go, check out the [crawlerdetect](https://github.com/x-way/crawlerdetect) module.
|
||||
|
||||
_Parts of this class are based on the brilliant [MobileDetect](https://github.com/serbanghita/Mobile-Detect)_
|
||||
|
||||
[![Analytics](https://ga-beacon.appspot.com/UA-72430465-1/Crawler-Detect/readme?pixel)](https://github.com/JayBizzle/Crawler-Detect)
|
29
www/extern/crawler-detect/composer.json
vendored
Normal file
29
www/extern/crawler-detect/composer.json
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "jaybizzle/crawler-detect",
|
||||
"type": "library",
|
||||
"description": "CrawlerDetect is a PHP class for detecting bots/crawlers/spiders via the user agent",
|
||||
"keywords": ["crawler", "crawler detect", "crawler detector", "crawlerdetect", "php crawler detect"],
|
||||
"homepage": "https://github.com/JayBizzle/Crawler-Detect/",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Mark Beech",
|
||||
"email": "m@rkbee.ch",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.8|^5.5|^6.5|^9.4"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Jaybizzle\\CrawlerDetect\\": "src/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"test": "vendor/bin/phpunit"
|
||||
}
|
||||
}
|
41
www/extern/crawler-detect/export.php
vendored
Normal file
41
www/extern/crawler-detect/export.php
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Crawler Detect - the web crawler detection library.
|
||||
*
|
||||
* (c) Mark Beech <m@rkbee.ch>
|
||||
*
|
||||
* This source file is subject to the MIT license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
|
||||
require 'src/Fixtures/AbstractProvider.php';
|
||||
require 'src/Fixtures/Crawlers.php';
|
||||
require 'src/Fixtures/Exclusions.php';
|
||||
require 'src/Fixtures/Headers.php';
|
||||
|
||||
$src = array(
|
||||
'Crawlers',
|
||||
'Exclusions',
|
||||
'Headers',
|
||||
);
|
||||
|
||||
foreach ($src as $class) {
|
||||
$class = "Jaybizzle\\CrawlerDetect\\Fixtures\\$class";
|
||||
$object = new $class;
|
||||
|
||||
outputJson($object);
|
||||
outputTxt($object);
|
||||
}
|
||||
|
||||
function outputJson($object)
|
||||
{
|
||||
$className = (new ReflectionClass($object))->getShortName();
|
||||
file_put_contents("raw/$className.json", json_encode($object->getAll()));
|
||||
}
|
||||
|
||||
function outputTxt($object)
|
||||
{
|
||||
$className = (new ReflectionClass($object))->getShortName();
|
||||
file_put_contents("raw/$className.txt", implode(PHP_EOL, $object->getAll()));
|
||||
}
|
1
www/extern/crawler-detect/raw/Crawlers.json
vendored
Normal file
1
www/extern/crawler-detect/raw/Crawlers.json
vendored
Normal file
File diff suppressed because one or more lines are too long
1402
www/extern/crawler-detect/raw/Crawlers.txt
vendored
Normal file
1402
www/extern/crawler-detect/raw/Crawlers.txt
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
www/extern/crawler-detect/raw/Exclusions.json
vendored
Normal file
1
www/extern/crawler-detect/raw/Exclusions.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
["Safari.[\\d\\.]*","Firefox.[\\d\\.]*"," Chrome.[\\d\\.]*","Chromium.[\\d\\.]*","MSIE.[\\d\\.]","Opera\\\/[\\d\\.]*","Mozilla.[\\d\\.]*","AppleWebKit.[\\d\\.]*","Trident.[\\d\\.]*","Windows NT.[\\d\\.]*","Android [\\d\\.]*","Macintosh.","Ubuntu","Linux","[ ]Intel","Mac OS X [\\d_]*","(like )?Gecko(.[\\d\\.]*)?","KHTML,","CriOS.[\\d\\.]*","CPU iPhone OS ([0-9_])* like Mac OS X","CPU OS ([0-9_])* like Mac OS X","iPod","compatible","x86_..","i686","x64","X11","rv:[\\d\\.]*","Version.[\\d\\.]*","WOW64","Win64","Dalvik.[\\d\\.]*"," \\.NET CLR [\\d\\.]*","Presto.[\\d\\.]*","Media Center PC","BlackBerry","Build","Opera Mini\\\/\\d{1,2}\\.\\d{1,2}\\.[\\d\\.]*\\\/\\d{1,2}\\.","Opera"," \\.NET[\\d\\.]*","cubot","; M bot","; CRONO","; B bot","; IDbot","; ID bot","; POWER BOT","OCTOPUS-CORE","htc_botdugls","super\\\/\\d+\\\/Android\\\/\\d+"]
|
50
www/extern/crawler-detect/raw/Exclusions.txt
vendored
Normal file
50
www/extern/crawler-detect/raw/Exclusions.txt
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
Safari.[\d\.]*
|
||||
Firefox.[\d\.]*
|
||||
Chrome.[\d\.]*
|
||||
Chromium.[\d\.]*
|
||||
MSIE.[\d\.]
|
||||
Opera\/[\d\.]*
|
||||
Mozilla.[\d\.]*
|
||||
AppleWebKit.[\d\.]*
|
||||
Trident.[\d\.]*
|
||||
Windows NT.[\d\.]*
|
||||
Android [\d\.]*
|
||||
Macintosh.
|
||||
Ubuntu
|
||||
Linux
|
||||
[ ]Intel
|
||||
Mac OS X [\d_]*
|
||||
(like )?Gecko(.[\d\.]*)?
|
||||
KHTML,
|
||||
CriOS.[\d\.]*
|
||||
CPU iPhone OS ([0-9_])* like Mac OS X
|
||||
CPU OS ([0-9_])* like Mac OS X
|
||||
iPod
|
||||
compatible
|
||||
x86_..
|
||||
i686
|
||||
x64
|
||||
X11
|
||||
rv:[\d\.]*
|
||||
Version.[\d\.]*
|
||||
WOW64
|
||||
Win64
|
||||
Dalvik.[\d\.]*
|
||||
\.NET CLR [\d\.]*
|
||||
Presto.[\d\.]*
|
||||
Media Center PC
|
||||
BlackBerry
|
||||
Build
|
||||
Opera Mini\/\d{1,2}\.\d{1,2}\.[\d\.]*\/\d{1,2}\.
|
||||
Opera
|
||||
\.NET[\d\.]*
|
||||
cubot
|
||||
; M bot
|
||||
; CRONO
|
||||
; B bot
|
||||
; IDbot
|
||||
; ID bot
|
||||
; POWER BOT
|
||||
OCTOPUS-CORE
|
||||
htc_botdugls
|
||||
super\/\d+\/Android\/\d+
|
1
www/extern/crawler-detect/raw/Headers.json
vendored
Normal file
1
www/extern/crawler-detect/raw/Headers.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
["HTTP_USER_AGENT","HTTP_X_OPERAMINI_PHONE_UA","HTTP_X_DEVICE_USER_AGENT","HTTP_X_ORIGINAL_USER_AGENT","HTTP_X_SKYFIRE_PHONE","HTTP_X_BOLT_PHONE_UA","HTTP_DEVICE_STOCK_UA","HTTP_X_UCBROWSER_DEVICE_UA","HTTP_FROM","HTTP_X_SCANNER"]
|
10
www/extern/crawler-detect/raw/Headers.txt
vendored
Normal file
10
www/extern/crawler-detect/raw/Headers.txt
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
HTTP_USER_AGENT
|
||||
HTTP_X_OPERAMINI_PHONE_UA
|
||||
HTTP_X_DEVICE_USER_AGENT
|
||||
HTTP_X_ORIGINAL_USER_AGENT
|
||||
HTTP_X_SKYFIRE_PHONE
|
||||
HTTP_X_BOLT_PHONE_UA
|
||||
HTTP_DEVICE_STOCK_UA
|
||||
HTTP_X_UCBROWSER_DEVICE_UA
|
||||
HTTP_FROM
|
||||
HTTP_X_SCANNER
|
196
www/extern/crawler-detect/src/CrawlerDetect.php
vendored
Normal file
196
www/extern/crawler-detect/src/CrawlerDetect.php
vendored
Normal file
@ -0,0 +1,196 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Crawler Detect - the web crawler detection library.
|
||||
*
|
||||
* (c) Mark Beech <m@rkbee.ch>
|
||||
*
|
||||
* This source file is subject to the MIT license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
|
||||
namespace Jaybizzle\CrawlerDetect;
|
||||
|
||||
use Jaybizzle\CrawlerDetect\Fixtures\Crawlers;
|
||||
use Jaybizzle\CrawlerDetect\Fixtures\Exclusions;
|
||||
use Jaybizzle\CrawlerDetect\Fixtures\Headers;
|
||||
|
||||
class CrawlerDetect
|
||||
{
|
||||
/**
|
||||
* The user agent.
|
||||
*
|
||||
* @var string|null
|
||||
*/
|
||||
protected $userAgent;
|
||||
|
||||
/**
|
||||
* Headers that contain a user agent.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $httpHeaders = array();
|
||||
|
||||
/**
|
||||
* Store regex matches.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $matches = array();
|
||||
|
||||
/**
|
||||
* Crawlers object.
|
||||
*
|
||||
* @var \Jaybizzle\CrawlerDetect\Fixtures\Crawlers
|
||||
*/
|
||||
protected $crawlers;
|
||||
|
||||
/**
|
||||
* Exclusions object.
|
||||
*
|
||||
* @var \Jaybizzle\CrawlerDetect\Fixtures\Exclusions
|
||||
*/
|
||||
protected $exclusions;
|
||||
|
||||
/**
|
||||
* Headers object.
|
||||
*
|
||||
* @var \Jaybizzle\CrawlerDetect\Fixtures\Headers
|
||||
*/
|
||||
protected $uaHttpHeaders;
|
||||
|
||||
/**
|
||||
* The compiled regex string.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $compiledRegex;
|
||||
|
||||
/**
|
||||
* The compiled exclusions regex string.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $compiledExclusions;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
*/
|
||||
public function __construct(array $headers = null, $userAgent = null)
|
||||
{
|
||||
$this->crawlers = new Crawlers();
|
||||
$this->exclusions = new Exclusions();
|
||||
$this->uaHttpHeaders = new Headers();
|
||||
|
||||
$this->compiledRegex = $this->compileRegex($this->crawlers->getAll());
|
||||
$this->compiledExclusions = $this->compileRegex($this->exclusions->getAll());
|
||||
|
||||
$this->setHttpHeaders($headers);
|
||||
$this->setUserAgent($userAgent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compile the regex patterns into one regex string.
|
||||
*
|
||||
* @param array
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function compileRegex($patterns)
|
||||
{
|
||||
return '('.implode('|', $patterns).')';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set HTTP headers.
|
||||
*
|
||||
* @param array|null $httpHeaders
|
||||
*/
|
||||
public function setHttpHeaders($httpHeaders)
|
||||
{
|
||||
// Use global _SERVER if $httpHeaders aren't defined.
|
||||
if (! is_array($httpHeaders) || ! count($httpHeaders)) {
|
||||
$httpHeaders = $_SERVER;
|
||||
}
|
||||
|
||||
// Clear existing headers.
|
||||
$this->httpHeaders = array();
|
||||
|
||||
// Only save HTTP headers. In PHP land, that means
|
||||
// only _SERVER vars that start with HTTP_.
|
||||
foreach ($httpHeaders as $key => $value) {
|
||||
if (strpos($key, 'HTTP_') === 0) {
|
||||
$this->httpHeaders[$key] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return user agent headers.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getUaHttpHeaders()
|
||||
{
|
||||
return $this->uaHttpHeaders->getAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the user agent.
|
||||
*
|
||||
* @param string|null $userAgent
|
||||
*/
|
||||
public function setUserAgent($userAgent)
|
||||
{
|
||||
if (is_null($userAgent)) {
|
||||
foreach ($this->getUaHttpHeaders() as $altHeader) {
|
||||
if (isset($this->httpHeaders[$altHeader])) {
|
||||
$userAgent .= $this->httpHeaders[$altHeader].' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->userAgent = $userAgent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check user agent string against the regex.
|
||||
*
|
||||
* @param string|null $userAgent
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isCrawler($userAgent = null)
|
||||
{
|
||||
$agent = trim(preg_replace(
|
||||
"/{$this->compiledExclusions}/i",
|
||||
'',
|
||||
$userAgent ?: $this->userAgent ?: ''
|
||||
));
|
||||
|
||||
if ($agent === '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (bool) preg_match("/{$this->compiledRegex}/i", $agent, $this->matches);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the matches.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getMatches()
|
||||
{
|
||||
return isset($this->matches[0]) ? $this->matches[0] : null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getUserAgent()
|
||||
{
|
||||
return $this->userAgent;
|
||||
}
|
||||
}
|
32
www/extern/crawler-detect/src/Fixtures/AbstractProvider.php
vendored
Normal file
32
www/extern/crawler-detect/src/Fixtures/AbstractProvider.php
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Crawler Detect - the web crawler detection library.
|
||||
*
|
||||
* (c) Mark Beech <m@rkbee.ch>
|
||||
*
|
||||
* This source file is subject to the MIT license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
|
||||
namespace Jaybizzle\CrawlerDetect\Fixtures;
|
||||
|
||||
abstract class AbstractProvider
|
||||
{
|
||||
/**
|
||||
* The data set.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $data;
|
||||
|
||||
/**
|
||||
* Return the data set.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAll()
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
}
|
1424
www/extern/crawler-detect/src/Fixtures/Crawlers.php
vendored
Normal file
1424
www/extern/crawler-detect/src/Fixtures/Crawlers.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
74
www/extern/crawler-detect/src/Fixtures/Exclusions.php
vendored
Normal file
74
www/extern/crawler-detect/src/Fixtures/Exclusions.php
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Crawler Detect - the web crawler detection library.
|
||||
*
|
||||
* (c) Mark Beech <m@rkbee.ch>
|
||||
*
|
||||
* This source file is subject to the MIT license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
|
||||
namespace Jaybizzle\CrawlerDetect\Fixtures;
|
||||
|
||||
class Exclusions extends AbstractProvider
|
||||
{
|
||||
/**
|
||||
* List of strings to remove from the user agent before running the crawler regex
|
||||
* Over a large list of user agents, this gives us about a 55% speed increase!
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $data = array(
|
||||
'Safari.[\d\.]*',
|
||||
'Firefox.[\d\.]*',
|
||||
' Chrome.[\d\.]*',
|
||||
'Chromium.[\d\.]*',
|
||||
'MSIE.[\d\.]',
|
||||
'Opera\/[\d\.]*',
|
||||
'Mozilla.[\d\.]*',
|
||||
'AppleWebKit.[\d\.]*',
|
||||
'Trident.[\d\.]*',
|
||||
'Windows NT.[\d\.]*',
|
||||
'Android [\d\.]*',
|
||||
'Macintosh.',
|
||||
'Ubuntu',
|
||||
'Linux',
|
||||
'[ ]Intel',
|
||||
'Mac OS X [\d_]*',
|
||||
'(like )?Gecko(.[\d\.]*)?',
|
||||
'KHTML,',
|
||||
'CriOS.[\d\.]*',
|
||||
'CPU iPhone OS ([0-9_])* like Mac OS X',
|
||||
'CPU OS ([0-9_])* like Mac OS X',
|
||||
'iPod',
|
||||
'compatible',
|
||||
'x86_..',
|
||||
'i686',
|
||||
'x64',
|
||||
'X11',
|
||||
'rv:[\d\.]*',
|
||||
'Version.[\d\.]*',
|
||||
'WOW64',
|
||||
'Win64',
|
||||
'Dalvik.[\d\.]*',
|
||||
' \.NET CLR [\d\.]*',
|
||||
'Presto.[\d\.]*',
|
||||
'Media Center PC',
|
||||
'BlackBerry',
|
||||
'Build',
|
||||
'Opera Mini\/\d{1,2}\.\d{1,2}\.[\d\.]*\/\d{1,2}\.',
|
||||
'Opera',
|
||||
' \.NET[\d\.]*',
|
||||
'cubot',
|
||||
'; M bot',
|
||||
'; CRONO',
|
||||
'; B bot',
|
||||
'; IDbot',
|
||||
'; ID bot',
|
||||
'; POWER BOT',
|
||||
'OCTOPUS-CORE',
|
||||
'htc_botdugls',
|
||||
'super\/\d+\/Android\/\d+',
|
||||
);
|
||||
}
|
37
www/extern/crawler-detect/src/Fixtures/Headers.php
vendored
Normal file
37
www/extern/crawler-detect/src/Fixtures/Headers.php
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Crawler Detect - the web crawler detection library.
|
||||
*
|
||||
* (c) Mark Beech <m@rkbee.ch>
|
||||
*
|
||||
* This source file is subject to the MIT license that is bundled
|
||||
* with this source code in the file LICENSE.
|
||||
*/
|
||||
|
||||
namespace Jaybizzle\CrawlerDetect\Fixtures;
|
||||
|
||||
class Headers extends AbstractProvider
|
||||
{
|
||||
/**
|
||||
* All possible HTTP headers that represent the user agent string.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $data = array(
|
||||
// The default User-Agent string.
|
||||
'HTTP_USER_AGENT',
|
||||
// Header can occur on devices using Opera Mini.
|
||||
'HTTP_X_OPERAMINI_PHONE_UA',
|
||||
// Vodafone specific header: http://www.seoprinciple.com/mobile-web-community-still-angry-at-vodafone/24/
|
||||
'HTTP_X_DEVICE_USER_AGENT',
|
||||
'HTTP_X_ORIGINAL_USER_AGENT',
|
||||
'HTTP_X_SKYFIRE_PHONE',
|
||||
'HTTP_X_BOLT_PHONE_UA',
|
||||
'HTTP_DEVICE_STOCK_UA',
|
||||
'HTTP_X_UCBROWSER_DEVICE_UA',
|
||||
// Sometimes, bots (especially Google) use a genuine user agent, but fill this header in with their email address
|
||||
'HTTP_FROM',
|
||||
'HTTP_X_SCANNER', // Seen in use by Netsparker
|
||||
);
|
||||
}
|
@ -57,6 +57,41 @@ class ProjectLawful implements IWebsiteModule
|
||||
return $this->site->modules->Database()->sql_query_assoc('SELECT variant, COUNT(*) AS `count` FROM projectlawful_downloadcounter GROUP BY variant ORDER BY variant');
|
||||
}
|
||||
|
||||
public function listDownloadCountsExt()
|
||||
{
|
||||
// https://github.com/JayBizzle/Crawler-Detect
|
||||
|
||||
require_once __DIR__ . '/../../extern/crawler-detect/src/Fixtures/AbstractProvider.php';
|
||||
require_once __DIR__ . '/../../extern/crawler-detect/src/Fixtures/Crawlers.php';
|
||||
require_once __DIR__ . '/../../extern/crawler-detect/src/Fixtures/Exclusions.php';
|
||||
require_once __DIR__ . '/../../extern/crawler-detect/src/Fixtures/Headers.php';
|
||||
require_once __DIR__ . '/../../extern/crawler-detect/src/CrawlerDetect.php';
|
||||
|
||||
$CrawlerDetect = new \Jaybizzle\CrawlerDetect\CrawlerDetect;
|
||||
|
||||
$r = [];
|
||||
|
||||
foreach ($this->site->modules->Database()->sql_query_assoc('SELECT * FROM projectlawful_downloadcounter ORDER BY timestamp ASC') as $entry)
|
||||
{
|
||||
if (!key_exists($entry['variant'], $r)) $r[$entry['variant']] = [0, 0, ''];
|
||||
|
||||
$v = $r[$entry['variant']];
|
||||
|
||||
if ($CrawlerDetect->isCrawler($entry['useragent']))
|
||||
{
|
||||
$r[$entry['variant']] = [$v[0] + 0, $v[1] + 1, $entry['timestamp']];
|
||||
}
|
||||
else
|
||||
{
|
||||
$r[$entry['variant']] = [$v[0] + 1, $v[1] + 1, $v[2]];
|
||||
}
|
||||
}
|
||||
|
||||
ksort($r);
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
public function variantExists(string $variant)
|
||||
{
|
||||
return isset($this->variants[$variant]);
|
||||
|
@ -97,8 +97,16 @@ $connected = true; try { $SITE->modules->Database(); } catch (Exception $e) { $c
|
||||
|
||||
<div class="bc_data keyvaluelist kvl_250">
|
||||
<?php if ($connected): ?>
|
||||
<?php foreach ($SITE->modules->ProjectLawful()->listDownloadCounts() as $dlc): ?>
|
||||
<div><span><?php echo $dlc['variant']; ?>:</span> <span><?php echo $dlc['count']; ?></span></div>
|
||||
<?php foreach ($SITE->modules->ProjectLawful()->listDownloadCountsExt() as $variant => [$nonbot, $total, $ts]): ?>
|
||||
<div class="row_hover">
|
||||
<span><?php echo $variant; ?>:</span>
|
||||
|
||||
<span title="non-crawler count" style="min-width: 4em"><?php echo $nonbot; ?></span>
|
||||
|
||||
<span title="total count" style="opacity: 0.45; min-width: 6em;">( <?php echo $total; ?> )</span>
|
||||
|
||||
<span title="last-non-crawler-download" style="opacity: 0.75"><?php echo $ts; ?></span>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<div class="bc_data keyvaluelist admindberr">Database not connected.</div>
|
||||
@ -150,11 +158,11 @@ $connected = true; try { $SITE->modules->Database(); } catch (Exception $e) { $c
|
||||
<div class="bc_header">Statics</div>
|
||||
|
||||
<div class="bc_data keyvaluelist kvl_250">
|
||||
<div><span>Blog entries:</span> <span><?php echo count($SITE->modules->Blog()->listAll()); ?></span></div>
|
||||
<div><span>Book entries:</span> <span><?php echo count($SITE->modules->Books()->listAll()); ?></span></div>
|
||||
<div><span>Euler entries:</span> <span><?php echo count($SITE->modules->Euler()->listAll()); ?></span></div>
|
||||
<div><span>Program entries:</span> <span><?php echo count($SITE->modules->Programs()->listAll()); ?></span></div>
|
||||
<div><span>Update entries:</span> <span><?php echo count($SITE->modules->UpdatesLog()->listUpdateData()); ?></span></div>
|
||||
<div class="row_hover" ><span>Blog entries:</span> <span><?php echo count($SITE->modules->Blog()->listAll()); ?></span></div>
|
||||
<div class="row_hover" ><span>Book entries:</span> <span><?php echo count($SITE->modules->Books()->listAll()); ?></span></div>
|
||||
<div class="row_hover" ><span>Euler entries:</span> <span><?php echo count($SITE->modules->Euler()->listAll()); ?></span></div>
|
||||
<div class="row_hover" ><span>Program entries:</span> <span><?php echo count($SITE->modules->Programs()->listAll()); ?></span></div>
|
||||
<div class="row_hover" ><span>Update entries:</span> <span><?php echo count($SITE->modules->UpdatesLog()->listUpdateData()); ?></span></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -218,9 +226,9 @@ $connected = true; try { $SITE->modules->Database(); } catch (Exception $e) { $c
|
||||
if ($key === 'extendedgitgraph') continue;
|
||||
|
||||
if (is_array($value))
|
||||
echo '<div><span>' . $key . '</span> <span style="white-space: pre">' . json_encode($value, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . '</span></div>' . "\n";
|
||||
echo '<div class="row_hover"><span>' . $key . '</span> <span style="white-space: pre">' . json_encode($value, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . '</span></div>' . "\n";
|
||||
else
|
||||
echo '<div><span>' . $key . '</span> <span>' . nl2br(var_export($value, true)) . '</span></div>' . "\n";
|
||||
echo '<div class="row_hover"><span>' . $key . '</span> <span>' . nl2br(var_export($value, true)) . '</span></div>' . "\n";
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user