Version Description
Download this release
Release Info
Developer | michelem |
Plugin | WassUp Real Time Analytics |
Version | 1.6.1 |
Comparing to | |
See all releases |
Code changes from version 1.6 to 1.6.1
- img/flags/eu.png +0 -0
- lib/action.php +45 -14
- lib/main.php +20 -6
- lib/settings.php +96 -15
- lib/wassup.class.php +7 -3
- readme.txt +2 -2
- wassup.php +539 -217
img/flags/eu.png
ADDED
Binary file
|
lib/action.php
CHANGED
@@ -7,14 +7,12 @@ header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); // always modifie
|
|
7 |
// HTTP/1.1
|
8 |
header('Cache-Control: no-store, no-cache, must-revalidate');
|
9 |
*/
|
10 |
-
//#debug...
|
11 |
-
//error_reporting(E_ALL | E_STRICT); //debug, E_STRICT=php5 only
|
12 |
-
//ini_set('display_errors','On'); //debug
|
13 |
|
14 |
//#check for required files and include them
|
15 |
if (!function_exists('get_bloginfo')) {
|
16 |
if (!defined('ABSPATH')) {
|
17 |
-
$
|
|
|
18 |
//don't call wp-blog-header.php as it will insert headers from plugins that we don't want here.
|
19 |
//if (file_exists($wpabspath. 'wp-blog-header.php')) {
|
20 |
// include_once($wpabspath. 'wp-blog-header.php');
|
@@ -29,7 +27,7 @@ if (!function_exists('get_bloginfo')) {
|
|
29 |
//Note: localization functions, _e() and __(), are not used
|
30 |
// here because they would not be defined if this error
|
31 |
// occurred
|
32 |
-
echo '<span style="
|
33 |
die();
|
34 |
}
|
35 |
}
|
@@ -50,7 +48,7 @@ $wpurl = get_bloginfo('wpurl');
|
|
50 |
$table_name = $wpdb->prefix . "wassup";
|
51 |
$wassup_settings = get_option('wassup_settings');
|
52 |
if (!defined('WASSUPFOLDER')) {
|
53 |
-
define('WASSUPFOLDER',
|
54 |
}
|
55 |
|
56 |
//#do a hash check
|
@@ -73,10 +71,14 @@ if (!$hashfail) {
|
|
73 |
} else {
|
74 |
//
|
75 |
// ### Begin actions that have output...
|
|
|
|
|
|
|
76 |
?>
|
77 |
<html>
|
78 |
<head>
|
79 |
<link rel="stylesheet" href="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER; ?>/wassup.css" type="text/css" />
|
|
|
80 |
</head>
|
81 |
<body>
|
82 |
<?php //#retrieve command-line arguments
|
@@ -94,7 +96,7 @@ if (!$hashfail) {
|
|
94 |
|
95 |
//#check that $to_date is a number
|
96 |
if (!is_numeric($to_date)) { //bad date sent
|
97 |
-
echo '<span style="
|
98 |
exit();
|
99 |
}
|
100 |
|
@@ -116,7 +118,8 @@ if (!$hashfail) {
|
|
116 |
$items_pie[] = $Tot->calc_tot("count", $search, "AND searchengine!='' AND spam=0", "DISTINCT");
|
117 |
$items_pie[] = $Tot->calc_tot("count", $search, "AND searchengine='' AND referrer NOT LIKE '%".$this->WpUrl."%' AND referrer!='' AND spam=0", "DISTINCT");
|
118 |
$items_pie[] = $Tot->calc_tot("count", $search, "AND searchengine='' AND (referrer LIKE '%".$this->WpUrl."%' OR referrer='') AND spam=0", "DISTINCT"); ?>
|
119 |
-
<div
|
|
|
120 |
|
121 |
<?php
|
122 |
// ACTION: DISPLAY RAW RECORDS
|
@@ -142,7 +145,7 @@ if (!$hashfail) {
|
|
142 |
<li><?php echo __("Language","wassup").": ".$rt->language; ?></li>
|
143 |
<?php }
|
144 |
} //end foreach ?>
|
145 |
-
|
146 |
</div>
|
147 |
|
148 |
<?php
|
@@ -179,7 +182,6 @@ if (!$hashfail) {
|
|
179 |
$spamselect = "";
|
180 |
}
|
181 |
?>
|
182 |
-
<style type="text/css">.top10 { color: #542; }</style>
|
183 |
<div id="toptenchart" style="width:<?php echo $pagewidth; ?>px;">
|
184 |
<table width="100%" border=0>
|
185 |
<tr valign="top">
|
@@ -268,7 +270,7 @@ if (!$hashfail) {
|
|
268 |
|
269 |
//#get top 10 browsers...
|
270 |
if ($top_ten['topbrowser'] == 1) {
|
271 |
-
$top_results = $wpdb->get_results("SELECT count(browser) as top_browser, browser FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date AND browser!='' AND browser NOT LIKE '
|
272 |
$char_len = round(($max_char_len*.17)+$widthoffset,0);
|
273 |
?>
|
274 |
<td style="min-width:<?php echo ($char_len-5); ?>px;">
|
@@ -305,7 +307,7 @@ if (!$hashfail) {
|
|
305 |
|
306 |
//#output top 10 locales/geographic regions...
|
307 |
if ($top_ten['toplocale'] == 1) {
|
308 |
-
$top_results = $wpdb->get_results("SELECT count(
|
309 |
$char_len = round(($max_char_len*.15)+$widthoffset,0);
|
310 |
|
311 |
?>
|
@@ -322,6 +324,35 @@ if (!$hashfail) {
|
|
322 |
</ul>
|
323 |
</td>
|
324 |
<?php } // end if toplocale
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
325 |
?>
|
326 |
</tr>
|
327 |
</table>
|
@@ -331,12 +362,12 @@ if (!$hashfail) {
|
|
331 |
</div>
|
332 |
<?php
|
333 |
} else {
|
334 |
-
echo '<span style="
|
335 |
} ?>
|
336 |
</body></html>
|
337 |
<?php
|
338 |
} //end else action=DELETE
|
339 |
} else {
|
340 |
-
echo '<span style="
|
341 |
} //end if !$hashfail
|
342 |
?>
|
7 |
// HTTP/1.1
|
8 |
header('Cache-Control: no-store, no-cache, must-revalidate');
|
9 |
*/
|
|
|
|
|
|
|
10 |
|
11 |
//#check for required files and include them
|
12 |
if (!function_exists('get_bloginfo')) {
|
13 |
if (!defined('ABSPATH')) {
|
14 |
+
$file = preg_replace('/\\\\/', '/', __FILE__);
|
15 |
+
$wpabspath=substr($file,0,strpos($file, '/wp-content/')+1);
|
16 |
//don't call wp-blog-header.php as it will insert headers from plugins that we don't want here.
|
17 |
//if (file_exists($wpabspath. 'wp-blog-header.php')) {
|
18 |
// include_once($wpabspath. 'wp-blog-header.php');
|
27 |
//Note: localization functions, _e() and __(), are not used
|
28 |
// here because they would not be defined if this error
|
29 |
// occurred
|
30 |
+
echo '<span style="color:red;">Action.php ERROR: file not found, '.$wpabspath.'wp-config.php</span>';
|
31 |
die();
|
32 |
}
|
33 |
}
|
48 |
$table_name = $wpdb->prefix . "wassup";
|
49 |
$wassup_settings = get_option('wassup_settings');
|
50 |
if (!defined('WASSUPFOLDER')) {
|
51 |
+
define('WASSUPFOLDER', dirname(dirname(__FILE__)));
|
52 |
}
|
53 |
|
54 |
//#do a hash check
|
71 |
} else {
|
72 |
//
|
73 |
// ### Begin actions that have output...
|
74 |
+
//#debug...
|
75 |
+
//error_reporting(E_ALL | E_STRICT); //debug, E_STRICT=php5 only
|
76 |
+
//ini_set('display_errors','On'); //debug
|
77 |
?>
|
78 |
<html>
|
79 |
<head>
|
80 |
<link rel="stylesheet" href="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER; ?>/wassup.css" type="text/css" />
|
81 |
+
<style type="text/css">.top10 { color: #542; }</style>
|
82 |
</head>
|
83 |
<body>
|
84 |
<?php //#retrieve command-line arguments
|
96 |
|
97 |
//#check that $to_date is a number
|
98 |
if (!is_numeric($to_date)) { //bad date sent
|
99 |
+
echo '<span style="color:red;">Action.php '.__("ERROR: bad date","wassup").', '.$to_date.'</span>';
|
100 |
exit();
|
101 |
}
|
102 |
|
118 |
$items_pie[] = $Tot->calc_tot("count", $search, "AND searchengine!='' AND spam=0", "DISTINCT");
|
119 |
$items_pie[] = $Tot->calc_tot("count", $search, "AND searchengine='' AND referrer NOT LIKE '%".$this->WpUrl."%' AND referrer!='' AND spam=0", "DISTINCT");
|
120 |
$items_pie[] = $Tot->calc_tot("count", $search, "AND searchengine='' AND (referrer LIKE '%".$this->WpUrl."%' OR referrer='') AND spam=0", "DISTINCT"); ?>
|
121 |
+
<div style="text-align: center"><img src="http://chart.apis.google.com/chart?cht=p3&chco=0000ff&chs=600x300&chl=Spam|Search%20Engine|Referrer|Direct&chd=<?php chart_data($items_pie, null, null, null, 'pie'); ?>" /></div>
|
122 |
+
|
123 |
|
124 |
<?php
|
125 |
// ACTION: DISPLAY RAW RECORDS
|
145 |
<li><?php echo __("Language","wassup").": ".$rt->language; ?></li>
|
146 |
<?php }
|
147 |
} //end foreach ?>
|
148 |
+
</ul>
|
149 |
</div>
|
150 |
|
151 |
<?php
|
182 |
$spamselect = "";
|
183 |
}
|
184 |
?>
|
|
|
185 |
<div id="toptenchart" style="width:<?php echo $pagewidth; ?>px;">
|
186 |
<table width="100%" border=0>
|
187 |
<tr valign="top">
|
270 |
|
271 |
//#get top 10 browsers...
|
272 |
if ($top_ten['topbrowser'] == 1) {
|
273 |
+
$top_results = $wpdb->get_results("SELECT count(browser) as top_browser, browser FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date AND browser!='' AND browser NOT LIKE 'N/A%' $spamselect GROUP BY browser ORDER BY top_browser DESC LIMIT 10");
|
274 |
$char_len = round(($max_char_len*.17)+$widthoffset,0);
|
275 |
?>
|
276 |
<td style="min-width:<?php echo ($char_len-5); ?>px;">
|
307 |
|
308 |
//#output top 10 locales/geographic regions...
|
309 |
if ($top_ten['toplocale'] == 1) {
|
310 |
+
$top_results = $wpdb->get_results("SELECT count(LOWER(language)) as top_locale, LOWER(language) as locale FROM $table_name WHERE timestamp BETWEEN $from_date AND $to_date AND language!='' $spamselect GROUP BY locale ORDER BY top_locale DESC LIMIT 10");
|
311 |
$char_len = round(($max_char_len*.15)+$widthoffset,0);
|
312 |
|
313 |
?>
|
324 |
</ul>
|
325 |
</td>
|
326 |
<?php } // end if toplocale
|
327 |
+
|
328 |
+
//#output top 10 visitors
|
329 |
+
if ($top_ten['topvisitor'] == 1) {
|
330 |
+
$result = false;
|
331 |
+
$char_len = round(($max_char_len*.17)+$widthoffset,0);
|
332 |
+
$tmptable = "top_visitor".rand(0,999);
|
333 |
+
if (mysql_query ("CREATE TEMPORARY TABLE {$tmptable} SELECT username as visitor, '1loggedin_user' as visitor_type, `timestamp` as visit_timestamp FROM $table_name WHERE `timestamp` BETWEEN $from_date AND $to_date AND username!='' $spamselect UNION SELECT comment_author as visitor, '2comment_author' as visitor_type, `timestamp` as visit_timestamp FROM wp_wassup WHERE `timestamp` BETWEEN $from_date AND $to_date AND username='' AND comment_author!='' $spamselect UNION SELECT hostname as visitor, '3hostname' as visitor_type, `timestamp` as visit_timestamp FROM wp_wassup WHERE `timestamp` BETWEEN $from_date AND $to_date AND username='' AND comment_author='' AND spider=''")) {
|
334 |
+
$numRows = mysql_affected_rows();
|
335 |
+
if ($numRows > 0) {
|
336 |
+
$result = mysql_query ("SELECT count(visitor) as top_visitor, visitor, visitor_type FROM {$tmptable} WHERE visitor!='' GROUP BY visitor ORDER BY 1 DESC, visitor_type, visitor LIMIT 10");
|
337 |
+
}
|
338 |
+
} //end if mysql_query
|
339 |
+
?>
|
340 |
+
<td style="min-width:<?php echo ($char_len-5); ?>px;">
|
341 |
+
<ul class="charts">
|
342 |
+
<li class="chartsT"><?php _e("TOP VISITOR", "wassup"); ?></li>
|
343 |
+
<?php
|
344 |
+
if ($result) {
|
345 |
+
while ($top10 = mysql_fetch_array($result,MYSQL_ASSOC)) { ?>
|
346 |
+
<li class="charts"><?php echo $top10['top_visitor'].': '; ?>
|
347 |
+
<span class="top10" title="<?php echo $top10['visitor']; ?>"><?php echo stringShortener($top10['visitor'], $char_len); ?></span>
|
348 |
+
</li>
|
349 |
+
<?php }
|
350 |
+
mysql_free_result($result);
|
351 |
+
} //end if result
|
352 |
+
mysql_query("DROP TABLE IF EXISTS {$tmptable}"); ?>
|
353 |
+
</ul>
|
354 |
+
</td>
|
355 |
+
<?php } // end if topvisitor
|
356 |
?>
|
357 |
</tr>
|
358 |
</table>
|
362 |
</div>
|
363 |
<?php
|
364 |
} else {
|
365 |
+
echo '<span style="color:red;">Action.php '.__("ERROR: Missing or unknown parameters","wassup").', action='.attribute_escape($_GET["action"]).'</span>';
|
366 |
} ?>
|
367 |
</body></html>
|
368 |
<?php
|
369 |
} //end else action=DELETE
|
370 |
} else {
|
371 |
+
echo '<span style="color:red;">Action.php '.__("ERROR: Nothing to do here","wassup").'</span>';
|
372 |
} //end if !$hashfail
|
373 |
?>
|
lib/main.php
CHANGED
@@ -551,12 +551,12 @@ function url_rootcheck($urltocheck) {
|
|
551 |
//# blogs that have wordpress installed in a separate folder
|
552 |
//# -Helene D. 1/22/08
|
553 |
function wAddSiteurl($inputurl) {
|
554 |
-
$wpurl = get_bloginfo('wpurl');
|
555 |
-
$siteurl = get_bloginfo('siteurl');
|
556 |
if (strcasecmp($siteurl, $wpurl) == 0) {
|
557 |
$outputurl=$inputurl;
|
558 |
} elseif (stristr($inputurl,$siteurl) === FALSE && url_rootcheck($siteurl)) {
|
559 |
-
$outputurl
|
560 |
} else {
|
561 |
$outputurl=$inputurl;
|
562 |
}
|
@@ -616,8 +616,19 @@ function spyview ($from_date="",$to_date="",$rows="999") {
|
|
616 |
$unclass = "-aut";
|
617 |
} elseif ($cv->spider != "") {
|
618 |
$unclass = "-spider";
|
619 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
620 |
<div class="sum-spy">
|
|
|
621 |
<span class="sum-box<?php print $unclass; ?>">
|
622 |
<?php print $ip[0]; ?></span>
|
623 |
<div class="sum-det"><span class="det1">
|
@@ -688,6 +699,7 @@ function chart_data($Wvisits, $pages=null, $atime=null, $type, $charttype=null,
|
|
688 |
|
689 |
// Chart type has two datasets
|
690 |
if ($charttype == "main") {
|
|
|
691 |
for ($i = 0; $i < count($Wvisits); $i++) {
|
692 |
$currentValue = $Wvisits[$i];
|
693 |
$currentTime = $atime[$i];
|
@@ -761,9 +773,10 @@ class MainItems {
|
|
761 |
global $wpdb;
|
762 |
$this->ItemsType = $Type;
|
763 |
$this->searchString = $Search;
|
|
|
764 |
|
765 |
// Add the Search variable to the WHERE clause
|
766 |
-
|
767 |
|
768 |
// Switch by every (global) items type (visits, pageviews, spams, etc...)
|
769 |
switch ($Type) {
|
@@ -786,7 +799,8 @@ class MainItems {
|
|
786 |
function TheChart($Ctype, $Res, $chart_height, $Search="", $axes_type, $chart_bg, $chart_type=null, $chart_pos=null) {
|
787 |
global $wpdb;
|
788 |
$mysqlversion=substr(mysql_get_server_info(),0,3);
|
789 |
-
|
|
|
790 |
//#Mysql's 'FROM_UNIXTIME' returns the local server
|
791 |
//# datetime from an expected UTC unix timestamp, so
|
792 |
//# convert 'timestamp' to UTC and calculate in any
|
551 |
//# blogs that have wordpress installed in a separate folder
|
552 |
//# -Helene D. 1/22/08
|
553 |
function wAddSiteurl($inputurl) {
|
554 |
+
$wpurl = rtrim(get_bloginfo('wpurl'),"/");
|
555 |
+
$siteurl = rtrim(get_bloginfo('siteurl'),"/");
|
556 |
if (strcasecmp($siteurl, $wpurl) == 0) {
|
557 |
$outputurl=$inputurl;
|
558 |
} elseif (stristr($inputurl,$siteurl) === FALSE && url_rootcheck($siteurl)) {
|
559 |
+
$outputurl=$siteurl."/".ltrim($inputurl,"/");
|
560 |
} else {
|
561 |
$outputurl=$inputurl;
|
562 |
}
|
616 |
$unclass = "-aut";
|
617 |
} elseif ($cv->spider != "") {
|
618 |
$unclass = "-spider";
|
619 |
+
}
|
620 |
+
// Start getting GEOIP info
|
621 |
+
/*
|
622 |
+
// TODO
|
623 |
+
$ch = curl_init("http://api.hostip.info/get_html.php?ip=".$ip[0]."&position=true");
|
624 |
+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
625 |
+
curl_setopt($ch, CURLOPT_HEADER, 0);
|
626 |
+
$data = curl_exec($ch);
|
627 |
+
curl_close($ch);
|
628 |
+
*/
|
629 |
+
?>
|
630 |
<div class="sum-spy">
|
631 |
+
|
632 |
<span class="sum-box<?php print $unclass; ?>">
|
633 |
<?php print $ip[0]; ?></span>
|
634 |
<div class="sum-det"><span class="det1">
|
699 |
|
700 |
// Chart type has two datasets
|
701 |
if ($charttype == "main") {
|
702 |
+
$label_time = "";
|
703 |
for ($i = 0; $i < count($Wvisits); $i++) {
|
704 |
$currentValue = $Wvisits[$i];
|
705 |
$currentTime = $atime[$i];
|
773 |
global $wpdb;
|
774 |
$this->ItemsType = $Type;
|
775 |
$this->searchString = $Search;
|
776 |
+
$ss = "";
|
777 |
|
778 |
// Add the Search variable to the WHERE clause
|
779 |
+
if ($Search != "") { $ss = " AND (ip LIKE '%".$this->searchString."%' OR hostname LIKE '%".$this->searchString."%' OR urlrequested LIKE '%".$this->searchString."%' OR agent LIKE '%".$this->searchString."%' OR referrer LIKE '%".$this->searchString."%') "; }
|
780 |
|
781 |
// Switch by every (global) items type (visits, pageviews, spams, etc...)
|
782 |
switch ($Type) {
|
799 |
function TheChart($Ctype, $Res, $chart_height, $Search="", $axes_type, $chart_bg, $chart_type=null, $chart_pos=null) {
|
800 |
global $wpdb;
|
801 |
$mysqlversion=substr(mysql_get_server_info(),0,3);
|
802 |
+
$ss = "";
|
803 |
+
|
804 |
//#Mysql's 'FROM_UNIXTIME' returns the local server
|
805 |
//# datetime from an expected UTC unix timestamp, so
|
806 |
//# convert 'timestamp' to UTC and calculate in any
|
lib/settings.php
CHANGED
@@ -3,16 +3,14 @@
|
|
3 |
//# settings in the Wassup options menu
|
4 |
?>
|
5 |
<?php
|
6 |
-
$to_date = wassup_get_time();
|
7 |
-
if ( isset($_POST['delete_manual'])) {
|
8 |
-
$from_date = @strtotime($_POST['delete_manual'], $to_date);
|
9 |
-
}
|
10 |
if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name) {
|
11 |
-
if ($_POST['delete_manual']
|
|
|
|
|
12 |
$wpdb->query("DELETE FROM $table_name WHERE timestamp<'$from_date'");
|
13 |
$wpdb->query("OPTIMIZE TABLE $table_name");
|
14 |
}
|
15 |
-
if ($_POST['wassup_empty']
|
16 |
$wpdb->query("DELETE FROM $table_name");
|
17 |
$wpdb->query("OPTIMIZE TABLE $table_name");
|
18 |
}
|
@@ -20,6 +18,7 @@
|
|
20 |
foreach ($table_status as $fstatus) {
|
21 |
$data_lenght = $fstatus->Data_length;
|
22 |
$data_rows = $fstatus->Rows;
|
|
|
23 |
}
|
24 |
$tusage = number_format(($data_lenght/1024/1024), 2, ",", " ");
|
25 |
$tusage2 = ($data_lenght/1024/1024);
|
@@ -27,6 +26,7 @@
|
|
27 |
|
28 |
$adminemail = get_bloginfo('admin_email');
|
29 |
|
|
|
30 |
if ($wassup_options->wassup_remind_flag == 2) {
|
31 |
$alert_msg = '<p style="color:red;font-weight:bold;">'.__('ATTENTION! Your WassUp table have reached the maximum value you set, I disabled the alert, you can re-enable it here.','wassup').'</p>';
|
32 |
$wassup_options->wassup_remind_flag = 0;
|
@@ -66,7 +66,7 @@
|
|
66 |
else { $tab = "0"; } ?>
|
67 |
<form action="" method="post">
|
68 |
<div id="tabcontainer">
|
69 |
-
<ul>
|
70 |
<li><a href="#wassup_opt_frag-1"><span><?php _e("General Setup", "wassup") ?></span></a></li>
|
71 |
<li<?php if ($tab == "2" || isset($_POST['submit-options2'])) { echo ' class="ui-tabs-selected"';} ?>><a href="#wassup_opt_frag-2"><span><?php _e("Statistics Recording", "wassup") ?></span></a></li>
|
72 |
<li<?php if ($tab == "3" || isset($_POST['submit-options3'])) { echo ' class="ui-tabs-selected"';} ?>><a href="#wassup_opt_frag-3"><span><?php _e("Manage Files & Database", "wassup") ?></span></a></li>
|
@@ -89,6 +89,10 @@
|
|
89 |
<p><input type="checkbox" name="wassup_dashboard_chart" value="1" <?php if($wassup_options->wassup_dashboard_chart == 1) print "CHECKED"; ?> /> <strong><?php _e('Display small chart in the dashboard','wassup'); ?></strong>
|
90 |
</p><br />
|
91 |
|
|
|
|
|
|
|
|
|
92 |
<br /><h3><?php _e('Visit Detail Settings','wassup'); ?></h3>
|
93 |
<p><strong><?php _e('Chart type - How many axes','wassup'); ?></strong>:
|
94 |
<select name='wassup_chart_type'>
|
@@ -126,10 +130,10 @@
|
|
126 |
<input type="checkbox" name="topos" value="1" <?php if($top_ten['topos'] == 1) print "CHECKED"; ?> /><?php _e("Top OS", "wassup"); ?> <br />
|
127 |
<input type="checkbox" name="toplocale" value="1" <?php if($top_ten['toplocale'] == 1) print "CHECKED"; ?> /><?php _e("Top Locales", "wassup"); ?></span><br />
|
128 |
</div>
|
129 |
-
<div style="
|
|
|
130 |
<input type="checkbox" name="topfeed" value="1" DISABLED /><?php _e("Top Feeds", "wassup"); ?><br />
|
131 |
-
<input type="checkbox" name="topcrawler" value="1" DISABLED /><?php _e("Top Crawlers", "wassup"); ?>
|
132 |
-
<input type="checkbox" name="topvisitor" value="1" DISABLED /><?php _e("Top Visitors", "wassup"); ?> (<?php _e("users only","wassup"); ?>)<br />
|
133 |
</div>
|
134 |
</div>
|
135 |
</p>
|
@@ -151,6 +155,7 @@
|
|
151 |
<input type="checkbox" name="wassup_loggedin" value="1" <?php if($wassup_options->wassup_loggedin == 1) print "CHECKED"; ?> /> <?php _e("Record logged in users", "wassup") ?><br />
|
152 |
<input type="checkbox" name="wassup_spider" value="1" <?php if($wassup_options->wassup_spider == 1) print "CHECKED"; ?> /> <?php _e("Record spiders and bots", "wassup") ?><br />
|
153 |
<input type="checkbox" name="wassup_attack" value="1" <?php if($wassup_options->wassup_attack == 1) print "CHECKED"; ?> /> <?php _e("Record attack/exploit attempts (libwww-perl agent)", "wassup") ?><br />
|
|
|
154 |
</span>
|
155 |
</p>
|
156 |
<br /><p><input type="checkbox" name="wassup_spamcheck" value="1" <?php if($wassup_options->wassup_spamcheck == 1 ) print "CHECKED"; ?> /> <strong><?php _e('Enable/Disable Spam Check on Records','wassup'); ?></strong></p>
|
@@ -171,6 +176,7 @@
|
|
171 |
</div>
|
172 |
|
173 |
<div id="wassup_opt_frag-3">
|
|
|
174 |
<h3><?php _e('Temporary files location folder','wassup'); ?></h3>
|
175 |
<p><?php echo '<strong>'.__('Current "Save path" directory for storing temporary files used to track visitor activity','wassup').'</strong>:<br />';
|
176 |
$sessionpath = $wassup_options->wassup_savepath;
|
@@ -191,13 +197,14 @@
|
|
191 |
<br /> <span style="font-size:95%; color:#555;">System default for session.save_path="<?php echo session_save_path(); //debug ?>" from <i>php.ini</i> or from web server configuration.</span>
|
192 |
<br /> <?php echo $sessionwarn."\n"; ?>
|
193 |
</p><br />
|
194 |
-
|
195 |
-
|
196 |
-
|
|
|
197 |
<p><?php _e("Statistical records collected by earlier versions of WassUp may not have the latest spider, search engine, and spam data properly identified. Click the \"Rescan\" button to retroactively scan and update old records","wassup"); ?>.
|
198 |
<br /><input type="button" name="rescan" value="<?php _e('Rescan Old Records','wassup'); ?>" />
|
199 |
</p><br />
|
200 |
-
|
201 |
<br /><h3><?php _e('Select actions for table growth','wassup'); ?></h3>
|
202 |
<p><?php _e("WassUp table grows very fast (especially if your blog is frequently visited), I recommend you to delete old records sometimes. You can select any option below to reset it, delete old records automatically or manually. (If you haven't database space problems you can leave the table as is)","wassup"); ?></p>
|
203 |
<p><?php _e('Current WassUp table usage is','wassup'); ?>:
|
@@ -226,7 +233,81 @@
|
|
226 |
<option value="-6 months"><?php _e("6 months", "wassup") ?></option>
|
227 |
<option value="-1 year"><?php _e("1 year", "wassup") ?></option>
|
228 |
</select></p><br />
|
229 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
230 |
<p style="clear:both;padding-left:0;padding-top:15px;"><input type="submit" name="submit-options3" value="<?php _e('Save Settings','wassup'); ?>" /> <input type="reset" name="reset" value="<?php _e('Reset','wassup'); ?>" /> - <input type="submit" name="reset-to-default" value="<?php _e("Reset to Default Settings", "wassup"); ?>" /></p><br />
|
231 |
</div>
|
232 |
|
3 |
//# settings in the Wassup options menu
|
4 |
?>
|
5 |
<?php
|
|
|
|
|
|
|
|
|
6 |
if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name) {
|
7 |
+
if (!empty($_POST['delete_manual'])) {
|
8 |
+
$to_date = wassup_get_time();
|
9 |
+
$from_date = @strtotime($_POST['delete_manual'], $to_date);
|
10 |
$wpdb->query("DELETE FROM $table_name WHERE timestamp<'$from_date'");
|
11 |
$wpdb->query("OPTIMIZE TABLE $table_name");
|
12 |
}
|
13 |
+
if (!empty($_POST['wassup_empty'])) {
|
14 |
$wpdb->query("DELETE FROM $table_name");
|
15 |
$wpdb->query("OPTIMIZE TABLE $table_name");
|
16 |
}
|
18 |
foreach ($table_status as $fstatus) {
|
19 |
$data_lenght = $fstatus->Data_length;
|
20 |
$data_rows = $fstatus->Rows;
|
21 |
+
$table_engine = (isset($fstatus->Engine)? $fstatus->Engine: 'unknown');
|
22 |
}
|
23 |
$tusage = number_format(($data_lenght/1024/1024), 2, ",", " ");
|
24 |
$tusage2 = ($data_lenght/1024/1024);
|
26 |
|
27 |
$adminemail = get_bloginfo('admin_email');
|
28 |
|
29 |
+
$alert_msg = "";
|
30 |
if ($wassup_options->wassup_remind_flag == 2) {
|
31 |
$alert_msg = '<p style="color:red;font-weight:bold;">'.__('ATTENTION! Your WassUp table have reached the maximum value you set, I disabled the alert, you can re-enable it here.','wassup').'</p>';
|
32 |
$wassup_options->wassup_remind_flag = 0;
|
66 |
else { $tab = "0"; } ?>
|
67 |
<form action="" method="post">
|
68 |
<div id="tabcontainer">
|
69 |
+
<ul style="list-style:none;">
|
70 |
<li><a href="#wassup_opt_frag-1"><span><?php _e("General Setup", "wassup") ?></span></a></li>
|
71 |
<li<?php if ($tab == "2" || isset($_POST['submit-options2'])) { echo ' class="ui-tabs-selected"';} ?>><a href="#wassup_opt_frag-2"><span><?php _e("Statistics Recording", "wassup") ?></span></a></li>
|
72 |
<li<?php if ($tab == "3" || isset($_POST['submit-options3'])) { echo ' class="ui-tabs-selected"';} ?>><a href="#wassup_opt_frag-3"><span><?php _e("Manage Files & Database", "wassup") ?></span></a></li>
|
89 |
<p><input type="checkbox" name="wassup_dashboard_chart" value="1" <?php if($wassup_options->wassup_dashboard_chart == 1) print "CHECKED"; ?> /> <strong><?php _e('Display small chart in the dashboard','wassup'); ?></strong>
|
90 |
</p><br />
|
91 |
|
92 |
+
<br /><h3><?php _e('Time format','wassup'); ?></h3>
|
93 |
+
<p>12h <input type="radio" name="wassup_time_format" value="12" <?php if($wassup_options->wassup_time_format == 12) print "CHECKED"; ?> /> - 24h <input type="radio" name="wassup_time_format" value="24" <?php if($wassup_options->wassup_time_format == 24) print "CHECKED"; ?> /> <strong><?php _e('Time format 12/24 hour','wassup'); ?></strong>
|
94 |
+
</p><br />
|
95 |
+
|
96 |
<br /><h3><?php _e('Visit Detail Settings','wassup'); ?></h3>
|
97 |
<p><strong><?php _e('Chart type - How many axes','wassup'); ?></strong>:
|
98 |
<select name='wassup_chart_type'>
|
130 |
<input type="checkbox" name="topos" value="1" <?php if($top_ten['topos'] == 1) print "CHECKED"; ?> /><?php _e("Top OS", "wassup"); ?> <br />
|
131 |
<input type="checkbox" name="toplocale" value="1" <?php if($top_ten['toplocale'] == 1) print "CHECKED"; ?> /><?php _e("Top Locales", "wassup"); ?></span><br />
|
132 |
</div>
|
133 |
+
<div style="vertical-align:top; float:left; width:225px;">
|
134 |
+
<input type="checkbox" name="topvisitor" value="1" <?php if($top_ten['topvisitor'] == 1) print "CHECKED"; ?> /><?php _e("Top Visitors", "wassup"); ?><br /><!--
|
135 |
<input type="checkbox" name="topfeed" value="1" DISABLED /><?php _e("Top Feeds", "wassup"); ?><br />
|
136 |
+
<input type="checkbox" name="topcrawler" value="1" DISABLED /><?php _e("Top Crawlers", "wassup"); ?> --><br />
|
|
|
137 |
</div>
|
138 |
</div>
|
139 |
</p>
|
155 |
<input type="checkbox" name="wassup_loggedin" value="1" <?php if($wassup_options->wassup_loggedin == 1) print "CHECKED"; ?> /> <?php _e("Record logged in users", "wassup") ?><br />
|
156 |
<input type="checkbox" name="wassup_spider" value="1" <?php if($wassup_options->wassup_spider == 1) print "CHECKED"; ?> /> <?php _e("Record spiders and bots", "wassup") ?><br />
|
157 |
<input type="checkbox" name="wassup_attack" value="1" <?php if($wassup_options->wassup_attack == 1) print "CHECKED"; ?> /> <?php _e("Record attack/exploit attempts (libwww-perl agent)", "wassup") ?><br />
|
158 |
+
<input type="checkbox" name="wassup_hack" value="1" <?php if($wassup_options->wassup_hack == 1) print "CHECKED"; ?> /> <?php _e("Record admin break-in/hacker attempts", "wassup") ?><br />
|
159 |
</span>
|
160 |
</p>
|
161 |
<br /><p><input type="checkbox" name="wassup_spamcheck" value="1" <?php if($wassup_options->wassup_spamcheck == 1 ) print "CHECKED"; ?> /> <strong><?php _e('Enable/Disable Spam Check on Records','wassup'); ?></strong></p>
|
176 |
</div>
|
177 |
|
178 |
<div id="wassup_opt_frag-3">
|
179 |
+
<?php /*
|
180 |
<h3><?php _e('Temporary files location folder','wassup'); ?></h3>
|
181 |
<p><?php echo '<strong>'.__('Current "Save path" directory for storing temporary files used to track visitor activity','wassup').'</strong>:<br />';
|
182 |
$sessionpath = $wassup_options->wassup_savepath;
|
197 |
<br /> <span style="font-size:95%; color:#555;">System default for session.save_path="<?php echo session_save_path(); //debug ?>" from <i>php.ini</i> or from web server configuration.</span>
|
198 |
<br /> <?php echo $sessionwarn."\n"; ?>
|
199 |
</p><br />
|
200 |
+
*/ ?>
|
201 |
+
<?php //TODO ?>
|
202 |
+
<!--
|
203 |
+
<br /><h3><?php _e('Rescan Old Records','wassup'); ?></h3>
|
204 |
<p><?php _e("Statistical records collected by earlier versions of WassUp may not have the latest spider, search engine, and spam data properly identified. Click the \"Rescan\" button to retroactively scan and update old records","wassup"); ?>.
|
205 |
<br /><input type="button" name="rescan" value="<?php _e('Rescan Old Records','wassup'); ?>" />
|
206 |
</p><br />
|
207 |
+
-->
|
208 |
<br /><h3><?php _e('Select actions for table growth','wassup'); ?></h3>
|
209 |
<p><?php _e("WassUp table grows very fast (especially if your blog is frequently visited), I recommend you to delete old records sometimes. You can select any option below to reset it, delete old records automatically or manually. (If you haven't database space problems you can leave the table as is)","wassup"); ?></p>
|
210 |
<p><?php _e('Current WassUp table usage is','wassup'); ?>:
|
233 |
<option value="-6 months"><?php _e("6 months", "wassup") ?></option>
|
234 |
<option value="-1 year"><?php _e("1 year", "wassup") ?></option>
|
235 |
</select></p><br />
|
236 |
+
|
237 |
+
<br /><h3><?php _e("Server Settings and Memory Resources","wassup"); ?></h3>
|
238 |
+
<p style="color:#555; margin-top:0; padding-top:0;"><?php _e('For information only. Some values may be adjustable in PHP startup file, php.ini or php5.ini','wassup'); ?>.</p>
|
239 |
+
<p><strong>WordPress <?php _e('Version','wassup'); ?></strong>: <?php echo $wp_version; ?></p>
|
240 |
+
<p style="padding-top:5px;"><strong>MySQL <?php _e('Version','wassup'); ?></strong>:
|
241 |
+
<?php $sqlversion = $wpdb->get_var("SELECT VERSION() AS version");
|
242 |
+
if (!empty($sqlversion)) { echo $sqlversion; }
|
243 |
+
else { _e("unknown","wassup"); }
|
244 |
+
?></p>
|
245 |
+
<p><strong>MySQL <?php _e('Engine','wassup'); ?></strong>:
|
246 |
+
<?php if (!empty($table_engine)) { echo $table_engine; }
|
247 |
+
else { _e("unknown","wassup"); }
|
248 |
+
?></p>
|
249 |
+
<!--
|
250 |
+
<p><strong>MySQL <?php _e('Query Cache Limit','wassup'); ?></strong>:
|
251 |
+
<?php $sqlquery = $wpdb->get_col("SHOW VARIABLES LIKE 'query_cache_limit'");
|
252 |
+
if (!empty($sqlquery)) {
|
253 |
+
$query_cache="";
|
254 |
+
foreach ($sqlquery as $fcache) {
|
255 |
+
$query_cache = $fcache;
|
256 |
+
}
|
257 |
+
if (is_numeric($query_cache)) {
|
258 |
+
echo ($query_cache/1024/1024) . "M";
|
259 |
+
} else {
|
260 |
+
echo $query_cache;
|
261 |
+
}
|
262 |
+
} else {
|
263 |
+
_e("unknown","wassup");
|
264 |
+
}
|
265 |
+
?></p>
|
266 |
+
-->
|
267 |
+
<p style="padding-top:5px;"><strong>PHP <?php _e("Version","wassup"); ?></strong>: <?php echo PHP_VERSION; ?></p>
|
268 |
+
<p><strong>PHP <?php _e("Safe Mode", "wassup"); ?> : </strong>
|
269 |
+
<?php if (ini_get("safe_mode")) { _e("on","wassup"); }
|
270 |
+
else { _e("off","wassup"); }
|
271 |
+
?></p>
|
272 |
+
<p><strong>PHP <?php _e("Memory Allocation","wassup"); ?></strong>:
|
273 |
+
<?php
|
274 |
+
$memory_use=0;
|
275 |
+
if (function_exists("memory_get_usage")) {
|
276 |
+
$memory_use=round(memory_get_usage()/1024/1024,2);
|
277 |
+
}
|
278 |
+
$memory_limit = ini_get("memory_limit");
|
279 |
+
if (preg_match('/^(\d+){1,4}(\w?)/',$memory_limit,$matches) > 0) {
|
280 |
+
$mem=(int)$matches[1];
|
281 |
+
if ( $mem < 12 && $matches[2] == "M") {
|
282 |
+
print '<span style="'.$alertstyle.'">'.$memory_limit."</span>";
|
283 |
+
} else {
|
284 |
+
echo $memory_limit;
|
285 |
+
}
|
286 |
+
} else {
|
287 |
+
$memory_limit=0; _e("unknown","wassup");
|
288 |
+
}
|
289 |
+
?></p>
|
290 |
+
<p><strong>PHP <?php _e("Memory Usage","wassup"); ?></strong>:
|
291 |
+
<?php
|
292 |
+
if ($memory_limit >0 && ($memory_limit-$memory_use) < 2) {
|
293 |
+
print '<span style="'.$alertstyle.'">'.$memory_use."M</span>";
|
294 |
+
} elseif ($memory_use >0) {
|
295 |
+
echo $memory_use."M";
|
296 |
+
} else {
|
297 |
+
_e("unknown","wassup");
|
298 |
+
}
|
299 |
+
?></p>
|
300 |
+
<p><strong>PHP <?php _e("Script Timeout Limit","wassup"); ?></strong> (in seconds):
|
301 |
+
<?php $max_execute = ini_get("max_execution_time");
|
302 |
+
if (!empty($max_execute)) { echo $max_execute; }
|
303 |
+
else { _e("unknown","wassup"); }
|
304 |
+
?></p>
|
305 |
+
<p><strong>PHP <?php _e("Browser Capabilities File","wassup"); ?></strong> (browscap):
|
306 |
+
<?php $browscap = ini_get("browscap");
|
307 |
+
if ( $browscap == "") { _e("not set","wassup"); }
|
308 |
+
else { echo basename($browscap); }
|
309 |
+
?></p>
|
310 |
+
<br /><br />
|
311 |
<p style="clear:both;padding-left:0;padding-top:15px;"><input type="submit" name="submit-options3" value="<?php _e('Save Settings','wassup'); ?>" /> <input type="reset" name="reset" value="<?php _e('Reset','wassup'); ?>" /> - <input type="submit" name="reset-to-default" value="<?php _e("Reset to Default Settings", "wassup"); ?>" /></p><br />
|
312 |
</div>
|
313 |
|
lib/wassup.class.php
CHANGED
@@ -14,13 +14,15 @@ class wassupOptions {
|
|
14 |
var $wassup_default_type = "";
|
15 |
var $wassup_default_limit = "10";
|
16 |
var $wassup_top10 ;
|
17 |
-
var $wassup_dashboard_chart;
|
|
|
18 |
|
19 |
/* recording settings */
|
20 |
var $wassup_active = "1";
|
21 |
var $wassup_loggedin = "1";
|
22 |
var $wassup_spider = "1";
|
23 |
var $wassup_attack = "1";
|
|
|
24 |
var $wassup_exclude;
|
25 |
var $wassup_exclude_url;
|
26 |
|
@@ -76,6 +78,7 @@ class wassupOptions {
|
|
76 |
$this->wassup_loggedin = "1";
|
77 |
$this->wassup_spider = "1";
|
78 |
$this->wassup_attack = "1";
|
|
|
79 |
$this->wassup_spamcheck = "1";
|
80 |
$this->wassup_spam = "1";
|
81 |
$this->wassup_refspam = "1";
|
@@ -94,6 +97,7 @@ class wassupOptions {
|
|
94 |
$this->wassup_default_type = "everything";
|
95 |
$this->wassup_default_limit = "10";
|
96 |
$this->wassup_dashboard_chart = "0";
|
|
|
97 |
$this->wassup_widget_title = "Visitors Online";
|
98 |
$this->wassup_widget_ulclass = "links";
|
99 |
$this->wassup_widget_loggedin = "1";
|
@@ -188,10 +192,10 @@ class wassupOptions {
|
|
188 |
__("One - two lines chart one axis","wassup"),
|
189 |
__("Two - two lines chart two axes","wassup"));
|
190 |
} elseif ($key == "wassup_default_type") {
|
191 |
-
$item_options = array("everything","
|
192 |
$item_options_meta = array(
|
193 |
__("Everything","wassup"),
|
194 |
-
__("
|
195 |
__("No spider","wassup"),
|
196 |
__("Spam","wassup"),
|
197 |
__("No Spam","wassup"),
|
14 |
var $wassup_default_type = "";
|
15 |
var $wassup_default_limit = "10";
|
16 |
var $wassup_top10 ;
|
17 |
+
var $wassup_dashboard_chart;
|
18 |
+
var $wassup_time_format; //new
|
19 |
|
20 |
/* recording settings */
|
21 |
var $wassup_active = "1";
|
22 |
var $wassup_loggedin = "1";
|
23 |
var $wassup_spider = "1";
|
24 |
var $wassup_attack = "1";
|
25 |
+
var $wassup_hack = "1"; //new - to identify/record break-in attempts
|
26 |
var $wassup_exclude;
|
27 |
var $wassup_exclude_url;
|
28 |
|
78 |
$this->wassup_loggedin = "1";
|
79 |
$this->wassup_spider = "1";
|
80 |
$this->wassup_attack = "1";
|
81 |
+
$this->wassup_hack = "1";
|
82 |
$this->wassup_spamcheck = "1";
|
83 |
$this->wassup_spam = "1";
|
84 |
$this->wassup_refspam = "1";
|
97 |
$this->wassup_default_type = "everything";
|
98 |
$this->wassup_default_limit = "10";
|
99 |
$this->wassup_dashboard_chart = "0";
|
100 |
+
$this->wassup_time_format = "24";
|
101 |
$this->wassup_widget_title = "Visitors Online";
|
102 |
$this->wassup_widget_ulclass = "links";
|
103 |
$this->wassup_widget_loggedin = "1";
|
192 |
__("One - two lines chart one axis","wassup"),
|
193 |
__("Two - two lines chart two axes","wassup"));
|
194 |
} elseif ($key == "wassup_default_type") {
|
195 |
+
$item_options = array("everything","spider","nospider","spam","nospam","nospamspider","loggedin","comauthor","searchengine","referrer");
|
196 |
$item_options_meta = array(
|
197 |
__("Everything","wassup"),
|
198 |
+
__("Spider","wassup"),
|
199 |
__("No spider","wassup"),
|
200 |
__("Spam","wassup"),
|
201 |
__("No Spam","wassup"),
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: michelem, helened
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=michele%40befree%2eit&item_name=wp%2dstatpress&no_shipping=0&no_note=1&tax=0¤cy_code=EUR&lc=IT&bn=PP%2dDonationsBF&charset=UTF%2d8
|
4 |
Tags: tracker, tracking, statistics, analyze, web, realtime, stats, ajax, visitors, visits, online users, details, seo, admin, spy, visitors, widgets, widget, sidebar
|
5 |
Requires at least: 2.2
|
6 |
-
Tested up to: 2.5 - 2.3.2 - 2.3.1 - 2.3 - 2.2
|
7 |
-
Stable tag: 1.6
|
8 |
|
9 |
Analyze your visitors traffic with real time statistics, chart, a lot of chronological information and a sidebar Widget.
|
10 |
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=michele%40befree%2eit&item_name=wp%2dstatpress&no_shipping=0&no_note=1&tax=0¤cy_code=EUR&lc=IT&bn=PP%2dDonationsBF&charset=UTF%2d8
|
4 |
Tags: tracker, tracking, statistics, analyze, web, realtime, stats, ajax, visitors, visits, online users, details, seo, admin, spy, visitors, widgets, widget, sidebar
|
5 |
Requires at least: 2.2
|
6 |
+
Tested up to: 2.5.* - 2.3.2 - 2.3.1 - 2.3 - 2.2
|
7 |
+
Stable tag: 1.6.1
|
8 |
|
9 |
Analyze your visitors traffic with real time statistics, chart, a lot of chronological information and a sidebar Widget.
|
10 |
|
wassup.php
CHANGED
@@ -3,8 +3,8 @@
|
|
3 |
Plugin Name: WassUp
|
4 |
Plugin URI: http://www.wpwp.org
|
5 |
Description: Wordpress plugin to analyze your visitors traffic with real time stats, chart and a lot of chronological informations. It has sidebar Widget support to show current online visitors and other statistics.
|
6 |
-
Version: 1.6
|
7 |
-
Author: Michele Marcucci
|
8 |
Author URI: http://www.michelem.org/
|
9 |
|
10 |
Copyright (c) 2007 Michele Marcucci
|
@@ -16,7 +16,7 @@ http://www.gnu.org/licenses/gpl.txt
|
|
16 |
if (preg_match('#'.basename(__FILE__) .'#', $_SERVER['PHP_SELF'])) {
|
17 |
die('Permission Denied! You are not allowed to call this page directly.');
|
18 |
}
|
19 |
-
$version = "1.6";
|
20 |
define('WASSUPFOLDER', dirname(plugin_basename(__FILE__)), TRUE);
|
21 |
require_once(dirname(__FILE__).'/lib/wassup.class.php');
|
22 |
require_once(dirname(__FILE__).'/lib/main.php');
|
@@ -39,6 +39,8 @@ if (version_compare($wp_version, '2.2', '<')) {
|
|
39 |
// -Helene D. 2/26/08.
|
40 |
function wassup_install() {
|
41 |
global $wpdb;
|
|
|
|
|
42 |
|
43 |
//### Add/update wassup settings in Wordpress options table
|
44 |
$wassup_options = new wassupOptions; //#settings initialized here
|
@@ -90,12 +92,20 @@ function wassup_install() {
|
|
90 |
"topvisitor"=>"0",
|
91 |
"topreferrer_exclude"=>""));
|
92 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
$wassup_options->saveSettings();
|
94 |
|
95 |
//### Detect problems with WassUp install and show warning
|
96 |
//#
|
97 |
//#Check for problems with 'session_savepath' and disable
|
98 |
//# recording, if found. -Helene D. 2/24/08
|
|
|
99 |
$sessionpath = $wassup_options->wassup_savepath;
|
100 |
if (empty($sessionpath)) { $sessionpath = getSessionpath(); }
|
101 |
//default to "/tmp" if no sessionpath value
|
@@ -103,37 +113,28 @@ function wassup_install() {
|
|
103 |
$sessionpath = "/tmp";
|
104 |
$wassup_options->wassup_savepath = $sessionpath;
|
105 |
}
|
106 |
-
|
107 |
if ($wassup_options->wassup_active == "1") {
|
108 |
$wassup_options->wassup_active = "0";
|
109 |
$wassup_options->wassup_alert_message = __('WassUp has detected a problem with "session.save_path" setting in your Wordpress/PHP configuration. Statistics logging has been disabled as a result. To fix, go to admin menu, "Wassup-->Options-->Manage Files & Database" and modify "Temporary files location folder".','wassup');
|
110 |
} else {
|
111 |
$wassup_options->wassup_alert_message = __('WassUp has detected a problem with "session.save_path" setting in your Wordpress/PHP configuration. Please fix by modifying "Temporary files location folder" in admin menu, "Wassup-->Options-->Manage Files & Database".','wassup');
|
112 |
}
|
113 |
-
}
|
114 |
$wassup_options->saveSettings();
|
115 |
unset($sessionpath); //because "install" works in global scope
|
116 |
-
|
117 |
//# TODO:
|
118 |
//###Detect known incompatible plugins like "wp_cache" and disable
|
119 |
//# recordings and show warning message...
|
120 |
|
121 |
//### Create/upgrade wassup MAIN table
|
122 |
-
$table_name = $wpdb->prefix . "wassup";
|
123 |
if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
|
124 |
-
CreateTable(
|
125 |
-
CreateTable(
|
126 |
} else {
|
127 |
UpdateTable(); //<== wassup_tmp is added here, if missing
|
128 |
}
|
129 |
-
//Double-check that wassup tables were created, then create table
|
130 |
-
// without charset, if needed
|
131 |
-
if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
|
132 |
-
CreateTable("wassup",false);
|
133 |
-
CreateTable("wassup_tmp",false);
|
134 |
-
} elseif ($wpdb->get_var("SHOW TABLES LIKE '$table_tmp_name'") != $table_tmp_name) {
|
135 |
-
CreateTable("wassup_tmp",false);
|
136 |
-
}
|
137 |
} //#end function wassup_install
|
138 |
|
139 |
//set global variables that are dependent on Wassup's wp_options values
|
@@ -150,8 +151,10 @@ function wassup_uninstall() {
|
|
150 |
if ($wassup_options->wassup_uninstall == "1") {
|
151 |
$table_name = $wpdb->prefix . "wassup";
|
152 |
$table_tmp_name = $wpdb->prefix . "wassup_tmp";
|
153 |
-
|
154 |
-
|
|
|
|
|
155 |
$wassup_options->deleteSettings();
|
156 |
}
|
157 |
} //#end function wassup_uninstall
|
@@ -221,9 +224,10 @@ function add_wassup_css() {
|
|
221 |
//Add css and javascript to wassup menu pages only...
|
222 |
if ($plugin_page == "wassup") {
|
223 |
//$wassup_settings = get_option('wassup_settings');
|
|
|
224 |
echo "\n".'<link rel="stylesheet" href="'.$wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/thickbox/thickbox.css'.'" type="text/css" />';
|
225 |
echo "\n".'<link rel="stylesheet" href="'.$wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/ui.tabs.css'.'" type="text/css" />';
|
226 |
-
echo "\n".'<link rel="stylesheet" href="'.$wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/wassup.css'.'" type="text/css" />';
|
227 |
|
228 |
if ($_GET['page'] != "wassup-options" AND $_GET['page'] != "wassup-spy") { ?>
|
229 |
<script type='text/javascript'>
|
@@ -418,15 +422,9 @@ function WassUp() {
|
|
418 |
global $wpdb, $wp_version, $version, $wpurl, $wassup_options, $whash;
|
419 |
|
420 |
//#debug...
|
421 |
-
//error_reporting(E_ALL); //debug
|
422 |
//ini_set('display_errors','On'); //debug
|
423 |
-
|
424 |
-
//assign a value to whash, if none
|
425 |
-
//if ($whash == "") {
|
426 |
-
// $whash = $wassup_options->get_wp_hash();
|
427 |
-
// $wassup_options->whash = $whash; //save new whash
|
428 |
-
// $wassup_options->saveSettings();
|
429 |
-
//}
|
430 |
|
431 |
$table_name = $wpdb->prefix . "wassup";
|
432 |
$table_tmp_name = $wpdb->prefix . "wassup_tmp";
|
@@ -449,6 +447,7 @@ function WassUp() {
|
|
449 |
$wassup_options->wassup_loggedin = $_POST['wassup_loggedin'];
|
450 |
$wassup_options->wassup_spider = $_POST['wassup_spider'];
|
451 |
$wassup_options->wassup_attack = $_POST['wassup_attack'];
|
|
|
452 |
$wassup_options->wassup_spamcheck = $_POST['wassup_spamcheck'];
|
453 |
$wassup_options->wassup_spam = $_POST['wassup_spam'];
|
454 |
$wassup_options->wassup_refspam = $_POST['wassup_refspam'];
|
@@ -460,6 +459,7 @@ function WassUp() {
|
|
460 |
$wassup_options->wassup_refresh = $_POST['wassup_refresh'];
|
461 |
$wassup_options->wassup_userlevel = $_POST['wassup_userlevel'];
|
462 |
$wassup_options->wassup_dashboard_chart = $_POST['wassup_dashboard_chart'];
|
|
|
463 |
$wassup_options->wassup_default_type = $_POST['wassup_default_type'];
|
464 |
$wassup_options->wassup_default_limit = $_POST['wassup_default_limit'];
|
465 |
$top_ten = array("topsearch" => $_POST['topsearch'],
|
@@ -468,18 +468,18 @@ function WassUp() {
|
|
468 |
"topbrowser" => $_POST['topbrowser'],
|
469 |
"topos" => $_POST['topos'],
|
470 |
"toplocale" => $_POST['toplocale'],
|
|
|
471 |
"topfeed" => "0",
|
472 |
"topcrawler" => "0",
|
473 |
-
"topvisitor" => "0",
|
474 |
"topreferrer_exclude" => $_POST['topreferrer_exclude']);
|
475 |
$wassup_options->wassup_top10 = serialize($top_ten);
|
476 |
-
if ( $_POST['wassup_savepath'] != $wassup_options->wassup_savepath ) {
|
477 |
if (empty($_POST['wassup_savepath']) || rtrim($_POST['wassup_savepath'],"/") == getSessionpath()) {
|
478 |
$wassup_options->wassup_savepath = NULL;
|
479 |
} else {
|
480 |
$wassup_options->setSavepath($_POST['wassup_savepath']);
|
481 |
}
|
482 |
-
}
|
483 |
if ($wassup_options->saveSettings()) {
|
484 |
$admin_message = __("Wassup options updated successfully","wassup")."." ;
|
485 |
}
|
@@ -536,6 +536,9 @@ function WassUp() {
|
|
536 |
$wassup_options->wassup_alert_message = "";
|
537 |
$wassup_options->saveSettings();
|
538 |
}
|
|
|
|
|
|
|
539 |
|
540 |
//moved max-width to single "wrap" div and removed it from
|
541 |
// the individual spans and divs in style.php... ?>
|
@@ -555,8 +558,11 @@ function WassUp() {
|
|
555 |
if ($currenttot > 0) {
|
556 |
$qryC = $wpdb->get_results("SELECT id, wassup_id, max(timestamp) as max_timestamp, ip, hostname, searchengine, urlrequested, agent, referrer, spider, username, comment_author FROM $table_tmp_name WHERE `timestamp` BETWEEN $from_date AND $to_date GROUP BY ip ORDER BY max_timestamp DESC");
|
557 |
foreach ($qryC as $cv) {
|
558 |
-
|
559 |
-
|
|
|
|
|
|
|
560 |
$ip_proxy = strpos($cv->ip,",");
|
561 |
//if proxy, get 2nd ip...
|
562 |
if ($ip_proxy !== false) {
|
@@ -612,7 +618,6 @@ function WassUp() {
|
|
612 |
$qryCD = $wpdb->get_results("SELECT `timestamp`, urlrequested FROM $table_tmp_name WHERE wassup_id='".$cv->wassup_id."' ORDER BY `timestamp` ASC");
|
613 |
$i=0;
|
614 |
foreach ($qryCD as $cd) {
|
615 |
-
//$timestamp2 = $cd->timestamp; //redundant
|
616 |
$time2 = gmdate("H:i:s", $cd->timestamp);
|
617 |
$num = ($i&1);
|
618 |
$char_len = round($max_char_len*.9,0);
|
@@ -731,7 +736,6 @@ function WassUp() {
|
|
731 |
|
732 |
//## Filter detail lists by a specific page and number
|
733 |
//# of items per page...
|
734 |
-
//#number of items on page
|
735 |
$items = 10; //default
|
736 |
if (isset($_GET['limit']) && is_numeric($_GET['limit'])) {
|
737 |
//$items = htmlentities(attribute_escape($_GET['limit']));
|
@@ -760,8 +764,7 @@ function WassUp() {
|
|
760 |
}
|
761 |
|
762 |
// DELETE EVERY RECORD MARKED BY IP
|
763 |
-
//#
|
764 |
-
//# -Helene D. 3/4/08.
|
765 |
if (!empty($_GET['deleteMARKED']) && $wassup_options->wmark == "1" ) {
|
766 |
$rec_deleted = $wpdb->get_var("SELECT COUNT(ip) as deleted FROM $table_name WHERE ip='".urlencode(attribute_escape($_GET['dip']))."' AND `timestamp` BETWEEN $from_date AND $to_date");
|
767 |
if (method_exists($wpdb,'prepare')) {
|
@@ -813,9 +816,17 @@ function WassUp() {
|
|
813 |
<img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/chart_add.png" style="padding:0px 6px 0 0;" alt="'.__('show chart','wassup').'" title="'.__('Show the chart and site usage','wassup'); ?>" /></a>
|
814 |
<?php }
|
815 |
|
816 |
-
|
817 |
-
|
818 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
819 |
_e('Summary for the last','wassup'); ?>
|
820 |
<select style="font-size: 11px;" name="last" onChange="window.location.href=this.options[this.selectedIndex].value;">
|
821 |
<?php
|
@@ -872,7 +883,8 @@ function WassUp() {
|
|
872 |
</div>
|
873 |
<?php } //end if wassup_chart == 1
|
874 |
|
875 |
-
if ($_GET['limit']
|
|
|
876 |
$expcol = '
|
877 |
<table width="100%"><tr>
|
878 |
<td align="left" class="legend"><a href="#" class="toggle-all">'.__('Expand All','wassup').'</a></td>
|
@@ -939,8 +951,13 @@ function WassUp() {
|
|
939 |
foreach ($main as $rk) {
|
940 |
$timestampF = $rk->max_timestamp;
|
941 |
$dateF = gmdate("d M Y", $timestampF);
|
942 |
-
$
|
943 |
-
|
|
|
|
|
|
|
|
|
|
|
944 |
//$ip = @explode(",", $rk->ip);
|
945 |
$ip_proxy = strpos($rk->ip,",");
|
946 |
//if proxy, get 2nd ip...
|
@@ -1101,14 +1118,19 @@ function WassUp() {
|
|
1101 |
<?php }
|
1102 |
} ?>
|
1103 |
<?php // Referer is a SPAM
|
1104 |
-
if ($rk->spam > 0) { ?>
|
1105 |
<ul class="spam">
|
1106 |
<li class="spam"><span class="indent-li-agent">
|
1107 |
<?php _e("Probably SPAM!","wassup");
|
1108 |
-
if ($rk->spam==
|
1109 |
-
|
1110 |
</span></li>
|
1111 |
</ul>
|
|
|
|
|
|
|
|
|
|
|
1112 |
<?php } ?>
|
1113 |
<?php // User os/browser/language
|
1114 |
if ($rk->spider == "" AND ($rk->os != "" OR $rk->browser != "")) {
|
@@ -1156,7 +1178,7 @@ function WassUp() {
|
|
1156 |
print '<br />';
|
1157 |
if ($itemstot >= 10) $p->show();
|
1158 |
print '<br />';
|
1159 |
-
if ($_GET['limit']
|
1160 |
print $expcol;
|
1161 |
}
|
1162 |
|
@@ -1168,22 +1190,31 @@ function WassUp() {
|
|
1168 |
<?php
|
1169 |
} //end function Wassup
|
1170 |
|
1171 |
-
function CreateTable($
|
1172 |
global $wpdb;
|
1173 |
$charset_collate = '';
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1178 |
$charset_collate .= " COLLATE $wpdb->collate";
|
|
|
|
|
|
|
|
|
1179 |
}
|
1180 |
-
$table_name = $wpdb->prefix . $newtable;
|
1181 |
$sql_createtable = "CREATE TABLE " . $table_name . " (
|
1182 |
id mediumint(9) NOT NULL auto_increment,
|
1183 |
-
wassup_id varchar(
|
1184 |
timestamp varchar(20) NOT NULL,
|
1185 |
ip varchar(35) default NULL,
|
1186 |
-
hostname varchar(
|
1187 |
urlrequested text,
|
1188 |
agent varchar(255) default NULL,
|
1189 |
referrer text default NULL,
|
@@ -1193,70 +1224,82 @@ function CreateTable($newtable="wassup",$withcharset=true) {
|
|
1193 |
browser varchar(50) default NULL,
|
1194 |
language varchar(5) default NULL,
|
1195 |
screen_res varchar(15) default NULL,
|
1196 |
-
searchengine varchar(
|
1197 |
spider varchar(50) default NULL,
|
1198 |
-
feed varchar(
|
1199 |
-
username VARCHAR(
|
1200 |
-
comment_author VARCHAR(
|
1201 |
spam VARCHAR(5) default 0,
|
1202 |
UNIQUE KEY id (id),
|
1203 |
-
KEY
|
|
|
|
|
1204 |
INDEX (timestamp)
|
1205 |
) $charset_collate;";
|
1206 |
require_once( ABSPATH.'wp-admin/upgrade-functions.php');
|
1207 |
-
|
|
|
|
|
1208 |
} //end function createTable
|
1209 |
|
1210 |
function UpdateTable() {
|
1211 |
global $wpdb, $wassup_options;
|
1212 |
$table_name = $wpdb->prefix . "wassup";
|
|
|
|
|
|
|
1213 |
|
1214 |
-
|
1215 |
-
|
1216 |
-
|
1217 |
-
|
1218 |
-
if ($result) {
|
1219 |
-
$row_count = mysql_num_rows($result);
|
1220 |
-
if ($row_count > 0) {
|
1221 |
-
//# look for an index on 'timestamp'
|
1222 |
-
$timestamp_idx = false;
|
1223 |
-
while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
|
1224 |
-
if ($row["Column_name"] == "timestamp") {
|
1225 |
-
$timestamp_idx = true;
|
1226 |
-
}
|
1227 |
-
}
|
1228 |
-
//# create an index on 'timestamp'
|
1229 |
-
if (!$timestamp_idx) {
|
1230 |
-
$sql_query = "ALTER TABLE $table_name ADD INDEX (timestamp)";
|
1231 |
-
$wpdb->query( $sql_query );
|
1232 |
-
}
|
1233 |
-
} //end if row_count
|
1234 |
-
mysql_free_result($result);
|
1235 |
}
|
1236 |
|
1237 |
-
|
1238 |
-
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1242 |
|
1243 |
// Upgrade from version <= 1.5.1 - increase size of wassup_id
|
1244 |
$wassup_col = $wpdb->get_results("SHOW COLUMNS FROM $table_name LIKE 'wassup_id'");
|
1245 |
foreach ($wassup_col as $wID) {
|
1246 |
-
if ($wID->Type != "varchar(
|
1247 |
-
$wpdb->query("ALTER TABLE {$table_name} CHANGE wassup_id wassup_id varchar(
|
1248 |
}
|
1249 |
}
|
1250 |
-
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
}
|
|
|
1255 |
}
|
1256 |
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
|
|
|
|
|
|
|
|
1260 |
|
1261 |
//Set Wassup_id and cookie (before headers sent)
|
1262 |
function wassupPrepend() {
|
@@ -1277,7 +1320,7 @@ function wassupPrepend() {
|
|
1277 |
$hostname = "";
|
1278 |
//#### Get the visitor's details from http header...
|
1279 |
if (isset($_SERVER["REMOTE_ADDR"])) {
|
1280 |
-
if ($_SERVER["HTTP_X_FORWARDED_FOR"]
|
1281 |
//in case of multiple forwarding
|
1282 |
list($IP) = explode(",",$_SERVER["HTTP_X_FORWARDED_FOR"]);
|
1283 |
$proxy = $_SERVER["REMOTE_ADDR"];
|
@@ -1285,7 +1328,12 @@ function wassupPrepend() {
|
|
1285 |
if (empty($hostname) || $hostname == "unknown") {
|
1286 |
$hostname = @gethostbyaddr($proxy);
|
1287 |
}
|
1288 |
-
$
|
|
|
|
|
|
|
|
|
|
|
1289 |
}else{
|
1290 |
list($IP) = explode(",",$_SERVER["REMOTE_ADDR"]);
|
1291 |
$hostname = @gethostbyaddr($IP);
|
@@ -1295,12 +1343,15 @@ function wassupPrepend() {
|
|
1295 |
if (empty($IP)) { $IP = $ipAddress; }
|
1296 |
if (empty($hostname)) { $hostname = "unknown"; }
|
1297 |
$userAgent = (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '');
|
|
|
|
|
1298 |
//# Create a new wassup id for this visit from a
|
1299 |
//# combination of date/hour/min/ip/hostname/useragent/.
|
1300 |
//# It is not unique so that multiple visits from the
|
1301 |
//# same ip/userAgent within a 30 minute-period, can be
|
1302 |
//# tracked, even when session/cookies is disabled.
|
1303 |
-
$temp_id = sprintf("%-060.60s", date('YmdH').str_replace(array(' ','http://','www.','/','.','\'','"',"\\",'$','-','&','+','_',';',',','>','<',':','#','*','%','!','@',')','(',), '', intval(date('i')/30).$IP.strrev($userAgent).strrev($hostname).intval(date('i')/30)).date('HdmY').$hostname.rand());
|
|
|
1304 |
|
1305 |
//Work-around for cookie rejection:
|
1306 |
//#assign new wassup id from "temp_id"
|
@@ -1326,12 +1377,21 @@ function wassupAppend() {
|
|
1326 |
$table_name = $wpdb->prefix . "wassup";
|
1327 |
$table_tmp_name = $wpdb->prefix . "wassup_tmp";
|
1328 |
$wassup_settings = get_option('wassup_settings');
|
|
|
|
|
|
|
1329 |
|
1330 |
-
if (
|
|
|
|
|
|
|
|
|
|
|
|
|
1331 |
|
1332 |
//#### Get the visitor's details from http header...
|
1333 |
if (isset($_SERVER["REMOTE_ADDR"])) {
|
1334 |
-
if ($_SERVER["HTTP_X_FORWARDED_FOR"]
|
1335 |
//in case of multiple forwarding
|
1336 |
list($IP) = explode(",",$_SERVER["HTTP_X_FORWARDED_FOR"]);
|
1337 |
$proxy = $_SERVER["REMOTE_ADDR"];
|
@@ -1339,7 +1399,12 @@ function wassupAppend() {
|
|
1339 |
if (empty($hostname) || $hostname == "unknown") {
|
1340 |
$hostname = @gethostbyaddr($proxy);
|
1341 |
}
|
1342 |
-
$
|
|
|
|
|
|
|
|
|
|
|
1343 |
}else{
|
1344 |
list($IP) = explode(",",$_SERVER["REMOTE_ADDR"]);
|
1345 |
$hostname = @gethostbyaddr($IP);
|
@@ -1377,13 +1442,12 @@ function wassupAppend() {
|
|
1377 |
}
|
1378 |
*/
|
1379 |
|
1380 |
-
$urlRequested = clean_url($_SERVER['REQUEST_URI']);
|
1381 |
$referrer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '');
|
1382 |
$userAgent = (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '');
|
1383 |
$language = (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? attribute_escape($_SERVER['HTTP_ACCEPT_LANGUAGE']) : '');
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
|
1388 |
$timestamp = wassup_get_time(); //Add a timestamp to visit...
|
1389 |
$flag_exclude_url = 0;
|
@@ -1407,14 +1471,13 @@ function wassupAppend() {
|
|
1407 |
|
1408 |
//### Exclude requests for themes, plugins, and favicon from recordings
|
1409 |
if (stristr($urlRequested,"favicon.ico") === FALSE) { //moved
|
1410 |
-
if (stristr($urlRequested,"/wp-content/plugins") === FALSE || stristr($urlRequested,"forum") !== FALSE ) { //moved and modified to allow forum requests
|
1411 |
-
if (stristr($urlRequested,"/wp-content/themes") === FALSE || stristr($urlRequested,"comment") !== FALSE
|
1412 |
-
|
1413 |
|
1414 |
//# More recording exclusion controls
|
1415 |
-
if ($wassup_options->wassup_loggedin == 1 ||
|
1416 |
if ($wassup_options->wassup_attack == 1 || stristr($userAgent,"libwww-perl") === FALSE ) {
|
1417 |
-
if (!is_404()) { //don't record 404 pages...
|
1418 |
|
1419 |
//##### Extract useful visit information from http header..
|
1420 |
$browser = "";
|
@@ -1430,7 +1493,7 @@ function wassupAppend() {
|
|
1430 |
//# ip/userAgent within a 30 minute-period, can be tracked as
|
1431 |
//# such, even when session/cookies is disabled.
|
1432 |
//# An md5 encoded version of temp_id is saved as "wassup_id".
|
1433 |
-
$temp_id = sprintf("%-060.60s", date('YmdH').str_replace(array(' ','http://','www.','/','.','\'','"',"\\",'$','-','&','+','_',';',',','>','<',':','#','*','%','!','@',')','(',), '', intval(date('i')/30).$IP.strrev($userAgent).strrev($hostname).intval(date('i')/30)).date('HdmY').$hostname.rand());
|
1434 |
$wassup_id = "";
|
1435 |
//Read the cookie for wassup_id
|
1436 |
if (isset($_COOKIE['wassup'])) {
|
@@ -1519,8 +1582,8 @@ function wassupAppend() {
|
|
1519 |
}
|
1520 |
//### Check for duplicates.
|
1521 |
$dup_urlrequest=0;
|
1522 |
-
// Dup: Hit recorded, ==wassup_id, last visit, <
|
1523 |
-
$dups = $wpdb->get_results("SELECT wassup_id, urlrequested, spam, `timestamp` AS hit_timestamp FROM ".$table_tmp_name." WHERE wassup_id='".$wassup_id."' AND `timestamp` >".($timestamp-
|
1524 |
if (!empty($dups)) {
|
1525 |
$i=0;
|
1526 |
foreach ($dups as $dup) { //check first record only
|
@@ -1541,27 +1604,20 @@ function wassupAppend() {
|
|
1541 |
//### Exclude duplicates...
|
1542 |
if ($dup_urlrequest == 0) {
|
1543 |
//##### Extract useful visit information from http header..
|
1544 |
-
if (empty($browser) ||
|
1545 |
-
list($spider,$feed) = wGetSpider($userAgent,$hostname);
|
1546 |
}
|
1547 |
|
1548 |
//#I prefer to see os/browser info. for spiders/bots.
|
1549 |
|
1550 |
//spider exclusion control
|
1551 |
-
//# Spider exclusion control moved to avoid unneeded tests
|
1552 |
if ($wassup_options->wassup_spider == 1 || $spider == '') {
|
1553 |
//
|
1554 |
-
//#
|
1555 |
-
|
1556 |
-
$country = strtoupper(substr($hostname,-2));
|
1557 |
-
if ($country == "UK") { $country = "GB"; } //change UK to GB for consistent language codes
|
1558 |
-
$language = array("$country");
|
1559 |
-
} else {
|
1560 |
-
$language = @explode("-", $language);
|
1561 |
-
$language = @explode(",", $language[1]);
|
1562 |
-
$language = @explode(";", $language[0]);
|
1563 |
-
}
|
1564 |
|
|
|
1565 |
list($searchengine,$search_phrase)=explode("|",wGetSE($referrer));
|
1566 |
$se=seReferer($referrer);
|
1567 |
if ($search_phrase != '') {
|
@@ -1603,7 +1659,7 @@ function wassupAppend() {
|
|
1603 |
//# some valid spiders to exclude from spam checking
|
1604 |
$goodbot = false;
|
1605 |
if ($hostname!="" && !empty($spider)) {
|
1606 |
-
if (preg_match('/^(googlebot|msnbot|yahoo\!\ slurp|technorati)/i',$spider)>0 && preg_match('
|
1607 |
$goodbot = true;
|
1608 |
}
|
1609 |
}
|
@@ -1679,6 +1735,12 @@ function wassupAppend() {
|
|
1679 |
} //end if wassup_spam == 1
|
1680 |
} //end if wassup_spamcheck == 1
|
1681 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1682 |
// Personally used to debug
|
1683 |
if ($current_user->user_email == "michele@befree.it") {
|
1684 |
}
|
@@ -1695,10 +1757,9 @@ function wassupAppend() {
|
|
1695 |
|
1696 |
// #Record visit in wassup tables...
|
1697 |
// Insert the record into the db
|
1698 |
-
insert_into_wp($table_name, $wassup_id, $timestamp, $ipAddress, $hostname, $urlRequested, $userAgent, $referrer, $search_phrase, $searchpage, $os, $browser, $language
|
1699 |
// Insert the record into the wassup_tmp table too
|
1700 |
-
insert_into_wp($table_tmp_name, $wassup_id, $timestamp, $ipAddress, $hostname, $urlRequested, $userAgent, $referrer, $search_phrase, $searchpage, $os, $browser, $language
|
1701 |
-
$recorded = true;
|
1702 |
// Delete records older then 3 minutes
|
1703 |
$wpdb->query("DELETE FROM $table_tmp_name WHERE `timestamp`<'".strtotime("-3 minutes", $timestamp)."'");
|
1704 |
|
@@ -1771,6 +1832,8 @@ function wassupAppend() {
|
|
1771 |
function insert_into_wp($table_name, $wassup_id, $timestamp, $ipAddress, $hostname, $urlRequested, $userAgent, $referrer, $search_phrase, $searchpage, $os, $browser, $language, $screen_res, $searchengine, $spider, $feed, $logged_user, $comment_user, $spam) {
|
1772 |
global $wpdb;
|
1773 |
if (!empty($table_name) && !empty($wassup_id) && !empty($timestamp)) {
|
|
|
|
|
1774 |
|
1775 |
if (method_exists($wpdb,'prepare')) {
|
1776 |
$insert = $wpdb->query( $wpdb->prepare("INSERT INTO $table_name (wassup_id, `timestamp`, ip, hostname, urlrequested, agent, referrer, search, searchpage, os, browser, language, screen_res, searchengine, spider, feed, username, comment_author, spam)
|
@@ -1819,7 +1882,8 @@ function insert_into_wp($table_name, $wassup_id, $timestamp, $ipAddress, $hostna
|
|
1819 |
'".attribute_escape($comment_user)."',
|
1820 |
'".attribute_escape($spam)."'
|
1821 |
)");
|
1822 |
-
}
|
|
|
1823 |
} //end if !empty($table_name)
|
1824 |
} //end function insert_into_wp
|
1825 |
|
@@ -1957,6 +2021,7 @@ function wGetSE($referrer = null){
|
|
1957 |
function wGetBrowser($agent="") {
|
1958 |
if (empty($agent)) { $agent = $_SERVER['HTTP_USER_AGENT']; }
|
1959 |
$browsercap = array();
|
|
|
1960 |
$browser = "";
|
1961 |
$os = "";
|
1962 |
//check PHP browscap data for browser and platform, when available
|
@@ -1976,6 +2041,7 @@ function wGetBrowser($agent="") {
|
|
1976 |
} }
|
1977 |
//reject generic browscap browsers (ex: mozilla, default)
|
1978 |
if (preg_match('/^(mozilla|default|unknown)/i',$browser) > 0) {
|
|
|
1979 |
$browser = "";
|
1980 |
}
|
1981 |
}
|
@@ -1985,16 +2051,24 @@ function wGetBrowser($agent="") {
|
|
1985 |
//use Detector class when browscap is missing or browser is unknown
|
1986 |
if ( $os == "" || $browser == "") {
|
1987 |
$dip = &new Detector("", $agent);
|
1988 |
-
$browser = $dip->browser." ".$dip->browser_version;
|
1989 |
-
$os = $dip->os." ".$dip->os_version;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1990 |
}
|
1991 |
-
return array(
|
1992 |
} //end function wGetBrowser
|
1993 |
|
1994 |
//extract spider and feed info from a user agent string and
|
1995 |
// return the values in an array: 0->spider 1->feed
|
1996 |
-
function wGetSpider($agent="",$hostname=""){
|
1997 |
if (empty($agent)) { $agent = $_SERVER['HTTP_USER_AGENT']; }
|
|
|
1998 |
$crawler = "";
|
1999 |
$feed = "";
|
2000 |
$os = "";
|
@@ -2028,98 +2102,346 @@ function wGetSpider($agent="",$hostname=""){
|
|
2028 |
$agent=str_replace(" ","",$agent);
|
2029 |
if (empty($crawler)) {
|
2030 |
$key = null;
|
2031 |
-
|
2032 |
-
|
2033 |
-
|
2034 |
-
"
|
2035 |
-
"
|
2036 |
-
"
|
2037 |
-
"
|
2038 |
-
"
|
2039 |
-
"
|
2040 |
-
"
|
2041 |
-
"
|
2042 |
-
"
|
2043 |
-
"
|
2044 |
-
"
|
2045 |
-
"
|
2046 |
-
"
|
2047 |
-
"
|
2048 |
-
"
|
2049 |
-
"
|
2050 |
-
"
|
2051 |
-
"
|
2052 |
-
"
|
2053 |
-
"
|
2054 |
-
"
|
2055 |
-
"
|
2056 |
-
"
|
2057 |
-
"
|
2058 |
-
"
|
2059 |
-
"
|
2060 |
-
"
|
2061 |
-
"
|
2062 |
-
"
|
2063 |
-
"
|
2064 |
-
"
|
2065 |
-
"
|
2066 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2067 |
"Spider|Spider|", "spider_monkey|mouse.house/7.1|", "SpiderBot|SpiderBot/1.0|", "Spiderline|spiderline/3.1.3|", "SpiderView(tm)|SpiderView|", "Site|ssearcher100|",
|
2068 |
-
"
|
2069 |
-
"
|
2070 |
-
"
|
2071 |
-
"
|
2072 |
-
"
|
2073 |
-
"
|
2074 |
-
"
|
2075 |
-
"
|
2076 |
-
"
|
2077 |
-
"
|
2078 |
-
"
|
2079 |
-
"
|
2080 |
-
"
|
2081 |
-
"
|
2082 |
-
"
|
2083 |
-
"
|
2084 |
-
"
|
2085 |
-
"
|
2086 |
-
"
|
2087 |
-
"
|
2088 |
-
"
|
2089 |
-
"
|
2090 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2091 |
foreach($lines as $line_num => $spider) {
|
2092 |
-
list($nome,$key)=explode("|",$spider);
|
2093 |
-
if(
|
2094 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2095 |
}
|
2096 |
} // end if crawler
|
2097 |
|
2098 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2099 |
if (preg_match("/([0-9]{1,10})(subscriber)/i",$agent,$subscriber) > 0) {
|
2100 |
// It's a feedreader with some subscribers
|
2101 |
$feed = $subscriber[1];
|
2102 |
if (empty($crawler)) {
|
2103 |
$crawler = "Feed Reader";
|
2104 |
}
|
2105 |
-
} elseif (
|
2106 |
-
if (empty($crawler)) {
|
|
|
|
|
2107 |
$crawler = "Feed Reader";
|
2108 |
$feed = "feed reader";
|
2109 |
-
} else {
|
2110 |
-
$feed = $crawler;
|
2111 |
}
|
2112 |
-
} //end
|
2113 |
|
2114 |
-
//check for spoofers of Google/
|
2115 |
if ($hostname!="") {
|
2116 |
-
if (preg_match('/^(googlebot|
|
2117 |
$crawler = "Spoofer bot";
|
2118 |
}
|
2119 |
} //end if hostname
|
2120 |
|
2121 |
return array($crawler,trim($feed));
|
2122 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2123 |
|
2124 |
//# Check input, $referrer against a list of known spammers and
|
2125 |
//# return "1" if match found.
|
@@ -2356,7 +2678,7 @@ function wassup_widget($wargs) {
|
|
2356 |
print "$before_title ".__('Last searched terms','wassup')." $after_title";
|
2357 |
print "<ul class='$ulclass'>";
|
2358 |
foreach ($query_det as $sref) {
|
2359 |
-
print "<li>- <a href='".attribute_escape($sref->referrer)."' target='
|
2360 |
}
|
2361 |
print "</ul>";
|
2362 |
}
|
@@ -2369,7 +2691,7 @@ function wassup_widget($wargs) {
|
|
2369 |
print "$before_title ".__('Last referers','wassup')." $after_title";
|
2370 |
print "<ul class='$ulclass'>";
|
2371 |
foreach ($query_ref as $eref) {
|
2372 |
-
print "<li>- <a href='".attribute_escape($eref->referrer)."' target='
|
2373 |
}
|
2374 |
print "</ul>";
|
2375 |
}
|
@@ -2377,7 +2699,7 @@ function wassup_widget($wargs) {
|
|
2377 |
|
2378 |
// Widget TOP Browsers
|
2379 |
if ($wassup_settings['wassup_widget_topbr'] == 1) {
|
2380 |
-
|
2381 |
if (count($query_topbr) > 0) {
|
2382 |
print "$before_title ".__('Top Browsers','wassup')." $after_title";
|
2383 |
print "<ul class='$ulclass'>";
|
@@ -2390,7 +2712,7 @@ function wassup_widget($wargs) {
|
|
2390 |
|
2391 |
// Widget TOP Oses
|
2392 |
if ($wassup_settings['wassup_widget_topos'] == 1) {
|
2393 |
-
|
2394 |
if (count($query_topos) > 0) {
|
2395 |
print "$before_title ".__('Top OS','wassup')." $after_title";
|
2396 |
print "<ul class='$ulclass'>";
|
@@ -2512,7 +2834,7 @@ function wassup_sidebar($before_widget='', $after_widget='', $before_title='', $
|
|
2512 |
print "$before_title Last searched terms $after_title";
|
2513 |
print "<ul class='$ulclass'>";
|
2514 |
foreach ($query_det as $sref) {
|
2515 |
-
print "<li>- <a href='".attribute_escape($sref->referrer)."' target='
|
2516 |
}
|
2517 |
print "</ul>";
|
2518 |
}
|
@@ -2524,14 +2846,14 @@ function wassup_sidebar($before_widget='', $after_widget='', $before_title='', $
|
|
2524 |
print "$before_title Last referers $after_title";
|
2525 |
print "<ul class='$ulclass'>";
|
2526 |
foreach ($query_ref as $eref) {
|
2527 |
-
print "<li>- <a href='".attribute_escape($eref->referrer)."' target='
|
2528 |
}
|
2529 |
print "</ul>";
|
2530 |
}
|
2531 |
}
|
2532 |
|
2533 |
if ($wtopbr == 1) {
|
2534 |
-
$query_topbr = $wpdb->get_results("SELECT count(browser) as top_browser, browser FROM $table_name WHERE browser!='' AND browser NOT LIKE '
|
2535 |
if (count($query_topbr) > 0) {
|
2536 |
print "$before_title Top Browsers $after_title";
|
2537 |
print "<ul class='$ulclass'>";
|
@@ -2543,7 +2865,7 @@ function wassup_sidebar($before_widget='', $after_widget='', $before_title='', $
|
|
2543 |
}
|
2544 |
|
2545 |
if ($wtopos == 1) {
|
2546 |
-
$query_topos = $wpdb->get_results("SELECT count(os) as top_os, os FROM $table_name WHERE os!='' AND os NOT LIKE '
|
2547 |
if (count($query_topos) > 0) {
|
2548 |
print "$before_title Top OS $after_title";
|
2549 |
print "<ul class='$ulclass'>";
|
@@ -2595,7 +2917,7 @@ add_action('admin_menu', 'wassup_add_pages');
|
|
2595 |
add_action('activity_box_end', 'wassupDashChart');
|
2596 |
|
2597 |
//## Wassup visitor tracking hooks
|
2598 |
-
//
|
2599 |
add_action('shutdown', 'wassupAppend');
|
2600 |
//add_action('send_headers', 'wassupAppend'); //slows down page load
|
2601 |
add_action('wp_head', 'add_wassup_meta_info');
|
3 |
Plugin Name: WassUp
|
4 |
Plugin URI: http://www.wpwp.org
|
5 |
Description: Wordpress plugin to analyze your visitors traffic with real time stats, chart and a lot of chronological informations. It has sidebar Widget support to show current online visitors and other statistics.
|
6 |
+
Version: 1.6.1
|
7 |
+
Author: Michele Marcucci, Helene D.
|
8 |
Author URI: http://www.michelem.org/
|
9 |
|
10 |
Copyright (c) 2007 Michele Marcucci
|
16 |
if (preg_match('#'.basename(__FILE__) .'#', $_SERVER['PHP_SELF'])) {
|
17 |
die('Permission Denied! You are not allowed to call this page directly.');
|
18 |
}
|
19 |
+
$version = "1.6.1";
|
20 |
define('WASSUPFOLDER', dirname(plugin_basename(__FILE__)), TRUE);
|
21 |
require_once(dirname(__FILE__).'/lib/wassup.class.php');
|
22 |
require_once(dirname(__FILE__).'/lib/main.php');
|
39 |
// -Helene D. 2/26/08.
|
40 |
function wassup_install() {
|
41 |
global $wpdb;
|
42 |
+
$table_name = $wpdb->prefix . "wassup";
|
43 |
+
$table_tmp_name = $wpdb->prefix . "wassup_tmp";
|
44 |
|
45 |
//### Add/update wassup settings in Wordpress options table
|
46 |
$wassup_options = new wassupOptions; //#settings initialized here
|
92 |
"topvisitor"=>"0",
|
93 |
"topreferrer_exclude"=>""));
|
94 |
}
|
95 |
+
//#upgrade from 1.6: new options wassup_time_format and wassup_hack
|
96 |
+
if (!isset($wassup_options->wassup_time_format)) {
|
97 |
+
$wassup_options->wassup_time_format = 24;
|
98 |
+
}
|
99 |
+
if (!isset($wassup_options->wassup_hack)) {
|
100 |
+
$wassup_options->wassup_hack = 1;
|
101 |
+
}
|
102 |
$wassup_options->saveSettings();
|
103 |
|
104 |
//### Detect problems with WassUp install and show warning
|
105 |
//#
|
106 |
//#Check for problems with 'session_savepath' and disable
|
107 |
//# recording, if found. -Helene D. 2/24/08
|
108 |
+
/*
|
109 |
$sessionpath = $wassup_options->wassup_savepath;
|
110 |
if (empty($sessionpath)) { $sessionpath = getSessionpath(); }
|
111 |
//default to "/tmp" if no sessionpath value
|
113 |
$sessionpath = "/tmp";
|
114 |
$wassup_options->wassup_savepath = $sessionpath;
|
115 |
}
|
116 |
+
if ($wassup_options->isWritableFolder($sessionpath) == false) {
|
117 |
if ($wassup_options->wassup_active == "1") {
|
118 |
$wassup_options->wassup_active = "0";
|
119 |
$wassup_options->wassup_alert_message = __('WassUp has detected a problem with "session.save_path" setting in your Wordpress/PHP configuration. Statistics logging has been disabled as a result. To fix, go to admin menu, "Wassup-->Options-->Manage Files & Database" and modify "Temporary files location folder".','wassup');
|
120 |
} else {
|
121 |
$wassup_options->wassup_alert_message = __('WassUp has detected a problem with "session.save_path" setting in your Wordpress/PHP configuration. Please fix by modifying "Temporary files location folder" in admin menu, "Wassup-->Options-->Manage Files & Database".','wassup');
|
122 |
}
|
123 |
+
}
|
124 |
$wassup_options->saveSettings();
|
125 |
unset($sessionpath); //because "install" works in global scope
|
126 |
+
*/
|
127 |
//# TODO:
|
128 |
//###Detect known incompatible plugins like "wp_cache" and disable
|
129 |
//# recordings and show warning message...
|
130 |
|
131 |
//### Create/upgrade wassup MAIN table
|
|
|
132 |
if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name) {
|
133 |
+
CreateTable($table_name);
|
134 |
+
CreateTable($table_tmp_name);
|
135 |
} else {
|
136 |
UpdateTable(); //<== wassup_tmp is added here, if missing
|
137 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
} //#end function wassup_install
|
139 |
|
140 |
//set global variables that are dependent on Wassup's wp_options values
|
151 |
if ($wassup_options->wassup_uninstall == "1") {
|
152 |
$table_name = $wpdb->prefix . "wassup";
|
153 |
$table_tmp_name = $wpdb->prefix . "wassup_tmp";
|
154 |
+
//$wpdb->query("DROP TABLE IF EXISTS $table_name"); //incorrectly causes an activation error in Wordpress
|
155 |
+
//$wpdb->query("DROP TABLE IF EXISTS $table_tmp_name"); //incorrectly causes an activation error in Wordpress
|
156 |
+
mysql_query("DROP TABLE IF EXISTS $table_tmp_name");
|
157 |
+
mysql_query("DROP TABLE IF EXISTS $table_name");
|
158 |
$wassup_options->deleteSettings();
|
159 |
}
|
160 |
} //#end function wassup_uninstall
|
224 |
//Add css and javascript to wassup menu pages only...
|
225 |
if ($plugin_page == "wassup") {
|
226 |
//$wassup_settings = get_option('wassup_settings');
|
227 |
+
echo "\n".'<script type="text/javascript">var tb_pathToImage = "'.$wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/thickbox/loadingAnimation.gif";</script>';
|
228 |
echo "\n".'<link rel="stylesheet" href="'.$wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/thickbox/thickbox.css'.'" type="text/css" />';
|
229 |
echo "\n".'<link rel="stylesheet" href="'.$wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/ui.tabs.css'.'" type="text/css" />';
|
230 |
+
echo "\n".'<link rel="stylesheet" href="'.$wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/wassup.css'.'" type="text/css" />'."\n";
|
231 |
|
232 |
if ($_GET['page'] != "wassup-options" AND $_GET['page'] != "wassup-spy") { ?>
|
233 |
<script type='text/javascript'>
|
422 |
global $wpdb, $wp_version, $version, $wpurl, $wassup_options, $whash;
|
423 |
|
424 |
//#debug...
|
425 |
+
//error_reporting(E_ALL | E_STRICT); //debug, E_STRICT=php5 only
|
426 |
//ini_set('display_errors','On'); //debug
|
427 |
+
//$wpdb->show_errors(); //debug
|
|
|
|
|
|
|
|
|
|
|
|
|
428 |
|
429 |
$table_name = $wpdb->prefix . "wassup";
|
430 |
$table_tmp_name = $wpdb->prefix . "wassup_tmp";
|
447 |
$wassup_options->wassup_loggedin = $_POST['wassup_loggedin'];
|
448 |
$wassup_options->wassup_spider = $_POST['wassup_spider'];
|
449 |
$wassup_options->wassup_attack = $_POST['wassup_attack'];
|
450 |
+
$wassup_options->wassup_hack = $_POST['wassup_hack'];
|
451 |
$wassup_options->wassup_spamcheck = $_POST['wassup_spamcheck'];
|
452 |
$wassup_options->wassup_spam = $_POST['wassup_spam'];
|
453 |
$wassup_options->wassup_refspam = $_POST['wassup_refspam'];
|
459 |
$wassup_options->wassup_refresh = $_POST['wassup_refresh'];
|
460 |
$wassup_options->wassup_userlevel = $_POST['wassup_userlevel'];
|
461 |
$wassup_options->wassup_dashboard_chart = $_POST['wassup_dashboard_chart'];
|
462 |
+
$wassup_options->wassup_time_format = $_POST['wassup_time_format'];
|
463 |
$wassup_options->wassup_default_type = $_POST['wassup_default_type'];
|
464 |
$wassup_options->wassup_default_limit = $_POST['wassup_default_limit'];
|
465 |
$top_ten = array("topsearch" => $_POST['topsearch'],
|
468 |
"topbrowser" => $_POST['topbrowser'],
|
469 |
"topos" => $_POST['topos'],
|
470 |
"toplocale" => $_POST['toplocale'],
|
471 |
+
"topvisitor" => $_POST['topvisitor'],
|
472 |
"topfeed" => "0",
|
473 |
"topcrawler" => "0",
|
|
|
474 |
"topreferrer_exclude" => $_POST['topreferrer_exclude']);
|
475 |
$wassup_options->wassup_top10 = serialize($top_ten);
|
476 |
+
/* if ( $_POST['wassup_savepath'] != $wassup_options->wassup_savepath ) {
|
477 |
if (empty($_POST['wassup_savepath']) || rtrim($_POST['wassup_savepath'],"/") == getSessionpath()) {
|
478 |
$wassup_options->wassup_savepath = NULL;
|
479 |
} else {
|
480 |
$wassup_options->setSavepath($_POST['wassup_savepath']);
|
481 |
}
|
482 |
+
} */
|
483 |
if ($wassup_options->saveSettings()) {
|
484 |
$admin_message = __("Wassup options updated successfully","wassup")."." ;
|
485 |
}
|
536 |
$wassup_options->wassup_alert_message = "";
|
537 |
$wassup_options->saveSettings();
|
538 |
}
|
539 |
+
//#debug - display MySQL errors/warnings
|
540 |
+
//$mysqlerror = $wpdb->print_error(); //debug
|
541 |
+
//if (!empty($mysqlerror)) { $wassup_options->showMessage($mysqlerror); } //debug
|
542 |
|
543 |
//moved max-width to single "wrap" div and removed it from
|
544 |
// the individual spans and divs in style.php... ?>
|
558 |
if ($currenttot > 0) {
|
559 |
$qryC = $wpdb->get_results("SELECT id, wassup_id, max(timestamp) as max_timestamp, ip, hostname, searchengine, urlrequested, agent, referrer, spider, username, comment_author FROM $table_tmp_name WHERE `timestamp` BETWEEN $from_date AND $to_date GROUP BY ip ORDER BY max_timestamp DESC");
|
560 |
foreach ($qryC as $cv) {
|
561 |
+
if ($wassup_options->wassup_time_format == 24) {
|
562 |
+
$timed = gmdate("H:i:s", $cv->max_timestamp);
|
563 |
+
} else {
|
564 |
+
$timed = gmdate("h:i:s a", $cv->max_timestamp);
|
565 |
+
}
|
566 |
$ip_proxy = strpos($cv->ip,",");
|
567 |
//if proxy, get 2nd ip...
|
568 |
if ($ip_proxy !== false) {
|
618 |
$qryCD = $wpdb->get_results("SELECT `timestamp`, urlrequested FROM $table_tmp_name WHERE wassup_id='".$cv->wassup_id."' ORDER BY `timestamp` ASC");
|
619 |
$i=0;
|
620 |
foreach ($qryCD as $cd) {
|
|
|
621 |
$time2 = gmdate("H:i:s", $cd->timestamp);
|
622 |
$num = ($i&1);
|
623 |
$char_len = round($max_char_len*.9,0);
|
736 |
|
737 |
//## Filter detail lists by a specific page and number
|
738 |
//# of items per page...
|
|
|
739 |
$items = 10; //default
|
740 |
if (isset($_GET['limit']) && is_numeric($_GET['limit'])) {
|
741 |
//$items = htmlentities(attribute_escape($_GET['limit']));
|
764 |
}
|
765 |
|
766 |
// DELETE EVERY RECORD MARKED BY IP
|
767 |
+
//# Delete limited to selected date range only. -Helene D. 3/4/08.
|
|
|
768 |
if (!empty($_GET['deleteMARKED']) && $wassup_options->wmark == "1" ) {
|
769 |
$rec_deleted = $wpdb->get_var("SELECT COUNT(ip) as deleted FROM $table_name WHERE ip='".urlencode(attribute_escape($_GET['dip']))."' AND `timestamp` BETWEEN $from_date AND $to_date");
|
770 |
if (method_exists($wpdb,'prepare')) {
|
816 |
<img src="<?php echo $wpurl.'/wp-content/plugins/'.WASSUPFOLDER.'/img/chart_add.png" style="padding:0px 6px 0 0;" alt="'.__('show chart','wassup').'" title="'.__('Show the chart and site usage','wassup'); ?>" /></a>
|
817 |
<?php }
|
818 |
|
819 |
+
//## Show selectable detail filters...
|
820 |
+
if (isset($_GET['limit'])) {
|
821 |
+
$new_limit = eregi_replace("\&limit=".$_GET['limit']."", "", $_SERVER['QUERY_STRING']);
|
822 |
+
} else {
|
823 |
+
$new_limit = $_SERVER['QUERY_STRING'];
|
824 |
+
}
|
825 |
+
if (isset($_GET['last'])) {
|
826 |
+
$new_last = eregi_replace("\&last=".$_GET['last']."", "", $_SERVER['QUERY_STRING']);
|
827 |
+
} else {
|
828 |
+
$new_last = $_SERVER['QUERY_STRING'];
|
829 |
+
}
|
830 |
_e('Summary for the last','wassup'); ?>
|
831 |
<select style="font-size: 11px;" name="last" onChange="window.location.href=this.options[this.selectedIndex].value;">
|
832 |
<?php
|
883 |
</div>
|
884 |
<?php } //end if wassup_chart == 1
|
885 |
|
886 |
+
if (!isset($_GET['limit']) OR $_GET['limit'] == 10 OR $_GET['limit'] == 20) {
|
887 |
+
|
888 |
$expcol = '
|
889 |
<table width="100%"><tr>
|
890 |
<td align="left" class="legend"><a href="#" class="toggle-all">'.__('Expand All','wassup').'</a></td>
|
951 |
foreach ($main as $rk) {
|
952 |
$timestampF = $rk->max_timestamp;
|
953 |
$dateF = gmdate("d M Y", $timestampF);
|
954 |
+
if ($wassup_options->wassup_time_format == 24) {
|
955 |
+
$datetimeF = gmdate('Y-m-d H:i:s', $timestampF);
|
956 |
+
$timeF = gmdate("H:i:s", $timestampF);
|
957 |
+
} else {
|
958 |
+
$datetimeF = gmdate('Y-m-d h:i:s a', $timestampF);
|
959 |
+
$timeF = gmdate("h:i:s a", $timestampF);
|
960 |
+
}
|
961 |
//$ip = @explode(",", $rk->ip);
|
962 |
$ip_proxy = strpos($rk->ip,",");
|
963 |
//if proxy, get 2nd ip...
|
1118 |
<?php }
|
1119 |
} ?>
|
1120 |
<?php // Referer is a SPAM
|
1121 |
+
if ($rk->spam > 0 && $rk->spam < 3) { ?>
|
1122 |
<ul class="spam">
|
1123 |
<li class="spam"><span class="indent-li-agent">
|
1124 |
<?php _e("Probably SPAM!","wassup");
|
1125 |
+
if ($rk->spam==2) { echo '('.__("Referer Spam","wassup").')'; }
|
1126 |
+
else { echo '(Akismet '.__("Spam","wassup").')'; } ?>
|
1127 |
</span></li>
|
1128 |
</ul>
|
1129 |
+
<?php } elseif ($rk->spam == 3) { ?>
|
1130 |
+
<ul class="spam">
|
1131 |
+
<li class="spam"><span class="indent-li-agent">
|
1132 |
+
<?php _e("Probably hack attempt!","wassup"); ?>
|
1133 |
+
</li></ul>
|
1134 |
<?php } ?>
|
1135 |
<?php // User os/browser/language
|
1136 |
if ($rk->spider == "" AND ($rk->os != "" OR $rk->browser != "")) {
|
1178 |
print '<br />';
|
1179 |
if ($itemstot >= 10) $p->show();
|
1180 |
print '<br />';
|
1181 |
+
if (!isset($_GET['limit']) OR $_GET['limit'] == 10 OR $_GET['limit'] == 20) {
|
1182 |
print $expcol;
|
1183 |
}
|
1184 |
|
1190 |
<?php
|
1191 |
} //end function Wassup
|
1192 |
|
1193 |
+
function CreateTable($table_name="",$withcharset=true) {
|
1194 |
global $wpdb;
|
1195 |
$charset_collate = '';
|
1196 |
+
//#don't do character set/collation if < MySQL 4.1
|
1197 |
+
if (version_compare(mysql_get_server_info(), '4.1.0', '<')) {
|
1198 |
+
$withcharset=false;
|
1199 |
+
} elseif (!defined('DB_CHARSET')) { //DB_CHARSET must be defined in wp-config.php
|
1200 |
+
$withcharset=false;
|
1201 |
+
}
|
1202 |
+
if ($withcharset && $wpdb->supports_collation() && !empty($wpdb->charset)) {
|
1203 |
+
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
|
1204 |
+
//use collate only when charset is specified
|
1205 |
+
if (!empty($wpdb->collate)) {
|
1206 |
$charset_collate .= " COLLATE $wpdb->collate";
|
1207 |
+
}
|
1208 |
+
}
|
1209 |
+
if ($table_name == "") {
|
1210 |
+
$table_name = $wpdb->prefix . "wassup";
|
1211 |
}
|
|
|
1212 |
$sql_createtable = "CREATE TABLE " . $table_name . " (
|
1213 |
id mediumint(9) NOT NULL auto_increment,
|
1214 |
+
wassup_id varchar(80) NOT NULL,
|
1215 |
timestamp varchar(20) NOT NULL,
|
1216 |
ip varchar(35) default NULL,
|
1217 |
+
hostname varchar(150) default NULL,
|
1218 |
urlrequested text,
|
1219 |
agent varchar(255) default NULL,
|
1220 |
referrer text default NULL,
|
1224 |
browser varchar(50) default NULL,
|
1225 |
language varchar(5) default NULL,
|
1226 |
screen_res varchar(15) default NULL,
|
1227 |
+
searchengine varchar(25) default NULL,
|
1228 |
spider varchar(50) default NULL,
|
1229 |
+
feed varchar(50) default NULL,
|
1230 |
+
username VARCHAR(50) default NULL,
|
1231 |
+
comment_author VARCHAR(50) default NULL,
|
1232 |
spam VARCHAR(5) default 0,
|
1233 |
UNIQUE KEY id (id),
|
1234 |
+
KEY idx_wassup (wassup_id(32),timestamp),
|
1235 |
+
INDEX (os),
|
1236 |
+
INDEX (browser),
|
1237 |
INDEX (timestamp)
|
1238 |
) $charset_collate;";
|
1239 |
require_once( ABSPATH.'wp-admin/upgrade-functions.php');
|
1240 |
+
dbDelta($sql_createtable);
|
1241 |
+
|
1242 |
+
//#TODO: check for errors or warnings during table creation
|
1243 |
} //end function createTable
|
1244 |
|
1245 |
function UpdateTable() {
|
1246 |
global $wpdb, $wassup_options;
|
1247 |
$table_name = $wpdb->prefix . "wassup";
|
1248 |
+
$table_tmp_name = $wpdb->prefix . "wassup_tmp";
|
1249 |
+
$idx_timestamp = false; //used for upgrade from <= 1.4.9
|
1250 |
+
$idx_wassup = false; //used for upgrade from <= 1.6
|
1251 |
|
1252 |
+
// Upgrade from version < 1.3.9 - add 'spam' column to wassup table
|
1253 |
+
if ($wpdb->get_var("SHOW COLUMNS FROM $table_name LIKE 'spam'") == "") {
|
1254 |
+
$sql_add_spam = "ALTER TABLE {$table_name} ADD COLUMN spam VARCHAR(5) DEFAULT '0'";
|
1255 |
+
$wpdb->query( $sql_add_spam );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1256 |
}
|
1257 |
|
1258 |
+
// Upgrade from version <= 1.4.9 - create an index on 'timestamp'
|
1259 |
+
//#$idx_cols = $wpdb->get_col("SHOW INDEX FROM $table_name","Column_name"); //doesn't work
|
1260 |
+
//# look for an index on 'timestamp' and make one if doesn't exist
|
1261 |
+
$result = mysql_query("SHOW INDEX FROM $table_name");
|
1262 |
+
if ($result) {
|
1263 |
+
$row_count = mysql_num_rows($result);
|
1264 |
+
//# look for an index on 'timestamp'
|
1265 |
+
if ($row_count > 0) {
|
1266 |
+
while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) {
|
1267 |
+
if ($row["Column_name"] == "timestamp") {
|
1268 |
+
$idx_timestamp = true;
|
1269 |
+
} elseif ( $row["Key_name"] == "idx_wassup") {
|
1270 |
+
$idx_wassup = true;
|
1271 |
+
}
|
1272 |
+
}
|
1273 |
+
//# create an index on 'timestamp'
|
1274 |
+
if (!$idx_timestamp) {
|
1275 |
+
$wpdb->query("ALTER TABLE {$table_name} ADD INDEX idx_timestamp (timestamp)");
|
1276 |
+
}
|
1277 |
+
} //end if row_count
|
1278 |
+
mysql_free_result($result);
|
1279 |
+
} //end if result
|
1280 |
|
1281 |
// Upgrade from version <= 1.5.1 - increase size of wassup_id
|
1282 |
$wassup_col = $wpdb->get_results("SHOW COLUMNS FROM $table_name LIKE 'wassup_id'");
|
1283 |
foreach ($wassup_col as $wID) {
|
1284 |
+
if ($wID->Type != "varchar(80)") {
|
1285 |
+
$wpdb->query("ALTER TABLE {$table_name} CHANGE wassup_id wassup_id varchar(80) NULL");
|
1286 |
}
|
1287 |
}
|
1288 |
+
|
1289 |
+
// Upgrade from version <= 1.6
|
1290 |
+
// - change wassup_id index to combination (wassup_id,timestamp)
|
1291 |
+
if (!$idx_wassup) {
|
1292 |
+
$wpdb->query("ALTER TABLE {$table_name} DROP KEY wassup_id");
|
1293 |
+
$wpdb->query("ALTER TABLE {$table_name} ADD KEY idx_wassup (wassup_id(32),timestamp)");
|
1294 |
}
|
1295 |
|
1296 |
+
// For all upgrades
|
1297 |
+
// - drop and recreate table "wp_wassup_tmp" and optimize "wp_wassup"
|
1298 |
+
//$wpdb->query("DROP TABLE IF EXISTS $table_tmp_name"); //incorrectly causes an activation error in Wordpress
|
1299 |
+
mysql_query("DROP TABLE IF EXISTS $table_tmp_name");
|
1300 |
+
CreateTable($table_tmp_name);
|
1301 |
+
$wpdb->query("OPTIMIZE TABLE {$table_name}");
|
1302 |
+
} //end function UpdateTable
|
1303 |
|
1304 |
//Set Wassup_id and cookie (before headers sent)
|
1305 |
function wassupPrepend() {
|
1320 |
$hostname = "";
|
1321 |
//#### Get the visitor's details from http header...
|
1322 |
if (isset($_SERVER["REMOTE_ADDR"])) {
|
1323 |
+
if (!empty($_SERVER["HTTP_X_FORWARDED_FOR"])){
|
1324 |
//in case of multiple forwarding
|
1325 |
list($IP) = explode(",",$_SERVER["HTTP_X_FORWARDED_FOR"]);
|
1326 |
$proxy = $_SERVER["REMOTE_ADDR"];
|
1328 |
if (empty($hostname) || $hostname == "unknown") {
|
1329 |
$hostname = @gethostbyaddr($proxy);
|
1330 |
}
|
1331 |
+
if (empty($IP) || $IP == "unknown") {
|
1332 |
+
$IP = $proxy;
|
1333 |
+
$ipAddress = $_SERVER["REMOTE_ADDR"];
|
1334 |
+
} else {
|
1335 |
+
$ipAddress = $proxy.",".$IP;
|
1336 |
+
}
|
1337 |
}else{
|
1338 |
list($IP) = explode(",",$_SERVER["REMOTE_ADDR"]);
|
1339 |
$hostname = @gethostbyaddr($IP);
|
1343 |
if (empty($IP)) { $IP = $ipAddress; }
|
1344 |
if (empty($hostname)) { $hostname = "unknown"; }
|
1345 |
$userAgent = (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '');
|
1346 |
+
$current_user = wp_get_current_user();
|
1347 |
+
$logged_user = $current_user->user_login;
|
1348 |
//# Create a new wassup id for this visit from a
|
1349 |
//# combination of date/hour/min/ip/hostname/useragent/.
|
1350 |
//# It is not unique so that multiple visits from the
|
1351 |
//# same ip/userAgent within a 30 minute-period, can be
|
1352 |
//# tracked, even when session/cookies is disabled.
|
1353 |
+
$temp_id = sprintf("%-060.60s", date('YmdH').str_replace(array(' ','http://','www.','/','.','\'','"',"\\",'$','-','&','+','_',';',',','>','<',':','#','*','%','!','@',')','(',), '', intval(date('i')/30).$IP.strrev($logged_user).strrev($userAgent).strrev($hostname).intval(date('i')/30)).date('HdmY').$hostname.rand());
|
1354 |
+
//$temp_id = sprintf("%-060.60s", date('YmdH').str_replace(array(' ','http://','www.','/','.','\'','"',"\\",'$','-','&','+','_',';',',','>','<',':','#','*','%','!','@',')','(',), '', intval(date('i')/30).$IP.strrev($userAgent).strrev($hostname).intval(date('i')/30)).date('HdmY').$hostname.rand());
|
1355 |
|
1356 |
//Work-around for cookie rejection:
|
1357 |
//#assign new wassup id from "temp_id"
|
1377 |
$table_name = $wpdb->prefix . "wassup";
|
1378 |
$table_tmp_name = $wpdb->prefix . "wassup_tmp";
|
1379 |
$wassup_settings = get_option('wassup_settings');
|
1380 |
+
$current_user = wp_get_current_user();
|
1381 |
+
$logged_user = $current_user->user_login;
|
1382 |
+
$urlRequested = clean_url($_SERVER['REQUEST_URI']);
|
1383 |
|
1384 |
+
if (empty($logged_user) && $wassup_setting->wassup_hack == "1") {
|
1385 |
+
$hackercheck = true;
|
1386 |
+
} else {
|
1387 |
+
$hackercheck = false;
|
1388 |
+
}
|
1389 |
+
|
1390 |
+
if ((!is_admin() && stristr($urlRequested,"/wp-admin/") === FALSE) || $hackercheck) { //exclude valid wordpress admin page visits
|
1391 |
|
1392 |
//#### Get the visitor's details from http header...
|
1393 |
if (isset($_SERVER["REMOTE_ADDR"])) {
|
1394 |
+
if (!empty($_SERVER["HTTP_X_FORWARDED_FOR"])){
|
1395 |
//in case of multiple forwarding
|
1396 |
list($IP) = explode(",",$_SERVER["HTTP_X_FORWARDED_FOR"]);
|
1397 |
$proxy = $_SERVER["REMOTE_ADDR"];
|
1399 |
if (empty($hostname) || $hostname == "unknown") {
|
1400 |
$hostname = @gethostbyaddr($proxy);
|
1401 |
}
|
1402 |
+
if (empty($IP) || $IP == "unknown") {
|
1403 |
+
$IP = $proxy;
|
1404 |
+
$ipAddress = $_SERVER["REMOTE_ADDR"];
|
1405 |
+
} else {
|
1406 |
+
$ipAddress = $proxy.",".$IP;
|
1407 |
+
}
|
1408 |
}else{
|
1409 |
list($IP) = explode(",",$_SERVER["REMOTE_ADDR"]);
|
1410 |
$hostname = @gethostbyaddr($IP);
|
1442 |
}
|
1443 |
*/
|
1444 |
|
|
|
1445 |
$referrer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '');
|
1446 |
$userAgent = (isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '');
|
1447 |
$language = (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? attribute_escape($_SERVER['HTTP_ACCEPT_LANGUAGE']) : '');
|
1448 |
+
//$current_user = wp_get_current_user(); //moved up
|
1449 |
+
//$logged_user = $current_user->user_login; //moved up
|
1450 |
+
$comment_user = (isset($_COOKIE['comment_author_'.COOKIEHASH]) ? utf8_encode($_COOKIE['comment_author_'.COOKIEHASH]) : '');
|
1451 |
|
1452 |
$timestamp = wassup_get_time(); //Add a timestamp to visit...
|
1453 |
$flag_exclude_url = 0;
|
1471 |
|
1472 |
//### Exclude requests for themes, plugins, and favicon from recordings
|
1473 |
if (stristr($urlRequested,"favicon.ico") === FALSE) { //moved
|
1474 |
+
if (stristr($urlRequested,"/wp-content/plugins") === FALSE || stristr($urlRequested,"forum") !== FALSE || $hackercheck) { //moved and modified to allow forum requests
|
1475 |
+
if (stristr($urlRequested,"/wp-content/themes") === FALSE || stristr($urlRequested,"comment") !== FALSE) { //moved and modified to allow comment requests
|
|
|
1476 |
|
1477 |
//# More recording exclusion controls
|
1478 |
+
if ($wassup_options->wassup_loggedin == 1 || !$loggedinuser ) {
|
1479 |
if ($wassup_options->wassup_attack == 1 || stristr($userAgent,"libwww-perl") === FALSE ) {
|
1480 |
+
if (!is_404() || $hackercheck) { //don't record 404 pages...
|
1481 |
|
1482 |
//##### Extract useful visit information from http header..
|
1483 |
$browser = "";
|
1493 |
//# ip/userAgent within a 30 minute-period, can be tracked as
|
1494 |
//# such, even when session/cookies is disabled.
|
1495 |
//# An md5 encoded version of temp_id is saved as "wassup_id".
|
1496 |
+
$temp_id = sprintf("%-060.60s", date('YmdH').str_replace(array(' ','http://','www.','/','.','\'','"',"\\",'$','-','&','+','_',';',',','>','<',':','#','*','%','!','@',')','(',), '', intval(date('i')/30).$IP.strrev($logged_user).strrev($userAgent).strrev($hostname).intval(date('i')/30)).date('HdmY').$hostname.rand());
|
1497 |
$wassup_id = "";
|
1498 |
//Read the cookie for wassup_id
|
1499 |
if (isset($_COOKIE['wassup'])) {
|
1582 |
}
|
1583 |
//### Check for duplicates.
|
1584 |
$dup_urlrequest=0;
|
1585 |
+
// Dup: Hit recorded, ==wassup_id, last visit, <90 secs old, ==URL
|
1586 |
+
$dups = $wpdb->get_results("SELECT wassup_id, urlrequested, spam, `timestamp` AS hit_timestamp FROM ".$table_tmp_name." WHERE wassup_id='".$wassup_id."' AND `timestamp` >".($timestamp-90)." GROUP BY wassup_id ORDER BY hit_timestamp DESC");
|
1587 |
if (!empty($dups)) {
|
1588 |
$i=0;
|
1589 |
foreach ($dups as $dup) { //check first record only
|
1604 |
//### Exclude duplicates...
|
1605 |
if ($dup_urlrequest == 0) {
|
1606 |
//##### Extract useful visit information from http header..
|
1607 |
+
if (empty($browser) || strstr($browser,"N/A") || is_feed()) {
|
1608 |
+
list($spider,$feed) = wGetSpider($userAgent,$hostname,$browser);
|
1609 |
}
|
1610 |
|
1611 |
//#I prefer to see os/browser info. for spiders/bots.
|
1612 |
|
1613 |
//spider exclusion control
|
1614 |
+
//# Spider exclusion control moved to avoid unneeded tests
|
1615 |
if ($wassup_options->wassup_spider == 1 || $spider == '') {
|
1616 |
//
|
1617 |
+
//#get language/locale info from hostname or referrer data
|
1618 |
+
$language = wGetLocale($language,$hostname,$referrer);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1619 |
|
1620 |
+
//# get search string details from referrer data
|
1621 |
list($searchengine,$search_phrase)=explode("|",wGetSE($referrer));
|
1622 |
$se=seReferer($referrer);
|
1623 |
if ($search_phrase != '') {
|
1659 |
//# some valid spiders to exclude from spam checking
|
1660 |
$goodbot = false;
|
1661 |
if ($hostname!="" && !empty($spider)) {
|
1662 |
+
if (preg_match('/^(googlebot|msnbot|yahoo\!\ slurp|technorati)/i',$spider)>0 && preg_match('/\.(googlebot|live|msn|yahoo|technorati)\.(com|net)$/i',$hostname)>0){
|
1663 |
$goodbot = true;
|
1664 |
}
|
1665 |
}
|
1735 |
} //end if wassup_spam == 1
|
1736 |
} //end if wassup_spamcheck == 1
|
1737 |
|
1738 |
+
//identify hacker/bad activity attempts and assign spam=3
|
1739 |
+
if ($spam == 0 && $hackercheck) {
|
1740 |
+
if (is_admin() || stristr($urlRequested,"/wp-content/plugins")!==FALSE || stristr($urlRequested,"/wp-admin/")!== FALSE) {
|
1741 |
+
$spam=3;
|
1742 |
+
}
|
1743 |
+
}
|
1744 |
// Personally used to debug
|
1745 |
if ($current_user->user_email == "michele@befree.it") {
|
1746 |
}
|
1757 |
|
1758 |
// #Record visit in wassup tables...
|
1759 |
// Insert the record into the db
|
1760 |
+
insert_into_wp($table_name, $wassup_id, $timestamp, $ipAddress, $hostname, $urlRequested, $userAgent, $referrer, $search_phrase, $searchpage, $os, $browser, $language, $screen_res, $searchengine, $spider, $feed, $logged_user, $comment_user, $spam);
|
1761 |
// Insert the record into the wassup_tmp table too
|
1762 |
+
insert_into_wp($table_tmp_name, $wassup_id, $timestamp, $ipAddress, $hostname, $urlRequested, $userAgent, $referrer, $search_phrase, $searchpage, $os, $browser, $language, $screen_res, $searchengine, $spider, $feed, $logged_user, $comment_user, $spam);
|
|
|
1763 |
// Delete records older then 3 minutes
|
1764 |
$wpdb->query("DELETE FROM $table_tmp_name WHERE `timestamp`<'".strtotime("-3 minutes", $timestamp)."'");
|
1765 |
|
1832 |
function insert_into_wp($table_name, $wassup_id, $timestamp, $ipAddress, $hostname, $urlRequested, $userAgent, $referrer, $search_phrase, $searchpage, $os, $browser, $language, $screen_res, $searchengine, $spider, $feed, $logged_user, $comment_user, $spam) {
|
1833 |
global $wpdb;
|
1834 |
if (!empty($table_name) && !empty($wassup_id) && !empty($timestamp)) {
|
1835 |
+
//double-check that table exists before doing insert to avoid errors showing up on page
|
1836 |
+
if ($wpdb->get_var("SHOW TABLES LIKE '$table_name'") == $table_name) {
|
1837 |
|
1838 |
if (method_exists($wpdb,'prepare')) {
|
1839 |
$insert = $wpdb->query( $wpdb->prepare("INSERT INTO $table_name (wassup_id, `timestamp`, ip, hostname, urlrequested, agent, referrer, search, searchpage, os, browser, language, screen_res, searchengine, spider, feed, username, comment_author, spam)
|
1882 |
'".attribute_escape($comment_user)."',
|
1883 |
'".attribute_escape($spam)."'
|
1884 |
)");
|
1885 |
+
} //end else method_exists(prepare)
|
1886 |
+
} //end if table exists
|
1887 |
} //end if !empty($table_name)
|
1888 |
} //end function insert_into_wp
|
1889 |
|
2021 |
function wGetBrowser($agent="") {
|
2022 |
if (empty($agent)) { $agent = $_SERVER['HTTP_USER_AGENT']; }
|
2023 |
$browsercap = array();
|
2024 |
+
$browscapbrowser = "";
|
2025 |
$browser = "";
|
2026 |
$os = "";
|
2027 |
//check PHP browscap data for browser and platform, when available
|
2041 |
} }
|
2042 |
//reject generic browscap browsers (ex: mozilla, default)
|
2043 |
if (preg_match('/^(mozilla|default|unknown)/i',$browser) > 0) {
|
2044 |
+
$browscapbrowser = "$browser"; //save just in case
|
2045 |
$browser = "";
|
2046 |
}
|
2047 |
}
|
2051 |
//use Detector class when browscap is missing or browser is unknown
|
2052 |
if ( $os == "" || $browser == "") {
|
2053 |
$dip = &new Detector("", $agent);
|
2054 |
+
$browser = trim($dip->browser." ".$dip->browser_version);
|
2055 |
+
$os = trim($dip->os." ".$dip->os_version);
|
2056 |
+
|
2057 |
+
//use saved browscap data, if Detector had no results
|
2058 |
+
if (!empty($browscapbrowser) && ($browser == "" || $browser == "N/A")) {
|
2059 |
+
if ($os != "" && $os != "N/A") {
|
2060 |
+
$browser = $browscapbrowser;
|
2061 |
+
}
|
2062 |
+
}
|
2063 |
}
|
2064 |
+
return array($browser,$os);
|
2065 |
} //end function wGetBrowser
|
2066 |
|
2067 |
//extract spider and feed info from a user agent string and
|
2068 |
// return the values in an array: 0->spider 1->feed
|
2069 |
+
function wGetSpider($agent="",$hostname="", $browser=""){
|
2070 |
if (empty($agent)) { $agent = $_SERVER['HTTP_USER_AGENT']; }
|
2071 |
+
$ua = $agent;
|
2072 |
$crawler = "";
|
2073 |
$feed = "";
|
2074 |
$os = "";
|
2102 |
$agent=str_replace(" ","",$agent);
|
2103 |
if (empty($crawler)) {
|
2104 |
$key = null;
|
2105 |
+
//# query list to identify some feedreaders and bots that don't show their name first in UA string
|
2106 |
+
//# format: "Bot Name"|"UserAgent keyword" (no spaces)|(F=feedreader or R=robot)
|
2107 |
+
$lines = array( "AboutUsBot|AboutUsBot/|R|",
|
2108 |
+
"Aggrevator|Aggrevator/0.|F|",
|
2109 |
+
"AlestiFeedBot|AlestiFeedBot||",
|
2110 |
+
"Alexa|ia_archiver|R|", "AltaVista|Scooter-|R|",
|
2111 |
+
"AltaVista|Scooter/|R|", "AltaVista|Scooter_|R|",
|
2112 |
+
"AMZNKAssocBot|AMZNKAssocBot/|R|",
|
2113 |
+
"AppleSyndication|AppleSyndication/|F|",
|
2114 |
+
"Apple-PubSub|Apple-PubSub/|F|",
|
2115 |
+
"Ask.com/Teoma|AskJeeves/Teoma)|R|",
|
2116 |
+
"Ask Jeeves/Teoma|ask.com|R|",
|
2117 |
+
"AskJeeves|AskJeeves|R|",
|
2118 |
+
"BlogBot|BlogBot/|F|", "Bloglines|Bloglines/|F|",
|
2119 |
+
"Blogslive|Blogslive|F|",
|
2120 |
+
"BlogsNowBot|BlogsNowBot|F|",
|
2121 |
+
"BlogPulseLive|BlogPulseLive|F|",
|
2122 |
+
"IceRocket BlogSearch|BlogSearch/|F|",
|
2123 |
+
"Charlotte|Charlotte/|R|",
|
2124 |
+
"Xyleme|cosmos/0.|R|", "cURL|curl/|R|",
|
2125 |
+
"Die|die-kraehe.de|R|",
|
2126 |
+
"Diggit! Robot|Digger/|R|",
|
2127 |
+
"disco/Nutch|disco/Nutch|R|",
|
2128 |
+
"Emacs-w3|Emacs-w3/v[0-9\.]+|",
|
2129 |
+
"ananzi|EMC|",
|
2130 |
+
"EnaBot|EnaBot|",
|
2131 |
+
"esculapio|esculapio/1.1|", "Esther|esther|",
|
2132 |
+
"everyfeed-spider|everyfeed-spider|F|",
|
2133 |
+
"Evliya|Evliya|", "nzexplorer|explorersearch|",
|
2134 |
+
"eZ publish Validator|eZpublishLinkValidator|",
|
2135 |
+
"FastCrawler|FastCrawler|R|",
|
2136 |
+
"FDSE|(compatible;FDSErobot)|R|",
|
2137 |
+
"Feed::Find|Feed::Find|",
|
2138 |
+
"FeedBurner|FeedBurner|F|",
|
2139 |
+
"FeedDemon|FeedDemon/|F|",
|
2140 |
+
"FeedHub FeedFetcher|FeedHub|F|",
|
2141 |
+
"Feedreader|Feedreader|F|",
|
2142 |
+
"Feedshow|Feedshow|F|",
|
2143 |
+
"Feedster|Feedster|F|",
|
2144 |
+
"FeedTools|feedtools|F|",
|
2145 |
+
"Feedfetcher-Google|Feedfetcher-google|F|",
|
2146 |
+
"Felix|FelixIDE/1.0|", "Wild|Hazel's|", "FetchRover|ESIRover|",
|
2147 |
+
"fido|fido/0.9|",
|
2148 |
+
"Fish|Fish-Search-Robot|", "Fouineur|Fouineur|",
|
2149 |
+
"Freecrawl|Freecrawl|R|", "FunnelWeb|FunnelWeb-1.0|",
|
2150 |
+
"gammaSpider|gammaSpider|", "gazz|gazz/1.0|", "GCreep|gcreep/1.0|",
|
2151 |
+
"GetRight|GetRight|R|",
|
2152 |
+
"GetterroboPlus|straight|",
|
2153 |
+
"GetURL|GetURL.rexx|", "Golem|Golem/1.1|",
|
2154 |
+
"Googlebot|Googlebot/|R|",
|
2155 |
+
"Google|googlebot/|R|","Google Images|Googlebot-Image|R|",
|
2156 |
+
"Google AdSense|Mediapartners-Google|R|",
|
2157 |
+
"Google Desktop|GoogleDesktop|F|",
|
2158 |
+
"GreatNews|GreatNews|F|",
|
2159 |
+
"Gregarius|Gregarius/|F|",
|
2160 |
+
"Gromit|Gromit/1.0|",
|
2161 |
+
"gsinfobot|gsinfobot|",
|
2162 |
+
"Northern|Gulliver/1.1|", "Gulper|Gulper|",
|
2163 |
+
"GurujiBot|GurujiBot|",
|
2164 |
+
"Harvest|yes|", "havIndex|havIndex/X.xx[bxx]|",
|
2165 |
+
"heritrix|heritrix/|",
|
2166 |
+
"HI|AITCSRobot/1.1|",
|
2167 |
+
"HKU|HKU|",
|
2168 |
+
"Hometown|Hometown|",
|
2169 |
+
"ht://Dig|htdig/3|R|", "HTMLgobble|HTMLgobble|", "Hyper-Decontextualizer|Hyper|",
|
2170 |
+
"iajaBot|iajaBot/0.1|", "IBM_Planetwide|IBM_Planetwide,|",
|
2171 |
+
"ichiro|ichiro|",
|
2172 |
+
"Popular|gestaltIconoclast/1.0|",
|
2173 |
+
"Ingrid|INGRID/0.1|", "Imagelock|Imagelock|", "IncyWincy|IncyWincy/1.0b1|", "Informant|Informant|",
|
2174 |
+
"InfoSeek|InfoSeek|",
|
2175 |
+
"InfoSpiders|InfoSpiders/0.1|", "Inspector|inspectorwww/1.0|", "IntelliAgent|'IAGENT/1.0'|",
|
2176 |
+
"ISC Systems iRc Search|ISCSystemsiRcSearch|",
|
2177 |
+
"Israeli-search|IsraeliSearch/1.0|",
|
2178 |
+
"IRLIRLbot/|IRLIRLbot|",
|
2179 |
+
"Italian Blog Rankings|blogbabel|F|",
|
2180 |
+
"Jakarta|Jakarta|",
|
2181 |
+
"Java|Java/|",
|
2182 |
+
"JBot|JBot|",
|
2183 |
+
"JCrawler|JCrawler/0.2|",
|
2184 |
+
"JoBo|JoBo|", "Jobot|Jobot/0.1alpha|", "JoeBot|JoeBot/x.x,|", "The|JubiiRobot/version#|", "JumpStation|jumpstation|",
|
2185 |
+
"image.kapsi.net|image.kapsi.net/1.0|R|",
|
2186 |
+
"Internet|User-Agent:|",
|
2187 |
+
"kalooga/kalooga|kalooga/kalooga|",
|
2188 |
+
"Katipo|Katipo/1.0|", "KDD-Explorer|KDD-Explorer/0.1|",
|
2189 |
+
"KIT-Fireball|KIT-Fireball/2.0|",
|
2190 |
+
"KindOpener|KindOpener|",
|
2191 |
+
"kinjabot|kinjabot|",
|
2192 |
+
"KO_Yappo_Robot|KO_Yappo_Robot/1.0.4(http://yappo.com/info/robot.html)|",
|
2193 |
+
"Krugle|Krugle|",
|
2194 |
+
"LabelGrabber|LabelGrab/1.1|",
|
2195 |
+
"Larbin|larbin_|", "legs|legs|",
|
2196 |
+
"libwww-perl|libwww-perl|",
|
2197 |
+
"lilina|Lilina|",
|
2198 |
+
"Link|Linkidator/0.93|", "LinkWalker|LinkWalker|",
|
2199 |
+
"LiteFinder|LiteFinder|",
|
2200 |
+
"logo.gif|logo.gif|",
|
2201 |
+
"LookSmart|grub-client|",
|
2202 |
+
"Lsearch/sondeur|Lsearch/sondeur|",
|
2203 |
+
"Lycos|Lycos/x.x|",
|
2204 |
+
"Magpie|Magpie/1.0|",
|
2205 |
+
"MagpieRSS|MagpieRSS|",
|
2206 |
+
"Mail.ru|Mail.ru|",
|
2207 |
+
"marvin/infoseek|marvin/infoseek|",
|
2208 |
+
"Mattie|M/3.8|",
|
2209 |
+
"MediaFox|MediaFox/x.y|",
|
2210 |
+
"Megite2.0|Megite.com|",
|
2211 |
+
"NEC-MeshExplorer|NEC-MeshExplorer|",
|
2212 |
+
"MindCrawler|MindCrawler|",
|
2213 |
+
"Missigua Locator|Missigua Locator|",
|
2214 |
+
"MJ12bot|MJ12bot|",
|
2215 |
+
"mnoGoSearch|UdmSearch|",
|
2216 |
+
"MOMspider|MOMspider/1.00|",
|
2217 |
+
"Monster|Monster/vX.X.X|",
|
2218 |
+
"Moreover|Moreoverbot|",
|
2219 |
+
"Motor|Motor/0.2|",
|
2220 |
+
"MSNBot|MSNBOT/0.1|R|",
|
2221 |
+
"MSN|msnbot|R|",
|
2222 |
+
"MSRBOT|MSRBOT|R|",
|
2223 |
+
"Muninn|Muninn/0.1|",
|
2224 |
+
"Muscat|MuscatFerret/<version>|",
|
2225 |
+
"Mwd.Search|MwdSearch/0.1|",
|
2226 |
+
"Naver|NaverBot|","Naver|Cowbot|",
|
2227 |
+
"NDSpider|NDSpider/1.5|",
|
2228 |
+
"Nederland.zoek|Nederland.zoek|",
|
2229 |
+
"NetCarta|NetCarta|", "NetMechanic|NetMechanic|",
|
2230 |
+
"NetScoop|NetScoop/1.0|",
|
2231 |
+
"NetNewsWire|NetNewsWire|",
|
2232 |
+
"NewsAlloy|NewsAlloy|",
|
2233 |
+
"newscan-online|newscan-online/1.1|",
|
2234 |
+
"NewsGatorOnline|NewsGatorOnline|",
|
2235 |
+
"NG/2.0|NG/2.0|",
|
2236 |
+
"NHSE|NHSEWalker/3.0|", "Nomad|Nomad-V2.x|",
|
2237 |
+
"Nutch/Nutch|Nutch/Nutch|",
|
2238 |
+
"ObjectsSearch|ObjectsSearch/0.01|",
|
2239 |
+
"Occam|Occam/1.0|",
|
2240 |
+
"Openfind|Openfind|",
|
2241 |
+
"OpiDig|OpiDig|",
|
2242 |
+
"Orb|Orbsearch/1.0|",
|
2243 |
+
"OSSE Scanner|OSSE Scanner|",
|
2244 |
+
"OWPBot|OWPBot|",
|
2245 |
+
"Pack|PackRat/1.0|", "ParaSite|ParaSite/0.21|",
|
2246 |
+
"Patric|Patric/0.01a|",
|
2247 |
+
"PECL::HTTP|PECL::HTTP|",
|
2248 |
+
"PerlCrawler|PerlCrawler/1.0|",
|
2249 |
+
"Phantom|Duppies|", "PhpDig|phpdig/x.x.x|",
|
2250 |
+
"PiltdownMan|PiltdownMan/1.0|",
|
2251 |
+
"Pimptrain.com's|Pimptrain|", "Pioneer|Pioneer|",
|
2252 |
+
"Portal|PortalJuice.com/4.0|", "PGP|PGP-KA/1.2|",
|
2253 |
+
"PlumtreeWebAccessor|PlumtreeWebAccessor/0.9|",
|
2254 |
+
"Poppi|Poppi/1.0|", "PortalB|PortalBSpider/1.0|",
|
2255 |
+
"psbot|psbot/|",
|
2256 |
+
"R6_CommentReade|R6_CommentReade|",
|
2257 |
+
"R6_FeedFetcher|R6_FeedFetcher|",
|
2258 |
+
"radianrss|RadianRSS|",
|
2259 |
+
"Raven|Raven-v2|",
|
2260 |
+
"relevantNOISE|www.relevantnoise.com|",
|
2261 |
+
"Resume|Resume|", "RoadHouse|RHCS/1.0a|",
|
2262 |
+
"RixBot|RixBot|", "Road|Road|",
|
2263 |
+
"Robbie|Robbie/0.1|", "RoboCrawl|RoboCrawl|",
|
2264 |
+
"RoboFox|Robofox|", "Robot|Robot|",
|
2265 |
+
"Robozilla|Robozilla/1.0|",
|
2266 |
+
"Rojo|rojo|F|",
|
2267 |
+
"Roverbot|Roverbot|",
|
2268 |
+
"RssBandit|RssBandit|",
|
2269 |
+
"RSSMicro|RSSMicro.com|F|",
|
2270 |
+
"Ruby|Rfeedfinder|",
|
2271 |
+
"RuLeS|RuLeS/1.0|",
|
2272 |
+
"Runnk RSS aggregator|Runnk|",
|
2273 |
+
"SafetyNet|SafetyNet|",
|
2274 |
+
"Sage|(Sage)|F|",
|
2275 |
+
"SBIder|Site|",
|
2276 |
+
"Scooter|Scooter/2.0|",
|
2277 |
+
"ScoutJet|ScoutJet|",
|
2278 |
+
"Search.Aus-AU.COM|not|",
|
2279 |
+
"SearchProcess|searchprocess/0.9|",
|
2280 |
+
"Seekbot|HTTPFetcher|",
|
2281 |
+
"wp-autoblogSimplePie|SimplePie|",
|
2282 |
+
"Sitemap Generator|SitemapGenerator|",
|
2283 |
+
"Senrigan|Senrigan/xxxxxx|",
|
2284 |
+
"SG-Scout|SG-Scout|", "Shai'Hulud|Shai'Hulud|",
|
2285 |
+
"Simmany|SimBot/1.0|",
|
2286 |
+
"SiteTech-Rover|SiteTech-Rover|",
|
2287 |
+
"shelob|shelob|",
|
2288 |
+
"Skymob.com|aWapClient|",
|
2289 |
+
"Sleek|Sleek|",
|
2290 |
+
"Inktomi|Slurp/2.0|",
|
2291 |
+
"Snapbot|Snap|",
|
2292 |
+
"Smart|ESISmartSpider/2.0|",
|
2293 |
+
"Snooper|Snooper/b97_01|", "Solbot|Solbot/1.0|",
|
2294 |
+
"Sphere Scout|SphereScout|",
|
2295 |
"Spider|Spider|", "spider_monkey|mouse.house/7.1|", "SpiderBot|SpiderBot/1.0|", "Spiderline|spiderline/3.1.3|", "SpiderView(tm)|SpiderView|", "Site|ssearcher100|",
|
2296 |
+
"StackRambler|StackRambler|",
|
2297 |
+
"Strategic Board Bot|StrategicBoardBot|",
|
2298 |
+
"Suke|suke/*.*|",
|
2299 |
+
"SummizeFeedReader|SummizeFeedReader|",
|
2300 |
+
"suntek|suntek/1.0|",
|
2301 |
+
"SurveyBot|SurveyBot|",
|
2302 |
+
"Sygol|http://www.sygol.com|",
|
2303 |
+
"Syndic8|Syndic8|F|",
|
2304 |
+
"TACH|TACH|", "Tarantula|Tarantula/1.0|",
|
2305 |
+
"tarspider|tarspider|", "Tcl|dlw3robot/x.y|",
|
2306 |
+
"TechBOT|TechBOT|",
|
2307 |
+
"Technorati|Technoratibot|",
|
2308 |
+
"Teemer|Teemer|",
|
2309 |
+
"Templeton|Templeton/{version}|",
|
2310 |
+
"TitIn|TitIn/0.2|", "TITAN|TITAN/0.1|",
|
2311 |
+
"Twiceler|cuill.com/twiceler/|R|",
|
2312 |
+
"UCSD|UCSD-Crawler|", "UdmSearch|UdmSearch/2.1.1|",
|
2313 |
+
"UniversalFeedParser|UniversalFeedParser|",
|
2314 |
+
"UptimeBot|uptimebot|",
|
2315 |
+
"URL|urlck/1.2.3|", "URL|URL|",
|
2316 |
+
"VadixBot|VadixBot|",
|
2317 |
+
"Valkyrie|Valkyrie/1.0|", "Verticrawl|Verticrawlbot|", "Victoria|Victoria/1.0|", "vision-search|vision-search/3.0'|",
|
2318 |
+
"void-bot|void-bot/0.1|",
|
2319 |
+
"Voila|VoilaBot|",
|
2320 |
+
"Voyager|Voyager/0.0|", "VWbot|VWbot_K/4.2|",
|
2321 |
+
"W3C_Validator|W3C_Validator|",
|
2322 |
+
"The|w3index|", "W3M2|W3M2/x.xxx|",
|
2323 |
+
"w3mir|w3mir|",
|
2324 |
+
"w@pSpider|w@pSpider/xxx|",
|
2325 |
+
"WallPaper|CrawlPaper/n.n.n|", "the|WWWWanderer|",
|
2326 |
+
"Web|root/0.1|",
|
2327 |
+
"WebCatcher|WebCatcher/1.0|",
|
2328 |
+
"webcollage|webcollage|",
|
2329 |
+
"WebCopier|WebCopier|",
|
2330 |
+
"WebCopy|WebCopy/(version)|",
|
2331 |
+
"webfetcher|WebFetcher/0.8,|",
|
2332 |
+
"WebGenBot|WebGenBot|",
|
2333 |
+
"Webinator|weblayers|",
|
2334 |
+
"weblayers/0.0|WebLinker|",
|
2335 |
+
"WebLinker/0.0|WebMirror|",
|
2336 |
+
"webLyzard|webLyzard|",
|
2337 |
+
"Weblog|wlm-1.1|",
|
2338 |
+
"Digimarc|WebReaper|", "WebReaper|webs|", "webs@recruit.co.jp|Websnarf|", "WebVac|webvac/1.0|", "webwalk|webwalk|",
|
2339 |
+
"WebWalker|WebWalker/1.10|", "WebWatch|WebWatch|",
|
2340 |
+
"WebStolperer|WOLP/1.0|",
|
2341 |
+
"WebZinger|none|",
|
2342 |
+
"Wells Search II|WellsSearchII|",
|
2343 |
+
"Wget|Wget/1.4.0|",
|
2344 |
+
"Wget|Wget/1.|",
|
2345 |
+
"whatUseek|whatUseek_winona/3.0|",
|
2346 |
+
"whiteiexpres/Nutch|whiteiexpres/Nutch|",
|
2347 |
+
"wikioblogs|wikioblogs|",
|
2348 |
+
"WikioFeedBot|WikioFeedBot|",
|
2349 |
+
"WikioPxyFeedBo|WikioPxyFeedBo|",
|
2350 |
+
"Wired|wired-digital-newsbot/1.5|",
|
2351 |
+
"Wordpress Pingback/Trackback|Wordpress|",
|
2352 |
+
"WWWC|WWWC/0.25|",
|
2353 |
+
"XGET|XGET/0.7|",
|
2354 |
+
"yacybot|yacybot|",
|
2355 |
+
"MyBlogLog|Yahoo!MyBlogLogAPIClient|F|",
|
2356 |
+
"Yahoo!|slurp@inktomi|","Yahoo!|Yahoo!Slurp|","Yahoo!|MMCrawler|",
|
2357 |
+
"Yahoo FeedSeeker|YahooFeedSeeker|",
|
2358 |
+
"Yandex|Yandex|");
|
2359 |
foreach($lines as $line_num => $spider) {
|
2360 |
+
list($nome,$key,$typebot)=explode("|",$spider);
|
2361 |
+
if ($key != "") {
|
2362 |
+
if(strstr($agent,$key)===FALSE) {
|
2363 |
+
continue;
|
2364 |
+
} else {
|
2365 |
+
$crawler = trim($nome);
|
2366 |
+
if (!empty($typebot) && $typebot == "F") {
|
2367 |
+
$feed = $crawler;
|
2368 |
+
}
|
2369 |
+
}
|
2370 |
+
}
|
2371 |
}
|
2372 |
} // end if crawler
|
2373 |
|
2374 |
+
//#If crawler not in list, use first word in user agent for crawler name
|
2375 |
+
if (empty($crawler)) {
|
2376 |
+
if (preg_match("/^(\w+)[\/\ \-\:_\.]/",$ua,$matches) > 0) {
|
2377 |
+
if (strlen($matches[1]) > 1 && $matches[1] != "Mozilla") {
|
2378 |
+
$crawler = $matches[1];
|
2379 |
+
}
|
2380 |
+
}
|
2381 |
+
if (empty($crawler) && !empty($browser)) {
|
2382 |
+
$crawler = $browser;
|
2383 |
+
}
|
2384 |
+
}
|
2385 |
+
|
2386 |
+
//#do a feed check and get feed subcribers, if available
|
2387 |
if (preg_match("/([0-9]{1,10})(subscriber)/i",$agent,$subscriber) > 0) {
|
2388 |
// It's a feedreader with some subscribers
|
2389 |
$feed = $subscriber[1];
|
2390 |
if (empty($crawler)) {
|
2391 |
$crawler = "Feed Reader";
|
2392 |
}
|
2393 |
+
} elseif (is_feed() || (empty($feed) && preg_match("/(feed|rss)/i",$agent)>0)) {
|
2394 |
+
if (!empty($crawler)) {
|
2395 |
+
$feed = $crawler;
|
2396 |
+
} else {
|
2397 |
$crawler = "Feed Reader";
|
2398 |
$feed = "feed reader";
|
|
|
|
|
2399 |
}
|
2400 |
+
} //end else preg_match subscriber
|
2401 |
|
2402 |
+
//check for spoofers of Google/Yahoo crawlers...
|
2403 |
if ($hostname!="") {
|
2404 |
+
if (preg_match('/^(googlebot|yahoo\!\ slurp)/i',$crawler)>0 && preg_match('/\.(googlebot|yahoo)\./i',$hostname)==0){
|
2405 |
$crawler = "Spoofer bot";
|
2406 |
}
|
2407 |
} //end if hostname
|
2408 |
|
2409 |
return array($crawler,trim($feed));
|
2410 |
+
} //end function wGetSpider
|
2411 |
+
|
2412 |
+
//#get the visitor locale/language
|
2413 |
+
function wGetLocale($language="",$hostname="",$referrer="") {
|
2414 |
+
//#use country code for language, if it exists in hostname
|
2415 |
+
if (!empty($hostname) && preg_match("/\.[a-zA-Z]{2}$/", $hostname) > 0) {
|
2416 |
+
$country = strtolower(substr($hostname,-2));
|
2417 |
+
if ($country == "uk") { $country = "gb"; } //change UK to GB for consistent language codes
|
2418 |
+
$language = $country;
|
2419 |
+
} elseif (strlen($language) >2) {
|
2420 |
+
$langarray = @explode("-", $language);
|
2421 |
+
$langarray = @explode(",", $langarray[1]);
|
2422 |
+
list($language) = @explode(";", strtolower($langarray[0]));
|
2423 |
+
}
|
2424 |
+
//#check referrer search string for language/locale code, if any
|
2425 |
+
if ((empty($language) || $language=="us" || $language=="en") && !empty($referrer)) {
|
2426 |
+
$country = $language;
|
2427 |
+
// google referrer syntax: google.com[.country],hl=language
|
2428 |
+
if (preg_match('/\.google(\.com)?\.(com|([a-z]{2}))?\/.*[&?]hl\=(\w{2})\-?(\w{2})?/',$referrer,$matches)>0) {
|
2429 |
+
if (!empty($matches[5])) {
|
2430 |
+
$country = strtolower($matches[5]);
|
2431 |
+
} elseif (!empty($matches[3])) {
|
2432 |
+
$country = strtolower($matches[3]);
|
2433 |
+
} elseif (!empty($matches[4])) {
|
2434 |
+
$country = strtolower($matches[4]);
|
2435 |
+
}
|
2436 |
+
}
|
2437 |
+
$language = $country;
|
2438 |
+
}
|
2439 |
+
//default to "US" if language==en (english)
|
2440 |
+
if ($language == "en") {
|
2441 |
+
$language = "us";
|
2442 |
+
}
|
2443 |
+
return $language;
|
2444 |
+
} //end function wGetLocale
|
2445 |
|
2446 |
//# Check input, $referrer against a list of known spammers and
|
2447 |
//# return "1" if match found.
|
2678 |
print "$before_title ".__('Last searched terms','wassup')." $after_title";
|
2679 |
print "<ul class='$ulclass'>";
|
2680 |
foreach ($query_det as $sref) {
|
2681 |
+
print "<li>- <a href='".attribute_escape($sref->referrer)."' target='_blank' rel='nofollow'>".stringShortener(attribute_escape($sref->search), $chars)."</a></li>";
|
2682 |
}
|
2683 |
print "</ul>";
|
2684 |
}
|
2691 |
print "$before_title ".__('Last referers','wassup')." $after_title";
|
2692 |
print "<ul class='$ulclass'>";
|
2693 |
foreach ($query_ref as $eref) {
|
2694 |
+
print "<li>- <a href='".attribute_escape($eref->referrer)."' target='_blank' rel='nofollow'>".stringShortener(pregi_replace("#https?://#", "", attribute_escape($eref->referrer)), $chars)."</a></li>";
|
2695 |
}
|
2696 |
print "</ul>";
|
2697 |
}
|
2699 |
|
2700 |
// Widget TOP Browsers
|
2701 |
if ($wassup_settings['wassup_widget_topbr'] == 1) {
|
2702 |
+
$query_topbr = $wpdb->get_results("SELECT count(browser) as top_browser, browser FROM $table_name WHERE browser!='' AND browser NOT LIKE 'N/A%' GROUP BY browser ORDER BY top_browser DESC LIMIT ".attribute_escape($topbrlimit)."");
|
2703 |
if (count($query_topbr) > 0) {
|
2704 |
print "$before_title ".__('Top Browsers','wassup')." $after_title";
|
2705 |
print "<ul class='$ulclass'>";
|
2712 |
|
2713 |
// Widget TOP Oses
|
2714 |
if ($wassup_settings['wassup_widget_topos'] == 1) {
|
2715 |
+
$query_topos = $wpdb->get_results("SELECT count(os) as top_os, os FROM $table_name WHERE os!='' AND os NOT LIKE 'N/A%' GROUP BY os ORDER BY top_os DESC LIMIT ".attribute_escape($toposlimit)."");
|
2716 |
if (count($query_topos) > 0) {
|
2717 |
print "$before_title ".__('Top OS','wassup')." $after_title";
|
2718 |
print "<ul class='$ulclass'>";
|
2834 |
print "$before_title Last searched terms $after_title";
|
2835 |
print "<ul class='$ulclass'>";
|
2836 |
foreach ($query_det as $sref) {
|
2837 |
+
print "<li>- <a href='".attribute_escape($sref->referrer)."' target='_blank' rel='nofollow'>".stringShortener(attribute_escape($sref->search), $chars)."</a></li>";
|
2838 |
}
|
2839 |
print "</ul>";
|
2840 |
}
|
2846 |
print "$before_title Last referers $after_title";
|
2847 |
print "<ul class='$ulclass'>";
|
2848 |
foreach ($query_ref as $eref) {
|
2849 |
+
print "<li>- <a href='".attribute_escape($eref->referrer)."' target='_blank' rel='nofollow'>".stringShortener(preg_replace("#https?://#", "", attribute_escape($eref->referrer)), $chars)."</a></li>";
|
2850 |
}
|
2851 |
print "</ul>";
|
2852 |
}
|
2853 |
}
|
2854 |
|
2855 |
if ($wtopbr == 1) {
|
2856 |
+
$query_topbr = $wpdb->get_results("SELECT count(browser) as top_browser, browser FROM $table_name WHERE browser!='' AND browser NOT LIKE 'N/A%' GROUP BY browser ORDER BY top_browser DESC LIMIT $topbrlimit");
|
2857 |
if (count($query_topbr) > 0) {
|
2858 |
print "$before_title Top Browsers $after_title";
|
2859 |
print "<ul class='$ulclass'>";
|
2865 |
}
|
2866 |
|
2867 |
if ($wtopos == 1) {
|
2868 |
+
$query_topos = $wpdb->get_results("SELECT count(os) as top_os, os FROM $table_name WHERE os!='' AND os NOT LIKE 'N/A%' GROUP BY os ORDER BY top_os DESC LIMIT $toposlimit");
|
2869 |
if (count($query_topos) > 0) {
|
2870 |
print "$before_title Top OS $after_title";
|
2871 |
print "<ul class='$ulclass'>";
|
2917 |
add_action('activity_box_end', 'wassupDashChart');
|
2918 |
|
2919 |
//## Wassup visitor tracking hooks
|
2920 |
+
//record visit after page is displayed to keep page load fast
|
2921 |
add_action('shutdown', 'wassupAppend');
|
2922 |
//add_action('send_headers', 'wassupAppend'); //slows down page load
|
2923 |
add_action('wp_head', 'add_wassup_meta_info');
|