WassUp Real Time Analytics - Version 1.7.2.1

Version Description

Download this release

Release Info

Developer michelem
Plugin Icon 128x128 WassUp Real Time Analytics
Version 1.7.2.1
Comparing to
See all releases

Code changes from version 1.7.2 to 1.7.2.1

language/{cs_CS.mo → cs_CZ.mo} RENAMED
Binary file
language/{cs_CS.po → cs_CZ.po} RENAMED
@@ -8,13 +8,13 @@ msgstr ""
8
  "Project-Id-Version: wassup\n"
9
  "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
10
  "POT-Creation-Date: 2009-05-18 12:28+0100\n"
11
- "PO-Revision-Date: 2009-07-13 01:10+0000\n"
12
  "Last-Translator: bengo <dominikmatus@seznam.cz>\n"
13
  "Language-Team: Czech <cs@li.org>\n"
14
  "MIME-Version: 1.0\n"
15
  "Content-Type: text/plain; charset=UTF-8\n"
16
  "Content-Transfer-Encoding: 8bit\n"
17
- "X-Launchpad-Export-Date: 2009-08-18 10:16+0000\n"
18
  "X-Generator: Launchpad (build Unknown)\n"
19
 
20
  #: wassup.php:45
@@ -184,7 +184,7 @@ msgstr "zobrazit graf"
184
 
185
  #: wassup.php:1115
186
  msgid "Summary for the last"
187
- msgstr "Zobrazit za posledních"
188
 
189
  #: wassup.php:1122
190
  msgid "Items per page"
@@ -683,7 +683,7 @@ msgstr "minuty interval obnovování (výchozí 3)"
683
 
684
  #: lib/settings.php:126
685
  msgid "Show visitor details for"
686
- msgstr "Zobrazit v Detailech návštěvníků pouze"
687
 
688
  #: lib/settings.php:131
689
  msgid "Number of items per page"
@@ -757,15 +757,15 @@ msgstr "Zaškrtněte pro statistiky záznamu pro každý typ \"návštěvníka\"
757
 
758
  #: lib/settings.php:176
759
  msgid "Record logged in users"
760
- msgstr "Záznam přihlášených uživatelů"
761
 
762
  #: lib/settings.php:178
763
  msgid "Record spiders and bots"
764
- msgstr "Zaznamenat pavouky a boty"
765
 
766
  #: lib/settings.php:179
767
  msgid "Record attack/exploit attempts (libwww-perl agent)"
768
- msgstr "Záznam pokusů útoků / využití (libwww perl-agent)"
769
 
770
  #: lib/settings.php:183
771
  msgid "Checkbox to record statistics for each type of \"spam\""
@@ -920,7 +920,7 @@ msgstr "Vše"
920
 
921
  #: lib/wassup.class.php:233
922
  msgid "No spider"
923
- msgstr "bez poavouků"
924
 
925
  #: lib/wassup.class.php:235
926
  msgid "No Spam"
@@ -928,7 +928,7 @@ msgstr "Kromě spamu"
928
 
929
  #: lib/wassup.class.php:236
930
  msgid "No Spam, No Spider"
931
- msgstr "bez spammu a pavouků"
932
 
933
  #: lib/wassup.class.php:237
934
  msgid "Users logged in"
@@ -1010,7 +1010,7 @@ msgstr "Kanál"
1010
  #: wassup.php:1278
1011
  #: lib/wassup.class.php:232
1012
  msgid "Spider"
1013
- msgstr "Pavouka"
1014
 
1015
  #: wassup.php:1280
1016
  msgid "Regular visitor"
@@ -1220,7 +1220,7 @@ msgstr "GEO IP Map (Špěhování)"
1220
 
1221
  #: lib/settings.php:89
1222
  msgid "Display a GEO IP Map in the spy visitors view"
1223
- msgstr "Zobrazit GEO IP Mapu ve špehování návštěvníků"
1224
 
1225
  #: lib/settings.php:97
1226
  msgid "Activation problem >> Error code"
8
  "Project-Id-Version: wassup\n"
9
  "Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
10
  "POT-Creation-Date: 2009-05-18 12:28+0100\n"
11
+ "PO-Revision-Date: 2009-07-02 10:57+0000\n"
12
  "Last-Translator: bengo <dominikmatus@seznam.cz>\n"
13
  "Language-Team: Czech <cs@li.org>\n"
14
  "MIME-Version: 1.0\n"
15
  "Content-Type: text/plain; charset=UTF-8\n"
16
  "Content-Transfer-Encoding: 8bit\n"
17
+ "X-Launchpad-Export-Date: 2009-07-13 00:44+0000\n"
18
  "X-Generator: Launchpad (build Unknown)\n"
19
 
20
  #: wassup.php:45
184
 
185
  #: wassup.php:1115
186
  msgid "Summary for the last"
187
+ msgstr "Zobrazit za poslední"
188
 
189
  #: wassup.php:1122
190
  msgid "Items per page"
683
 
684
  #: lib/settings.php:126
685
  msgid "Show visitor details for"
686
+ msgstr "Zobrazit detaily návštěvníka pro"
687
 
688
  #: lib/settings.php:131
689
  msgid "Number of items per page"
757
 
758
  #: lib/settings.php:176
759
  msgid "Record logged in users"
760
+ msgstr "Rekord přihlášených uživatelů"
761
 
762
  #: lib/settings.php:178
763
  msgid "Record spiders and bots"
764
+ msgstr "Rekord pavouků a botů"
765
 
766
  #: lib/settings.php:179
767
  msgid "Record attack/exploit attempts (libwww-perl agent)"
768
+ msgstr "Rekord pokusů útoků / využití (libwww perl-agent)"
769
 
770
  #: lib/settings.php:183
771
  msgid "Checkbox to record statistics for each type of \"spam\""
920
 
921
  #: lib/wassup.class.php:233
922
  msgid "No spider"
923
+ msgstr "Kromě pavouků"
924
 
925
  #: lib/wassup.class.php:235
926
  msgid "No Spam"
928
 
929
  #: lib/wassup.class.php:236
930
  msgid "No Spam, No Spider"
