1
0
Fork 0

edit: phpdoc stuff

add: pChart lib - no more usage of google api. There has to be the wp-content/cache writable for images
add: test-folder for later use
new: class agents, new isBot-functionality within this class, old function is deprecated, uses an ini-file with botnames
Dieser Commit ist enthalten in:
Oldperl 2011-11-14 14:21:22 +00:00
Ursprung 187cc396c4
Commit 86383bb510
53 geänderte Dateien mit 26319 neuen und 380 gelöschten Zeilen

Datei anzeigen

@ -26,6 +26,24 @@
* $Id$
*
*/
/**
* based upon semmelstatz
* Copyright (c) 2005-2009 Andreas 'Redunzl' Mueller (redunzl@gmx.de)
*
* @license http://www.gnu.org/licenses/gpl-2.0.html
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2) as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
### Encodierung der IP-Adresse durch simple arithmetische Operation
function sem_encodeIP($ip) {
$ip_parts = split("[.]", $ip);
@ -85,160 +103,29 @@
return $useronline;
}
### Prüfen, ob Besucher ein Bot ist
function sem_AreYouBot($user_agent) {
global $isBot;
$bots = array(
'aipbot',
'amfibibot',
'appie',
'ask jeeves/teoma',
'aspseek',
'axadine',
'baiduspider',
'becomebot',
'blogcorpuscrawler',
'blogpulse',
'blogsnowbot',
'boitho.com',
'bruinbot',
'cerberian',
'cfnetwork',
'check_http',
'cipinetbot',
'claymont',
'cometsearch@cometsystems.com',
'converacrawler',
'cydralspider',
'digger',
'es.net_crawler',
'eventax',
'everyfeed-spider',
'exabot@exava.com',
'faxobot',
'findlinks',
'fireball',
'francis',
'gaisbot',
'gamekitbot',
'gazz@nttr.co.jp',
'geonabot',
'getrax crawler',
'gigabot',
'girafa.com',
'goforitbot',
'googlebot',
'grub-client',
'holmes',
'houxoucrawler',
'http://www.almaden.ibm.com/cs/crawler',
'http://www.istarthere.com',
'http://www.relevantnoise.com',
'httrack ?',
'ia_archiver',
'ichiro',
'iltrovatore-setaccio',
'inelabot',
'infoseek',
'inktomi.com',
'irlbot',
'jetbot',
'jobspider_ba',
'kazoombot',
'larbin',
'libwww',
'linkwalker',
'lmspider',
'mackster',
'mediapartners-google',
'microsoft url control',
'mj12bot',
'moreoverbot',
'mozdex',
'msnbot',
'msrbot',
'naverbot',
'netresearchserver',
'ng/2.0',
'np(bot)',
'nutch',
'objectssearch',
'ocelli',
'omniexplorer_bot',
'openbot',
'overture',
'patwebbot',
'php',
'phpdig',
'pilgrim html-crawler',
'pipeliner',
'pompos',
'psbot',
'python-urllib',
'quepasacreep',
'robozilla',
'rpt-httpclient',
'savvybot',
'scooter',
'search.ch',
'seekbot',
'semager',
'seznambot',
'sherlock',
'shelob',
'sitesearch',
'snapbot',
'snappreviewbot',
'speedy spider',
'sphere scout',
'stackrambler',
'steeler',
'surveybot',
'szukacz',
'technoratibot',
'telnet',
'themiragorobot',
'thesubot',
'thumbshots-de-bot',
'topicblogs',
'turnitinbot',
'tutorgigbot',
'tutorial crawler',
'twiceler',
'vagabondo',
'versus',
'voilabot',
'w3c_css_validator',
'w3c_validator',
'w3c-checklink',
'web downloader',
'webcopier',
'webcrawler',
'webfilter robot',
'west wind internet protocols',
'wget',
'wwweasel robot',
'wwwster',
'xaldon webspider',
'xenu',
'yahoo! slurp',
'yahoofeedseeker',
'yahoo-mmcrawler',
'zao',
'zipppbot',
'zyborg',
);
foreach($bots as $bot) {
if(stristr($user_agent, $bot) !== false) {
return true;
}
}
return false;
}
/**
* Check if agent is a bot
*
* @deprecated use Agents-object in the future
*
* @param string $user_agent
* @return boolean
*/
function sem_AreYouBot($user_agent) {
require_once 'class.agents.php';
$oCheckAgent = new Agents($user_agent);
return $oCheckAgent->isBot();
}
### Referer nach Suchmaschinen-Queries und interner Suche prüfen und Suchstring extrahieren
function sem_getKeyword($referer) {
$keyword = @parse_url($referer);
function sem_getKeyword($referer) {
if(empty($referer)) return false;
$homehost = '%'.(substr($_SERVER['SERVER_NAME'],0,4) == 'www.')?
substr($_SERVER['SERVER_NAME'],4) . '%':
$_SERVER['SERVER_NAME'] . '%';
$keyword = parse_url($referer);
if(!isset($keyword['host']) || !isset($keyword['query'])) return false;
if (preg_match("/google\./i", $keyword["host"])) {
if (preg_match("/imgurl/i", $keyword["query"])) {
@ -374,18 +261,18 @@
### Zeigt Copyright-Notiz an
function sem_showCopyright() {
print "<p class='copyright'>semmelstatzR ". SEMMELSTATZR_VERSION . " happily coded by <a target='_blank' href='http://php-backoffice.de'>PHP-Backoffice<br />
print "<p class='copyright'>semmelstatzR ". SEMMELSTATZR_VERSION . " happily coded by <a target='_blank' href='http://semmelstatz.sourceforge.net/'>SEM-Team<br />
<a target='_blank' style='border:none;' href='http://sourceforge.net/projects/semmelstatz/'>
<img src='".get_option('siteurl')."/wp-content/plugins/semmelstatzR/img/statzR.png' /></a></p>";
}
### statz-Tabelle leeren (NICHT LÖSCHEN!!!)
function sem_truncateStatzTable() {
global $wpdb, $userip;
$wpdb->query('TRUNCATE TABLE '.$wpdb->statz);
sem_optStatzTable();
$wpdb->query("INSERT INTO `$wpdb->statz`(ip, time, referer, page, username) VALUES('127.0.0.1', NOW(),NULL,0,'statz-Tabelle geleert')");
}
function sem_truncateStatzTable() {
global $wpdb, $userip;
$wpdb->query('TRUNCATE TABLE '.$wpdb->statz);
sem_optStatzTable();
return $wpdb->query("INSERT INTO `$wpdb->statz`(ip, time, referer, page, username) VALUES('127.0.0.1', NOW(),NULL,0,'statz-Tabelle geleert')");
}
### Obsolet, bleibt aber aus Kompatibilitätsgründen zu SEMMELSTATZ_DELETE
function sem_delOldRecords($days) {
@ -470,7 +357,7 @@
}
}
### Summen der vergangenen Tage in die statzhist schreiben */
/* Summen der vergangenen Tage in die statzhist schreiben */
function sem_writeOldDaysToHist() {
global $wpdb;
if(!$wpdb->get_var("SELECT date FROM ".$wpdb->statzhist." WHERE substring(date,1,10) <= DATE_SUB(CURDATE(), INTERVAL 1 DAY)")) {