931
+ msgstr "Kromě spamu a pavouků"
932
 
933
  #: lib/wassup.class.php:237
934
  msgid "Users logged in"
1010
  #: wassup.php:1278
1011
  #: lib/wassup.class.php:232
1012
  msgid "Spider"
1013
+ msgstr "Pavouk"
1014
 
1015
  #: wassup.php:1280
1016
  msgid "Regular visitor"
1220
 
1221
  #: lib/settings.php:89
1222
  msgid "Display a GEO IP Map in the spy visitors view"
1223
+ msgstr "Zobrazit GEO IP Mapů ve špehování návštěvníků"
1224
 
1225
  #: lib/settings.php:97
1226
  msgid "Activation problem >> Error code"
lib/main.php CHANGED
@@ -502,34 +502,35 @@ function stringShortener($input, $max=0, $separator="(...)", $exceedFromEnd=0){
502
  //Replace all %-hex chars with literals and trim the input string
503
  // of whitespaces ...because it's shorter and more legible.
504
  // -Helene D. 11/18/07
505
- $input = attribute_escape(trim(stripslashes(rawurldecode(html_entity_decode($input)))," +\t")); //insecure
506
 
507
- $inputlen=strlen($input);
508
  $max=(is_numeric($max))?(integer)$max:$inputlen;
509
- if($max>=$inputlen){return $input;};
510
- $separator=($separator)?$separator:"(...)";
511
- $modulus=(($max%2));
512
- $halfMax=floor($max/2);
513
- $begin="";
514
- if(!$modulus){$begin=substr($input, 0, $halfMax);}
515
- else{$begin=(!$exceedFromEnd)? substr($input, 0, $halfMax+1) : substr($input, 0, $halfMax);}
516
- $end="";
517
- if(!$modulus){$end=substr($input,$inputlen-$halfMax);}
518
- else{$end=($exceedFromEnd)? substr($input,$inputlen-$halfMax-1) :substr($input,$inputlen-$halfMax);}
519
- $extracted=substr( $input, strpos($input,$begin)+strlen($begin), $inputlen-$max );
520
- $outstring = $begin.$separator.$end;
521
- if (strlen($outstring) >= $inputlen) { //Because "Fir(...)fox" is longer than "Firefox"
522
- $outstring = $input;
523
- }
524
- //# add WordPress 2.x function attribute_escape and 1.2.x function
525
- // wp_specialchars to make malicious code harmless when echoed to
526
- // the screen...
527
- if (function_exists('attribute_escape')) {
528
- return attribute_escape(wp_specialchars($outstring,ENT_QUOTES));
529
  } else {
530
- return addslashes(wp_specialchars($outstring,ENT_QUOTES));
531
  }
532
- }
 
533
 
534
  //# Return a value of true if url argument is a root url and false when
535
  //# url constains a subdirectory path or query parameters...
@@ -568,15 +569,15 @@ function wAddSiteurl($inputurl) {
568
  }
569
 
570
  //sanitize url of potentially dangerous code before display
571
- function wCleanURL($url) {
572
  if (empty($url)) {
573
  return;
574
  }
575
- $urlstring = stripslashes($url);
576
  if (function_exists('esc_url')) { //#WP 2.8+
577
- $cleaned_url = esc_url($urlstring);
578
  } else {
579
- $cleaned_url = clean_url($urlstring);
580
  }
581
  if (empty($cleaned_url)) { //oops, clean_url chomp
582
  $cleaned_url = attribute_escape(stripslashes($url));
@@ -674,13 +675,12 @@ function spyview ($from_date="",$to_date="",$rows="999",$spytype="",$spy_datasou
674
  $map_icon = "marker_user.png";
675
  }
676
 
677
- // Start getting GEOIP info
678
  // Start getting GEOIP info
679
  $location="";
680
  $lat = 0;
681
  $lon = 0;
682
  if (function_exists('curl_init')) {
683
- //TODO: save geo data in 'wassup_geoloc' table
684
  // so multi-page visits from save ip don't do
685
  // redundant curl lookups
686
  $geo_url = "http://api.hostip.info/get_html.php?ip=".$ip[0]."&position=true";
@@ -911,7 +911,7 @@ function wGetStats($stat_type, $stat_limit=10, $stat_condition="") {
911
  $stat_results = $wpdb->get_results("SELECT count(LOWER(language)) as top_count, LOWER(language) as top_item FROM $table_name WHERE $stat_condition AND language!='' AND spider='' GROUP BY top_item ORDER BY top_count DESC LIMIT $stat_limit");
912
 
913
  } else {
914
- //check that wp_wassup.$stat_type column exist and is char
915
  if (!empty($stat_type)) {
916
  $stat_results = $wpdb->get_results("SELECT count($stat_type) AS top_count, `$stat_type` AS top_item FROM $table_name WHERE $stat_condition AND `$stat_type`!='' AND `$stat_type` NOT LIKE 'N/A%' GROUP BY `$stat_type` ORDER BY top_count DESC LIMIT $stat_limit");
917
  }
502
  //Replace all %-hex chars with literals and trim the input string
503
  // of whitespaces ...because it's shorter and more legible.
504
  // -Helene D. 11/18/07
505
+ $instring = trim(stripslashes(rawurldecode(html_entity_decode($input)))," +\t"); //insecure
506
 
507
+ $inputlen=strlen($instring);
508
  $max=(is_numeric($max))?(integer)$max:$inputlen;
509
+ //if($max>=$inputlen){return $input;}; //caused security loophole ...only $outstring should be returned
510
+ if ($max < $inputlen) {
511
+ $separator=($separator)?$separator:"(...)";
512
+ $modulus=(($max%2));
513
+ $halfMax=floor($max/2);
514
+ $begin="";
515
+ if(!$modulus){$begin=substr($instring, 0, $halfMax);}
516
+ else{$begin=(!$exceedFromEnd)? substr($instring, 0, $halfMax+1) : substr($instring, 0, $halfMax);}
517
+ $end="";
518
+ if(!$modulus){$end=substr($instring,$inputlen-$halfMax);}
519
+ else{$end=($exceedFromEnd)? substr($instring,$inputlen-$halfMax-1) :substr($instring,$inputlen-$halfMax);}
520
+ $extracted=substr($instring, strpos($instring,$begin)+strlen($begin), $inputlen-$max );
521
+ $outstring = $begin.$separator.$end;
522
+ if (strlen($outstring) >= $inputlen) { //Because "Fir(...)fox" is longer than "Firefox"
523
+ $outstring = $instring;
524
+ }
525
+ //# use WordPress 2.x function attribute_escape and 1.2.x
526
+ // function wp_specialchars to make malicious code
527
+ // harmless when echoed to the screen
528
+ $outstring=attribute_escape(wp_specialchars($outstring,ENT_QUOTES));
529
  } else {
530
+ $outstring = attribute_escape(wp_specialchars($instring,ENT_QUOTES));
531
  }
532
+ return $outstring;
533
+ } //end function stringShortener
534
 
535
  //# Return a value of true if url argument is a root url and false when
536
  //# url constains a subdirectory path or query parameters...
569
  }
570
 
571
  //sanitize url of potentially dangerous code before display
572
+ function wCleanURL($url="") {
573
  if (empty($url)) {
574
  return;
575
  }
576
+ //$urlstring = stripslashes($url);
577
  if (function_exists('esc_url')) { //#WP 2.8+
578
+ $cleaned_url = esc_url(stripslashes($url));
579
  } else {
580
+ $cleaned_url = clean_url(stripslashes($url));
581
  }
582
  if (empty($cleaned_url)) { //oops, clean_url chomp
583
  $cleaned_url = attribute_escape(stripslashes($url));
675
  $map_icon = "marker_user.png";
676
  }
677
 
 
678
  // Start getting GEOIP info
679
  $location="";
680
  $lat = 0;
681
  $lon = 0;
682
  if (function_exists('curl_init')) {
683
+ //TODO: save geo data in 'wassup_tmp_geoloc' table
684
  // so multi-page visits from save ip don't do
685
  // redundant curl lookups
686
  $geo_url = "http://api.hostip.info/get_html.php?ip=".$ip[0]."&position=true";
911
  $stat_results = $wpdb->get_results("SELECT count(LOWER(language)) as top_count, LOWER(language) as top_item FROM $table_name WHERE $stat_condition AND language!='' AND spider='' GROUP BY top_item ORDER BY top_count DESC LIMIT $stat_limit");
912
 
913
  } else {
914
+ //TODO: check that wp_wassup.$stat_type column exist and is char
915
  if (!empty($stat_type)) {
916
  $stat_results = $wpdb->get_results("SELECT count($stat_type) AS top_count, `$stat_type` AS top_item FROM $table_name WHERE $stat_condition AND `$stat_type`!='' AND `$stat_type` NOT LIKE 'N/A%' GROUP BY `$stat_type` ORDER BY top_count DESC LIMIT $stat_limit");
917
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=michele%
4
  Tags: tracker, tracking, statistics, analyze, web, realtime, stats, ajax, visitors, visits, online users, details, seo, admin, spy, visitors, widgets, widget, sidebar, monitor, webmaster, tool
5
  Requires at least: 2.2
6
  Tested up to: 2.8.3 - 2.7.* - 2.6.* - 2.5.* - 2.3.* - 2.2.3 - 2.2.2
7
- Stable tag: 1.7.2
8
 
9
  Analyze your visitors traffic with real time statistics, chart, a lot of chronological information and a sidebar Widget.
10
 
4
  Tags: tracker, tracking, statistics, analyze, web, realtime, stats, ajax, visitors, visits, online users, details, seo, admin, spy, visitors, widgets, widget, sidebar, monitor, webmaster, tool
5
  Requires at least: 2.2
6
  Tested up to: 2.8.3 - 2.7.* - 2.6.* - 2.5.* - 2.3.* - 2.2.3 - 2.2.2
7
+ Stable tag: 1.7.2.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,7 +3,7 @@
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. For Wordpress 2.2 or higher.
6
- Version: 1.7.2
7
  Author: Michele Marcucci, Helene D.
8
  Author URI: http://www.michelem.org/
9
  Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
@@ -17,7 +17,7 @@ http://www.gnu.org/licenses/gpl.txt
17
  if (preg_match('#'.basename(__FILE__) .'#', $_SERVER['PHP_SELF'])) {
18
  die('Permission Denied! You are not allowed to call this page directly.');
19
  }
20
- $wassupversion = "1.7.2";
21
  $debug_mode=false; //turns on debugging (global)
22
  $wassupdir = dirname(__FILE__);
23
  define('WASSUPFOLDER', dirname(plugin_basename(__FILE__)), TRUE);
@@ -239,18 +239,22 @@ function wassup_meta_info($screen_res="") {
239
  //$siteurl = get_bloginfo('siteurl');
240
  if ($wassup_options->wassup_active == "1") {
241
  print '<meta name="wassup-version" content="'.$wassupversion.'" />'."\n";
242
- //if (!is_admin() || empty($current_user)) {
243
  //add screen resolution javascript to blog header
244
  if ($screen_res == "" && isset($_COOKIE['wassup_screen_res'])) {
245
  $screen_res = $_COOKIE['wassup_screen_res'];
 
246
  }
247
- if (empty($screen_res) && isset($_GET['wscr'])) {
248
- $screen_res = $_GET['wscr'];
 
249
  }
250
- //if (empty($screen_res) && isset($_POST['wscr'])) {
251
- // $screen_res = $_POST['wscr'];
 
 
 
 
252
  //}
253
-
254
  //Get visitor's screen resolution using javascript and a cookie.
255
  // - Added here so javascript code is placed in document <head>
256
  // to store this client-side only variable in a cookie that PHP
@@ -258,69 +262,54 @@ function wassup_meta_info($screen_res="") {
258
  <script type="text/javascript">
259
  //<![CDATA[
260
  var screen_res = "<?php echo $screen_res; ?>";
261
- <?php if (empty($screen_res) && !isset($_COOKIE['wassup_screen_res']) && !isset($_GET['wscr']) && !isset($_POST['wscr'])) { ?>
262
- var screenwidth = screen.width;
263
- var screenheight = screen.height;
264
- if (screenwidth != "") {
265
- screen_res = screenwidth + "x" + screenheight;
266
- }
267
- function writeCookie(cname,cvalue,chours) {
268
- var the_cookie = cname + "=" + cvalue;
269
- var ctime=chours*60*60*1000; //convert hours to microseconds
270
- if (ctime > 0) { //0==expires on browser close
271
- var expireDate = new Date();
272
- expireDate.setTime(expireDate.getTime()+ctime);
273
- var expires = expireDate.toGMTString();
274
- the_cookie = the_cookie + "; expires=" + expires;
275
- }
276
- <?php if (defined('COOKIE_DOMAIN')) {
277
  $cookiedomain = COOKIE_DOMAIN;
278
  $cookiepath = "/";
279
  } else {
280
  $cookieurl = parse_url(get_option('home'));
281
- $cookiedomain = preg_replace('/^www\./i','',$cookieurl['host']);
282
  $cookiepath = $cookieurl['path'];
283
  }
284
- if (!empty($cookiedomain)) {
285
- if (!empty($cookiepath)) {
286
- echo "\t".'the_cookie = the_cookie + "; domain='.$cookiedomain.'"; path='.$cookiepath.'";';
287
- } else {
288
- echo "\t".'the_cookie = the_cookie + "; domain='.$cookiedomain.'";';
289
- }
290
- }
291
- echo "\n\t\tdocument.cookie = the_cookie;\n"; ?>
292
  }
 
 
293
  <?php
294
- // If visitor stays online, try a page reload after 40 seconds so
295
- // WassUp (PHP) can read and record screen resolution. In case
296
- // cookie is rejected, screen resolution is also assigned as GET
297
- // parameter, 'wscr', and included on request line. ?>
298
- function resolution_reload() {
299
  if (screen_res != "") {
300
- var reload_url="<?php
301
  if (empty($_SERVER['QUERY_STRING'])) {
302
  echo $_SERVER['REQUEST_URI'].'?wscr=';
303
  } else {
304
  echo $_SERVER['REQUEST_URI'].'&wscr=';
305
- } ?>"+screen_res;
306
  location.replace(reload_url);
307
  }
308
  }
309
- writeCookie("wassup_screen_res",screen_res,"48"); //keep 2 days
310
- <?php
311
  //reload page after timeout of 40 seconds with 'wscr' param set (browsers only, no spiders)
312
- if (preg_match('/(?:Opera|Gecko|Webkit|MSIE)/i',$_SERVER['HTTP_USER_AGENT'])>0 && !is_user_logged_in()) {
313
- echo "\t".'if (screen_res != "")';
314
- echo "\n\t\t".'setTimeout("resolution_reload()",40000);'."\n";
315
- }
316
- ?>
317
- <?php //} else {
318
- //var screen_res = "<?php if (isset($_COOKIE['wassup_screen_res'])) { echo $_COOKIE['wassup_screen_res']; } elseif (isset($_GET['wscr'])) { echo $_GET['wscr']; }
319
- } //end if empty($screen_res) ?>
320
  //]]>
321
  </script>
322
-
323
- <?php //} //end if !is_admin
324
  } // end if wassup_active == "1"
325
  } //end function wassup_meta_info
326
 
@@ -381,7 +370,7 @@ function wassup_init() {
381
  function add_wassup_css() {
382
  global $wpurl, $wassup_options, $whash, $debug_mode;
383
 
384
- $plugin_page = attribute_escape($_GET['page']);
385
  if (stristr($plugin_page,'wassup') !== FALSE) { $plugin_page="wassup"; }
386
  //Add css and javascript to wassup menu pages only...
387
  if ($plugin_page == "wassup") {
@@ -435,8 +424,6 @@ if ($_GET['page'] != "wassup-options" AND $_GET['page'] != "wassup-spy") { ?>
435
  tickerID = window.setInterval("CountDownTick()", 1000);
436
  }
437
  function CountDownTick() {
438
- //SetCountdownText(_currentSeconds-1);
439
- //window.setTimeout("CountDownTick()", 1000); //replaced by setInterval in ActivateCountDown
440
  if (_currentSeconds > 0) { //don't tick below zero
441
  SetCountdownText(_currentSeconds-1);
442
  } else {
@@ -662,10 +649,7 @@ function WassUp() {
662
  global $wpdb, $wp_version, $wassupversion, $wpurl, $wassup_options, $whash, $debug_mode;
663
 
664
  // Start getting time of execution to debug SQL query
665
- //$mtime = microtime();
666
- //$mtime = explode(" ",$mtime);
667
  $starttime = microtime_float();
668
- // This could be commented out
669
 
670
  //#debug...
671
  if ($debug_mode) {
@@ -1596,9 +1580,10 @@ function WassUp() {
1596
  <ul class="url">
1597
  <?php
1598
  if ($numurl > 1) {
1599
- //$qryCD = $wpdb->get_results("SELECT `timestamp`, urlrequested FROM $table_name WHERE wassup_id='".$rk->wassup_id."' ORDER BY `timestamp`");
1600
- //$qryCD = $wpdb->get_results("SELECT DISTINCT `timestamp`, urlrequested FROM $table_name WHERE wassup_id='".$rk->wassup_id."' ORDER BY `timestamp`"); //no duplications
1601
- $qryCD = $wpdb->get_results("SELECT `id`, `timestamp`, urlrequested FROM $table_name WHERE wassup_id='".$rk->wassup_id."' ORDER BY `id`"); //id is sequential, so sort order == visit order
 
1602
  $i=1;
1603
  $char_len = round($max_char_len*.92,0);
1604
  foreach ($qryCD as $cd) {
@@ -1704,32 +1689,33 @@ function wCreateTable($table_name="",$withcharset=true) {
1704
  }
1705
 
1706
  //wassup table structure
1707
- $sql_createtable = "CREATE TABLE $table_name (
1708
- id mediumint(9) NOT NULL auto_increment,
1709
- wassup_id varchar(60) NOT NULL,
1710
- timestamp varchar(20) NOT NULL,
1711
- ip varchar(35) default NULL,
1712
- hostname varchar(150) default NULL,
1713
- urlrequested text,
1714
- agent varchar(255) default NULL,
1715
- referrer text default NULL,
1716
- search varchar(255) default NULL,
1717
- searchpage int(11) default 0,
1718
- os varchar(15) default NULL,
1719
- browser varchar(50) default NULL,
1720
- language varchar(5) default NULL,
1721
- screen_res varchar(15) default NULL,
1722
- searchengine varchar(25) default NULL,
1723
- spider varchar(50) default NULL,
1724
- feed varchar(50) default NULL,
1725
- username VARCHAR(50) default NULL,
1726
- comment_author VARCHAR(50) default NULL,
1727
- spam VARCHAR(5) default 0,
1728
- UNIQUE KEY id (id),
1729
- KEY idx_wassup (wassup_id(32),timestamp),
1730
- INDEX (os),
1731
- INDEX (browser),
1732
- INDEX (timestamp)) {$charset_collate};";
 
1733
  // Note: index (username,ip) has been removed because of problems
1734
  // with non-romanic language display
1735
 
@@ -1905,6 +1891,7 @@ function wassupPrepend() {
1905
  $screen_res = "";
1906
  $cookieIP = "";
1907
  $cookieHost = "";
 
1908
  if (empty($current_user->user_login)) {
1909
  get_currentuserinfo(); //sets $current_user, $user_xx
1910
  }
@@ -1919,7 +1906,7 @@ function wassupPrepend() {
1919
  //#visitor tracking with "cookie"...
1920
  if (isset($_COOKIE['wassup'])) {
1921
  $cookie_value = $_COOKIE['wassup'];
1922
- $cookie_data = explode('::',attribute_escape(base64_decode(urldecode($cookie_value))));
1923
  $wassup_id = $cookie_data[0];
1924
  if (!empty($cookie_data[1])) {
1925
  $wassup_timer = $cookie_data[1];
@@ -1927,12 +1914,7 @@ function wassupPrepend() {
1927
  }
1928
  if (!empty($cookie_data[2])) {
1929
  $screen_res = $cookie_data[2];
1930
- } elseif (isset($_COOKIE['wassup_screen_res'])) {
1931
- $screen_res = $_COOKIE['wassup_screen_res'];
1932
- } elseif (isset($_GET['wscr'])) {
1933
- $screen_res = $_GET['wscr'];
1934
  }
1935
-
1936
  if (!empty($cookie_data[3])) {
1937
  $cookieIP = $cookie_data[3];
1938
  if (!empty($cookie_data[4])) {
@@ -1940,8 +1922,22 @@ function wassupPrepend() {
1940
  }
1941
  }
1942
  }
1943
- //Assign a value to screen res based on GET or POST values, if any
1944
- if (empty($wassup_id) || $session_timeout < 1) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1945
  $ipAddress = "";
1946
  $hostname = "";
1947
  //#### Get the visitor's details from http header...
@@ -2013,15 +2009,21 @@ function wassupPrepend() {
2013
  $cookie_value = urlencode(base64_encode($cookie_data));
2014
  setcookie("wassup", "$cookie_value", $expire, $cookiepath, $cookiedomain);
2015
  } //end if empty(wassup_id)
2016
- //place wassup tag in document head
2017
- add_action('wp_head', 'wassup_meta_info', $screen_res);
2018
- if ($debug_mode) {
2019
- //show wassupAppend debug output in footer when in debug mode
2020
- add_action('wp_footer', 'wassupAppend', $cookie_value);
2021
- } else {
2022
- //add visit record after page is displayed to keep page load fast
2023
- add_action('shutdown', 'wassupAppend', $cookie_value);
2024
- }
 
 
 
 
 
 
2025
 
2026
  } //end if !is_admin
2027
  } //end if wassup_admin
@@ -2085,7 +2087,7 @@ function wassupAppend($cookie_value="") {
2085
  //TODO: exclude page requests by post_id
2086
  if (!empty($wassup_options->wassup_exclude_url) && !$exclude_visit) {
2087
  $exclude_list = explode(",", $wassup_options->wassup_exclude_url);
2088
- $pagerequest=strtolower($urlRequested);
2089
  foreach ($exclude_list as $exclude_url) {
2090
  $exclude_page = strtolower($exclude_url);
2091
  if ($pagerequest == $exclude_page) {
@@ -2117,10 +2119,6 @@ function wassupAppend($cookie_value="") {
2117
  $wassup_id = $wassup_cookie[0];
2118
  if (!empty($wassup_cookie[2])) {
2119
  $screen_res = $wassup_cookie[2];
2120
- } elseif (isset($_COOKIE['wassup_screen_res'])) {
2121
- $screen_res = $_COOKIE['wassup_screen_res'];
2122
- } elseif (isset($_GET['wscr'])) {
2123
- $screen_res = $_GET['wscr'];
2124
  }
2125
  if (!empty($wassup_cookie[3])) {
2126
  $cookieIP = $wassup_cookie[3];
@@ -2129,6 +2127,19 @@ function wassupAppend($cookie_value="") {
2129
  }
2130
  }
2131
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
2132
  //#### Get the visitor's details from http header...
2133
  $ipAddress = "";
2134
  $hostname = "";
@@ -2237,9 +2248,11 @@ function wassupAppend($cookie_value="") {
2237
  $recent = $wpdb->get_results("SELECT wassup_id, urlrequested, spam, screen_res, `timestamp`, browser, spider, os, feed, agent FROM ".$table_tmp_name." WHERE wassup_id='".$wassup_id."' AND `timestamp` >".($timestamp-180)." ORDER BY `timestamp` DESC");
2238
  if (!empty($recent)) {
2239
  //check 1st record only
2240
- //record is dup is same url and user-agent
2241
- if ($recent[0]->urlrequested == $urlRequested && $recent[0]->agent == $userAgent) {
2242
- $dup_urlrequest=1;
 
 
2243
  }
2244
  //retrieve previous spam check results
2245
  $spamresult = $recent[0]->spam;
@@ -2278,7 +2291,7 @@ function wassupAppend($cookie_value="") {
2278
  }
2279
  if ($recent[0]->agent != $userAgent) {
2280
  echo "\nUser Agents NOT Identical:";
2281
- echo "\n\tCurrent user agent: ".attribute_escape($userAgent);
2282
  echo "\n\tPrevious user agent: $recent[0]->agent\n";
2283
  }
2284
  } else {
@@ -2316,6 +2329,7 @@ function wassupAppend($cookie_value="") {
2316
  }
2317
  $os = $ua->os;
2318
  if (!empty($ua->resolution)) {
 
2319
  $screen_res = $ua->resolution;
2320
  }
2321
  } //end if $ua->name
@@ -2498,21 +2512,21 @@ function wassupAppend($cookie_value="") {
2498
  $searchpage=(int)($searchpage/10)+1;
2499
  }
2500
  if (!empty($searchengine)) {
2501
- if (empty($searchcountry)) {
2502
  $secountry = explode(".", $searchdomain);
2503
  if (!empty($secountry[4])) {
2504
  $clength=strlen($secountry[4]);
2505
  if ($clength == 2) {
2506
  $searchcountry = $secountry[4];
2507
- } elseif (strlen($secountry[1])==2 && $clength >2) {
2508
- $searchcountry = $secountry[1];
2509
  }
2510
  } elseif (!empty($secountry[3])) {
2511
  $clength=strlen($secountry[3]);
2512
  if ($clength == 2) {
2513
  $searchcountry = $secountry[3];
2514
- } elseif (strlen($secountry[1])==2 && $clength >2) {
2515
- $searchcountry = $secountry[1];
2516
  }
2517
  } elseif ($searchcountry[2] != '' && strlen($secountry[2]) == 2) {
2518
  $searchcountry = $secountry[2];
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. For Wordpress 2.2 or higher.
6
+ Version: 1.7.2.1
7
  Author: Michele Marcucci, Helene D.
8
  Author URI: http://www.michelem.org/
9
  Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
17
  if (preg_match('#'.basename(__FILE__) .'#', $_SERVER['PHP_SELF'])) {
18
  die('Permission Denied! You are not allowed to call this page directly.');
19
  }
20
+ $wassupversion = "1.7.2.1";
21
  $debug_mode=false; //turns on debugging (global)
22
  $wassupdir = dirname(__FILE__);
23
  define('WASSUPFOLDER', dirname(plugin_basename(__FILE__)), TRUE);
239
  //$siteurl = get_bloginfo('siteurl');
240
  if ($wassup_options->wassup_active == "1") {
241
  print '<meta name="wassup-version" content="'.$wassupversion.'" />'."\n";
 
242
  //add screen resolution javascript to blog header
243
  if ($screen_res == "" && isset($_COOKIE['wassup_screen_res'])) {
244
  $screen_res = $_COOKIE['wassup_screen_res'];
245
+ if (trim($screen_res) == "x") $screen_res="";
246
  }
247
+ if (empty($screen_res) && isset($_ENV['HTTP_UA_PIXELS'])) {
248
+ //resolution in IE/IEMobile header sometimes
249
+ $screen_res = str_replace('X','x',$_ENV['HTTP_UA_PIXELS']);
250
  }
251
+ if (empty($screen_res) && isset($_COOKIE['wassup'])) {
252
+ $cookie_data = explode('::',attribute_escape(base64_decode(urldecode($_COOKIE['wassup']))));
253
+ $screen_res=(!empty($cookie_data[2]))?$cookie_data[2]:"";
254
+ }
255
+ //if (empty($screen_res) && isset($_GET['wscr'])) {
256
+ // $screen_res = $_GET['wscr'];
257
  //}
 
258
  //Get visitor's screen resolution using javascript and a cookie.
259
  // - Added here so javascript code is placed in document <head>
260
  // to store this client-side only variable in a cookie that PHP
262
  <script type="text/javascript">
263
  //<![CDATA[
264
  var screen_res = "<?php echo $screen_res; ?>";
265
+ <?php if (empty($screen_res) && !isset($_COOKIE['wassup_screen_res'])) { ?>
266
+ function writeCookie(name,value,hours) {
267
+ var the_cookie = name+"="+value+"; expires=";
268
+ var expires = "";
269
+ hours=hours+0; //convert to number
270
+ if (hours > 0) { //0==expires on browser close
271
+ var date = new Date();
272
+ date.setTime(date.getTime()+(hours*60*60*1000));
273
+ expires = expires+date.toGMTString();
274
+ }
275
+ <?php if (defined('COOKIE_DOMAIN')) {
 
 
 
 
 
276
  $cookiedomain = COOKIE_DOMAIN;
277
  $cookiepath = "/";
278
  } else {
279
  $cookieurl = parse_url(get_option('home'));
280
+ $cookiedomain = preg_replace('/^www\./','',$cookieurl['host']);
281
  $cookiepath = $cookieurl['path'];
282
  }
283
+ echo "\t".'document.cookie = the_cookie+expires+"; path='.$cookiepath.'; domain='.$cookiedomain.'";'."\n"; ?>
 
 
 
 
 
 
 
284
  }
285
+ screen_res = window.screen.width+"x"+window.screen.height;
286
+ writeCookie("wassup_screen_res",screen_res,"48"); //keep 2 days
287
  <?php
288
+ // *DISABLED* because inflates the number of visitor page views
289
+ // if (!isset($_GET['wscr']) && !isset($_COOKIE['wassup'])) {
290
+ // In case cookie is rejected, screen resolution is assigned as
291
+ // GET parameter, 'wscr', and included on request line. ? >
292
+ /* function resolution_reload() {
293
  if (screen_res != "") {
294
+ var reload_url="< ? php
295
  if (empty($_SERVER['QUERY_STRING'])) {
296
  echo $_SERVER['REQUEST_URI'].'?wscr=';
297
  } else {
298
  echo $_SERVER['REQUEST_URI'].'&wscr=';
299
+ } ? >"+screen_res;
300
  location.replace(reload_url);
301
  }
302
  }
303
+ */
 
304
  //reload page after timeout of 40 seconds with 'wscr' param set (browsers only, no spiders)
305
+ /* if (empty($screen_res) && preg_match('/(?:Opera|Gecko|Webkit|MSIE\s[78])/i',$_SERVER['HTTP_USER_AGENT'])>0 && !is_user_logged_in()) { ? >
306
+ if (screen_res != "") setTimeout("resolution_reload()",40000);
307
+ } */
308
+ //} //end if !isset 'wscr'
309
+ } //end if !isset('wassup_screen_res') ?>
 
 
 
310
  //]]>
311
  </script>
312
+ <?php
 
313
  } // end if wassup_active == "1"
314
  } //end function wassup_meta_info
315
 
370
  function add_wassup_css() {
371
  global $wpurl, $wassup_options, $whash, $debug_mode;
372
 
373
+ $plugin_page = $_GET['page'];
374
  if (stristr($plugin_page,'wassup') !== FALSE) { $plugin_page="wassup"; }
375
  //Add css and javascript to wassup menu pages only...
376
  if ($plugin_page == "wassup") {
424
  tickerID = window.setInterval("CountDownTick()", 1000);
425
  }
426
  function CountDownTick() {
 
 
427
  if (_currentSeconds > 0) { //don't tick below zero
428
  SetCountdownText(_currentSeconds-1);
429
  } else {
649
  global $wpdb, $wp_version, $wassupversion, $wpurl, $wassup_options, $whash, $debug_mode;
650
 
651
  // Start getting time of execution to debug SQL query
 
 
652
  $starttime = microtime_float();
 
653
 
654
  //#debug...
655
  if ($debug_mode) {
1580
  <ul class="url">
1581
  <?php
1582
  if ($numurl > 1) {
1583
+ //Important Note: list of urls visited is affected by browsers like Safari 4 which hits a page from both the user window and from it's "top sites" page, creating multiple duplicate records with distinct id's...
1584
+ //$qryCD = $wpdb->get_results("SELECT `timestamp`, urlrequested FROM $table_name WHERE wassup_id='".$rk->wassup_id."' ORDER BY `timestamp`"); //duplicates possible
1585
+ $qryCD = $wpdb->get_results("SELECT DISTINCT `timestamp`, urlrequested, agent FROM $table_name WHERE wassup_id='".$rk->wassup_id."' ORDER BY `timestamp`"); //no duplication, unless agent is differnt
1586
+ //$qryCD = $wpdb->get_results("SELECT `id`, `timestamp`, urlrequested FROM $table_name WHERE wassup_id='".$rk->wassup_id."' ORDER BY `id`"); //id is sequential, so sort order == visit order...UPDATE: may not be in visit order because 'insert delayed' could make `id` out of sync with `timestamp`
1587
  $i=1;
1588
  $char_len = round($max_char_len*.92,0);
1589
  foreach ($qryCD as $cd) {
1689
  }
1690
 
1691
  //wassup table structure
1692
+ $sql_createtable = "CREATE TABLE `$table_name` (
1693
+ `id` mediumint(9) unsigned NOT NULL auto_increment,
1694
+ `wassup_id` varchar(60) NOT NULL,
1695
+ `timestamp` varchar(20) NOT NULL,
1696
+ `ip` varchar(35) default NULL,
1697
+ `hostname` varchar(150) default NULL,
1698
+ `urlrequested` text,
1699
+ `agent` varchar(255) default NULL,
1700
+ `referrer` text,
1701
+ `search` varchar(255) default NULL,
1702
+ `searchpage` int(11) unsigned default '0',
1703
+ `os` varchar(15) default NULL,
1704
+ `browser` varchar(50) default NULL,
1705
+ `language` varchar(5) default NULL,
1706
+ `screen_res` varchar(15) default NULL,
1707
+ `searchengine` varchar(25) default NULL,
1708
+ `spider` varchar(50) default NULL,
1709
+ `feed` varchar(50) default NULL,
1710
+ `username` varchar(50) default NULL,
1711
+ `comment_author` varchar(50) default NULL,
1712
+ `spam` varchar(5) default '0',
1713
+ `url_wpid` varchar(50) default NULL,
1714
+ UNIQUE KEY `id` (`id`),
1715
+ KEY `idx_wassup` (`wassup_id`(32),`timestamp`),
1716
+ INDEX (`os`),
1717
+ INDEX (`browser`),
1718
+ INDEX `timestamp` (`timestamp`)) {$charset_collate};";
1719
  // Note: index (username,ip) has been removed because of problems
1720
  // with non-romanic language display
1721
 
1891
  $screen_res = "";
1892
  $cookieIP = "";
1893
  $cookieHost = "";
1894
+ $cookie_value="";
1895
  if (empty($current_user->user_login)) {
1896
  get_currentuserinfo(); //sets $current_user, $user_xx
1897
  }
1906
  //#visitor tracking with "cookie"...
1907
  if (isset($_COOKIE['wassup'])) {
1908
  $cookie_value = $_COOKIE['wassup'];
1909
+ $cookie_data = explode('::',attribute_escape(base64_decode(urldecode($_COOKIE['wassup']))));
1910
  $wassup_id = $cookie_data[0];
1911
  if (!empty($cookie_data[1])) {
1912
  $wassup_timer = $cookie_data[1];
1914
  }
1915
  if (!empty($cookie_data[2])) {
1916
  $screen_res = $cookie_data[2];
 
 
 
 
1917
  }
 
1918
  if (!empty($cookie_data[3])) {
1919
  $cookieIP = $cookie_data[3];
1920
  if (!empty($cookie_data[4])) {
1922
  }
1923
  }
1924
  }
1925
+ //set screen resolution value from cookie or browser header data, if any
1926
+ if (empty($screen_res)) {
1927
+ if (isset($_COOKIE['wassup_screen_res'])) {
1928
+ $screen_res = $_COOKIE['wassup_screen_res'];
1929
+ if (trim($screen_res) == "x") $screen_res="";
1930
+ }
1931
+ if (empty($screen_res) && isset($_ENV['HTTP_UA_PIXELS'])) {
1932
+ //resolution in IE/IEMobile header sometimes
1933
+ $screen_res = str_replace('X','x',$_ENV['HTTP_UA_PIXELS']);
1934
+ }
1935
+ //if (empty($screen_res) && isset($_GET['wscr'])) {
1936
+ // $screen_res = $_GET['wscr'];
1937
+ //}
1938
+ }
1939
+ //write wassup cookie for new visits, visit timeout (45 mins) or empty screen_res
1940
+ if (empty($wassup_id) || $session_timeout < 1 || (empty($cookie_data[2]) && !empty($screen_res))) {
1941
  $ipAddress = "";
1942
  $hostname = "";
1943
  //#### Get the visitor's details from http header...
2009
  $cookie_value = urlencode(base64_encode($cookie_data));
2010
  setcookie("wassup", "$cookie_value", $expire, $cookiepath, $cookiedomain);
2011
  } //end if empty(wassup_id)
2012
+
2013
+ //place wassup tag and javascript in document head and footer
2014
+ add_action('wp_head', 'wassup_meta_info', 10, "$screen_res");
2015
+
2016
+ //record visit after page is displayed to keep page load fast
2017
+ if ($debug_mode) {
2018
+ //show wassupAppend debug output in footer when in debug mode
2019
+ //...15-priority so runs after other wp_footer actions
2020
+ add_action('wp_footer', 'wassupAppend', 15, "$cookie_value");
2021
+ } else {
2022
+ //add visit record after page is displayed to keep page load fast
2023
+ //...1-priority so runs before other 'shutdown' actions such as cache flush
2024
+ add_action('shutdown', 'wassupAppend', 1, "$cookie_value");
2025
+ //Warning Note: since Wordpress 2.7.1, 'shutdown' hook causes sporadic inclusion of non-visited posts in wassup table for some wordpress themes
2026
+ }
2027
 
2028
  } //end if !is_admin
2029
  } //end if wassup_admin
2087
  //TODO: exclude page requests by post_id
2088
  if (!empty($wassup_options->wassup_exclude_url) && !$exclude_visit) {
2089
  $exclude_list = explode(",", $wassup_options->wassup_exclude_url);
2090
+ $pagerequest=strtolower(remove_query_arg('wscr',$urlRequested));
2091
  foreach ($exclude_list as $exclude_url) {
2092
  $exclude_page = strtolower($exclude_url);
2093
  if ($pagerequest == $exclude_page) {
2119
  $wassup_id = $wassup_cookie[0];
2120
  if (!empty($wassup_cookie[2])) {
2121
  $screen_res = $wassup_cookie[2];
 
 
 
 
2122
  }
2123
  if (!empty($wassup_cookie[3])) {
2124
  $cookieIP = $wassup_cookie[3];
2127
  }
2128
  }
2129
  }
2130
+ //### set screen resolution value from cookie or browser header data, if any
2131
+ if (empty($screen_res)) {
2132
+ if (isset($_COOKIE['wassup_screen_res'])) {
2133
+ $screen_res = attribute_escape($_COOKIE['wassup_screen_res']);
2134
+ }
2135
+ if (empty($screen_res) && isset($_ENV['HTTP_UA_PIXELS'])) {
2136
+ //resolution in IE/IEMobile header sometimes
2137
+ $screen_res = str_replace('X','x',attribute_escape($_ENV['HTTP_UA_PIXELS']));
2138
+ }
2139
+ //if (empty($screen_res) && isset($_GET['wscr'])) {
2140
+ // $screen_res = attribute_escape($_GET['wscr']);
2141
+ //}
2142
+ }
2143
  //#### Get the visitor's details from http header...
2144
  $ipAddress = "";
2145
  $hostname = "";
2248
  $recent = $wpdb->get_results("SELECT wassup_id, urlrequested, spam, screen_res, `timestamp`, browser, spider, os, feed, agent FROM ".$table_tmp_name." WHERE wassup_id='".$wassup_id."' AND `timestamp` >".($timestamp-180)." ORDER BY `timestamp` DESC");
2249
  if (!empty($recent)) {
2250
  //check 1st record only
2251
+ //record is dup if same url (with 'wscr' removed) and same user-agent
2252
+ if ($recent[0]->urlrequested == $urlRequested || $recent[0]->urlrequested == remove_query_arg('wscr',$urlRequested)) {
2253
+ if ($recent[0]->agent == $userAgent || empty($recent[0]->agent)) {
2254
+ $dup_urlrequest=1;
2255
+ }
2256
  }
2257
  //retrieve previous spam check results
2258
  $spamresult = $recent[0]->spam;
2291
  }
2292
  if ($recent[0]->agent != $userAgent) {
2293
  echo "\nUser Agents NOT Identical:";
2294
+ echo "\n\tCurrent user agent: ".$userAgent;
2295
  echo "\n\tPrevious user agent: $recent[0]->agent\n";
2296
  }
2297
  } else {
2329
  }
2330
  $os = $ua->os;
2331
  if (!empty($ua->resolution)) {
2332
+ //TODO?: Write 'wassup_screen_res' cookie, if none
2333
  $screen_res = $ua->resolution;
2334
  }
2335
  } //end if $ua->name
2512
  $searchpage=(int)($searchpage/10)+1;
2513
  }
2514
  if (!empty($searchengine)) {
2515
+ if (empty($searchcountry) && preg_match('/([a-z]\.)+/i',$searchdomain)) {
2516
  $secountry = explode(".", $searchdomain);
2517
  if (!empty($secountry[4])) {
2518
  $clength=strlen($secountry[4]);
2519
  if ($clength == 2) {
2520
  $searchcountry = $secountry[4];
2521
+ } elseif (strlen($secountry[0])==2 && $clength >2) {
2522
+ $searchcountry = $secountry[0];
2523
  }
2524
  } elseif (!empty($secountry[3])) {
2525
  $clength=strlen($secountry[3]);
2526
  if ($clength == 2) {
2527
  $searchcountry = $secountry[3];
2528
+ } elseif (strlen($secountry[0])==2 && $clength >2) {
2529
+ $searchcountry = $secountry[0];
2530
  }
2531
  } elseif ($searchcountry[2] != '' && strlen($secountry[2]) == 2) {
2532
  $searchcountry = $secountry[2];